1function inputFocus(i) { 2 if (i.value == i.defaultValue) { 3 i.value = ""; 4 i.style.color = "#FFFFFF"; 5 } 6} 7 8function inputBlur(i) { 9 if (i.value == "") { 10 i.value = i.defaultValue; 11 i.style.color = "#FFFFFF"; 12 } 13} 14 15$(function() { 16 // MAIN NAVIGATION 17 var $nav = $("#navlinks"); 18 var $navToggleInner = $(".nav-toggle a"); 19 $(".nav-toggle").on("click", function(e) { 20 e.preventDefault(); 21 $('span.glyphicon', this).removeClass('glyphicon-menu-up').addClass('glyphicon-menu-down'); 22 if ($nav.hasClass('is-open')) { 23 $nav.addClass('is-collapsing').removeClass('is-open'); 24 $navToggleInner.attr("aria-expanded","false"); 25 setTimeout(function() { 26 $nav.removeClass('is-collapsing'); 27 }, 300); 28 } else { 29 $nav.addClass('is-collapsing is-open'); 30 $navToggleInner.attr("aria-expanded","true"); 31 $('span.glyphicon', this).removeClass('glyphicon-menu-down').addClass('glyphicon-menu-up'); 32 } 33 }); 34 // SEARCH BAR 35 if ($('.search-overlay').length > 0) { 36 navSearch(); 37 } 38 39 // Initialize select2 on selects with the class 40 $('.select2').select2(); 41 42 // Since select2 is older version, and doesn't support 'unselect' event 43 var selectVal, selectPrevVal = []; 44 $('.select2.select-multiple').on('change', function(e) { 45 selectPrevVal = (!!selectVal && selectVal.length > 0) ? selectVal : selectPrevVal; 46 optionAll = $(this).find('option[value=0]'); 47 options = $(this).find('option'); 48 selectVal = $(this).val(); 49 if (!!selectVal && selectVal.indexOf('0') === 0) { // if is 'all' 50 $(this).find('option:not([value=0])').prop('selected', true); 51 } else if (!!selectPrevVal && selectPrevVal.indexOf('0') === 0) { 52 options.prop('selected', false); 53 } else if (!selectVal || selectVal.length <= 0) { // if no values selected 54 optionAll.prop('disabled', false); 55 } else { // anything other than null or all 56 optionAll.prop('disabled', true); 57 } 58 }); 59 60 function navSearch() { 61 var searchBtn = $('.nav-utilities-search-form-btnwrap').html(); 62 var searchForm = $('.nav-utilities-search-form').detach().prependTo('.search-overlay'); 63 $('.nav-utilities-search').html(searchBtn); 64 $('.nav-utilities-search button').prop('type', 'button').attr('id', 'js-trigger-overlay'); 65 66 var triggerBttn = document.getElementById('js-trigger-overlay'), 67 overlay = document.querySelector('div.search-overlay'), 68 closeBttn = document.getElementById('search-close'), 69 searchInput = $('div.search-overlay input[type="search"]'); 70 transEndEventNames = { 71 'WebkitTransition': 'webkitTransitionEnd', 72 'MozTransition': 'transitionend', 73 'OTransition': 'oTransitionEnd', 74 'msTransition': 'MSTransitionEnd', 75 'transition': 'transitionend' 76 }, 77 transEndEventName = transEndEventNames[Modernizr.prefixed('transition')], 78 support = { transitions: Modernizr.csstransitions }; 79 80 function toggleOverlay() { 81 if (classie.has(overlay, 'is-open')) { 82 classie.remove(overlay, 'is-open'); 83 classie.add(overlay, 'is-close'); 84 var onEndTransitionFn = function(ev) { 85 if (support.transitions) { 86 if (ev.propertyName !== 'visibility') return; 87 this.removeEventListener(transEndEventName, onEndTransitionFn); 88 } 89 classie.remove(overlay, 'is-close'); 90 }; 91 if (support.transitions) { 92 overlay.addEventListener(transEndEventName, onEndTransitionFn); 93 } else { 94 onEndTransitionFn(); 95 } 96 triggerBttn.focus(); 97 overlay.setAttribute("aria-hidden", "true"); 98 closeBttn.setAttribute("tabindex", "-1"); 99 } else if (!classie.has(overlay, 'is-close')) { 100 classie.add(overlay, 'is-open'); 101 searchInput.focus(); 102 overlay.setAttribute("aria-hidden", "false"); 103 closeBttn.removeAttribute("tabindex"); 104 } 105 } 106 107 triggerBttn.addEventListener('click', toggleOverlay); 108 closeBttn.addEventListener('click', toggleOverlay); 109 110 document.onkeydown = kp; 111 112 function kp(e) {
113 var charCode = (typeof e.which == "number") ? e.which : e.keyCode 114 if (charCode == 27 && classie.has(overlay, 'is-open')) { 115 e.preventDefault(); 116 toggleOverlay(); 117 } 118 if (charCode == 9 && classie.has(overlay, 'is-open')) { 119 e.preventDefault(); 120 var searchInput = $('#search-input'), 121 searchBtn = $('#overlay-button'), 122 closeBtn = $('#search-close'); 123 if (e.target.id == "search-close") { 124 if (e.shiftKey) { 125 searchBtn.focus(); 126 } else { 127 searchInput.focus(); 128 } 129 } else if (e.target.id == "search-input") { 130 if (e.shiftKey) { 131 closeBtn.focus(); 132 } else { 133 searchBtn.focus(); 134 } 135 } else if (e.target.id == "overlay-button") { 136 if (e.shiftKey) { 137 searchInput.focus(); 138 } else { 139 closeBtn.focus(); 140 } 141 } 142 } 143 } 144 145 } 146 147 if (window.location.hash && window.location.hash == '#_=_') { 148 if (window.history !== undefined) { 149 window.history.replaceState ? window.history.replaceState(null, null, window.location.href.split('#')[0]) : window.location.hash = ''; 150 } else { 151 window.location.hash = ''; 152 } 153 } 154 155 $(window).on('signedin.hive', function(e) { 156 $('body').addClass('is-logged-in'); 157 //Remove Login/Signup button from header and footer upon login, show Signout instead 158 $('.nav-utilities .js-show-guest, footer .js-show-guest').hide().attr('aria-hidden', 'true'); 159 $('.nav-utilities .js-show-user, footer .js-show-user').each(function(k, i) { 160 var $i = $(i); 161 var html = $i.html(); 162 html = html.replace(/LOGOUT_TOKEN/, e.logout_token); 163 $i.html(html); 164 $i.find('[data-hive-user="username"]').text(e.userName); 165 }).show().attr('aria-hidden', 'false'); 166 }); 167 168 $(window).on('signedout.hive', function(e) { 169 $('body').removeClass('is-logged-in'); 170 $('.nav-utilities .js-show-user, footer .js-show-user').each(function(k, i) { 171 var $i = $(i); 172 var html = $i.html(); 173 html = html.replace(/(\/logout)\/[^"]+/g, '$1/LOGOUT_TOKEN'); 174 $i.html(html); 175 $i.find('[data-hive-user="username"]').text('USERNAME'); 176 }).hide().attr('aria-hidden', 'true'); 177 $('.nav-utilities .js-show-guest, footer .js-show-guest').show().attr('aria-hidden', 'false'); 178 }); 179 180});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.