2021-03-11 19:13:27 +05:30
|
|
|
import setHighlightClass from 'ee_else_ce/search/highlight_blob_search_result';
|
2021-01-03 14:25:43 +05:30
|
|
|
import { queryToObject } from '~/lib/utils/url_utility';
|
2023-03-17 16:20:25 +05:30
|
|
|
import syntaxHighlight from '~/syntax_highlight';
|
2022-11-25 23:54:43 +05:30
|
|
|
import { initSidebar, sidebarInitState } from './sidebar';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { initSearchSort } from './sort';
|
2021-01-03 14:25:43 +05:30
|
|
|
import createStore from './store';
|
2021-02-22 17:27:13 +05:30
|
|
|
import { initTopbar } from './topbar';
|
2022-10-11 01:57:18 +05:30
|
|
|
import { initBlobRefSwitcher } from './under_topbar';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
export const initSearchApp = () => {
|
2023-03-17 16:20:25 +05:30
|
|
|
syntaxHighlight(document.querySelectorAll('.js-search-results'));
|
|
|
|
const query = queryToObject(window.location.search, { gatherArrays: true });
|
|
|
|
const { navigationJsonParsed: navigation } = sidebarInitState() || {};
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2023-03-17 16:20:25 +05:30
|
|
|
const store = createStore({
|
|
|
|
query,
|
|
|
|
navigation,
|
|
|
|
});
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
initTopbar(store);
|
2021-01-29 00:20:46 +05:30
|
|
|
initSidebar(store);
|
2021-03-11 19:13:27 +05:30
|
|
|
initSearchSort(store);
|
|
|
|
|
|
|
|
setHighlightClass(query.search); // Code Highlighting
|
2022-10-11 01:57:18 +05:30
|
|
|
initBlobRefSwitcher(); // Code Search Branch Picker
|
2021-01-03 14:25:43 +05:30
|
|
|
};
|