1$(document).ready(initPage); 2 3function initPage(){ 4 // initSearchForm(); 5 6 if (mobileViewActive()){ 7 initMobileMenus(); 8 } 9 10 $(".LeftContent").removeAttr("style"); 11 12 $("#sidebarCollapse").on("click", function() { $(window).scrollTop(0); }); 13} 14 15// function initSearchForm(){ 16 // $("#SearchText").on("keydown", function() { searchOnEnterKey(); }); 17 // $("#SearchButton").on("click", function() { search(); }); 18 // populateSearchText(); 19 // loadSearchResults(); 20 // $("#SearchText").focus(); 21// } 22 23// function populateSearchText(){ 24 // var searchText = getParameterValue("SearchText"); 25 // var searchType = getParameterValue("SearchType"); 26 // if (searchText){ 27 // searchText = decodeURIComponent(searchText); 28 // $("#SearchText").val(searchText); 29 // $(".SearchResults").removeClass("NoResults"); 30 // } 31 // if (searchType){ 32 // searchType = decodeURIComponent(searchType); 33 // $("#SearchType").find(":selected").prop("selected",false); 34 // $("#SearchType [value='" + searchType + "']").prop("selected",true); 35 // } 36 37// } 38// function searchOnEnterKey(){ 39 // if (event.which==13) { 40 // event.preventDefault(); 41 // $("#SearchButton").click(); 42 // } 43// } 44// function search(){ 45 // var searchText = $("#SearchText").val(); 46 // var searchType = $("#SearchType").find(":selected").val(); 47 // if (searchText){ 48 49 // var searchUrl = "/Search?SearchText=" + encodeURIComponent(searchText) 50 // + "&SearchType=" + searchType; 51 52 // if (window.location.pathname == "/Search"){ 53 // location.replace(searchUrl); 54 // }else{ 55 // window.location.href = searchUrl; 56 // } 57 // } 58 // return false; 59// } 60// function loadSearchResults(){ 61 // var searchUrl = "http://search.manchesternh.gov/search?site=ManchesterNH&output=xml_no_dtd"; 62 // var searchText = getParameterValue("SearchText"); 63 // var searchType = getParameterValue("SearchType"); 64 65 // if (searchType){ 66 // searchType = decodeURIComponent(searchType); 67 // }else{ 68 // searchType = "ManchesterAll"; 69 // } 70 71 // searchUrl += 72 // "&client=" + searchType 73 // + "&proxystylesheet=" + searchType; 74 75 // if (searchText){ 76 // searchText = decodeURIComponent(searchText); 77 // searchUrl += 78 // "&q=" + searchText; 79 // } 80 81 // $("#SearchResultsFrame").attr("src",searchUrl); 82// } 83 84function setSeniorNewsletterCategoryActiveLink() { 85 var currentCategory = getParameterValue("Category"); 86 var activeLink; 87 if (currentCategory) { 88 activeLink = $("#CategoryEventFilter a[id='Category" + currentCategory + "']")[0]; 89 } 90 else { 91 activeLink = $("#CategoryEventFilter a:first-of-type")[0]; 92 } 93 94 if (activeLink) { 95 activeLink.className = "ActiveLink"; 96 } 97} 98 99function setPoliceLogFilterActiveLink() { 100 var currentDay = getParameterValue2("Day"); 101 var activeLink; 102 if (currentDay) { 103 activeLink = $("#PoliceLogFilter li a[href*='" + currentDay + "']")[0]; 104 } 105 else { 106 activeLink = $("#PoliceLogFilter a:first-of-type")[0]; 107 } 108 109 if (activeLink) { 110 activeLink.className = "ActiveLink"; 111 } 112} 113 114function loadEventFilter(){ 115 try { 116 setEventFilterActiveLink("Month"); 117 setEventFilterActiveLink("Category"); 118 } 119 catch(err) { 120 121 } 122} 123 124function setEventFilterActiveLink(filterType){ 125 var itemID = getParameterValue(filterType); 126 var filterID = filterType + "EventFilter"; 127 128 var activeLink; 129 if (itemID){ 130 activeLink = $("#" + filterID + " li a[id='" + filterType + itemID + "']")[0]; 131 } 132 // else { 133 // activeLink = $("#" + filterID + " li a")[0]; 134 // } 135 136 if (activeLink){ 137 activeLink.className = "ActiveLink"; 138 } 139} 140 141function filterEvents(filterType,itemID){ 142 try { 143 var filterQueryString = ""; 144 145 if (filterType == "Category") { 146 filterQueryString = getEventFilterQueryString(itemID, getEventFilterActiveLinkID("Month")); 147 } else { 148 filterQueryString = getEventFilterQueryString(getEventFilterActiveLinkID("Category"), itemID); 149 } 150 151 window.location.href = window.location.pathname + filterQueryString; 152 return false; 153 } 154 catch(err){ 155 return false; 156 } 157} 158 159function getEventFilterActiveLinkID(filterType) { 160 var filterID = filterType + "EventFilter"; 161 162 var activeLink = $("#" + filterID + " li a[class='ActiveLink']")[0]; 163 if (activeLink) { 164 return activeLink.id.replace(filterType,""); 165 } else { 166 return ""; 167 } 168} 169 170function getEventFilterQueryString(categoryValue,monthValue){ 171 var qs = "" 172 173 if (!(categoryValue == "")){ 174 qs = "Category=" + categoryValue; 175 } 176 177 if (!(monthValue == "")){ 178 if (!(qs == "")){ 179 qs = qs + "&"; 180 } 181 qs = qs + "Month=" + monthValue; 182 } 183 184 if (qs == "") { 185 return "" 186 } else { 187 return "?" + qs; 188 } 189} 190 191 192function initMobileMenus(){ 193 $("#QuickLinks a").click(collapseQuickLinksOnNavigate); 194 $("#SiteNav a").click(collapseSiteNavOnNavigate); 195 $(".Collapsible.BlueMenuContentPane ul a").click(collapseBlueMenuOnNavigate); 196} 197function collapseSiteNavOnNavigate(){ 198 var $expandHandle = $(this).find(".rpExpandHandle"); 199 if (!($(this).hasClass("rpExpandable")) || !($expandHandle.hasClass("rpExpandHandleHovered"))){ 200 scrollToTop(); 201 $("#ToggleQuickLinks").click(); 202 window.location.href = $(this).attr("href"); 203 } 204} 205function collapseBlueMenuOnNavigate(){ 206 scrollToTop(); 207 /*$("#ToggleBlueMenu").click();*/ 208} 209function collapseQuickLinksOnNavigate(){ 210 scrollToTop(); 211 /*$("#ToggleQuickLinks").click();*/ 212} 213function scrollToTop() { 214 $("html,body").scrollTop(0); 215} 216 217 218function displayButtonWaitMessage(btn){ 219 btn.textContent = 'Please Wait...'; 220 btn.className = 'dnnSecondaryAction'; 221} 222 223 224function mobileScrollToContent() { 225 if (mobileViewActive()){ 226 var $content = $(".ContentPane"); 227 $(window).scrollTop($content.offset().top).scrollLeft($content.offset().left); 228 } 229} 230 231function mobileViewActive(){ 232 return ($(".MobileMenuBar").css("display") != "none"); 233} 234 235/*function calculateTrashCartPaymentTotal(quantity65, quantity95) { 236 return '$' + ((parseInt('0' + quantity65) * 28) + (parseInt('0' + quantity95) * 35)).toString() + '.00'; 237} 238 239function calculateTrashCartTotal(quantity65, quantity95) { 240 return (parseInt('0' + quantity65) + parseInt('0' + quantity95)); 241}*/ 242 243 244function getParameterValue(parameterName){ 245 var vars = [], hash; 246 var q = document.URL.split('?')[1]; 247 if(q != undefined){ 248 q = q.split('&'); 249 for(var i = 0; i < q.length; i++){ 250 hash = q[i].split('='); 251 vars.push(hash[1]); 252 vars[hash[0]] = hash[1]; 253 } 254 } 255 return vars[parameterName]; 256} 257 258function getParameterValue2(parameterName){ 259 var q = document.URL.split('/'); 260 if(q != undefined){ 261 if( q.length > 2){ 262 if( q[q.length - 2] == parameterName){ 263 return q[q.length - 1]; 264 } 265 } 266 } 267 return ; 268} 269 270function goBack(){ 271 window.history.back(); 272}
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.