2021-03-11 05:43:45 +01:00
|
|
|
import $ from "jquery";
|
|
|
|
|
2021-03-22 16:09:12 +01:00
|
|
|
import * as browser_history from "./browser_history";
|
2021-03-25 22:35:45 +01:00
|
|
|
import {page_params} from "./page_params";
|
2021-02-28 01:28:13 +01:00
|
|
|
import * as search_pill from "./search_pill";
|
2020-08-01 03:43:15 +02:00
|
|
|
|
2021-02-28 01:28:13 +01:00
|
|
|
export let widget;
|
2021-02-10 17:09:55 +01:00
|
|
|
|
2021-02-28 01:28:13 +01:00
|
|
|
export function initialize() {
|
2018-06-08 14:24:17 +02:00
|
|
|
if (!page_params.search_pills_enabled) {
|
|
|
|
return;
|
|
|
|
}
|
2022-01-25 11:36:19 +01:00
|
|
|
const $container = $("#search_arrows");
|
|
|
|
widget = search_pill.create_pills($container);
|
2018-07-14 16:10:00 +02:00
|
|
|
|
2021-02-28 01:28:13 +01:00
|
|
|
widget.onPillRemove(() => {
|
|
|
|
if (widget.items().length === 0) {
|
2021-03-22 16:09:12 +01:00
|
|
|
browser_history.go_to_location("");
|
2020-06-17 16:24:11 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-28 01:28:13 +01:00
|
|
|
widget.createPillonPaste(() => false);
|
|
|
|
}
|