Note: This story was dynamically reformatted for online reading convenience. /*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */ jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateM ute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){ret urn r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0, t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.conso le.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){ i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQu ery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.valu e&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|chec ked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|sco ped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.att rFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName) &&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:funct ion(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn .attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments) :("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments) :("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=fun ction(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r( "$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i [2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSO N=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.br owser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h .version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser= h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this( ),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t), i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function (){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t ,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery .clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function (e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.remove Child(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script ")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([ ],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)), s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live, M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSucces s",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){re turn"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.pr ops.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dis patch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJ AX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.ca ll(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e) :(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e. isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,ar guments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector, n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector ||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t ,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger (n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQu ery,window); var stacks = {}; stacks.jQuery = jQuery.noConflict(true); stacks.stacks_in_169_page167 = {}; stacks.stacks_in_169_page167 = (function(stack) { var jQuery = stacks.jQuery;var $ = jQuery;/*!*************************************************** * mark.js v8.11.1 * https://markjs.io/ * Copyright (c) 2014 -"2018, Julian Kühnel * Released under the MIT license https://git.io/vwTVl *****************************************************/ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Mark=t()}(this,function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(n){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this. exclude=i,this.iframesTimeout=o}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.pro totype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==type of this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[t his.ctx]:[]).forEach(function(t){var n=e.filter(function(e){return e.contains(t)}).length>0;-1!==e.indexOf(t)||n||e.push(t)}),e}},{key:"getIfr ameContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var i=e.contentWindow;if(r=i.document,!i||!r)throw new Error("iframe inaccessible")}catch(e){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e ){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",valu e:function(e,t,n){var r=this,i=!1,o=null,a=function a(){if(!i){i=!0,clearTimeout(o);try{r.isIframeBlank(e)||(e.removeEventListe ner("load",a),r.getIframeContents(e,t,n))}catch(e){n()}}};e.addEventListene r("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",valu e:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this .isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t, n):this.observeIframeLoad(e,t,n)}catch(e){n()}}},{key:"waitForIframes",valu e:function(e,t){var n=this,r=0;this.forEachIframe(e,function(){return!0},function(e){r++,n.wait ForIframes(e.querySelector("html"),function(){--r||t()})},function(e){e||t( )})}},{key:"forEachIframe",value:function(t,n,r){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=t.querySelectorAll("iframe"),s =a.length,c=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&o(c)};s||u(),a.forEach(function(t){e.matches(t,i.exclu de)?u():i.onIframeReady(t,function(e){n(t)&&(c++,r(e)),u()},u)})}},{key:"cr eateIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value :function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:fu nction(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECED ING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POS ITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e ){var t=e.previousNode();return{prevNode:t,node:null===t?e.nextNode():e.nextNode( )&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var i=!1,o=!1;return r.forEach(function(e,t){e.val===n&&(i=t,o=e.handled)}),this.compareNodeIfra me(e,t,n)?(!1!==i||o?!1===i||o||(r[i].handled=!0):r.push({val:n,handled:!0} ),!0):(!1===i&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",va lue:function(e,t,n,r){var i=this;e.forEach(function(e){e.handled||i.getIframeContents(e.val,function( e){i.createInstanceOnIframe(e).forEachNode(t,n,r)})})}},{key:"iterateThroug hNodes",value:function(e,t,n,r,i){for(var o,a=this,s=this.createIterator(t,e,r),c=[],u=[],l=void 0,h=void 0;void 0,o=a.getIteratorNode(s),h=o.prevNode,l=o.node;)this.iframes&&this.forEachI frame(t,function(e){return a.checkIframeFilter(l,h,e,c)},function(t){a.createInstanceOnIframe(t).forEa chNode(e,function(e){return u.push(e)},r)}),u.push(l);u.forEach(function(e){n(e)}),this.iframes&&this.h andleOpenIframes(c,e,n,r),i()}},{key:"forEachNode",value:function(e,t,n){va r r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length; a||i(),o.forEach(function(o){var s=function(){r.iterateThroughNodes(e,o,t,n,function(){--a<=0&&i()})};r.ifra mes?r.waitForIframes(o,s):s()})}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSe lector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var i=!1;return n.every(function(t){return!r.call(e,t)||(i=!0,!1)}),i}return!1}}]),e}(),o=f unction(){function e(n){t(this,e),this.opt=r({},{diacritics:!0,synonyms:{},accuracy:"partially ",caseSensitive:!1,ignoreJoiners:!1,ignorePunctuation:[],wildcards:"disable d"},n)}return n(e,[{key:"create",value:function(e){return"disabled"!==this.opt.wildcards& &(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt. synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners| |this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),t his.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedB lanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)& &(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.c reateWildcardsRegExp(e)),e=this.createAccuracyRegExp(e),new RegExp(e,"gm"+(this.opt.caseSensitive?"":"i"))}},{key:"escapeStr",value:fun ction(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createSynon ymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiner s||this.opt.ignorePunctuation.length?"\0":"";for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this. escapeStr(i),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o) :this.escapeStr(o);""!==a&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.p rocessSynonyms(a)+"|"+this.processSynonyms(s)+")"+r))}return e}},{key:"processSynonyms",value:function(e){return(this.opt.ignoreJoiners| |this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e }},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\) *\?/g,function(e){return"\\"===e.charAt(0)?"?":""})).replace(/(?:\\)*\*/g, function(e){return"\\"===e.charAt(0)?"*":""})}},{key:"createWildcardsRegEx p",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?": "\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"})}},{key:"createJo inersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ign oreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000 +/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:funct ion(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạă +/-ắẳẵặâầấ(C)<<ậäåā...","A-ÁẢÃẠ,Ằ(R)Ẳ 'Ặ,-Ấ"ẪẬ,...-,","cçćč","CÇĆČ","d`ď","DĐĎ","e" (C)>ẽ'ê>ế>>...><<>"(TM)","E^0/0ẺẼ,Ê>-Ế>, >,><Ě'~","iìí>0/0(C)><(R)ï<<","IÌÍ>^">ÎÏĪ","l,","L ","n+/-^,","N`ŇŃ","oòó>õ>'>">`>*>-->(TM)ơ>>>>> >ö,ō","O'">*>">'>>">->~Ơ>>>>>-~Ō","r(TM)", "R~","sš>(TM)ş","SŠŚ~Ş","tť>ţ","TŤȚŢ","u'ú>(C)>ư><< >(C)>>>+/->üů<<","U(TM)Ú>-">Ư>>">>(R)>>Ü(R)Ū", "yý>>>'>ÿ","YÝ>>>,>',","zžżź","ZŽ>'"]:["aàáảã ă+/-ắẳẵặâầấ(C)<<ậäåā...A-ÁẢÃẠ,Ằ(R) 'Ặ,-Ấ"ẪẬ,...-,","cçćčCÇĆČ","d`ďDĐĎ","e"(C) >ẽ'ê>ế>>...><<>"(TM)E^0/0ẺẼ,Ê>-Ế>,>,>< '~","iìí>0/0(C)><(R)ï<<IÌÍ>^">ÎÏĪ","l,LŁ","n+/-^,N `ŇŃ","oòó>õ>'>">`>*>-->(TM)ơ>>>>>>ö,ōO'"> *>">'>>">->~Ơ>>>>>-~Ō","r(TM)R~","sš>(TM)şSŠ ~Ş","tť>ţTŤȚŢ","u'ú>(C)>ư><<>(C)>>>+/->üů<<U(T M)Ú>-">Ư>>">>(R)>>Ü(R)Ū","yý>>>'>ÿYÝ>>>,> ',","zžżźZŽ>'"],r=[];return e.split("").forEach(function(i){n.every(function(n){if(-1!==n.indexOf(i)){i f(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0})}),e}},{key:"create MergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function (e){var t=this,n=this.opt.accuracy,r="string"==typeof n?n:n.value,i="";switch(("string"==typeof n?[]:n.limiters).forEach(function(e){i+="|"+t.escapeStr(e)}),r){case"partia lly":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+( i||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+e+"[^"+i +"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}}]),e}(),a= function(){function a(e){t(this,a),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1 )&&(this.ie=!0)}return n(a,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"objec t"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach(function(e){t.opt.separateWordSearch?e.split(" ").forEach(function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)}):e.trim()&&- 1===n.indexOf(e)&&n.push(e)}),{keywords:n.sort(function(e,t){return t.length-e.length}),length:n.length}}},{key:"isNumeric",value:function(e){r eturn Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort(function(e,t){return e.start-t.start}).forEach(function(e){var i=t.callNoMatchOnInvalidRanges(e,r),o=i.start,a=i.end;i.valid&&(e.start=o,e .length=a-o,n.push(e),r=a)}),n}},{key:"callNoMatchOnInvalidRanges",value:fu nction(e,t){var n=void 0,r=void 0,i=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeri c(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?i=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:i}}},{key:"c heckWhitespaceRanges",value:function(e,t,n){var r=void 0,i=!0,o=n.length,a=t-o,s=parseInt(e.start,10)-a;return(r=(s=s>o?o:s)+parse Int(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),s<0||r-s<0||s>o||r>o?(i=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s +/g,"")&&(i=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:i}}},{key:"g etTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(e) {r.push({start:n.length,end:(n+=e.textContent).length,node:e})},function(e) {return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_A CCEPT},function(){e({value:n,nodes:r})})}},{key:"matchesExclude",value:func tion(e){return i.matches(e,this.opt.exclude.concat(["script","style","title","head","html" ]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",i=e.splitText(t),o=i.splitText(n -t),a=document.createElement(r);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("cl ass",this.opt.className),a.textContent=i.textContent,i.parentNode.replaceCh ild(a,i),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,i){var o=this;e.nodes.every(function(a,s){var c=e.nodes[s+1];if(void 0===c||c.start>t){if(!r(a.node))return!1;var u=t-a.start,l=(n>a.end?a.end:n)-a.start,h=e.value.substr(0,a.start),f=e.val ue.substr(l+a.start);if(a.node=o.wrapRangeInTextNode(a.node,u,l),e.value=h+ f,e.nodes.forEach(function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[ n].start-=l),e.nodes[n].end-=l)}),n-=l,i(a.node.previousSibling,a.start),!( n>a.end))return!1;t=a.end}return!0})}},{key:"wrapGroups",value:function(e,t ,n,r){return r((e=this.wrapRangeInTextNode(e,t,t+n)).previousSibling),e}},{key:"separate Groups",value:function(e,t,n,r,i){for(var o=t.length,a=1;a<o;a++){var s=e.textContent.indexOf(t[a]);t[a]&&s>-1&&r(t[a],e)&&(e=this.wrapGroups(e,s ,t[a].length,i))}return e}},{key:"wrapMatches",value:function(e,t,n,r,i){var o=this,a=0===t?0:t+1;this.getTextNodes(function(t){t.nodes.forEach(function (t){t=t.node;for(var i=void 0;null!==(i=e.exec(t.textContent))&&""!==i[a];){if(o.opt.separateGroups)t=o .separateGroups(t,i,a,n,r);else{if(!n(i[a],t))continue;var s=i.index;if(0!==a)for(var c=1;c<a;c++)s+=i[c].length;t=o.wrapGroups(t,s,i[a].length,r)}e.lastIndex=0} }),i()})}},{key:"wrapMatchesAcrossElements",value:function(e,t,n,r,i){var o=this,a=0===t?0:t+1;this.getTextNodes(function(t){for(var s=void 0;null!==(s=e.exec(t.value))&&""!==s[a];){var c=s.index;if(0!==a)for(var u=1;u<a;u++)c+=s[u].length;var l=c+s[a].length;o.wrapRangeInMappedTextNode(t,c,l,function(e){return n(s[a],e)},function(t,n){e.lastIndex=n,r(t)})}i()})}},{key:"wrapRangeFromIn dex",value:function(e,t,n,r){var i=this;this.getTextNodes(function(o){var a=o.value.length;e.forEach(function(e,r){var s=i.checkWhitespaceRanges(e,a,o.value),c=s.start,u=s.end;s.valid&&i.wrapRan geInMappedTextNode(o,c,u,function(n){return t(n,e,o.value.substring(c,u),r)},function(t){n(t,e)})}),r()})}},{key:"unwra pMatches",value:function(e){for(var t=e.parentNode,n=document.createDocumentFragment();e.firstChild;)n.appendCh ild(e.removeChild(e.firstChild));t.replaceChild(n,e),this.ie?this.normalize TextNode(t):t.normalize()}},{key:"normalizeTextNode",value:function(e){if(e ){if(3===e.nodeType)for(;e.nextSibling&&3===e.nextSibling.nodeType;)e.nodeV alue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)} }},{key:"markRegExp",value:function(e,t){var n=this;this.opt=t,this.log('Searching with expression "'+e+'"');var r=0,i="wrapMatches";this.opt.acrossElements&&(i="wrapMatchesAcrossElements" ),this[i](e,this.opt.ignoreGroups,function(e,t){return n.opt.filter(t,e,r)},function(e){r++,n.opt.each(e)},function(){0===r&&n.opt .noMatch(e),n.opt.done(r)})}},{key:"mark",value:function(e,t){var n=this;this.opt=t;var r=0,i="wrapMatches",a=this.getSeparatedKeywords("string"==typeof e?[e]:e),s=a.keywords,c=a.length;this.opt.acrossElements&&(i="wrapMatchesAc rossElements"),0===c?this.opt.done(r):function e(t){var a=new o(n.opt).create(t),u=0;n.log('Searching with expression "'+a+'"'),n[i](a,1,function(e,i){return n.opt.filter(i,t,r,u)},function(e){u++,r++,n.opt.each(e)},function(){0===u& &n.opt.noMatch(t),s[c-1]===t?n.opt.done(r):e(s[s.indexOf(t)+1])})}(s[0])}}, {key:"markRanges",value:function(e,t){var n=this;this.opt=t;var r=0,i=this.checkRanges(e);i&&i.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(i)),this.wrapRangeFromIndex(i,function(e,t,r,i){return n.opt.filter(e,t,r,i)},function(e,t){r++,n.opt.each(e,t)},function(){n.opt. done(r)})):this.opt.done(r)}},{key:"unmark",value:function(e){var t=this;this.opt=e;var n=this.opt.element?this.opt.element:"*";n+="[data-markjs]",this.opt.classNa me&&(n+="."+this.opt.className),this.log('Removal selector "'+n+'"'),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,function(e){t.u nwrapMatches(e)},function(e){var r=i.matches(e,n),o=t.matchesExclude(e);return!r||o?NodeFilter.FILTER_REJECT :NodeFilter.FILTER_ACCEPT},this.opt.done)}},{key:"opt",set:function(e){this ._opt=r({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e 3,separateWordSearch:!0,acrossElements:!1,ignoreGroups:0,each:function(){}, noMatch:function(){},filter:function(){return!0},done:function(){},debug:!1 ,log:window.console},e)},get:function(){return this._opt}},{key:"iterator",get:function(){return new i(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}}]),a }();return function(e){var t=this,n=new a(e);return this.mark=function(e,r){return n.mark(e,r),t},this.markRegExp=function(e,r){return n.markRegExp(e,r),t},this.markRanges=function(e,r){return n.markRanges(e,r),t},this.unmark=function(e){return n.unmark(e),t},this}}); function stringIsEmpty(value) { return value ? value.trim().length == 0 : true; } function highlight() { var liveSearchTerm = location.search.split('s=')[1]; if (liveSearchTerm == null){ } else if (liveSearchTerm.includes('&')) { liveSearchTerm = liveSearchTerm.substring(0, liveSearchTerm.indexOf('&')); } liveSearchTerm = decodeURIComponent(liveSearchTerm); if("False" == "True") { console.log("Search Term/s: " + liveSearchTerm); } if(!stringIsEmpty(liveSearchTerm)) { var markInstance; if ($("#container").length > 0 ) { markInstance = new Mark(document.querySelector("#container")); markInstance.mark(liveSearchTerm, { wildcards: "enabled", exclude: ["nav *"], done: function() { if($('mark').length) { $("html, body").animate({ scrollTop: $('mark').offset().top - 300 }, 300); } } }); if($('mark').length) { $('html, body').scrollTop($("mark").offset().top - $('html, body').offset().top + $('html, body').scrollTop()); } } else if ($(".stacks_top").length > 0){ markInstance = new Mark(document.querySelector("div.stacks_top")); markInstance.mark(liveSearchTerm, { wildcards: "enabled", exclude: ["nav *"], done: function() { if($('mark').length) { $("html, body").animate({ scrollTop: $('mark').offset().top - 300 }, 300); } } }); } else { markInstance = new Mark(document.querySelector("body")); markInstance.mark(liveSearchTerm, { wildcards: "enabled", exclude: ["nav *"], done: function() { if($('mark').length) { $("html, body").animate({ scrollTop: $('mark').offset().top - 300 }, 300); } } }); } } } function cleanString(input) { var output = ""; for (var i=0; i<input.length; i++) { if (input.charCodeAt(i) <= 127) { output += input.charAt(i); } } return output; } jQuery(document).ready( function() { // var suggestions = $("#searchstacks_in_169_page167").html(); suggestions = suggestions.replace(/(?:\r\n|\r|\n)/g, '</option><option>'); suggestions.concat("<option>","</option>"); $("#searchstacks_in_169_page167").html(suggestions); // /* Tipue Search Copyright (c) 2015 Tipue Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //Get folder path var path = jQuery(".stacks_in_169_page167_pages").html(); path = path.split('href="'); window.folderPath = ""; jQuery.each(path, function(index, value) { var newArr = this.split('"'); if (index == 1 && newArr[0] != "./") { if (newArr[0].match("^../../../../../")) { window.folderPath = "../../../../../"; } else if (newArr[0].match("^../../../../")) { window.folderPath = "../../../../"; } else if (newArr[0].match("^../../../")) { window.folderPath = "../../../"; } else if (newArr[0].match("^../../")) { window.folderPath = "../../"; } else if (newArr[0].match("^../")) { window.folderPath = "../"; } newArr = newArr[0]; } }); //Get all links var tipuesearch_pages = []; var pages = [], duplicates; for (var i= document.links.length; i-->0;) { if (document.links[i].hostname===location.hostname) { var href = document.links[i].href; href = href.replace(/\?.*/,''); href = href.replace(/\#.*/,''); if (href.match(/\.(jpeg|jpg|gif|pdf|png)$/) == null) { duplicates = document.links[i].href; if(duplicates.substr(duplicates.indexOf("#") + 1) == "") { duplicates = duplicates.replace(/\#.*/,''); } if($.inArray(duplicates, tipuesearch_pages) === -1) { tipuesearch_pages.push(document.links[i].href); } } } } if("False" == "True") { if ($("#container").length > 0) { console.log("Search Container: #container"); } else if ($(".stacks_top").length > 0){ console.log("Search Container: .stacks_top"); } else { console.log("Search Container: None"); } console.log("Automatically identified pages:"); for (i = 0; i < tipuesearch_pages.length; i++){ console.log(tipuesearch_pages[i]); } } // jQuery.each(pages, function(index, value) { // tipuesearch_pages.push(this); // }); // //Exclude pages // //Remove duplicates var arrayUnique = function (arr) { return arr.filter(function(item, index){ return arr.indexOf(item) >= index; }); }; tipuesearch_pages = arrayUnique(tipuesearch_pages); $.when(tipuesearch_pages).done(function() { if("False" == "True") { console.log("Final list of pages to search:"); } //Remove URL variables for (i = 0; i < tipuesearch_pages.length; i++){ tipuesearch_pages[i] = tipuesearch_pages[i].replace(/\?.*\#/, '#'); var hasVar = tipuesearch_pages[i].indexOf('?'); tipuesearch_pages[i] = tipuesearch_pages[i].substring(0, hasVar != -1 ? hasVar : tipuesearch_pages[i].length); if("False" == "True") {console.log(tipuesearch_pages[i]);} } }); /* Tipue Search 5.0 Copyright (c) 2015 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search */ /* Stop words Stop words list from http://www.ranks.nl/stopwords */ var tipuesearch_stop_words = ["zzzzzz"]; //var tipuesearch_stop_words = ["a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "can't", "cannot", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "don't", "down", "during", "each", "few", "for", "from", "further", "had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "isn't", "it", "it's", "its", "itself", "let's", "me", "more", "most", "mustn't", "my", "myself", "no", "nor", "not", "of", "off", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "shan't", "she", "she'd", "she'll", "she's", "should", "shouldn't", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", "was", "wasn't", "we", "we'd", "we'll", "we're", "we've", "were", "weren't", "what", "what's", "when", "when's", "where", "where's", "which", "while", "who", "who's", "whom", "why", "why's", "with", "won't", "would", "wouldn't", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves"]; // Word replace var tipuesearch_replace = {'words': [ {'word': 'tipua', 'replace_with': 'tipue'}, {'word': 'javscript', 'replace_with': 'javascript'}, {'word': 'jqeury', 'replace_with': '$'} ]}; // Weighting var tipuesearch_weight = {'weight': [ {'url': 'http://tipue.dev/search', 'score': 200}, {'url': 'http://tipue.dev/about', 'score': 100}, {'url': 'http://tipue.dev/tos', 'score': -1200} ]}; // Stemming var tipuesearch_stem = {'words': [ {'word': 'e-mail', 'stem': 'email'}, {'word': 'javascript', 'stem': 'jQuery'}, {'word': 'javascript', 'stem': 'js'} ]}; // // var tipuesearch_string_1 = 'No title';//skipped var tipuesearch_string_2 = String(/Results for /).replace(/\//g,""); var tipuesearch_string_3 = String(/Search instead for/).replace(/\//g,""); var tipuesearch_string_4 = String(/1 result /).replace(/\//g,""); var tipuesearch_string_5 = String(/results /).replace(/\//g,""); var tipuesearch_string_6 = String(/Prev /).replace(/\//g,""); var tipuesearch_string_7 = String(/Next /).replace(/\//g,""); var tipuesearch_string_8 = String(/No joy /).replace(/\//g,""); var tipuesearch_string_9 = String(/Common words are largely ignored /).replace(/\//g,""); var tipuesearch_string_10 = String(/Search too short /).replace(/\//g,""); var tipuesearch_string_11 = '';//skipped var tipuesearch_string_12 = String(/Should be 3 characters or more /).replace(/\//g,""); var tipuesearch_string_13 = '';//removed // //Tipue Search /* Tipue Search 5.0 Copyright (c) 2015 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search */ (function($) { $.fn.tipuesearch = function(options) { var set = $.extend( { 'show' : 7, 'newWindow' : false, 'showURL' : true, 'showTitleCount' : true, 'minimumLength' : 3, 'descriptiveWords' : 25, 'highlightTerms' : true, 'highlightEveryTerm' : false, 'mode' : 'static', 'liveDescription' : '*', 'liveContent' : '*', 'contentLocation' : 'tipuesearch/tipuesearch_content.json', 'debug' : false }, options); return this.each(function() { var tipuesearch_in = { pages: [] }; $.ajaxSetup({ async: true//modified from false }); var tipuesearch_t_c = 0; if (set.mode == 'live') { $.each(tipuesearch_pages, function(index, value) { $.get(tipuesearch_pages[index]) .done(function(html) { //Modifications window.customDesc = 0; if (html.substring(0, 15) == "<!--NOSEARCH-->") { noSearch = 1; if("False" == "True") { console.log("NOSEARCH: " + value); } } var noSearch, cont, desc; var htmlObj = "<div><div class='liveSearchAll'>"+html+"</div></div>"; htmlObj=htmlObj.replace(/<img.+?>/g," "); var hashLink = value.split('#')[1], hasHashLink = false; if(typeof hashLink !== "undefined" && hashLink !== "") { hasHashLink = true; if("False" == "True") { console.log("Hash link found: #" + hashLink); } } if(hasHashLink && $("#"+hashLink, htmlObj).length) { cont = $("#"+hashLink, htmlObj).html(); if("False" == "True") { console.log("Hash ID found in page, only searching ID element."); } } else if (hasHashLink && $('a[href="#'+hashLink+'"]:not(.ls-add-page)', htmlObj).length) { cont = $('a[href="#'+hashLink+'"]:not(.ls-add-page)', htmlObj).parent().html(); if("False" == "True") { console.log("Hash link found in page, only searching link's parent element."); } } else if ($("#container", htmlObj).length > 0) { if(hasHashLink && "False" == "True") { console.log("ERROR: No matching hash link or element found. Searching #container instead."); } cont = $("#container", htmlObj).html(); } else if ($(".stacks_top", htmlObj).length > 0) { if(hasHashLink && "False" == "True") { console.log("ERROR: No matching hash link or element found. Searching .stacks_top instead."); } cont = $(".stacks_top", htmlObj).html(); } else { if(hasHashLink && "False" == "True") { console.log("ERROR: No matching hash link or element found. Searching entire page instead."); } cont = $(".liveSearchAll", htmlObj).html(); } cont=cont.replace(/\s+/g," "); cont=cont.replace(/<!--LIVESEARCH-->[\s\S]*?<!--LIVESEARCH-->/g,""); cont=cont.replace(/<!--NOSEARCH-->[\s\S]*?<!--NOSEARCH-->/g,""); cont=cont.replace(/<!---NOSEARCH--->[\s\S]*?<!---NOSEARCH--->/g,""); cont=cont.replace(/<! -"NOSEARCH -">[\s\S]*?<! -"NOSEARCH -">/g,""); cont=cont.replace(/<!--—NOSEARCH—-->[\s\S]*?<!--—NOSEARCH —-->/g,""); cont=cont.replace(/<!---NOSE ARCH--->[\s\S]*?<!---NOSE ARCH--->/g,""); cont=cont.replace(/<style[\s\S]*?style>/g,""); cont=cont.replace(/<script[\s\S]*?script>/g,""); cont=cont.replace(/<.+?>/g," "); cont=cont.replace(/ /g,""); if(hasHashLink && $("#"+hashLink, htmlObj).length) { desc = $("#"+hashLink, htmlObj).html(); } else if (hasHashLink && $('a[href="#'+hashLink+'"]:not(.ls-add-page)', htmlObj).length) { desc = $('a[href="#'+hashLink+'"]:not(.ls-add-page)', htmlObj).parent().html(); } else if ($("#container", htmlObj).length > 0) { desc = $("#container", htmlObj).html(); } else if ($(".stacks_top", htmlObj).length > 0){ desc = $(".stacks_top", htmlObj).html(); } else { desc = $(".liveSearchAll", htmlObj).html(); } if ($(".live-search-description", htmlObj).parent().length > 0) { desc = $(".live-search-description", htmlObj).parent().html() + desc; window.customDesc = 1; } desc=desc.replace(/\s+/g," "); desc=desc.replace(/<!--NOSEARCH-->[\s\S]*?<!--NOSEARCH-->/g,""); desc=desc.replace(/<!--LIVESEARCH-->[\s\S]*?<!--LIVESEARCH-->/g,""); desc=desc.replace(/<nav[\s\S]*?nav>/g,""); desc=desc.replace(/<style[\s\S]*?style>/g,""); desc=desc.replace(/<script[\s\S]*?script>/g,""); desc=desc.replace(/<.+?>/g," "); desc=desc.replace(/ /g,""); //End modifications // var cont = $(set.liveContent, html).text(); // cont = cont.replace(/\s+/g, ' '); // var desc = $(set.liveDescription, html).text(); // desc = desc.replace(/\s+/g, ' '); if ($("title", htmlObj).length > 0) { var t_1 = html.toLowerCase().indexOf('<title>'); var t_2 = html.toLowerCase().indexOf('</title>', t_1 + 7); if (t_1 != -1 && t_2 != -1) { var tit = html.slice(t_1 + 7, t_2); } else { var tit = tipuesearch_string_1; } } else { var tit = tipuesearch_pages[index]; desc = ""; } // jQuery.each(window.hideWords, function(){ var thisValue = this.valueOf(); thisValue = thisValue.replace(/ +(?= )/g,'').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); thisValue = new RegExp(thisValue, "g"); desc=desc.replace(thisValue, ""); tit=tit.replace(thisValue,""); }); // tit=tit.replace(/\|/g, ""); if(noSearch == 1) { tit = " "; desc = " "; cont = " "; tipuesearch_pages[index] = " "; } var getHash; if(tipuesearch_pages[index].includes('#')) { getHash = tipuesearch_pages[index].substring(tipuesearch_pages[index].indexOf('#')); tipuesearch_pages[index] = tipuesearch_pages[index].substr(0, tipuesearch_pages[index].indexOf('#')); } if(getHash == undefined || getHash == "#") { getHash = ""; } tipuesearch_in.pages.push( { "title": tit, "text": desc, "tags": cont, "url": tipuesearch_pages[index], "url_base": tipuesearch_pages[index], "hash": getHash }); }); }); } if (set.mode == 'json') { $.getJSON(set.contentLocation) .done(function(json) { tipuesearch_in = $.extend({}, json); }); } if (set.mode == 'static') { tipuesearch_in = $.extend({}, tipuesearch); } var tipue_search_w = ''; if (set.newWindow) { tipue_search_w = ' target="_blank"'; } function getURLP(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20')) || null; } if (getURLP('q')) { $('#stacks_in_169_page167_tipue_search_input').val(getURLP('q')); getTipueSearch(0, true); } $(this).keyup(function(event) { if(event.keyCode == '13') { getTipueSearch(0, true); } }); function getTipueSearch(start, replace) { $('#stacks_in_169_page167_tipue_search_content').hide(); $('#stacks_in_169_page167_tipue_search_content').html('<div class="tipue_search_spinner"><div class="tipue_search_rect1"></div><div class="tipue_search_rect2"></div><div class="rect3"></div></div>'); $('#stacks_in_169_page167_tipue_search_content').show(); var out = ''; var results = ''; var show_replace = false; var show_stop = false; var standard = true; var c = 0; found = []; var d = $('#stacks_in_169_page167_tipue_search_input').val().toLowerCase(); var urlVar = ""; var randomN = Math.floor(Math.random() * 10001) if("false" == "true") { urlVar = "?s=" + encodeURIComponent(d) + "&r=" + randomN; } else { urlVar = "?r=" + randomN; } d = $.trim(d); if ((d.match("^\"") && d.match("\"$")) || (d.match("^'") && d.match("'$"))) { standard = false; } if (standard) { var d_w = d.split(' '); d = ''; for (var i = 0; i < d_w.length; i++) { var a_w = true; for (var f = 0; f < tipuesearch_stop_words.length; f++) { if (d_w[i] == tipuesearch_stop_words[f]) { a_w = false; show_stop = true; } } if (a_w) { d = d + ' ' + d_w[i]; } } d = $.trim(d); d_w = d.split(' '); } else { d = d.substring(1, d.length - 1); } if (d.length >= set.minimumLength) { if (standard) { if (replace) { var d_r = d; for (var i = 0; i < d_w.length; i++) { for (var f = 0; f < tipuesearch_replace.words.length; f++) { if (d_w[i] == tipuesearch_replace.words[f].word) { d = d.replace(d_w[i], tipuesearch_replace.words[f].replace_with); show_replace = true; } } } d_w = d.split(' '); } var d_t = d; for (var i = 0; i < d_w.length; i++) { for (var f = 0; f < tipuesearch_stem.words.length; f++) { if (d_w[i] == tipuesearch_stem.words[f].word) { d_t = d_t + ' ' + tipuesearch_stem.words[f].stem; } } } d_w = d_t.split(' '); for (var i = 0; i < tipuesearch_in.pages.length; i++) { var score = 0; var s_t = tipuesearch_in.pages[i].text; //console.log(d_w); //console.log(s_t); for (var f = 0; f < d_w.length; f++) { var pat = new RegExp(d_w[f], 'gi'); if (tipuesearch_in.pages[i].title.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].title.match(pat).length; score += (20 * m_c); } if (tipuesearch_in.pages[i].text.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].text.match(pat).length; score += (20 * m_c); } if (set.highlightTerms) { if (set.highlightEveryTerm) { var patr = new RegExp('(' + d_w[f] + ')', 'gi'); } else { var patr = new RegExp('(' + d_w[f] + ')', 'i'); } //console.log(s_t); s_t = s_t.replace(patr, "<span class=\"h01\">$1</span>"); var s_t_check = s_t.split(/\s+/).slice(0,20).join(" "); //if(s_t.includes("<span") ) { if(s_t.indexOf("<span") >= 0) { var s_t_start = s_t.split(/\s+/).slice(0,10).join(" "),// 10(9) words at the start of the search container s_t_snip = s_t.substring(s_t.indexOf("<") - (30));// show 30 characters before the searched term //if(!s_t_check.includes("<span")) { if(s_t_check.indexOf("<span") < 0) {// if highlighted term is not inside of the first 10(9) words s_t_snip = s_t_snip.substring(s_t_snip.indexOf(" ") + 1); s_t = s_t_start + " ... " + s_t_snip;//first 10(9) words + ... + the rest of the searched text. It will be trimmed later by the set description length } } } if (tipuesearch_in.pages[i].tags.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].tags.match(pat).length; score += (10 * m_c); } if (tipuesearch_in.pages[i].url.search(pat) != -1) h { score += 20; } if (score != 0) { for (var e = 0; e < tipuesearch_weight.weight.length; e++) { if (tipuesearch_in.pages[i].url == tipuesearch_weight.weight[e].url) { score += tipuesearch_weight.weight[e].score; } } } if (d_w[f].match('^-')) { pat = new RegExp(d_w[f].substring(1), 'i'); if (tipuesearch_in.pages[i].title.search(pat) != -1 || tipuesearch_in.pages[i].text.search(pat) != -1 || tipuesearch_in.pages[i].tags.search(pat) != -1) { score = 0; } } } if (score != 0) { found.push( { "score": score, "title": tipuesearch_in.pages[i].title + " " + tipuesearch_in.pages[i].hash, "desc": s_t, "url_base": tipuesearch_in.pages[i].url + tipuesearch_in.pages[i].hash, "url": tipuesearch_in.pages[i].url + urlVar + tipuesearch_in.pages[i].hash }); c++; } } } else { for (var i = 0; i < tipuesearch_in.pages.length; i++) { var score = 0; var s_t = tipuesearch_in.pages[i].text; var pat = new RegExp(d, 'gi'); if (tipuesearch_in.pages[i].title.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].title.match(pat).length; score += (20 * m_c); } if (tipuesearch_in.pages[i].text.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].text.match(pat).length; score += (20 * m_c); } if (set.highlightTerms) { if (set.highlightEveryTerm) { var patr = new RegExp('(' + d + ')', 'gi'); } else { var patr = new RegExp('(' + d + ')', 'i'); } //console.log(s_t); s_t = s_t.replace(patr, "<span class=\"h01\">$1</span>"); var s_t_check = s_t.split(/\s+/).slice(0,20).join(" "); //if(s_t.includes("<span") ) { if(s_t.indexOf("<span") >= 0) { var s_t_start = s_t.split(/\s+/).slice(0,10).join(" "),// 10(9) words at the start of the search container s_t_snip = s_t.substring(s_t.indexOf("<") - (30));// show 30 characters before the searched term //if(!s_t_check.includes("<span")) { if(s_t_check.indexOf("<span") < 0) {// if highlighted term is not inside of the first 10(9) words s_t_snip = s_t_snip.substring(s_t_snip.indexOf(" ") + 1); s_t = s_t_start + " ... " + s_t_snip;//first 10(9) words + ... + the rest of the searched text. It will be trimmed later by the set description length } } } if (tipuesearch_in.pages[i].tags.search(pat) != -1) { var m_c = tipuesearch_in.pages[i].tags.match(pat).length; score += (10 * m_c); } if (tipuesearch_in.pages[i].url.search(pat) != -1) { score += 20; } if (score != 0) { for (var e = 0; e < tipuesearch_weight.weight.length; e++) { if (tipuesearch_in.pages[i].url == tipuesearch_weight.weight[e].url) { score += tipuesearch_weight.weight[e].score; } } } if (score != 0) { found.push( { "score": score, "title": tipuesearch_in.pages[i].title + " " + tipuesearch_in.pages[i].hash, "desc": s_t, "url_base": tipuesearch_in.pages[i].url + tipuesearch_in.pages[i].hash, "url": tipuesearch_in.pages[i].url + urlVar + tipuesearch_in.pages[i].hash }); c++; } } } if (c != 0) { if (set.showTitleCount && tipuesearch_t_c == 0) { var title = document.title; document.title = '(' + c + ') ' + title; tipuesearch_t_c++; } if (show_replace == 1) { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_2 + ' ' + d + '. ' + tipuesearch_string_3 + ' <a id="stacks_in_169_page167_tipue_search_replaced">' + d_r + '</a></div>'; } if (c == 1) { out += '<div id="stacks_in_169_page167_tipue_search_results_count">' + tipuesearch_string_4 + '</div>'; } else { c_c = c.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); out += '<div id="stacks_in_169_page167_tipue_search_results_count">' + c_c + ' ' + tipuesearch_string_5 + '</div>'; } found.sort(function(a, b) { return b.score - a.score } ); var l_o = 0; for (var i = 0; i < found.length; i++) { if (l_o >= start && l_o < set.show + start) { out += '<div class="tipue_search_content_title"><a href="' + found[i].url + '"' + tipue_search_w + '>' + found[i].title + '</a></div>'; if (set.debug) { out += '<div class="tipue_search_content_debug">Score: ' + found[i].score + '</div>'; } if (set.showURL) { var s_u = found[i].url.toLowerCase(); if(s_u.indexOf('http://') == 0) { s_u = s_u.slice(7); } out += '<div class="tipue_search_content_url"><a href="' + (found[i].url) + '"' + tipue_search_w + '>' + found[i].url_base + '</a></div>'; } if (found[i].desc) { var t = found[i].desc; var t_d = ''; var t_w = t.split(' '); if (t_w.length < set.descriptiveWords){ t_d = t; } else { for (var f = 0; f < set.descriptiveWords; f++) { t_d += t_w[f] + ' '; } } t_d = $.trim(t_d); if (t_d.charAt(t_d.length - 1) != '.') { t_d += ' ...'; } out += '<div class="tipue_search_content_text">' + t_d + '</div>'; } } l_o++; } if (c > set.show) { var pages = Math.ceil(c / set.show); var page = (start / set.show); out += '<div id="stacks_in_169_page167_tipue_search_foot"><ul id="stacks_in_169_page167_tipue_search_foot_boxes">'; if (start > 0) { out += '<li><a class="tipue_search_foot_box" id="' + (start - set.show) + '_' + replace + '">' + tipuesearch_string_6 + '</a></li>'; } if (page <= 2) { var p_b = pages; if (pages > 3) { p_b = 3; } for (var f = 0; f < p_b; f++) { if (f == page) { out += '<li class="current">' + (f + 1) + '</li>'; } else { out += '<li><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; } } } else { var p_b = page + 2; if (p_b > pages) { p_b = pages; } for (var f = page - 1; f < p_b; f++) { if (f == page) { out += '<li class="current">' + (f + 1) + '</li>'; } else { out += '<li><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; } } } if (page + 1 != pages) { out += '<li><a class="tipue_search_foot_box" id="' + (start + set.show) + '_' + replace + '">' + tipuesearch_string_7 + '</a></li>'; } out += '</ul></div>'; } } else { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_8 + '</div>'; } } else { if (show_stop) { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_8 + '. ' + tipuesearch_string_9 + '</div>'; } else { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_10 + '</div>'; if (set.minimumLength == 1) { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_11 + '</div>'; } else { out += '<div id="stacks_in_169_page167_tipue_search_warning">' + tipuesearch_string_12 + '</div>'; } } } $('#stacks_in_169_page167_tipue_search_content').hide(); $('#stacks_in_169_page167_tipue_search_content').html(out); $('#stacks_in_169_page167_tipue_search_content').slideDown(200); $('#stacks_in_169_page167_tipue_search_replaced').click(function() { getTipueSearch(0, false); }); $('.tipue_search_foot_box').click(function() { var id_v = $(this).attr('id'); var id_a = id_v.split('_'); getTipueSearch(parseInt(id_a[0]), id_a[1]); }); } }); }; })(jQuery); // Read a page's GET URL variables and return them as an associative array. function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } //More results if ($(".live-search-results").length && $(window).width() > 768) { $("#stacks_in_169_page167_tipue_search_content").appendTo(".live-search-res ults"); } else if ($(".live-search-results-mobile").length) { $("#stacks_in_169_page167_tipue_search_content").appendTo(".live-search-res ults-mobile"); } //Search var previewMode = getUrlVars(); previewMode = previewMode[0]; //console.log(previewMode.substring(0, 11)); if((previewMode.substring(0, 11) == "http://file") || (previewMode.substring(0, 16) == "http://localhost" || (previewMode.substring(0, 10) == "http://127"))) { jQuery('form#stacks_in_169_page167_live-search').on('submit', function() { e.stopPropagation(); jQuery("body").addClass("searchingstacks_in_169_page167"); jQuery("#stacks_in_169_page167_tipue_search_content").html("Live Search is unable perform searches in preview mode. Please publish your project to use this search bar."); jQuery(document).on('click', function (e) { jQuery("body").removeClass("searchingstacks_in_169_page167"); }); return false; }); } else { jQuery('#stacks_in_169_page167_tipue_search_input').tipuesearch({ 'mode': 'live', //The mode for loading content. The value can be 'static', 'live' or 'json'. The default is 'static'. 'liveDescription': '*', // the element containing the descriptive text // // 'liveContent': '*', // 'show': 5, //The number of results displayed. The default is 7. 'newWindow': false, //The search result opens in a new browser tab if set to true. The default is false. 'showURL': false, //The URL is displayed in each search result if set to true. The default is true. 'showTitleCount': true, //The number of search results is displayed in the document title if set to true. The default is true. 'minimumLength': 3, //The minimum length of characters in a search query. The default is 3. 'descriptiveWords': 60, //The number of words displayed in the descriptive text in the search search. The default is 25. 'highlightTerms': true, //Search terms are highlighted if set to true. The default is true. The highlight CSS is set in the h01 class. 'highlightEveryTerm': true //Every occurrence of search terms are highlighted if set to true. The default is false. }); jQuery('form#stacks_in_169_page167_live-search').on('submit', function() { jQuery("body").addClass("searchingstacks_in_169_page167"); return false; }); jQuery('#stacks_in_169_page167_tipue_search_input, #stacks_in_169_page167_tipue_search_content').on('click', function(e) { e.stopPropagation(); }); jQuery(document).on('click', function (e) { jQuery("body").removeClass("searchingstacks_in_169_page167"); }); } jQuery("body").addClass("tipue_search_loaded"); }); jQuery(window).load(function() { highlight(); }) return stack;})(stacks.stacks_in_169_page167)