// Web Client 10.4 var includeWithinCurrentFolder = true; var hideAll = false; if (typeof window.qsearchDisabled == 'undefined') { window.qsearchDisabled = true; fixQuickSearch(); $('.quickSearchOptionMenu ul li').on('click', function() { fixQuickSearch(); }); $('.quickSearchOptionMenu ul li').attr('aria-fixed', 'true'); $('.quickSearchOptionMenu button').on('click', function() { fixQuickSearch(); }); // $('input[ng-model="searchQuery"]').click(function() { fixQuickSearch(); }); } return false; function fixQuickSearch() { setTimeout(function() { let start = 2; // Is there at least one custom search? if ($('li[ng-show="customSearch.applicable"]').length) { // select first if no thing is selected if (!$('li[ng-show="customSearch.applicable"] a[aria-checked="true"]').length) { $('li[ng-show="customSearch.applicable"]:first').click(); } hideAll = true; // Hide all and keep first basic search } else { hideAll = false; // Otherwise } if (hideAll) { start = 1; } else { // Make sure first basic search is selected if ($('a[ng-if="searchType"]:eq(1)').attr('aria-checked')!='true') { // otherwise select it $('a[ng-if="searchType"]:eq(1)').parent().click(); } } // Within current folder if (includeWithinCurrentFolder) { if ($('a[ng-if="searchType"]:eq(0)').attr('aria-checked')=='true') { $('a[ng-if="searchType"]:eq(0)').parent().click(); // unselect } $('a[ng-if="searchType"]:eq(0)').parent().hide(); } // Other basic search for(let i=start; i<=4; i++) { if ($('a[ng-if="searchType"]:eq('+i+')').attr('aria-checked')=='true') { $('a[ng-if="searchType"]:eq('+i+')').parent().click(); // unselect } $('a[ng-if="searchType"]:eq('+i+')').parent().hide(); } if (includeWithinCurrentFolder || hideAll) $('.quickSearchOptionMenu li.divider:first').hide(); if (includeWithinCurrentFolder && hideAll) $('.quickSearchOptionMenu li.divider:eq(1)').hide(); }, 1000); // check if new qs items are added if ($('.quickSearchOptionMenu ul li:not([aria-fixed="true"]').length) { $('.quickSearchOptionMenu ul li:not([aria-fixed="true"]').click(function() { fixQuickSearch(); }); $('.quickSearchOptionMenu ul li:not([aria-fixed="true"]').attr('aria-fixed', 'true'); } }