mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-23 17:42:46 +01:00
35 lines
888 B
JavaScript
35 lines
888 B
JavaScript
import { $ } from "../api/jquery.js";
|
|
import { TD } from "../api/td.js";
|
|
import { ensurePropertyExists } from "../api/utils.js";
|
|
|
|
/**
|
|
* @typedef SearchEventData
|
|
* @type {Object}
|
|
*
|
|
* @property {string} query
|
|
* @property {string} [searchScope]
|
|
* @property {string} [columnKey]
|
|
* @property {boolean} [tduckResetInput]
|
|
*/
|
|
|
|
/**
|
|
* Clears search input after confirmation.
|
|
*/
|
|
export default function() {
|
|
ensurePropertyExists(TD, "controller", "columnManager", "_columnOrder");
|
|
ensurePropertyExists(TD, "controller", "columnManager", "move");
|
|
|
|
/**
|
|
* @param e
|
|
* @param {SearchEventData} data
|
|
*/
|
|
const onSearch = function(e, data) {
|
|
if (data.query && data.searchScope !== "users" && !data.columnKey && !("tduckResetInput" in data)) {
|
|
$(".js-app-search-input").val("");
|
|
$(".js-perform-search").blur();
|
|
}
|
|
};
|
|
|
|
$(document).on("uiSearchNoTemporaryColumn", onSearch);
|
|
};
|