1/* eslint-disable */ 2// prettier-ignore 3var searchPage = { 4 batchSize: 20, 5 endIndex: 0, 6 query: null, 7 facetedkey: [], 8 facetedvalue: [], 9 sortby: 'relevancydate', 10 fromdate: '', 11 todate: '', 12 13 init: function (querylyId, siteName) { 14 queryly.QuerylyKey = querylyId; 15 16 var sPageURL = window.location.search.substring(1); 17 var sURLVariables = sPageURL.split('&'); 18 for (var i = 0; i < sURLVariables.length; i++) { 19 var sParameterName = sURLVariables[i].split('='); 20 if (sParameterName[0].toLowerCase() == 'query') { 21 searchPage.query = sParameterName[1] + ' '; 22 break; 23 } 24 } 25 26 var script = document.createElement("SCRIPT"); 27 script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; 28 script.type = 'text/javascript'; 29 script.onload = function () { 30 $ = window.jQuery; 31 if (searchPage.query != '' && searchPage.query != null) { 32 searchPage.renderSytle(); 33 searchPage.dofacetedsearch(0, '', ''); 34 } 35 }; 36 document.getElementsByTagName("head")[0].appendChild(script); 37 38 39 }, 40 41 applyDateRange: function () { 42 if ($('#datepicker_from').val() == '' || $('#datepicker_to').val() == '') { 43 alert("Please select a valid \"From Date\" and \"To Date\""); 44 return; 45 } 46 47 if ($('#datepicker_from').datepicker('getDate') > $('#datepicker_to').datepicker('getDate')) { 48 alert("The \"From Date\" can't be greater than the \"To Date\""); 49 return; 50 } 51 searchPage.fromdate = $('#datepicker_from').val(); 52 searchPage.todate = $('#datepicker_to').val(); 53 if (searchPage.facetedkey.indexOf("pubDate") >= 0) { 54 var i = searchPage.facetedkey.indexOf("pubDate"); 55 searchPage.facetedkey.splice(i, 1); 56 searchPage.facetedvalue.splice(i, 1); 57 } 58 59 searchPage.turnpage(0); 60 }, 61 62 renderSytle: function () { 63 var style = document.createElement('style'); 64 var stylehtml = '#queryly_advanced_container {padding:12px;margin:0 auto;} #faceteddata {float: left; padding: 0px; padding-top:0px; font-size: 15px; margin-right: -10px;width: 220px;line-height:30px; overflow: hidden;} .queryly_item_row img {width: 200px!important;} .queryly_item_row {min-height: 100px;max-height: 180px!important;} .queryly_item_title {overflow: hidden;} .queryly_item_description {color: #5f5f5f; font-size: 14px;font-weight: 400; overflow: hidden; line-height: 21px; } #resultdata {margin-left: 250px;margin-bottom: 60px;}'; 65 stylehtml = stylehtml + ' .selectedFilterItem a {font-weight:800} .queryly_item_title {margin-top:0px;margin-bottom:6px;;font-size:18px;line-height:22px;font-weight:600;}; @media (max-width: 780px) {.filterbar {display:none;} section {width:100%!important;padding:0px!important;} #resultdata{margin-left:0px!important;} .queryly_item_title {important;font-weight:normal;} } '; 66 stylehtml = stylehtml + ' @media (max-width: 780px) {.queryly_item_description {display: none;} .queryly_item_title {font-size: 14px!important;font-weight: normal; } .queryly_item_row { min-height: 50px;} .queryly_item_row img { width: 140px; } #faceteddata { display: none;} #resultdata { margin-left: 0px; } .filterbar { display: none; }}'; 67 style.innerHTML = stylehtml; 68 document.getElementById('queryly_advanced_container').parentNode.insertBefore(style, document.getElementById('queryly_advanced_container')); 69 }, 70 71 //This render the faceted object into html. In the current rss feed, creator and pubdate are used in the facet. 72 renderFaceted: function (faceted, filters) { 73 var html = '<style> .queryly_item_description {font-size:14px;} .queryly_advanced_item_imagecontainer {margin-right: 20px; padding-bottom: 0px; height: 116px;width: 220px; overflow: hidden; background-size: cover; background-position: 50% 50%; position: relative;}} </style><style> @media (max-width: 768px) {.queryly_advanced_item_imagecontainer {width: 160px; height: 100px; margin-right: 15px;} } </style><div style="margin-top:10px;" ><a style="color:black;cursor:pointer" onclick="searchPage.dofacetedsearch(0,\'\',\'\');return false;">Clear Filters</a></div>'; 74 75 html = html + '<div id="pubDate_filter"><div style="margin-top:10px;margin-bottom:10px;background: #111 ;color:white;padding:6px;font-weight" >Filter by Date</div>'; 76 //build the filters for publication date, data are grouped into buckets. for example, 168 means "published in the past 168 hours" 77 var dates = faceted.pubDate; 78 for (var i = 0; i < dates.length; i++) { 79 var datename = ''; 80 if (dates[i].key == '24') { 81 datename = "Within one day"; 82 } 83 else if (dates[i].key == '168') { 84 datename = "Within one week"; 85 } 86 else if (dates[i].key == '720') { 87 datename = "Within one month"; 88 } 89 else if (dates[i].key == '8760') { 90 datename = "Within one year"; 91 } 92 93 if (datename != '') { 94 html = html + '<div class="filter_item" data-filter-value="' + dates[i].key + '"><a style="cursor:pointer;color:black;" onclick="searchPage.dofacetedsearch(0,\'pubDate\',\'' + encodeURIComponent(dates[i].key) + '\')";return false;">' + datename + ' (' + dates[i].value + ')</a></div>'; 95 } 96 } 97 98 if (typeof $ != 'undefined') { 99 html = html + "<div style='border-top: 1px solid #ccc; margin-top: 30px;'><center style='height: 20px;'><div style='display: inline-block; padding-left: 10px; padding-right: 10px; background: white; position: relative; top: -16px; font-size: 15px; font-weight: bold;'>OR</div></center></div><div style='text-align:center;padding: 10px 0px;text-align:left;'>"; 100 html = html + "<input autocorrect='off' autocapitalize='off' autocomplete='off' spellcheck='false' placeholder='From Date' type='text' id='datepicker_from' style='font-size: 15px;width: 200px; padding:8px;margin-bottom:8px;' value='" + searchPage.fromdate + "'>"; 101 html = html + "<input autocorrect='off' autocapitalize='off' autocomplete='off' spellcheck='false' placeholder='To Date' type='text' id='datepicker_to' style='font-size: 15px;width: 200px; padding: 8px;margin-bottom:8px;' value='" + searchPage.todate + "' >"; 102 html = html + "<button type='button' onclick='searchPage.applyDateRange();' style='padding:6px;font-weight:bold;text-transform:none;font-size:16px;'>Apply</button></div>"; 103 104 } 105 106 html = html + '</div>'; 107 108 html = html + '<div id="section_filter"><div style="margin-top:10px;margin-bottom:10px;background: #111 ;color:white;padding:6px;font-weight" >Filter by Category</div>'; 109 var sections = faceted.section; 110 for (var i = 0; i < sections.length; i++) { 111 var name = sections[i].key; 112 if (name == "") { continue; } 113 html = html + '<div class="filter_item" data-filter-value="' + sections[i].key + '"><a style="cursor:pointer;color:black;" onclick="searchPage.dofacetedsearch(0,\'section\',\'' + sections[i].key.replace(/\\/g, "\\\\").replace(/'/g, "\\'") + '\')";return false;">' + sections[i].key + ' (' + sections[i].value + ')</a></div>'; 114 } 115 html = html + '</div>'; 116 117 html = html + '<div id="creator_filter"><div style="margin-top:10px;margin-bottom:10px;background: #111 ;color:white;padding:6px;font-weight" >
117Filter by Author</div>'; 118 var creators = faceted.creator; 119 for (var i = 0; i < creators.length; i++) { 120 var name = creators[i].key; 121 if (name == "") { continue; } 122 html = html + '<div class="filter_item" data-filter-value="' + creators[i].key + '"><a style="cursor:pointer;color:black;" onclick="searchPage.dofacetedsearch(0,\'creator\',\'' + creators[i].key.replace(/\\/g, "\\\\").replace(/'/g, "\\'") + '\')";return false;">' + creators[i].key.replace("Submitted by ", "").replace("By ", "") + ' (' + creators[i].value + ')</a></div>'; 123 } 124 html = html + '</div>'; 125 126 document.getElementById('faceteddata').innerHTML = (html); 127 128 try { 129 if (typeof filters != 'undefined') { 130 if (filters.length == 0) { 131 var filter_items = document.querySelectorAll('.filter_item'); 132 for (var j = 0; j < filter_items.length; j++) { 133 filter_items[j].classList.remove("selectedFilterItem"); 134 } 135 } 136 else { 137 for (var i = 0; i < filters.length; i++) { 138 var val = filters[i].value; 139 var filter_items = document.querySelector('#' + filters[i].key + '_filter').querySelectorAll('.filter_item'); 140 for (var j = 0; j < filter_items.length; j++) { 141 if (filter_items[j].getAttribute("data-filter-value").toLowerCase() == val) { 142 filter_items[j].classList.add("selectedFilterItem"); 143 } 144 else { 145 filter_items[j].classList.remove("selectedFilterItem"); 146 } 147 } 148 149 } 150 } 151 152 } 153 } 154 catch (e) { } 155 156 if (typeof $ != 'undefined' && jQuery.ui) { 157 $("#datepicker_from").datepicker({ autoSize: true }); 158 $("#datepicker_to").datepicker({ autoSize: true }); 159 } 160 else { 161 $('head').append('<link rel="stylesheet" href="https://www.queryly.com/css/jquery-ui.css" type="text/css" />'); 162 var script = document.createElement("SCRIPT"); 163 script.src = 'https://www.queryly.com/js/jquery-ui.js'; 164 script.type = 'text/javascript'; 165 script.onload = function () { 166 try { 167 $("#datepicker_from").datepicker({ autoSize: true }); 168 $("#datepicker_to").datepicker({ autoSize: true }); 169 } 170 catch (ex) { } 171 }; 172 document.getElementsByTagName("head")[0].appendChild(script); 173 $('head').append('<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" type="text/css" />'); 174 } 175 }, 176 177 SwitchSort: function () { 178 searchPage.sortby = document.querySelector('#sortby').value; 179 180 document.getElementById('resultdata').innerHTML = ''; 181 182 //assemble the rest api. 183 var url = "//api.queryly.com/json.aspx?queryly_key=" + queryly.QuerylyKey + "&query=" + searchPage.query + "&endindex=0&batchsize=" + searchPage.batchSize + "&callback=searchPage.resultcallback&showfaceted=true&extendeddatafields=creator,imageresizer,promo_image&timezoneoffset=" + (new Date(0)).getTimezoneOffset(); 184 185 if (searchPage.sortby != 'relevancydate') { 186 url = url + "&sort=date"; 187 } 188 189 var keys = ''; 190 var values = ''; 191 for (var i = 0; i < searchPage.facetedkey.length; i++) { 192 keys = keys + searchPage.facetedkey[i] + "|"; 193 values = values + searchPage.facetedvalue[i] + "|"; 194 url = url + "&facetedkey=" + encodeURIComponent(keys) + "&facetedvalue=" + encodeURIComponent(values); 195 } 196 197 searchPage.loadScript(url, function (data, textStatus, jqxhr) { 198 window.scrollTo(0, 0); 199 }); 200 }, 201 202 advanced_searchbox_keydown: function (e) { 203 var keyCode = e.keyCode || e.which; 204 if (keyCode == 13) { 205 searchPage.redirectsearch(); 206 } 207 }, 208 209 resultcallback: function (results) { 210 //retrieve metadata 211 var total = results.metadata.total; 212 searchPage.endIndex = results.metadata.endindex; 213 214 //if there is faceted data in results object, render it. 215 if (results.faceted != null && results.faceted != undefined) { 216 this.renderFaceted(results.faceted, results.metadata.filters); 217 } 218 219 var html = '<div style="padding-bottom: 20px;position: relative;"><form action=""><input class="queryly_searchbox" name="query" type="text" style="height:36px;font-size: 20px;color: #333;background: white;width: 100%;padding: 5px;border: 2px solid #aaa;" value="' + results.metadata.query.trim() + '" placeholder="Search ' + siteName + ' ..." onkeydown="searchPage.processEnterKey(event);"><button style="height:36px;padding: 10px 15px;vertical-align:top;background: rgb(44, 84, 114);color: white;border-style: hidden;font-weight: bold;position: absolute;top: 0px;right: -2px;" type="submit">Search</button></form></div>'; 220 html = html + "<div style = 'margin-bottom: 12px; border-bottom: 1px solid #ccc;padding-bottom:10px;margin-top:0px;' ><div class='filterbar' style='float: right;font-weight:bold;margin-left: 20px;'>Order by: <select id='sortby' onchange='searchPage.SwitchSort()'; style='padding: 5px!important;background:white; '><option " + (searchPage.sortby == "date" ? "" : "selected") + " value='relevancydate'>Relevant</option><option " + (searchPage.sortby == "date" ? "selected" : "") + " value='date'>Newest</option></select></div><div style='font-size:20px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;color:#111;padding-bottom:16px;'>Showing " + results.metadata.total + " results for <b>\"" + results.metadata.query.trim() + "\"</b></div></div> "; 221 //loop through each result. 222 //html = html + "<div class='filterbar' style='float: right;font-weight:bold;margin-top: -66px;'>Order by: <select id='sortby' onchange='searchPage.SwitchSort()'; style='padding: 5px!important;background:white; '><option " + (searchPage.sortby == "date" ? "" : "selected") + " value='relevancydate'>Relevant</option><option " + (searchPage.sortby == "date" ? "selected" : "") + " value='date'>Newest</option></select></div>"; 223 224 if (results.items.length == 0) { 225 html = html + "<div style='margin: 50px;text-align: center;font-size: 30px;color: #444;'>No result found. Please try a different keyword.</div>"; 226 document.getElementById('resultdata').innerHTML = html; 227 return; 228 } 229 230 if (typeof results.topics != 'undefined') { 231 for (var i = 0; i < results.topics.length; i++) { 232 //display search native ad if available 233 234 235 var item = results.topics[i]; 236 html = html + searchPage.renderitem(item); 237 break; 238 //document.getElementById('resultdata').innerHTML = html; 239 //queryly.jquery('#resultdata').append(html); 240 } 241 } 242 243 for (var i = 0; i < results.items.length; i++) { 244 var item = results.items[i]; 245 html = html + searchPage.renderitem(item); 246 } 247 248 //var pagerhtml = ''; 249 if (total > searchPage.endIndex) { 250 html = html + '<a style="float:right;font-family: Arial,Helvetica,sans-serif;font-size: 17px;color: #428bca;font-weight: 600;" class="next_btn" onclick="searchPage.turnpage(' + searchPage.endIndex + ');return false;" href="#">Next Page</a>'; 251 } 252 if (searchPage.endIndex > searchPage.batchSize) { 253 var prev = Math.max(0, searchPage.endIndex - 2 * searchPage.batchSize); 254 html = html + '<a style="float:left;font-family: Arial;font-size: 17px;color: #428bca;font-weight: 600;" class="prev_btn" onclick="searchPage.turnpage(' + prev + ');return false;" href="#" >Previous Page</a>'; 255 } 256 document.getElementById('resultdata').innerHTML = html; 257 window.scrollTo(0, 0); 258 }, 259 260 renderitem: function (item) { 261 262 var trackcall = 'onmousedown = "queryly.util.trackClick(\'' + item.link + '\',\'' + searchPage.query + '\');"'; 263 if (item.isad == 1) { 264 trackcall = 'onmousedown = "queryly.util.trackAdClick(' + item._id + ')"'; 265 } 266 267 item.image = item.image.replace("http://", "https://"); 268 var html = '<div class="queryly_item_row" style="max-height:180px;position:relative;overflow:hidden;margin-bottom:20px;font-size:10px;border-bottom:1px solid #ccc;padding-bottom:20px;width:100%;"><a ' + trackcall + ' href="' + item.link + '" style="text-decoration:none;color:#333">'; 269 270 if (item.image == '') { 271 item.image = item.promo_image; 272 } 273 else { 274 item.image = item.image.split('|')[0]; 275 } 276 277 278 279 //html = html + '<img style="padding:6px;padding-right:12px;float:left;
279max-width:200px;" onerror="this.parentNode.removeChild(this);" src="' + item.image + '" />'; 280 //html = html + '<div class="queryly_advanced_item_imagecontainer" style="float:left;background-image: url(\'' + item.image + '\'),url(\'https://baltimorebanner-the-baltimore-banner-prod.web.arc-cdn.net/resizer/tDHPx6GIMjZjyE_65qNL4_rLr58=/800x0/filters:format(png):quality(70)/cloudfront-us-east-1.images.arcpublishing.com/sandbox.baltimorebanner/YUXCLINNEBCGZJD7YAHFQFWPSM.png\');background-size:cover;background-color:#aaa;"></div>'; 281 html = html + '<div class="queryly_advanced_item_imagecontainer" style="float:left;background-image: url(\'' + item.image + '\');background-size:cover;background-color:#dadada;"></div>'; 282 html = html + '<div style="margin-top:0px;overflow:hidden;"><div class="queryly_item_title" style="font-weight:bold;">' + item.title.replace(/(([^\s]+\s\s*){15})(.*)/, "$1...") + '</div>'; 283 284 var datebyline = ''; 285 if (typeof item.pubdate != "undefined") { 286 datebyline = item.pubdate; 287 } 288 289 290 291 html = html + '<div class="queryly_item_description">' + item.description.replace(/"/g, "").replace(/'/g, "").replace(/(([^\s]+\s\s*){15})(.*)/, "$1...") + '</div>'; 292 html = html + '<div style="margin-top:6px;color:#555;font-size:12px;">' + datebyline + '</div>'; 293 html = html + '</div></a></div>'; 294 295 return html; 296 }, 297 298 turnpage: function (index) { 299 // queryly.jquery('#resultdata').html(''); 300 document.getElementById('resultdata').innerHTML = ''; 301 302 var keys = ''; 303 var values = ''; 304 for (var i = 0; i < searchPage.facetedkey.length; i++) { 305 keys = keys + searchPage.facetedkey[i] + "|"; 306 values = values + searchPage.facetedvalue[i] + "|"; 307 } 308 var url = "//api.queryly.com/json.aspx?queryly_key=" + queryly.QuerylyKey + "&query=" + searchPage.query + "&endindex=" + index + "&batchsize=" + searchPage.batchSize + "&callback=searchPage.resultcallback&showfaceted=true&extendeddatafields=creator,imageresizer,promo_image&timezoneoffset=" + (new Date(0)).getTimezoneOffset(); 309 310 if (searchPage.facetedkey.length > 0) { 311 url = url + "&facetedkey=" + encodeURIComponent(keys) + "&facetedvalue=" + encodeURIComponent(values); 312 } 313 314 if (searchPage.fromdate != '' && searchPage.todate != '') { 315 var fromdate = $('#datepicker_from').datepicker('getDate').getMonth() + 1 + "/" + $('#datepicker_from').datepicker('getDate').getDate() + "/" + $('#datepicker_from').datepicker('getDate').getFullYear(); 316 var todate = $('#datepicker_to').datepicker('getDate').getMonth() + 1 + "/" + $('#datepicker_to').datepicker('getDate').getDate() + "/" + $('#datepicker_to').datepicker('getDate').getFullYear(); 317 url = url + "&daterange=" + fromdate + "," + todate; 318 } 319 320 if (searchPage.sortby != 'relevancydate') { 321 url = url + "&sort=date"; 322 } 323 324 //making the search call to Queryly server 325 searchPage.loadScript(url, function (data, textStatus, jqxhr) { 326 window.scrollTo(0, 0); 327 }); 328 329 330 }, 331 332 //similar with dosearch method, but with faceted turned on. It passes in the current facet selection if any. 333 dofacetedsearch: function (index, key, value) { 334 document.getElementById('resultdata').innerHTML = ''; 335 336 //assemble the rest api. 337 var url = "//api.queryly.com/json.aspx?queryly_key=" + queryly.QuerylyKey + "&query=" + searchPage.query + "&endindex=" + index + "&batchsize=" + searchPage.batchSize + "&callback=searchPage.resultcallback&showfaceted=true&extendeddatafields=creator,imageresizer,promo_image&timezoneoffset=" + (new Date(0)).getTimezoneOffset(); 338 339 if (key != '') { 340 if (searchPage.facetedkey.indexOf(key) >= 0) { 341 var i = searchPage.facetedkey.indexOf(key); 342 searchPage.facetedvalue[i] = value; 343 } 344 else { 345 searchPage.facetedkey.push(key); 346 searchPage.facetedvalue.push(value); 347 } 348 349 var keys = ''; 350 var values = ''; 351 for (var i = 0; i < searchPage.facetedkey.length; i++) { 352 keys = keys + searchPage.facetedkey[i] + "|"; 353 values = values + searchPage.facetedvalue[i] + "|"; 354 } 355 356 url = url + "&facetedkey=" + encodeURIComponent(keys) + "&facetedvalue=" + encodeURIComponent(values); 357 358 if (key == 'pubDate') { 359 searchPage.fromdate = ''; 360 searchPage.todate = ''; 361 $('#datepicker_from').val(''); 362 $('#datepicker_to').val(''); 363 } 364 } 365 else { 366 searchPage.facetedkey = []; 367 searchPage.facetedvalue = []; 368 369 searchPage.fromdate = ''; 370 searchPage.todate = ''; 371 $('#datepicker_from').val(''); 372 $('#datepicker_to').val(''); 373 } 374 375 if (searchPage.fromdate != '' && searchPage.todate != '') { 376 var fromdate = $('#datepicker_from').datepicker('getDate').getMonth() + 1 + "/" + $('#datepicker_from').datepicker('getDate').getDate() + "/" + $('#datepicker_from').datepicker('getDate').getFullYear(); 377 var todate = $('#datepicker_to').datepicker('getDate').getMonth() + 1 + "/" + $('#datepicker_to').datepicker('getDate').getDate() + "/" + $('#datepicker_to').datepicker('getDate').getFullYear(); 378 url = url + "&daterange=" + fromdate + "," + todate; 379 } 380 381 if (searchPage.sortby != 'relevancydate') { 382 url = url + "&sort=date"; 383 } 384 385 //making the search call to Queryly server 386 searchPage.loadScript(url, function (data, textStatus, jqxhr) { 387 window.scrollTo(0, 0); 388 }); 389 }, 390 391 loadScript: function (src, callback) { 392 var script = document.createElement('script'); 393 var loaded = false;
394 script.setAttribute('src', src); 395 if (callback) { 396 script.onreadystatechange = script.onload = function () { 397 if (!loaded) { 398 callback(); 399 } 400 loaded = true; 401 }; 402 } 403 document.head.appendChild(script); 404 } 405}; 406const currentScript = document.currentScript; 407 408const querylyId = currentScript?.dataset.querylyId; 409const siteName = currentScript?.dataset.siteName; 410 411searchPage.init({ 412 querylyId, 413 siteName, 414});
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.