Commit bb2313dd authored by Kevin Abel's avatar Kevin Abel
Browse files

Whitespace

parent bed234a8
/search.js.map
/*.map
/search.min.js
(function(window) {
"use strict";
var
initCallback = 'searchInit',
// Service server (defaults to //directory.unl.edu)
directoryServer = null,
unlContext = '015236299699564929946:nk1siew10ie',
transitionDelay = 400,
inputSel = '#search_q',
formSel = '#searchform form',
resultSel = '.search-results',
googleSel = '.google-results',
evtStateChange = 'statechange',
wrapperMain = '#search_wrapper',
wrapperWeb = '#search_results',
wrapperDir = '#directory_results',
dirResults = 'ppl_results',
unlResults = 'unl_results',
localResults = 'local_results';
window[initCallback] = function() {
window[initCallback] = null;
require(['jquery', 'analytics'], function($, analytics) {
// Caching Class
var Cache = function() {
......@@ -40,17 +40,17 @@
this.storage[key] = value;
return this;
};
// Directory Controller Class
var Directory = function(server, containerId) {
var cntSel = '#' + containerId;
this._server = server || '//directory.unl.edu';
this._cache = new Cache();
this._searchCanceled = false;
this._viewState = 0;
this._renderTo = cntSel;
$(function() {
$(cntSel).on('click', '.fn a', function() {
if (this.target !== '_blank') {
......@@ -63,22 +63,22 @@
if (this._searchCanceled) {
return;
}
$(this._renderTo)
.html(data)
.addClass('active');
this._renderState(0);
};
Directory.prototype._renderState = function(duration) {
var $innerRes = $('.results', $(this._renderTo)),
$showRes, failState,
depFilter = '.departments';
if (!$innerRes.length) {
return;
}
$innerRes.slideUp(duration);
if (this._viewState === 0) {
$showRes = $innerRes.not(depFilter);
......@@ -87,12 +87,12 @@
$showRes = $innerRes.filter(depFilter);
failState = 0;
}
if (!$showRes.length && typeof duration !== "undefined") {
this.changeViewState(failState);
return;
}
$showRes.slideDown();
};
Directory.prototype.cancelSearch = function() {
......@@ -104,12 +104,12 @@
Directory.prototype.execute = function(q) {
var cacheData = this._cache.get(q),
self = this;
this._searchCanceled = false;
if (this._xhr) {
this._xhr.abort();
}
if (cacheData) {
this._render(cacheData);
} else {
......@@ -123,25 +123,25 @@
if (this._viewState == state) {
return;
}
var prevState = this._viewState;
this._viewState = state;
this._renderState();
$(this._renderTo).trigger(evtStateChange, [state, prevState]);
};
Directory.prototype.clearAllResults = function() {
$(this._renderTo).empty();
};
var
// query related
query = '',
firstQ = window['INITIAL_QUERY'],
actCls = 'active',
// CustomSearchControl instances and config
unlSearch,
localSearch,
......@@ -150,7 +150,7 @@
localContext = window['LOCAL_SEARCH_CONTEXT'],
drawOp = new google.search.DrawOptions(),
searchToggleLock = false,
trackQuery = function(q) {
var loc = window.location,
qs = loc.search.replace(/(?:(\?)|&)q=[^&]*(?:&|$)/, '$1'),
......@@ -161,16 +161,16 @@
'q=',
encodeURIComponent(q)
].join('');
analytics.callTrackPageview(page);
if (window.history.pushState) {
window.history.pushState({query: q}, '', page);
}
},
queryComplete = function(control) {
var $root = $(control.root);
// a11y patching
$('img.gs-image', $root).each(function() {
if (!this.alt) {
......@@ -178,15 +178,15 @@
}
});
$('img.gcsc-branding-img-noclear', $root).attr('alt', 'Google™');
if (!searchToggleLock && control == localSearch && $('.gs-no-results-result', $root).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) {
......@@ -219,96 +219,96 @@
directorySearch.execute(q);
}
};
drawOp.enableSearchResultsOnly();
unlSearch = activeSearch = new google.search.CustomSearchControl(unlContext);
unlSearch.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
unlSearch.setSearchCompleteCallback(window, queryComplete);
unlSearch.setSearchStartingCallback(window, queryStart);
if (localContext) {
localSearch = activeSearch = new google.search.CustomSearchControl(localContext);
localSearch.setResultSetSize('small');
localSearch.setSearchCompleteCallback(window, queryComplete);
localSearch.setSearchStartingCallback(window, queryStart);
}
directorySearch = new Directory(directoryServer, dirResults);
// Setup DOM on ready
$(function() {
var $q = $(inputSel),
resSel = '.results-group',
tabsSel = '.result-tab',
selCls = 'selected',
stateClsPfx = 'state-',
$resTabs = $('.result-tab'),
tabStateChange = function(e, state, prevState) {
var $tab = $(this).find(tabsSel);
e.stopPropagation();
$tab.removeClass(stateClsPfx + prevState);
$tab.addClass(stateClsPfx + state);
$tab.children().removeClass(selCls).eq(state).addClass(selCls);
},
googleOrigin = /^https?:\/\/.*\.google\.com$/,
isValidOrigin = function(origin) {
if (googleOrigin.test(origin)) {
return false;
}
// don't allow self origin or browser extension origins
if (origin == location.origin || /^chrome:/.test(origin)) {
return false;
}
return true;
},
passiveQuery = function(q, track) {
if (query === q) {
return;
}
query = q;
$q.val(q);
if (q) {
fullQuery(q, track);
} else {
fullStop();
}
};
// draw the Google search controls
unlSearch.draw(unlResults, drawOp);
if (localContext) {
localSearch.draw(localResults, drawOp);
}
// a11y patch Google search box
$('form.gsc-search-box').remove();
// setup the tab-like result filters
$('li:first-child', $resTabs).addClass(selCls);
$($resTabs).on('click', 'li', function(e) {
e.preventDefault();
e.preventDefault();
if ($(this).hasClass(selCls)) {
return;
}
var i = $(this).index(),
$par = $(this).parents(resSel);
if ($par.is(wrapperDir)) {
directorySearch.changeViewState(i);
} else if ($par.is(wrapperWeb)) {
......@@ -319,48 +319,48 @@
} else {
activeSearch = unlSearch;
}
activeSearch.execute(query);
}
});
$(resSel).on(evtStateChange, tabStateChange);
// listen for the submit event
$(formSel).submit(function(e) {
e.preventDefault();
var q = $.trim($q.val());
passiveQuery(q);
});
// issue an inital query
if (firstQ) {
passiveQuery(firstQ, false);
}
// listen for message from parent frames
$(window).on('message', function(e) {
var oEvent = e.originalEvent, q;
if (!isValidOrigin(oEvent.origin)) {
return;
}
q = $.trim(oEvent.data);
passiveQuery(q);
});
$(window).on('popstate', function(e) {
var oEvent = e.originalEvent,
q = firstQ || '';
if (oEvent.state) {
q = oEvent.state.query || '';
}
passiveQuery(q, false);
});
if (window.parent != undefined) {
$(document).on('keydown', function(e) {
if (e.keyCode === 27) {
......@@ -369,10 +369,10 @@
});
}
});
});
};
window['pf_getUID'] = function() {
return true;
};
......
......@@ -8,7 +8,7 @@
// Template overrides
.embed #visitorChat,
#wdn_search {
#wdn_search {
display: none !important;
}
......@@ -25,16 +25,16 @@
// Input Groups
form .input-group {
display: table;
> * {
display: table-cell;
.border-radius(0);
}
.input-group-btn {
width: 1%;
vertical-align: middle;
button {
font-size: 18px;
line-height: normal;
......@@ -42,19 +42,19 @@ form .input-group {
margin: 0;
}
}
input {
margin: 0;
}
:first-child {
.border-radius(4px 0 0 4px);
}
:last-child {
.border-bottom-right-radius(4px);
.border-top-right-radius(4px);
button {
.border-bottom-left-radius(0);
.border-top-left-radius(0);
......@@ -66,7 +66,7 @@ form .input-group {
text-align: center;
background: #38431b url(../images/050419.jpg) 50% 50% no-repeat;
.background-size(cover);
.input-group {
margin: 0 auto;
max-width: 30em;
......@@ -78,20 +78,20 @@ form .input-group {
}
.results-group {
&:hover {
background-color: #fff;
.result-head {
background-color: @ui09;
}
}
.result-head {
background-color: mix(@ui09, @page-background, 95%);
color: #fff;
position: relative;
h2 {
color: inherit;
margin: 0;
......@@ -104,28 +104,28 @@ form .input-group {
margin: 0;
padding: 0;
list-style: none;
li {
display: inline;
&.selected {
color: #fff;
}
a {
color: inherit;
border: 0;
}
&:before {
content: '\b7\a0'; // middle-dot + space
}
&:first-child:before {
content: none;
}
}
&:after {
content: '';
position: absolute;
......@@ -135,46 +135,46 @@ form .input-group {
bottom: 0;
left: 0;
.transition(transform 400ms);
.no-csstransforms & {
.transition(left 400ms);
}
#directory_results & {
.translateX(2.95em);
.no-csstransforms & {
left: 2.95em;
}
}
#search_results & {
.translateX(4.95em);
.no-csstransforms & {
left: 4.95em;
}
}
}
&.state-1:after {
#directory_results & {
.translateX(8.95em);
.no-csstransforms & {
left: 8.95em;
}
}
#search_results & {
.translateX(10.35em);
.no-csstransforms & {
left: 10.35em;
}
}
}
}
.search-set, .embed {
......@@ -185,11 +185,11 @@ form .input-group {
.search-results {
.transition(opacity 400ms);
opacity: 0;
&.active {
opacity: 1;
}
h3 {
display: none;
}
......@@ -204,41 +204,41 @@ form .input-group {
> * {
padding: 1.425em 9.375%;
}
@media @bp2 {
width: 33.3333%;
}
.embed & {
width: 40%;
}
}
#search_results {
> * {
padding: 1.425em 7.812%;
}
@media @bp2 {
width: 66.6667%;
.result-head {
border-right: 1px solid @ui09;
}
.search-results {
border-right: 1px solid @ui02;
}
}
.embed & {
width: 60%;
.result-head {
border-right: 1px solid @ui09;
}
.search-results {
border-right: 1px solid @ui02;
}
......@@ -254,47 +254,47 @@ form .input-group {
h3, h4, .result_head {
display: none;
}
.pfResult {
padding: 0;
list-style: none;
}
.ppl_Sresult, .dep_result {
margin: 1em 0;
}
.cInfo {
display: none;