/* * # Fomantic UI - 2.8.4 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(k,q,D,E){"use strict";k.isFunction=k.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},q=void 0!==q&&q.Math==Math?q:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),k.fn.search=function(R){var x,C=k(this),w=C.selector||"",S=(new Date).getTime(),F=[],T=R,j="string"==typeof T,A=[].slice.call(arguments,1);return k(this).each(function(){var f,l=k.isPlainObject(R)?k.extend(!0,{},k.fn.search.settings,R):k.extend({},k.fn.search.settings),g=l.className,u=l.metadata,n=l.regExp,i=l.fields,h=l.selector,d=l.error,e=l.namespace,r="."+e,t=e+"-module",p=k(this),m=p.find(h.prompt),s=p.find(h.searchButton),a=p.find(h.results),c=p.find(h.result),v=(p.find(h.category),this),o=p.data(t),y=!1,b=!1;f={initialize:function(){f.verbose("Initializing module"),f.get.settings(),f.determine.searchFields(),f.bind.events(),f.set.type(),f.create.results(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),o=f,p.data(t,f)},destroy:function(){f.verbose("Destroying instance"),p.off(r).removeData(t)},refresh:function(){f.debug("Refreshing selector cache"),m=p.find(h.prompt),s=p.find(h.searchButton),p.find(h.category),a=p.find(h.results),c=p.find(h.result)},refreshResults:function(){a=p.find(h.results),c=p.find(h.result)},bind:{events:function(){f.verbose("Binding events to search"),l.automatic&&(p.on(f.get.inputEvent()+r,h.prompt,f.event.input),m.attr("autocomplete","off")),p.on("focus"+r,h.prompt,f.event.focus).on("blur"+r,h.prompt,f.event.blur).on("keydown"+r,h.prompt,f.handleKeyboard).on("click"+r,h.searchButton,f.query).on("mousedown"+r,h.results,f.event.result.mousedown).on("mouseup"+r,h.results,f.event.result.mouseup).on("click"+r,h.result,f.event.result.click)}},determine:{searchFields:function(){R&&R.searchFields!==E&&(l.searchFields=R.searchFields)}},event:{input:function(){l.searchDelay?(clearTimeout(f.timer),f.timer=setTimeout(function(){f.is.focused()&&f.query()},l.searchDelay)):f.query()},focus:function(){f.set.focus(),l.searchOnFocus&&f.has.minimumCharacters()&&f.query(function(){f.can.show()&&f.showResults()})},blur:function(e){function t(){f.cancel.query(),f.remove.focus(),f.timer=setTimeout(f.hideResults,l.hideDelay)}var s=D.activeElement===this;s||(b=!1,f.resultsClicked?(f.debug("Determining if user action caused search to close"),p.one("click.close"+r,h.results,function(e){f.is.inMessage(e)||y?m.focus():(y=!1,f.is.animating()||f.is.hidden()||t())})):(f.debug("Input blurred without user action, closing results"),t()))},result:{mousedown:function(){f.resultsClicked=!0},mouseup:function(){f.resultsClicked=!1},click:function(e){f.debug("Search result selected");var t=k(this),s=t.find(h.title).eq(0),n=t.is("a[href]")?t:t.find("a[href]").eq(0),r=n.attr("href")||!1,i=n.attr("target")||!1,a=0=l.minCharacters},results:function(){return 0!==a.length&&""!=a.html()}},clear:{cache:function(e){var t=p.data(u.cache);e?e&&t&&t[e]&&(f.debug("Removing value from cache",e),delete t[e],p.data(u.cache,t)):(f.debug("Clearing cache",e),p.removeData(u.cache))}},read:{cache:function(e){var t=p.data(u.cache);return!!l.cache&&(f.verbose("Checking cache for generated html for query",e),"object"==typeof t&&t[e]!==E&&t[e])}},create:{categoryResults:function(e){var s={};return k.each(e,function(e,t){t.category&&(s[t.category]===E?(f.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){var s,n=e+1;return t!==E?(s=String.fromCharCode(97+t)+n,f.verbose("Creating category result id",s)):(s=n,f.verbose("Creating result id",s)),s},results:function(){0===a.length&&(a=k("
").addClass(g.results).appendTo(p))}},inject:{result:function(e,t,s){f.verbose("Injecting result into results");var n=s!==E?a.children().eq(s).children(h.results).first().children(h.result).eq(t):a.children(h.result).eq(t);f.verbose("Injecting results metadata",n),n.data(u.result,e)},id:function(e){f.debug("Injecting unique ids into results");var s=0,n=0;return"category"===l.type?k.each(e,function(e,t){0 as a polyfill.'},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,beginsWith:"(?:s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(t)return e;var s={"<":"<",">":">",'"':""","'":"'","`":"`"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,6};)/,"&")).replace(/[<>"'`]/g,function(e){return s[e]}):e},message:function(e,t,s){var n="";return e!==E&&t!==E&&(n+='
',s&&(n+='
'+s+"
"),n+='
'+e+"
",n+="
"),n},category:function(e,s,n){var r="",i=k.fn.search.settings.templates.escape;return e[s.categoryResults]!==E&&(k.each(e[s.categoryResults],function(e,t){t[s.results]!==E&&0',t[s.categoryName]!==E&&(r+='
'+i(t[s.categoryName],n)+"
"),r+='",r+="
")}),e[s.action]&&(!1===s.actionURL?r+='
'+i(e[s.action][s.actionText],n)+"
":r+=''+i(e[s.action][s.actionText],n)+""),r)},standard:function(e,s,n){var r="",i=k.fn.search.settings.templates.escape;return e[s.results]!==E&&(k.each(e[s.results],function(e,t){t[s.url]?r+='':r+='',t[s.image]!==E&&(r+='
'),r+='
',t[s.price]!==E&&(r+='
'+i(t[s.price],n)+"
"),t[s.title]!==E&&(r+='
'+i(t[s.title],n)+"
"),t[s.description]!==E&&(r+='
'+i(t[s.description],n)+"
"),r+="
",r+="
"}),e[s.action]&&(!1===s.actionURL?r+='
'+i(e[s.action][s.actionText],n)+"
":r+=''+i(e[s.action][s.actionText],n)+""),r)}}}}(jQuery,window,document);