Permalink
Browse files

UNL Search has a new home

Use the new search.unl.edu host to handle framework search requests.
  • Loading branch information...
kabel committed Feb 1, 2016
1 parent 0b212b6 commit 6658ed56329673b67472db8d6663fb632bd248d2
Showing with 13 additions and 12 deletions.
  1. +1 −1 wdn/templates_4.1/includes/search.html
  2. +12 −11 wdn/templates_4.1/scripts/search.js
@@ -1,7 +1,7 @@
<div id="wdn_search" role="search">
<input type="checkbox" id="wdn_search_toggle" class="wdn_search_toggle wdn-input-driver wdn-dropdown-widget-toggle visible-at-full-nav" aria-controls="wdn_search_form" value="Show search form" />
<label for="wdn_search_toggle" id="wdn_search_toggle_label" class="wdn-icon-search"><span class="wdn-text-hidden">Show search form</span></label>
- <form id="wdn_search_form" class="wdn-dropdown-widget-content" action="//www1.unl.edu/search/" method="get">
+ <form id="wdn_search_form" class="wdn-dropdown-widget-content" action="https://search.unl.edu/" method="get">
<label for="wdn_search_query">Search</label>
<input required accesskey="f" id="wdn_search_query" name="q" type="search" />
<button type="submit"><span class="wdn-icon-search" aria-hidden="true"></span><span class="wdn-text-hidden">Search</span></button>
@@ -7,7 +7,7 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
return false;
}
-
+
var initd = false;
var isFullNav = function() {
@@ -30,9 +30,9 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
submitted = false,
postReady = false,
autoSubmitTimeout,
- searchHost = 'www1.unl.edu', // domain of UNL Search app
- searchPath = '/search/', // path to UNL Search app
- searchOrigin = window.location.protocol + '//' + searchHost,
+ searchHost = 'search.unl.edu', // domain of UNL Search app
+ searchPath = '/', // path to UNL Search app
+ searchOrigin = 'https://' + searchHost,
searchAction = searchOrigin + searchPath,
allowSearchParams = ['u', 'cx'], // QS Params allowed by UNL Search app
siteHomepage = nav.getSiteHomepage(),
@@ -45,17 +45,18 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
// ensure the default action is the UNL Search app
if (domSearchForm[0].action !== searchAction) {
- domSearchForm.attr('action', searchAction)
+ domSearchForm.attr('action', searchAction);
}
if (localSearch && localSearch.indexOf(searchAction + '?') === 0) {
// attempt to parse the allowed UNL Search parameter overrides allowed
var localSearchParams;
+ var i;
try {
if (window.URLSearchParams) {
localSearchParams = new URLSearchParams(localSearch.slice(localSearch.indexOf('?') + 1));
- for (var i = 0; i < allowSearchParams.length; i++) {
+ for (i = 0; i < allowSearchParams.length; i++) {
if (localSearchParams.has(allowSearchParams[i])) {
domSearchForm.append($('<input>', {
type: "hidden",
@@ -67,7 +68,7 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
} else {
var paramPair;
localSearchParams = localSearch.slice(localSearch.indexOf('?') + 1).split('&');
- for (var i = 0; i < localSearchParams.length; i++) {
+ for (i = 0; i < localSearchParams.length; i++) {
paramPair = localSearchParams[i].split('=');
if (allowSearchParams.indexOf(paramPair[0]) >= 0) {
domSearchForm.append($('<input>', {
@@ -104,7 +105,7 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
if (!isFullNav()) {
return;
}
-
+
if (e0.keyCode === 27) {
//Close on escape
closeSearch();
@@ -186,17 +187,17 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
//Close search on escape while the iframe has focus
$(window).on('message', function(e) {
var originalEvent = e.originalEvent;
-
+
if ('wdn.search.close' != originalEvent.data) {
//Make sure this is our event
return;
}
-
+
if (searchOrigin != originalEvent.origin) {
//Verify the origin
return;
}
-
+
closeSearch();
});

0 comments on commit 6658ed5

Please sign in to comment.