You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
68 KiB
1 lines
68 KiB
{"version":3,"sources":["search.js"],"names":["$","window","document","undefined","Math","self","Function","fn","search","parameters","returnedValue","$allModules","this","moduleSelector","selector","time","Date","getTime","performance","query","arguments","methodInvoked","queryArguments","slice","call","each","module","settings","isPlainObject","extend","className","metadata","regExp","fields","error","namespace","eventNamespace","moduleNamespace","$module","$prompt","find","prompt","$searchButton","searchButton","$results","results","$result","result","$category","category","element","instance","data","disabledBubbled","initialize","verbose","determine","searchFields","bind","events","set","type","create","instantiate","destroy","off","removeData","refresh","debug","refreshResults","automatic","on","get","inputEvent","event","input","attr","focus","blur","handleKeyboard","mousedown","mouseup","click","clearTimeout","timer","setTimeout","searchDelay","has","minimumCharacters","can","show","showResults","pageLostFocus","activeElement","callback","cancel","remove","hideResults","hideDelay","resultsClicked","one","is","inMessage","animating","hidden","$title","title","eq","$link","href","target","value","html","length","text","isFunction","onSelect","ctrlKey","open","location","newIndex","$activeResult","filter","active","currentIndex","index","resultSize","hasActiveResult","keyCode","which","keys","backspace","enter","escape","upArrow","downArrow","trigger","visible","preventDefault","removeClass","addClass","closest","buttonPressed","buttonFocus","setup","api","searchTerm","apiSettings","cache","action","urlData","onSuccess","response","parse","onAbort","onFailure","displayMessage","serverError","onError","useAPI","focused","empty","transition","hasClass","$target","isInDOM","contains","documentElement","message","createEvent","promptElement","initEvent","dispatchEvent","oninput","onpropertychange","val","lookupFields","isArray","object","select","firstResult","first","loading","pressed","read","save","addResults","inject","id","source","local","remote","onSearchQuery","searchHTML","content","generateResults","write","fuzzyResults","searchExp","toString","replace","matchRegExp","RegExp","beginsWith","addResult","array","notResult","inArray","notFuzzyResult","push","field","label","fieldExists","searchFullText","fuzzySearch","merge","term","termLength","queryLength","toLowerCase","characterIndex","nextCharacterIndex","queryCharacter","charCodeAt","numCharacters","minCharacters","clear","name","resultIndex","categoryIndex","letterID","resultID","String","fromCharCode","appendTo","$selectedResult","children","onResultsAdd","selectFirstResult","animation","duration","queue","stop","fadeIn","easing","onResultsOpen","fadeOut","onResultsClose","template","templates","isProperObject","isEmptyObject","isProperArray","maxResults","noTemplate","showNoResults","noResults","onResults","setting","internal","silent","log","prototype","console","info","apply","currentTime","executionTime","previousTime","Name","Arguments","Element","Execution Time","display","totalTime","group","table","groupCollapsed","groupEnd","invoke","passedArguments","context","maxDepth","found","split","depth","camelCaseValue","charAt","toUpperCase","displayField","logging","noEndpoint","method","categories","categoryName","categoryResults","description","image","price","url","actionText","actionURL","string","badChars","shouldEscape","&","<",">","\"","'","`","escapedChar","chr","test","standard","jQuery"],"mappings":";;;;;;;;;CAUC,SAAWA,EAAGC,EAAQC,EAAUC,GAEjC,YAEAF,GAA2B,mBAAVA,IAAyBA,EAAOG,MAAQA,KACrDH,EACgB,mBAARI,OAAuBA,KAAKD,MAAQA,KAC1CC,KACAC,SAAS,iBAGfN,EAAEO,GAAGC,OAAS,SAASC,GACrB,GAUEC,GATAC,EAAkBX,EAAEY,MACpBC,EAAkBF,EAAYG,UAAY,GAE1CC,GAAkB,GAAIC,OAAOC,UAC7BC,KAEAC,EAAkBC,UAAU,GAC5BC,EAAmC,gBAATF,GAC1BG,KAAqBC,MAAMC,KAAKJ,UAAW,EA4jC7C,OAzjCApB,GAAEY,MACCa,KAAK,WACJ,GA4BEC,GA3BAC,EAAsB3B,EAAE4B,cAAcnB,GAClCT,EAAE6B,QAAO,KAAU7B,EAAEO,GAAGC,OAAOmB,SAAUlB,GACzCT,EAAE6B,UAAW7B,EAAEO,GAAGC,OAAOmB,UAE7BG,EAAkBH,EAASG,UAC3BC,EAAkBJ,EAASI,SAC3BC,EAAkBL,EAASK,OAC3BC,EAAkBN,EAASM,OAC3BnB,EAAkBa,EAASb,SAC3BoB,EAAkBP,EAASO,MAC3BC,EAAkBR,EAASQ,UAE3BC,EAAkB,IAAMD,EACxBE,EAAkBF,EAAY,UAE9BG,EAAkBtC,EAAEY,MACpB2B,EAAk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vH,EAAOoH,QAAQpH,EAAO2Q,YACjC,QAEG5L,IAIX0M,SAAU,SAASlK,EAAUvH,GAC3B,GACE+E,GAAO,EAET,OAAGwC,GAASvH,EAAOY,WAAa1C,IAG9BH,EAAEyB,KAAK+H,EAASvH,EAAOY,SAAU,SAASgF,EAAO9E,GAE7CiE,GADCjE,EAAOd,EAAO0Q,KACN,2BAA6B5P,EAAOd,EAAO0Q,KAAO,KAGlD,qBAER5P,EAAOd,EAAOwQ,SAAWtS,IAC1B6G,GAAQ,iCAEYjE,EAAOd,EAAOwQ,OAAS,YAI7CzL,GAAQ,wBACLjE,EAAOd,EAAOyQ,SAAWvS,IAC1B6G,GAAQ,sBAAwBjE,EAAOd,EAAOyQ,OAAS,UAEtD3P,EAAOd,EAAOyE,SAAWvG,IAC1B6G,GAAQ,sBAAwBjE,EAAOd,EAAOyE,OAAS,UAEtD3D,EAAOd,EAAOuQ,eAAiBrS,IAChC6G,GAAQ,4BAA8BjE,EAAOd,EAAOuQ,aAAe,UAErExL,GAAS,SAGTA,GAAQ,SAGPwC,EAASvH,EAAOoH,UACjBrC,GAAQ,YACQwC,EAASvH,EAAOoH,QAAQpH,EAAO4Q,WAAa,oBACxDrJ,EAASvH,EAAOoH,QAAQpH,EAAO2Q,YACjC,QAEG5L,OAOX2M,OAAQ1T,OAAQC","file":"search.min.js","sourcesContent":["/*!\n * # Semantic UI 2.2.6 - Search\n * http://github.com/semantic-org/semantic-ui/\n *\n *\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n *\n */\n\n;(function ($, window, document, undefined) {\n\n\"use strict\";\n\nwindow = (typeof window != 'undefined' && window.Math == Math)\n ? window\n : (typeof self != 'undefined' && self.Math == Math)\n ? self\n : Function('return this')()\n;\n\n$.fn.search = function(parameters) {\n var\n $allModules = $(this),\n moduleSelector = $allModules.selector || '',\n\n time = new Date().getTime(),\n performance = [],\n\n query = arguments[0],\n methodInvoked = (typeof query == 'string'),\n queryArguments = [].slice.call(arguments, 1),\n returnedValue\n ;\n $(this)\n .each(function() {\n var\n settings = ( $.isPlainObject(parameters) )\n ? $.extend(true, {}, $.fn.search.settings, parameters)\n : $.extend({}, $.fn.search.settings),\n\n className = settings.className,\n metadata = settings.metadata,\n regExp = settings.regExp,\n fields = settings.fields,\n selector = settings.selector,\n error = settings.error,\n namespace = settings.namespace,\n\n eventNamespace = '.' + namespace,\n moduleNamespace = namespace + '-module',\n\n $module = $(this),\n $prompt = $module.find(selector.prompt),\n $searchButton = $module.find(selector.searchButton),\n $results = $module.find(selector.results),\n $result = $module.find(selector.result),\n $category = $module.find(selector.category),\n\n element = this,\n instance = $module.data(moduleNamespace),\n\n disabledBubbled = false,\n\n module\n ;\n\n module = {\n\n initialize: function() {\n module.verbose('Initializing module');\n module.determine.searchFields();\n module.bind.events();\n module.set.type();\n module.create.results();\n module.instantiate();\n },\n instantiate: function() {\n module.verbose('Storing instance of module', module);\n instance = module;\n $module\n .data(moduleNamespace, module)\n ;\n },\n destroy: function() {\n module.verbose('Destroying instance');\n $module\n .off(eventNamespace)\n .removeData(moduleNamespace)\n ;\n },\n\n refresh: function() {\n module.debug('Refreshing selector cache');\n $prompt = $module.find(selector.prompt);\n $searchButton = $module.find(selector.searchButton);\n $category = $module.find(selector.category);\n $results = $module.find(selector.results);\n $result = $module.find(selector.result);\n },\n\n refreshResults: function() {\n $results = $module.find(selector.results);\n $result = $module.find(selector.result);\n },\n\n bind: {\n events: function() {\n module.verbose('Binding events to search');\n if(settings.automatic) {\n $module\n .on(module.get.inputEvent() + eventNamespace, selector.prompt, module.event.input)\n ;\n $prompt\n .attr('autocomplete', 'off')\n ;\n }\n $module\n // prompt\n .on('focus' + eventNamespace, selector.prompt, module.event.focus)\n .on('blur' + eventNamespace, selector.prompt, module.event.blur)\n .on('keydown' + eventNamespace, selector.prompt, module.handleKeyboard)\n // search button\n .on('click' + eventNamespace, selector.searchButton, module.query)\n // results\n .on('mousedown' + eventNamespace, selector.results, module.event.result.mousedown)\n .on('mouseup' + eventNamespace, selector.results, module.event.result.mouseup)\n .on('click' + eventNamespace, selector.result, module.event.result.click)\n ;\n }\n },\n\n determine: {\n searchFields: function() {\n // this makes sure $.extend does not add specified search fields to default fields\n // this is the only setting which should not extend defaults\n if(parameters && parameters.searchFields !== undefined) {\n settings.searchFields = parameters.searchFields;\n }\n }\n },\n\n event: {\n input: function() {\n clearTimeout(module.timer);\n module.timer = setTimeout(module.query, settings.searchDelay);\n },\n focus: function() {\n module.set.focus();\n if( module.has.minimumCharacters() ) {\n module.query();\n if( module.can.show() ) {\n module.showResults();\n }\n }\n },\n blur: function(event) {\n var\n pageLostFocus = (document.activeElement === this),\n callback = function() {\n module.cancel.query();\n module.remove.focus();\n module.timer = setTimeout(module.hideResults, settings.hideDelay);\n }\n ;\n if(pageLostFocus) {\n return;\n }\n if(module.resultsClicked) {\n module.debug('Determining if user action caused search to close');\n $module\n .one('click.close' + eventNamespace, selector.results, function(event) {\n if(module.is.inMessage(event) || disabledBubbled) {\n $prompt.focus();\n return;\n }\n disabledBubbled = false;\n if( !module.is.animating() && !module.is.hidden()) {\n callback();\n }\n })\n ;\n }\n else {\n module.debug('Input blurred without user action, closing results');\n callback();\n }\n },\n result: {\n mousedown: function() {\n module.resultsClicked = true;\n },\n mouseup: function() {\n module.resultsClicked = false;\n },\n click: function(event) {\n module.debug('Search result selected');\n var\n $result = $(this),\n $title = $result.find(selector.title).eq(0),\n $link = $result.is('a[href]')\n ? $result\n : $result.find('a[href]').eq(0),\n href = $link.attr('href') || false,\n target = $link.attr('target') || false,\n title = $title.html(),\n // title is used for result lookup\n value = ($title.length > 0)\n ? $title.text()\n : false,\n results = module.get.results(),\n result = $result.data(metadata.result) || module.get.result(value, results),\n returnedValue\n ;\n if( $.isFunction(settings.onSelect) ) {\n if(settings.onSelect.call(element, result, results) === false) {\n module.debug('Custom onSelect callback cancelled default select action');\n disabledBubbled = true;\n return;\n }\n }\n module.hideResults();\n if(value) {\n module.set.value(value);\n }\n if(href) {\n module.verbose('Opening search link found in result', $link);\n if(target == '_blank' || event.ctrlKey) {\n window.open(href);\n }\n else {\n window.location.href = (href);\n }\n }\n }\n }\n },\n handleKeyboard: function(event) {\n var\n // force selector refresh\n $result = $module.find(selector.result),\n $category = $module.find(selector.category),\n $activeResult = $result.filter('.' + className.active),\n currentIndex = $result.index( $activeResult ),\n resultSize = $result.length,\n hasActiveResult = $activeResult.length > 0,\n\n keyCode = event.which,\n keys = {\n backspace : 8,\n enter : 13,\n escape : 27,\n upArrow : 38,\n downArrow : 40\n },\n newIndex\n ;\n // search shortcuts\n if(keyCode == keys.escape) {\n module.verbose('Escape key pressed, blurring search field');\n module.trigger.blur();\n }\n if( module.is.visible() ) {\n if(keyCode == keys.enter) {\n module.verbose('Enter key pressed, selecting active result');\n if( $result.filter('.' + className.active).length > 0 ) {\n module.event.result.click.call($result.filter('.' + className.active), event);\n event.preventDefault();\n return false;\n }\n }\n else if(keyCode == keys.upArrow && hasActiveResult) {\n module.verbose('Up key pressed, changing active result');\n newIndex = (currentIndex - 1 < 0)\n ? currentIndex\n : currentIndex - 1\n ;\n $category\n .removeClass(className.active)\n ;\n $result\n .removeClass(className.active)\n .eq(newIndex)\n .addClass(className.active)\n .closest($category)\n .addClass(className.active)\n ;\n event.preventDefault();\n }\n else if(keyCode == keys.downArrow) {\n module.verbose('Down key pressed, changing active result');\n newIndex = (currentIndex + 1 >= resultSize)\n ? currentIndex\n : currentIndex + 1\n ;\n $category\n .removeClass(className.active)\n ;\n $result\n .removeClass(className.active)\n .eq(newIndex)\n .addClass(className.active)\n .closest($category)\n .addClass(className.active)\n ;\n event.preventDefault();\n }\n }\n else {\n // query shortcuts\n if(keyCode == keys.enter) {\n module.verbose('Enter key pressed, executing query');\n module.query();\n module.set.buttonPressed();\n $prompt.one('keyup', module.remove.buttonFocus);\n }\n }\n },\n\n setup: {\n api: function(searchTerm) {\n var\n apiSettings = {\n debug : settings.debug,\n on : false,\n cache : true,\n action : 'search',\n urlData : {\n query : searchTerm\n },\n onSuccess : function(response) {\n module.parse.response.call(element, response, searchTerm);\n },\n onAbort : function(response) {\n },\n onFailure : function() {\n module.displayMessage(error.serverError);\n },\n onError : module.error\n },\n searchHTML\n ;\n $.extend(true, apiSettings, settings.apiSettings);\n module.verbose('Setting up API request', apiSettings);\n $module.api(apiSettings);\n }\n },\n\n can: {\n useAPI: function() {\n return $.fn.api !== undefined;\n },\n show: function() {\n return module.is.focused() && !module.is.visible() && !module.is.empty();\n },\n transition: function() {\n return settings.transition && $.fn.transition !== undefined && $module.transition('is supported');\n }\n },\n\n is: {\n animating: function() {\n return $results.hasClass(className.animating);\n },\n hidden: function() {\n return $results.hasClass(className.hidden);\n },\n inMessage: function(event) {\n if(!event.target) {\n return;\n }\n var\n $target = $(event.target),\n isInDOM = $.contains(document.documentElement, event.target)\n ;\n return (isInDOM && $target.closest(selector.message).length > 0);\n },\n empty: function() {\n return ($results.html() === '');\n },\n visible: function() {\n return ($results.filter(':visible').length > 0);\n },\n focused: function() {\n return ($prompt.filter(':focus').length > 0);\n }\n },\n\n trigger: {\n blur: function() {\n var\n events = document.createEvent('HTMLEvents'),\n promptElement = $prompt[0]\n ;\n if(promptElement) {\n module.verbose('Triggering native blur event');\n events.initEvent('blur', false, false);\n promptElement.dispatchEvent(events);\n }\n }\n },\n\n get: {\n inputEvent: function() {\n var\n prompt = $prompt[0],\n inputEvent = (prompt !== undefined && prompt.oninput !== undefined)\n ? 'input'\n : (prompt !== undefined && prompt.onpropertychange !== undefined)\n ? 'propertychange'\n : 'keyup'\n ;\n return inputEvent;\n },\n value: function() {\n return $prompt.val();\n },\n results: function() {\n var\n results = $module.data(metadata.results)\n ;\n return results;\n },\n result: function(value, results) {\n var\n lookupFields = ['title', 'id'],\n result = false\n ;\n value = (value !== undefined)\n ? value\n : module.get.value()\n ;\n results = (results !== undefined)\n ? results\n : module.get.results()\n ;\n if(settings.type === 'category') {\n module.debug('Finding result that matches', value);\n $.each(results, function(index, category) {\n if($.isArray(category.results)) {\n result = module.search.object(value, category.results, lookupFields)[0];\n // don't continue searching if a result is found\n if(result) {\n return false;\n }\n }\n });\n }\n else {\n module.debug('Finding result in results object', value);\n result = module.search.object(value, results, lookupFields)[0];\n }\n return result || false;\n },\n },\n\n select: {\n firstResult: function() {\n module.verbose('Selecting first result');\n $result.first().addClass(className.active);\n }\n },\n\n set: {\n focus: function() {\n $module.addClass(className.focus);\n },\n loading: function() {\n $module.addClass(className.loading);\n },\n value: function(value) {\n module.verbose('Setting search input value', value);\n $prompt\n .val(value)\n ;\n },\n type: function(type) {\n type = type || settings.type;\n if(settings.type == 'category') {\n $module.addClass(settings.type);\n }\n },\n buttonPressed: function() {\n $searchButton.addClass(className.pressed);\n }\n },\n\n remove: {\n loading: function() {\n $module.removeClass(className.loading);\n },\n focus: function() {\n $module.removeClass(className.focus);\n },\n buttonPressed: function() {\n $searchButton.removeClass(className.pressed);\n }\n },\n\n query: function() {\n var\n searchTerm = module.get.value(),\n cache = module.read.cache(searchTerm)\n ;\n if( module.has.minimumCharacters() ) {\n if(cache) {\n module.debug('Reading result from cache', searchTerm);\n module.save.results(cache.results);\n module.addResults(cache.html);\n module.inject.id(cache.results);\n }\n else {\n module.debug('Querying for', searchTerm);\n if($.isPlainObject(settings.source) || $.isArray(settings.source)) {\n module.search.local(searchTerm);\n }\n else if( module.can.useAPI() ) {\n module.search.remote(searchTerm);\n }\n else {\n module.error(error.source);\n }\n }\n settings.onSearchQuery.call(element, searchTerm);\n }\n else {\n module.hideResults();\n }\n },\n\n search: {\n local: function(searchTerm) {\n var\n results = module.search.object(searchTerm, settings.content),\n searchHTML\n ;\n module.set.loading();\n module.save.results(results);\n module.debug('Returned local search results', results);\n\n searchHTML = module.generateResults({\n results: results\n });\n module.remove.loading();\n module.addResults(searchHTML);\n module.inject.id(results);\n module.write.cache(searchTerm, {\n html : searchHTML,\n results : results\n });\n },\n remote: function(searchTerm) {\n if($module.api('is loading')) {\n $module.api('abort');\n }\n module.setup.api(searchTerm);\n $module\n .api('query')\n ;\n },\n object: function(searchTerm, source, searchFields) {\n var\n results = [],\n fuzzyResults = [],\n searchExp = searchTerm.toString().replace(regExp.escape, '\\\\$&'),\n matchRegExp = new RegExp(regExp.beginsWith + searchExp, 'i'),\n\n // avoid duplicates when pushing results\n addResult = function(array, result) {\n var\n notResult = ($.inArray(result, results) == -1),\n notFuzzyResult = ($.inArray(result, fuzzyResults) == -1)\n ;\n if(notResult && notFuzzyResult) {\n array.push(result);\n }\n }\n ;\n source = source || settings.source;\n searchFields = (searchFields !== undefined)\n ? searchFields\n : settings.searchFields\n ;\n\n // search fields should be array to loop correctly\n if(!$.isArray(searchFields)) {\n searchFields = [searchFields];\n }\n\n // exit conditions if no source\n if(source === undefined || source === false) {\n module.error(error.source);\n return [];\n }\n\n // iterate through search fields looking for matches\n $.each(searchFields, function(index, field) {\n $.each(source, function(label, content) {\n var\n fieldExists = (typeof content[field] == 'string')\n ;\n if(fieldExists) {\n if( content[field].search(matchRegExp) !== -1) {\n // content starts with value (first in results)\n addResult(results, content);\n }\n else if(settings.searchFullText && module.fuzzySearch(searchTerm, content[field]) ) {\n // content fuzzy matches (last in results)\n addResult(fuzzyResults, content);\n }\n }\n });\n });\n return $.merge(results, fuzzyResults);\n }\n },\n\n fuzzySearch: function(query, term) {\n var\n termLength = term.length,\n queryLength = query.length\n ;\n if(typeof query !== 'string') {\n return false;\n }\n query = query.toLowerCase();\n term = term.toLowerCase();\n if(queryLength > termLength) {\n return false;\n }\n if(queryLength === termLength) {\n return (query === term);\n }\n search: for (var characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {\n var\n queryCharacter = query.charCodeAt(characterIndex)\n ;\n while(nextCharacterIndex < termLength) {\n if(term.charCodeAt(nextCharacterIndex++) === queryCharacter) {\n continue search;\n }\n }\n return false;\n }\n return true;\n },\n\n parse: {\n response: function(response, searchTerm) {\n var\n searchHTML = module.generateResults(response)\n ;\n module.verbose('Parsing server response', response);\n if(response !== undefined) {\n if(searchTerm !== undefined && response[fields.results] !== undefined) {\n module.addResults(searchHTML);\n module.inject.id(response[fields.results]);\n module.write.cache(searchTerm, {\n html : searchHTML,\n results : response[fields.results]\n });\n module.save.results(response[fields.results]);\n }\n }\n }\n },\n\n cancel: {\n query: function() {\n if( module.can.useAPI() ) {\n $module.api('abort');\n }\n }\n },\n\n has: {\n minimumCharacters: function() {\n var\n searchTerm = module.get.value(),\n numCharacters = searchTerm.length\n ;\n return (numCharacters >= settings.minCharacters);\n }\n },\n\n clear: {\n cache: function(value) {\n var\n cache = $module.data(metadata.cache)\n ;\n if(!value) {\n module.debug('Clearing cache', value);\n $module.removeData(metadata.cache);\n }\n else if(value && cache && cache[value]) {\n module.debug('Removing value from cache', value);\n delete cache[value];\n $module.data(metadata.cache, cache);\n }\n }\n },\n\n read: {\n cache: function(name) {\n var\n cache = $module.data(metadata.cache)\n ;\n if(settings.cache) {\n module.verbose('Checking cache for generated html for query', name);\n return (typeof cache == 'object') && (cache[name] !== undefined)\n ? cache[name]\n : false\n ;\n }\n return false;\n }\n },\n\n create: {\n id: function(resultIndex, categoryIndex) {\n var\n resultID = (resultIndex + 1), // not zero indexed\n categoryID = (categoryIndex + 1),\n firstCharCode,\n letterID,\n id\n ;\n if(categoryIndex !== undefined) {\n // start char code for \"A\"\n letterID = String.fromCharCode(97 + categoryIndex);\n id = letterID + resultID;\n module.verbose('Creating category result id', id);\n }\n else {\n id = resultID;\n module.verbose('Creating result id', id);\n }\n return id;\n },\n results: function() {\n if($results.length === 0) {\n $results = $('<div />')\n .addClass(className.results)\n .appendTo($module)\n ;\n }\n }\n },\n\n inject: {\n result: function(result, resultIndex, categoryIndex) {\n module.verbose('Injecting result into results');\n var\n $selectedResult = (categoryIndex !== undefined)\n ? $results\n .children().eq(categoryIndex)\n .children(selector.result).eq(resultIndex)\n : $results\n .children(selector.result).eq(resultIndex)\n ;\n module.verbose('Injecting results metadata', $selectedResult);\n $selectedResult\n .data(metadata.result, result)\n ;\n },\n id: function(results) {\n module.debug('Injecting unique ids into results');\n var\n // since results may be object, we must use counters\n categoryIndex = 0,\n resultIndex = 0\n ;\n if(settings.type === 'category') {\n // iterate through each category result\n $.each(results, function(index, category) {\n resultIndex = 0;\n $.each(category.results, function(index, value) {\n var\n result = category.results[index]\n ;\n if(result.id === undefined) {\n result.id = module.create.id(resultIndex, categoryIndex);\n }\n module.inject.result(result, resultIndex, categoryIndex);\n resultIndex++;\n });\n categoryIndex++;\n });\n }\n else {\n // top level\n $.each(results, function(index, value) {\n var\n result = results[index]\n ;\n if(result.id === undefined) {\n result.id = module.create.id(resultIndex);\n }\n module.inject.result(result, resultIndex);\n resultIndex++;\n });\n }\n return results;\n }\n },\n\n save: {\n results: function(results) {\n module.verbose('Saving current search results to metadata', results);\n $module.data(metadata.results, results);\n }\n },\n\n write: {\n cache: function(name, value) {\n var\n cache = ($module.data(metadata.cache) !== undefined)\n ? $module.data(metadata.cache)\n : {}\n ;\n if(settings.cache) {\n module.verbose('Writing generated html to cache', name, value);\n cache[name] = value;\n $module\n .data(metadata.cache, cache)\n ;\n }\n }\n },\n\n addResults: function(html) {\n if( $.isFunction(settings.onResultsAdd) ) {\n if( settings.onResultsAdd.call($results, html) === false ) {\n module.debug('onResultsAdd callback cancelled default action');\n return false;\n }\n }\n if(html) {\n $results\n .html(html)\n ;\n module.refreshResults();\n if(settings.selectFirstResult) {\n module.select.firstResult();\n }\n module.showResults();\n }\n else {\n module.hideResults();\n }\n },\n\n showResults: function() {\n if(!module.is.visible()) {\n if( module.can.transition() ) {\n module.debug('Showing results with css animations');\n $results\n .transition({\n animation : settings.transition + ' in',\n debug : settings.debug,\n verbose : settings.verbose,\n duration : settings.duration,\n queue : true\n })\n ;\n }\n else {\n module.debug('Showing results with javascript');\n $results\n .stop()\n .fadeIn(settings.duration, settings.easing)\n ;\n }\n settings.onResultsOpen.call($results);\n }\n },\n hideResults: function() {\n if( module.is.visible() ) {\n if( module.can.transition() ) {\n module.debug('Hiding results with css animations');\n $results\n .transition({\n animation : settings.transition + ' out',\n debug : settings.debug,\n verbose : settings.verbose,\n duration : settings.duration,\n queue : true\n })\n ;\n }\n else {\n module.debug('Hiding results with javascript');\n $results\n .stop()\n .fadeOut(settings.duration, settings.easing)\n ;\n }\n settings.onResultsClose.call($results);\n }\n },\n\n generateResults: function(response) {\n module.debug('Generating html from response', response);\n var\n template = settings.templates[settings.type],\n isProperObject = ($.isPlainObject(response[fields.results]) && !$.isEmptyObject(response[fields.results])),\n isProperArray = ($.isArray(response[fields.results]) && response[fields.results].length > 0),\n html = ''\n ;\n if(isProperObject || isProperArray ) {\n if(settings.maxResults > 0) {\n if(isProperObject) {\n if(settings.type == 'standard') {\n module.error(error.maxResults);\n }\n }\n else {\n response[fields.results] = response[fields.results].slice(0, settings.maxResults);\n }\n }\n if($.isFunction(template)) {\n html = template(response, fields);\n }\n else {\n module.error(error.noTemplate, false);\n }\n }\n else if(settings.showNoResults) {\n html = module.displayMessage(error.noResults, 'empty');\n }\n settings.onResults.call(element, response);\n return html;\n },\n\n displayMessage: function(text, type) {\n type = type || 'standard';\n module.debug('Displaying message', text, type);\n module.addResults( settings.templates.message(text, type) );\n return settings.templates.message(text, type);\n },\n\n setting: function(name, value) {\n if( $.isPlainObject(name) ) {\n $.extend(true, settings, name);\n }\n else if(value !== undefined) {\n settings[name] = value;\n }\n else {\n return settings[name];\n }\n },\n internal: function(name, value) {\n if( $.isPlainObject(name) ) {\n $.extend(true, module, name);\n }\n else if(value !== undefined) {\n module[name] = value;\n }\n else {\n return module[name];\n }\n },\n debug: function() {\n if(!settings.silent && settings.debug) {\n if(settings.performance) {\n module.performance.log(arguments);\n }\n else {\n module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');\n module.debug.apply(console, arguments);\n }\n }\n },\n verbose: function() {\n if(!settings.silent && settings.verbose && settings.debug) {\n if(settings.performance) {\n module.performance.log(arguments);\n }\n else {\n module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');\n module.verbose.apply(console, arguments);\n }\n }\n },\n error: function() {\n if(!settings.silent) {\n module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');\n module.error.apply(console, arguments);\n }\n },\n performance: {\n log: function(message) {\n var\n currentTime,\n executionTime,\n previousTime\n ;\n if(settings.performance) {\n currentTime = new Date().getTime();\n previousTime = time || currentTime;\n executionTime = currentTime - previousTime;\n time = currentTime;\n performance.push({\n 'Name' : message[0],\n 'Arguments' : [].slice.call(message, 1) || '',\n 'Element' : element,\n 'Execution Time' : executionTime\n });\n }\n clearTimeout(module.performance.timer);\n module.performance.timer = setTimeout(module.performance.display, 500);\n },\n display: function() {\n var\n title = settings.name + ':',\n totalTime = 0\n ;\n time = false;\n clearTimeout(module.performance.timer);\n $.each(performance, function(index, data) {\n totalTime += data['Execution Time'];\n });\n title += ' ' + totalTime + 'ms';\n if(moduleSelector) {\n title += ' \\'' + moduleSelector + '\\'';\n }\n if($allModules.length > 1) {\n title += ' ' + '(' + $allModules.length + ')';\n }\n if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {\n console.groupCollapsed(title);\n if(console.table) {\n console.table(performance);\n }\n else {\n $.each(performance, function(index, data) {\n console.log(data['Name'] + ': ' + data['Execution Time']+'ms');\n });\n }\n console.groupEnd();\n }\n performance = [];\n }\n },\n invoke: function(query, passedArguments, context) {\n var\n object = instance,\n maxDepth,\n found,\n response\n ;\n passedArguments = passedArguments || queryArguments;\n context = element || context;\n if(typeof query == 'string' && object !== undefined) {\n query = query.split(/[\\. ]/);\n maxDepth = query.length - 1;\n $.each(query, function(depth, value) {\n var camelCaseValue = (depth != maxDepth)\n ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)\n : query\n ;\n if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {\n object = object[camelCaseValue];\n }\n else if( object[camelCaseValue] !== undefined ) {\n found = object[camelCaseValue];\n return false;\n }\n else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {\n object = object[value];\n }\n else if( object[value] !== undefined ) {\n found = object[value];\n return false;\n }\n else {\n return false;\n }\n });\n }\n if( $.isFunction( found ) ) {\n response = found.apply(context, passedArguments);\n }\n else if(found !== undefined) {\n response = found;\n }\n if($.isArray(returnedValue)) {\n returnedValue.push(response);\n }\n else if(returnedValue !== undefined) {\n returnedValue = [returnedValue, response];\n }\n else if(response !== undefined) {\n returnedValue = response;\n }\n return found;\n }\n };\n if(methodInvoked) {\n if(instance === undefined) {\n module.initialize();\n }\n module.invoke(query);\n }\n else {\n if(instance !== undefined) {\n instance.invoke('destroy');\n }\n module.initialize();\n }\n\n })\n ;\n\n return (returnedValue !== undefined)\n ? returnedValue\n : this\n ;\n};\n\n$.fn.search.settings = {\n\n name : 'Search',\n namespace : 'search',\n\n silent : false,\n debug : false,\n verbose : false,\n performance : true,\n\n // template to use (specified in settings.templates)\n type : 'standard',\n\n // minimum characters required to search\n minCharacters : 1,\n\n // whether to select first result after searching automatically\n selectFirstResult : false,\n\n // API config\n apiSettings : false,\n\n // object to search\n source : false,\n\n // fields to search\n searchFields : [\n 'title',\n 'description'\n ],\n\n // field to display in standard results template\n displayField : '',\n\n // whether to include fuzzy results in local search\n searchFullText : true,\n\n // whether to add events to prompt automatically\n automatic : true,\n\n // delay before hiding menu after blur\n hideDelay : 0,\n\n // delay before searching\n searchDelay : 200,\n\n // maximum results returned from local\n maxResults : 7,\n\n // whether to store lookups in local cache\n cache : true,\n\n // whether no results errors should be shown\n showNoResults : true,\n\n // transition settings\n transition : 'scale',\n duration : 200,\n easing : 'easeOutExpo',\n\n // callbacks\n onSelect : false,\n onResultsAdd : false,\n\n onSearchQuery : function(query){},\n onResults : function(response){},\n\n onResultsOpen : function(){},\n onResultsClose : function(){},\n\n className: {\n animating : 'animating',\n active : 'active',\n empty : 'empty',\n focus : 'focus',\n hidden : 'hidden',\n loading : 'loading',\n results : 'results',\n pressed : 'down'\n },\n\n error : {\n source : 'Cannot search. No source used, and Semantic API module was not included',\n noResults : 'Your search returned no results',\n logging : 'Error in debug logging, exiting.',\n noEndpoint : 'No search endpoint was specified',\n noTemplate : 'A valid template name was not specified.',\n serverError : 'There was an issue querying the server.',\n maxResults : 'Results must be an array to use maxResults setting',\n method : 'The method you called is not defined.'\n },\n\n metadata: {\n cache : 'cache',\n results : 'results',\n result : 'result'\n },\n\n regExp: {\n escape : /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,\n beginsWith : '(?:\\s|^)'\n },\n\n // maps api response attributes to internal representation\n fields: {\n categories : 'results', // array of categories (category view)\n categoryName : 'name', // name of category (category view)\n categoryResults : 'results', // array of results (category view)\n description : 'description', // result description\n image : 'image', // result image\n price : 'price', // result price\n results : 'results', // array of results (standard)\n title : 'title', // result title\n url : 'url', // result url\n action : 'action', // \"view more\" object name\n actionText : 'text', // \"view more\" text\n actionURL : 'url' // \"view more\" url\n },\n\n selector : {\n prompt : '.prompt',\n searchButton : '.search.button',\n results : '.results',\n message : '.results > .message',\n category : '.category',\n result : '.result',\n title : '.title, .name'\n },\n\n templates: {\n escape: function(string) {\n var\n badChars = /[&<>\"'`]/g,\n shouldEscape = /[&<>\"'`]/,\n escape = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"`\": \"`\"\n },\n escapedChar = function(chr) {\n return escape[chr];\n }\n ;\n if(shouldEscape.test(string)) {\n return string.replace(badChars, escapedChar);\n }\n return string;\n },\n message: function(message, type) {\n var\n html = ''\n ;\n if(message !== undefined && type !== undefined) {\n html += ''\n + '<div class=\"message ' + type + '\">'\n ;\n // message type\n if(type == 'empty') {\n html += ''\n + '<div class=\"header\">No Results</div class=\"header\">'\n + '<div class=\"description\">' + message + '</div class=\"description\">'\n ;\n }\n else {\n html += ' <div class=\"description\">' + message + '</div>';\n }\n html += '</div>';\n }\n return html;\n },\n category: function(response, fields) {\n var\n html = '',\n escape = $.fn.search.settings.templates.escape\n ;\n if(response[fields.categoryResults] !== undefined) {\n\n // each category\n $.each(response[fields.categoryResults], function(index, category) {\n if(category[fields.results] !== undefined && category.results.length > 0) {\n\n html += '<div class=\"category\">';\n\n if(category[fields.categoryName] !== undefined) {\n html += '<div class=\"name\">' + category[fields.categoryName] + '</div>';\n }\n\n // each item inside category\n $.each(category.results, function(index, result) {\n if(result[fields.url]) {\n html += '<a class=\"result\" href=\"' + result[fields.url] + '\">';\n }\n else {\n html += '<a class=\"result\">';\n }\n if(result[fields.image] !== undefined) {\n html += ''\n + '<div class=\"image\">'\n + ' <img src=\"' + result[fields.image] + '\">'\n + '</div>'\n ;\n }\n html += '<div class=\"content\">';\n if(result[fields.price] !== undefined) {\n html += '<div class=\"price\">' + result[fields.price] + '</div>';\n }\n if(result[fields.title] !== undefined) {\n html += '<div class=\"title\">' + result[fields.title] + '</div>';\n }\n if(result[fields.description] !== undefined) {\n html += '<div class=\"description\">' + result[fields.description] + '</div>';\n }\n html += ''\n + '</div>'\n ;\n html += '</a>';\n });\n html += ''\n + '</div>'\n ;\n }\n });\n if(response[fields.action]) {\n html += ''\n + '<a href=\"' + response[fields.action][fields.actionURL] + '\" class=\"action\">'\n + response[fields.action][fields.actionText]\n + '</a>';\n }\n return html;\n }\n return false;\n },\n standard: function(response, fields) {\n var\n html = ''\n ;\n if(response[fields.results] !== undefined) {\n\n // each result\n $.each(response[fields.results], function(index, result) {\n if(result[fields.url]) {\n html += '<a class=\"result\" href=\"' + result[fields.url] + '\">';\n }\n else {\n html += '<a class=\"result\">';\n }\n if(result[fields.image] !== undefined) {\n html += ''\n + '<div class=\"image\">'\n + ' <img src=\"' + result[fields.image] + '\">'\n + '</div>'\n ;\n }\n html += '<div class=\"content\">';\n if(result[fields.price] !== undefined) {\n html += '<div class=\"price\">' + result[fields.price] + '</div>';\n }\n if(result[fields.title] !== undefined) {\n html += '<div class=\"title\">' + result[fields.title] + '</div>';\n }\n if(result[fields.description] !== undefined) {\n html += '<div class=\"description\">' + result[fields.description] + '</div>';\n }\n html += ''\n + '</div>'\n ;\n html += '</a>';\n });\n\n if(response[fields.action]) {\n html += ''\n + '<a href=\"' + response[fields.action][fields.actionURL] + '\" class=\"action\">'\n + response[fields.action][fields.actionText]\n + '</a>';\n }\n return html;\n }\n return false;\n }\n }\n};\n\n})( jQuery, window, document );\n"]}
|