1 line
611 KiB
Plaintext
1 line
611 KiB
Plaintext
|
!function(a){var c=function(t,k,h,q){var n=0,r=0,j=h.length,o,f,e=false,g=false,p;for(;n<j;n++){o=h[n],f=null;p=false;if(o.required){f=DDG.getProperty(t,o.required);if(f){if(f.length&&f.length>0){e=true;continue}if(f===0||!!f){e=true;continue}}return false}if(!o.key){return false}f=DDG.getProperty(t,o.key);g=true;if(f){if(o.match){var m=f.match(o.match);p=!!m;if(p&&o.strict){var s=DDG.get_query().match(o.match);p=(m[0].toLowerCase()==s[0].toLowerCase())}if(!p){return false}}else{if($.isArray(f)){f=f.join(" ")}p=DDG.isRelevant(f,o.skip_words||k.skip_words,o.min_length,!!o.strict)}}else{p=false}if(p){r++}else{if(!q){return false}}}if(r===0){if(e&&!g){return true}return false}return true};var b=function(f,e){var g,h=e[e.type||"primary"];if(!h){return true}g=c(f,e,h,true);return g};a.DDH={spice_tabs:{},spice_objects:{},add:function(f){if(!f.id){return}if(!f.data){return}if(f.require){var g=f.require;delete f.require;DDG.require(g,a.DDH.add.bind(a.DDH,f));return}if(!f.allowMultipleCalls&&this.spice_objects[f.id]){return null}if(a.DDH[f.id]&&a.DDH[f.id].build&&$.isFunction(a.DDH[f.id].build)){var e=a.DDH[f.id].build(f);if(e===false||($.type(e)==="object"&&$.isEmptyObject(e))){return}else{$.extend(f,e)}}if(a.DDH[f.id]&&a.DDH[f.id].build_async&&$.isFunction(a.DDH[f.id].build_async)){a.DDH[f.id].build_async(f,function(j){var i=a.DDH._build_ops(j);if(i){a.DDH.spice_tabs[i.id]=DDG.duckbar.add(i)}})}else{var h=a.DDH._build_ops(f);if(h){a.DDH.spice_tabs[h.id]=DDG.duckbar.add(h)}}},_build_ops:function(f){f.templates=f.templates||{};f.meta=f.meta||{};if(a.DDH[f.id]&&a.DDH[f.id].meta){f.meta=$.extend(a.DDH[f.id].meta,f.meta)}if(f.meta.tab){f.name=f.meta.tab}var g=f.normalize||null,j=$.isArray(f.data),h,t=[],u,s=f.relevancy,e=DDG.get_query(),r=[],o=[];if(j){if(s){f.meta.idField=s.dup}for(var m=0,k=f.data.length;m<k;m++){var v=f.data[m];if(s&&!b(v,s)){continue}if(g){u=g(v);if(u){h=$.extend({},v,u)}else{continue}}else{h=v}if(h.exactMatch){o.push(h)}else{if(h.boost){r.push(h)}else{t.push(h)}}}if(r.length>0){for(m=0;m<r.length;m++){t.unshift(r[m])}}if(o.length>0){for(m=0;m<o.length;m++){t.unshift(o[m])}}if(t.length<1){DDG.duckbar.failed(f.id);return}f.data=t;if(t.length>1&&f.sort_fields&&f.sort_default){var p=null;if(typeof f.sort_default==="string"){p=f.sort_default}else{if(s&&s.type){p=f.sort_default[s.type]}}if(p&&p.length>0){f.data.sort(DDG.getProperty(f.sort_fields,p))}else{}}}else{if(s){if(!b(f.data,s)){DDG.duckbar.failed(f.id);return}}if(g){u=g(f.data);if(u){f.data=$.extend({},f.data,u)}else{DDG.duckbar.failed(f.id);return}}}if(f.id==="cheat_sheets"){f.meta.id=f.from}else{f.meta.id=f.id}a.DDH.spice_objects[f.id]=a.DDH.spice_objects[f.id]||{};return f},failed:function(e){return DDG.duckbar.failed(e)},getDOM:function(g){var f=this.spice_tabs[g],e=f&&f.view&&f.view.$el;return e||$()},selectNextItem:function(f){var e=this.spice_tabs[f];return e&&e.view&&e.view.selectNextItem&&e.view.selectNextItem()},registerHelper:function(f,e){Handlebars.registerHelper(f,e)}};a.Spice=a.DDH;a.DDH.sharedir_map=this.spice_paths?$.parseJSON(spice_paths):{}}(window);Spice.names=["airlines","alternative_to","amazon","astrobin_apod","aur","bible","brainy_quote","caniuse_lists","code_search","coupons","cryptocurrency","currency","cve_summary","detect_lang","dictionary_definition","dns","dogo_books","dogo_movies","dogo_news","duck_say","economic_indicators","emojipedia","etsy","expand_url","first_robotics_team_info","flash_version","flights_route","forecast","git_book_status","github","github_status","glassdoor","gravatar","grunt","gulp","hacker_news","haxelib","hayoo","hex","holiday","images","indeed_jobs","is_it_up","islamic_prayer_times","keybase","launchbug","launchpad_project","magic_the_gathering","maps_maps","maps_places","maven","meta_cpan","metar","minecraft_status","near_earth_objects","newint","news","npm","nutrition","nxt_account","octopart","open_nic","package_tracking","packagist","people_in_space","playing_cards","plos","product_hunt","public_holidays","pwned","quandl_fundamentals","quote_of_the_day","rain","rand_pos","rand_word","recipes","rfc",
|