1!function(t, e, i) { 2 var o = ["webkit", "Moz", "ms", "O"], r = {}, n; 3 4 function a(t, i) { 5 var o = e.createElement(t || "div"), r; 6 for(r in i) { 7 o[r] = i[r]; 8 } 9 return o 10 } 11 12 function s(t) { 13 for(var e = 1, i = arguments.length; e < i; e++) { 14 t.appendChild(arguments[e]); 15 } 16 return t 17 } 18 19 var f = function() { 20 var t = a("style", {type: "text/css"}); 21 s(e.getElementsByTagName("head")[0], t); 22 return t.sheet || t.styleSheet 23 }(); 24 25 function l(t, e, i, o) { 26 var a = [ 27 "opacity", 28 e, 29 ~~(t * 100), 30 i, 31 o 32 ].join("-"), s = .01 + i / o * 100, l = Math.max(1 - (1 - t) / e * (100 - s), t), p = n.substring(0, n.indexOf("Animation")).toLowerCase(), u = p && "-" + p + "-" || ""; 33 if(!r[a]) { 34 f.insertRule("@" + u + "keyframes " + a + "{" + "0%{opacity:" + l + "}" + s + "%{opacity:" + t + "}" + (s + .01) + "%{opacity:1}" + (s + e) % 100 + "%{opacity:" + t + "}" + "100%{opacity:" + l + "}" + "}", f.cssRules.length); 35 r[a] = 1 36 } 37 return a 38 } 39 40 function p(t, e) { 41 var r = t.style, n, a; 42 if(r[e] !== i) { 43 return e; 44 } 45 e = e.charAt(0).toUpperCase() + e.slice(1); 46 for(a = 0; a < o.length; a++) { 47 n = o[a] + e; 48 if(r[n] !== i) { 49 return n 50 } 51 } 52 } 53 54 function u(t, e) { 55 for(var i in e) { 56 t.style[p(t, i) || i] = e[i]; 57 } 58 return t 59 } 60 61 function c(t) { 62 for(var e = 1; e < arguments.length; e++) { 63 var o = arguments[e]; 64 for(var r in o) { 65 if(t[r] === i) { 66 t[r] = o[r] 67 } 68 } 69 } 70 return t 71 } 72 73 function d(t) { 74 var e = {x: t.offsetLeft, y: t.offsetTop}; 75 while(t = t.offsetParent) { 76 e.x += t.offsetLeft, e.y += t.offsetTop; 77 } 78 return e 79 } 80 81 var h = { 82 lines: 12, 83 length: 7, 84 width: 5, 85 radius: 10, 86 rotate: 0, 87 corners: 1, 88 color: "#000", 89 speed: 1, 90 trail: 100, 91 opacity: 1 / 4, 92 fps: 20, 93 zIndex: 2e9, 94 className: "spinner", 95 top: "auto", 96 left: "auto", 97 position: "relative" 98 }; 99 100 function m(t) { 101 if(!this.spin) { 102 return new m(t); 103 } 104 this.opts = c(t || {}, m.defaults, h) 105 } 106 107 m.defaults = {}; 108 c(m.prototype, { 109 spin: function(t) { 110 this.stop(); 111 var e = this, i = e.opts, o = e.el = u(a(0, {className: i.className}), {position: i.position, width: 0, zIndex: i.zIndex}), r = i.radius + i.length + i.width, s, f; 112 if(t) { 113 t.insertBefore(o, t.firstChild || null); 114 f = d(t); 115 s = d(o); 116 u(o, { 117 left: (i.left == "auto" ? f.x - s.x + (t.offsetWidth >> 1) : parseInt(i.left, 10) + r) + "px", 118 top: (i.top == "auto" ? f.y - s.y + (t.offsetHeight >> 1) : parseInt(i.top, 10) + r) + "px" 119 }) 120 } 121 o.setAttribute("aria-role", "progressbar"); 122 e.lines(o, e.opts); 123 if(!n) { 124 var l = 0, p = i.fps, c = p / i.speed, h = (1 - i.opacity) / (c * i.trail / 100), m = c / i.lines; 125 (function y() { 126 l++; 127 for(var t = i.lines; t; t--) { 128 var r = Math.max(1 - (l + t * m) % c * h, i.opacity); 129 e.opacity(o, i.lines - t, r, i) 130 } 131 e.timeout = e.el && setTimeout(y, ~~(1e3 / p)) 132 })() 133 } 134 return e 135 }, stop: function() { 136 var t = this.el; 137 if(t) { 138 clearTimeout(this.timeout); 139 if(t.parentNode) { 140 t.parentNode.removeChild(t); 141 } 142 this.el = i 143 } 144 return this 145 }, lines: function(t, e) { 146 var i = 0, o; 147 148 function r(t, o) { 149 return u(a(), { 150 position: "absolute", 151 width: e.length + e.width + "px", 152 height: e.width + "px", 153 background: t, 154 boxShadow: o, 155 transformOrigin: "left", 156 transform: "rotate(" + ~~(360 / e.lines * i + e.rotate) + "deg) translate(" + e.radius + "px" + ",0)", 157 borderRadius: (e.corners * e.width >> 1) + "px" 158 }) 159 } 160 161 for(; i < e.lines; i++) { 162 o = u(a(), { 163 position: "absolute", 164 top: 1 + ~(e.width / 2) + "px", 165 transform: e.hwaccel ? "translate3d(0,0,0)" : "", 166 opacity: e.opacity, 167 animation: n && l(e.opacity, e.trail, i, e.lines) + " " + 1 / e.speed + "s linear infinite" 168 }); 169 if(e.shadow) { 170 s(o, u(r("#000", "0 0 4px " + "#000"), {top: 2 + "px"})); 171 } 172 s(t, s(o, r(e.color, "0 0 1px rgba(0,0,0,.1)"))) 173 } 174 return t 175 }, opacity: function(t, e, i) { 176 if(e < t.childNodes.length) { 177 t.childNodes[e].style.opacity = i 178 } 179 } 180 }); 181 (function() { 182 function t(t, e) { 183 return a("<" + t + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', e) 184 } 185 186 var e = u(a("group"), {behavior: "url(#default#VML)"}); 187 if(!p(e, "transform") && e.adj) { 188 f.addRule(".spin-vml", "behavior:url(#default#VML)"); 189 m.prototype.lines = function(e, i) { 190 var o = i.length + i.width, r = 2 * o; 191 192 function n() { 193 return u(t("group", {coordsize: r + " " + r, coordorigin: -o + " " + -o}), {width: r, height: r}) 194 } 195 196 var a = -(i.width + i.length) * 2 + "px", f = u(n(), {position: "absolute", top: a, left: a}), l; 197 198 function p(e, r, a) { 199 s(f, s(u(n(), {rotation: 360 / i.lines * e + "deg", left: ~~r}), s(u(t("roundrect", {arcsize: i.corners}), { 200 width: o, height: i.width, left: i.radius, top: -i.width >> 1, filter: a 201 }), t("fill", {color: i.color, opacity: i.opacity}), t("stroke", {opacity: 0})))) 202 } 203 204 if(i.shadow) { 205 for(l = 1; l <= i.lines; l++) { 206 p(l, -2, "progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)"); 207 } 208 }
209 for(l = 1; l <= i.lines; l++) { 210 p(l); 211 } 212 return s(e, f) 213 }; 214 m.prototype.opacity = function(t, e, i, o) { 215 var r = t.firstChild; 216 o = o.shadow && o.lines || 0; 217 if(r && e + o < r.childNodes.length) { 218 r = r.childNodes[e + o]; 219 r = r && r.firstChild; 220 r = r && r.firstChild; 221 if(r) { 222 r.opacity = i 223 } 224 } 225 } 226 } else { 227 n = p(e, "animation") 228 } 229 })(); 230 if(typeof define == "function" && define.amd) { 231 define(function() { 232 return m 233 }); 234 } else { 235 t.Spinner = m 236 } 237}(window, document); 238 239jQuery.fn.highlight = function(pat) { 240 function innerHighlight(node, pat) { 241 var skip = 0; 242 if(node.nodeType == 3) { 243 var pos = node.data.toUpperCase().indexOf(pat); 244 if(pos >= 0) { 245 var spannode = document.createElement('span'); 246 spannode.className = 'wpus-highlight'; 247 var middlebit = node.splitText(pos); 248 var endbit = middlebit.splitText(pat.length); 249 var middleclone = middlebit.cloneNode(true); 250 spannode.appendChild(middleclone); 251 middlebit.parentNode.replaceChild(spannode, middlebit); 252 skip = 1; 253 } 254 } else if(node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { 255 for(var i = 0; i < node.childNodes.length; ++i) { 256 i += innerHighlight(node.childNodes[i], pat); 257 } 258 } 259 return skip; 260 } 261 262 return this.length && pat && pat.length ? this.each(function() { 263 innerHighlight(this, pat.toUpperCase()); 264 }) : this; 265}; 266 267jQuery.fn.removeHighlight = function() { 268 return this.find("span.wpus-highlight").each(function() { 269 this.parentNode.firstChild.nodeName; 270 with(this.parentNode) { 271 replaceChild(this.firstChild, this); 272 normalize(); 273 } 274 }).end(); 275}; 276 277jQuery(document).ready(function($) { 278 279 var opts = { 280 lines: 16, // The number of lines to draw 281 length: 8, // The length of each line 282 width: 3, // The line thickness 283 radius: 10, // The radius of the inner circle 284 corners: 1, // Corner roundness (0..1) 285 rotate: 0, // The rotation offset
286 color: '#444', // #rgb or #rrggbb 287 speed: 1.6, // Rounds per second 288 trail: 60, // Afterglow percentage 289 shadow: false, // Whether to render a shadow 290 hwaccel: true, // Whether to use hardware acceleration 291 className: 'spinner', // The CSS class to assign to the spinner 292 zIndex: 2e9, // The z-index (defaults to 2000000000) 293 top: 'auto', // Top position relative to parent in px 294 left: 'auto' // Left position relative to parent in px 295 }; 296 297 // Defaults for shortcode params 298 var query = ''; 299 var include = ''; 300 var exclude = ''; 301 302 // Check to see if default parameters have been passed into the shortcode 303 if(typeof shortcode_localize != 'undefined') { 304 305 // Prepopulated query 306 if('std' in shortcode_localize) { 307 query = shortcode_localize.std; 308 } 309 310 // Include terms 311 if('include' in shortcode_localize) { 312 include = shortcode_localize.include; 313 } 314 315 // Exclude terms 316 if('exclude' in shortcode_localize) { 317 exclude = shortcode_localize.exclude; 318 } 319 320 } 321 322 var visualSearch = VS.init({ 323 container: $("#search_box_container"), query: query, remainder: wpus_script.remainder, placeholder: wpus_script.placeholder, showFacets: wpus_script.showfacets, callbacks: { 324 search: function(query, searchCollection) { 325 // enable the following line for search query debugging: 326 // console.log(["query", searchCollection.facets(), query]); 327 328 // Update routers 329 var searchdata = []; 330 var searchuri = 'search/'; 331 searchdata = searchCollection.facets(); 332 333 // Build the search URI 334 for(var i = 0; i < searchdata.length; i++) { 335 $.each(searchdata[i], function(k, v) { 336 searchdata[i][k] = searchdata[i][k].replace('&', '\%and'); 337 }); 338 searchuri = searchuri + $.param(searchdata[i]); 339 if(i < (searchdata.length - 1)) { 340 searchuri = searchuri + "&"; 341 } 342 } 343 344 if(!query) { 345 return; 346 } 347 348 // Set spinner target 349 var spinner = new Spinner(opts).spin(document.getElementById('wpus_response')); 350 351 // Dim results area while query is being conducted 352 $("#wpus_response").animate({ 353 opacity: 0.5 354 }, 500, function() { 355 }); 356 357 var data = { 358 action: "wpus_search", wpusquery: searchCollection.facets(), searchNonce: wpus_script.searchNonce 359 }; 360 361 if($("#wpus_response").length > 0) { 362 363 if(wpus_script.disable_permalinks != 1) { 364 VS.app.searcher.navigate("/" + searchuri); 365 } 366 367 $.get(wpus_script.ajaxurl, data, function(response_from_get_results) { 368 spinner.stop(); 369 $("#wpus_response").html(response_from_get_results); 370 371 if(wpus_script.highlight) { 372 for(var i = 0; i < searchdata.length; i++) { 373 if(searchdata[i][wpus_script.remainder]) { 374 var words = searchdata[i][wpus_script.remainder].split(' '); 375 for(var word in words) { 376 $("#wpus_response").highlight(words[word]); 377 } 378 } 379 } 380 } 381 382 $("#wpus_response").animate({ 383 opacity: 1 384 }, 500, function() { 385 386 387 // Cancel / clear buttons 388 $('#wpus-clear-search').click(function(e) { 389 e.preventDefault(); 390 visualSearch.searchBox.clearSearch('type=keydown'); 391 $("#wpus_response").html(""); 392 VS.app.searcher.navigate("/"); 393 }); 394 $('.VS-icon-cancel').click(function(e) { 395 $("#wpus_response").html(""); 396 VS.app.searcher.navigate("/"); 397 }); 398 399 }); 400 if(wpus_script.trackevents == true) { 401 _gaq.push(['_trackEvent', wpus_script.eventtitle, 'Submit', searchCollection.serialize(), parseInt(wpus_response.numresults)]); 402 } 403 }); 404 } else { 405 window.location.href = wpus_script.resultspage + "#" + searchuri; 406 } 407 }, valueMatches: function(category, searchTerm, callback) { 408
409 if(wpus_script.radius && category == wpus_script.radius) { 410 $('div.is_editing .search_facet_input_container input:not(.geocomplete)').addClass('geocomplete').geocomplete().bind("geocode:result", function(event, result) { 411 query = visualSearch.searchBox.currentQuery; 412 visualSearch.searchBox.value(query + ' "' + category + '": "' + $('.geocomplete').val() + '"'); 413 visualSearch.searchBox.searchEvent({}); 414 }); 415 return; 416 } 417 var data = { 418 action: "wpus_getvalues", facet: category, include: include, exclude: exclude 419 }; 420 $.get(wpus_script.ajaxurl, data, function(response_from_get_values) { 421 if(response_from_get_values) { 422 423 response_from_get_values = $.parseJSON(response_from_get_values); 424 425 // Don't display a value if it's already in use in the search collection 426 $.each(visualSearch.searchQuery.facets(), function(key, value) { 427 $.each(value, function(key, value) { 428 429 if(key == category) { 430 response_from_get_values = $.grep(response_from_get_values, function(val) { 431 return val != value; 432 }); 433 } 434 435 }); 436 }); 437 438 callback(response_from_get_values, { 439 preserveOrder: true 440 }); 441 } 442 }); 443 }, facetMatches: function(callback) { 444 var facets = $.parseJSON(wpus_script.enabledfacets.replace(/"/g, '"')); 445 var currentfacets = visualSearch.searchQuery.facets(); 446 447 // If only one facet has been enabled, and "single facet" mode is turned on 448 if(facets.length == 1 && wpus_script.single_facet == true && currentfacets.length > 0) { 449 450 var lastfacet = currentfacets[currentfacets.length - 1]; 451 452 if(lastfacet[Object.keys(lastfacet)[0]].length > 0) { 453 454 // Add a regular facet to the box 455 visualSearch.searchBox.addFacet(facets[0], '', 99); 456 457 } else { 458 459 // If the last facet in the box is empty, move the cursor to the previous one and open the autocomplete dropdown. 460 visualSearch.searchBox.facetViews[currentfacets.length - 1].setCursorAtEnd(-1); 461 visualSearch.searchBox.facetViews[currentfacets.length - 1].searchAutocomplete(-1); 462 } 463 464 } else if(facets.length == 1 && wpus_script.single_facet == true && currentfacets.length == 0) { 465 466 // First facet being added to the box 467 visualSearch.searchBox.addFacet(facets[0], '', 99); 468 469 } else { 470 // If we're only allowing each facet to be used once. 471 if(wpus_script.single_use == 1) { 472 var currentFacets = visualSearch.searchQuery.pluck("category"); 473 474 facets = facets.filter(function(el) { 475 return currentFacets.indexOf(el) < 0; 476 }); 477 } 478 479 callback(facets, { 480 preserveOrder: true 481 }); 482 } 483 } 484 } 485 }); 486 487 VS.utils.Searcher = Backbone.Router.extend({ 488 routes: { 489 "search/:query": "search" // matches http://ultimatesearch.mindsharelabs.com/#search/query 490 }, search: function(query) { 491 492 if(!query) { 493 return; 494 } 495 var result = new Array(); 496 497 query = query.replace(/\+/g, ' '); 498 499 $.each(query.split('&'), function(index, value) { 500 if(value) { 501 value = value.replace('%and', '&'); 502 result.push(value); 503 } 504 }); 505 506 // Clear the search box 507 visualSearch.searchBox.value(''); 508 509 // For each query parameter, break it into a key/value pair and create a facet 510 $.each(result, function(index, value) { 511 var param = value.split('='); 512 visualSearch.searchBox.addFacet(param[0], param[1], 99); 513 }); 514 515 // Execute the search 516 visualSearch.searchBox.searchEvent({}); 517 518 // If we're in single facet mode, create a new facet and open the dropdown 519 if(wpus_script.single_facet == true) { 520 521 var facets = $.parseJSON(wpus_script.enabledfacets.replace(/"/g, '"')); 522 523 if(facets.length == 1) { 524 visualSearch.searchBox.addFacet(facets[0], '', 99); 525 } 526 } 527 528 } 529 }); 530 // Initiate the router 531 VS.app.searcher = new VS.utils.Searcher; 532 533 // Start Backbone history a necessary step for bookmarkable URL's 534 Backbone.history.start(); 535 536});
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.