Skip to content
Snippets Groups Projects
Commit 5252793d authored by Kevin Abel's avatar Kevin Abel
Browse files

Implement automatic web search tab switching on empty local result

When a local search occurs (not triggered by explict tab click),
automatically switch to the "All of UNL" tab if no result are detected.
parent ce317432
No related branches found
No related tags found
No related merge requests found
......@@ -146,6 +146,7 @@
directorySearch,
localContext = window['LOCAL_SEARCH_CONTEXT'],
drawOp = new google.search.DrawOptions(),
searchToggleLock = false,
trackQuery = function(q) {
var loc = window.location,
......@@ -175,8 +176,15 @@
});
$('img.gcsc-branding-img-noclear', $root).attr('alt', 'Google™');
if (!searchToggleLock && control == localSearch && $('.gs-no-results-result').length) {
$root.closest('.results-group').find('.result-tab li:last-child').click();
return;
}
$root.closest(resultSel).addClass(actCls);
$root.closest(googleSel).slideDown();
searchToggleLock = false;
},
fullQuery = function(q, track) {
if (track !== false) {
......@@ -288,6 +296,7 @@
if ($par.is(wrapperDir)) {
directorySearch.changeViewState(i);
} else if ($par.is(wrapperWeb)) {
searchToggleLock = true;
$(activeSearch.root).closest(googleSel).slideUp().trigger(evtStateChange, [i, 0 + !i]);
if (i === 0) {
activeSearch = localSearch;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment