From a16558ce8124b7c50d37ca5b1b9b8c9395afa513 Mon Sep 17 00:00:00 2001
From: Tyler Lemburg <lemburg@unl.edu>
Date: Tue, 4 Apr 2017 11:08:30 -0500
Subject: [PATCH] Cache bust CSS and fix auto-switching

---
 www/js/search.js                  | 12 ++++++++----
 www/templates/end-scripts.tpl.php |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/www/js/search.js b/www/js/search.js
index 6f70781..45af855 100644
--- a/www/js/search.js
+++ b/www/js/search.js
@@ -194,10 +194,12 @@ define(['jquery', 'analytics'], function ($, analytics) {
 				});
 				$('img.gcsc-branding-img-noclear', $root).attr('alt', 'Googleâ„¢');
 
-				if (!searchToggleLock && localGoogleSearch && control == localGoogleSearch.control && $('.gs-no-results-result', $root).length) {
-					$root.closest('.results-group').find('.result-tab li:last-child').click();
-					return;
-				}
+				setTimeout(function() {
+					if (!searchToggleLock && localGoogleSearch && control == localGoogleSearch.control && $('.gs-no-results-result', $root).length) {
+						$root.closest('.results-group').find('.result-tab li:last-child').click();
+						return;
+					}
+				}, 1000);
 
 				$root.closest(resultSel).addClass(actCls);
 				$root.closest(googleSel).slideDown();
@@ -290,6 +292,8 @@ define(['jquery', 'analytics'], function ($, analytics) {
 						}
 					};
 
+				$('#unl_results').hide();
+
 				var render_attrs = {
 					div: 'unl_results',
 					tag: 'searchresults-only',
diff --git a/www/templates/end-scripts.tpl.php b/www/templates/end-scripts.tpl.php
index 81688c6..a8ae6a8 100644
--- a/www/templates/end-scripts.tpl.php
+++ b/www/templates/end-scripts.tpl.php
@@ -19,7 +19,7 @@ require(['jquery', '<?php echo $localScriptUrl ?>'], function($, UNLSearch) {
     }).appendTo($('body'));
 
     var $localCss = $('<link>', {
-        'href': './css/search-google.css'
+        'href': './css/search-google.css?v=20170404'
     });
 
     gSearchDefer.done(function(google) {
-- 
GitLab