/* * jQuery dropdown: A simple dropdown plugin * * Inspired by Bootstrap: http://twitter.github.com/bootstrap/javascript.html#dropdowns * * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/) * * Dual licensed under the MIT or GPL Version 2 licenses * */ jQuery&&function(e){function t(t){var r=e(this),i=e(e(this).attr("data-dropdown")),s=r.hasClass("dropdown-open");t.preventDefault(),t.stopPropagation(),n();if(s||r.hasClass("dropdown-disabled"))return;i.css({left:i.hasClass("anchor-right")?r.offset().left-(i.outerWidth()-r.outerWidth()):r.offset().left,top:r.offset().top+r.outerHeight()}).show(),r.addClass("dropdown-open")}function n(t){var n=t?e(t.target).parents().andSelf():null;if(n&&n.is(".dropdown-menu")&&!n.is("A"))return;e("BODY").find(".dropdown-menu").hide().end().find("[data-dropdown]").removeClass("dropdown-open")}e.extend(e.fn,{dropdown:function(t,r){switch(t){case"hide":return n(),e(this);case"attach":return e(this).attr("data-dropdown",r);case"detach":return n(),e(this).removeAttr("data-dropdown");case"disable":return e(this).addClass("dropdown-disabled");case"enable":return n(),e(this).removeClass("dropdown-disabled")}}}),e(function(){e("BODY").on("click.dropdown","[data-dropdown]",t),e("HTML").on("click.dropdown",n)})}(jQuery); /* * jQuery Hotkeys Plugin * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * * Based upon the plugin by Tzury Bar Yochay: * http://github.com/tzuryby/hotkeys * * Original idea by: * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ */ (function(e){function t(t){if(typeof t.data!="string")return;var n=t.handler,r=t.data.toLowerCase().split(" ");t.handler=function(t){if(!(this===t.target||!/textarea|select/i.test(t.target.nodeName)&&t.target.type!=="text"))return;var i=t.type!=="keypress"&&e.hotkeys.specialKeys[t.which],s=String.fromCharCode(t.which).toLowerCase(),o,u="",a={};t.altKey&&i!=="alt"&&(u+="alt+"),t.ctrlKey&&i!=="ctrl"&&(u+="ctrl+"),t.metaKey&&!t.ctrlKey&&i!=="meta"&&(u+="meta+"),t.shiftKey&&i!=="shift"&&(u+="shift+"),i?a[u+i]=!0:(a[u+s]=!0,a[u+e.hotkeys.shiftNums[s]]=!0,u==="shift+"&&(a[e.hotkeys.shiftNums[s]]=!0));for(var f=0,l=r.length;f","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}})})(jQuery); /*! * string_score.js: String Scoring Algorithm 0.1.10 * * http://joshaven.com/string_score * https://github.com/joshaven/string_score * * Copyright (C) 2009-2011 Joshaven Potter * Special thanks to all of the contributors listed here https://github.com/joshaven/string_score * MIT license: http://www.opensource.org/licenses/mit-license.php * * Date: Tue Mar 1 2011 */ /** * Scores a string against another string. * 'Hello World'.score('he'); //=> 0.5931818181818181 * 'Hello World'.score('Hello'); //=> 0.7318181818181818 */ String.prototype.score=function(e,t){if(this==e)return 1;if(e=="")return 0;var n=0,r=e.length,i=this,s=i.length,o,u,a=1,f;for(var l=0,c,h,p,d,v,m;l-1?m:Math.max(d,v);if(h===-1){if(t){a+=1-t;continue}return 0}c=.1,i[h]===p&&(c+=.1),h===0?(c+=.6,l===0&&(o=1)):i.charAt(h-1)===" "&&(c+=.8),i=i.substring(h+1,s),n+=c}return u=n/r,f=(u*(r/s)+u)/2,f/=a,o&&f+.15<1&&(f+=.15),f}; /** * Fivefish Javascript * $Id$ * * @author Michael Granger * * Copyright © 2012, Michael Granger * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the author/s, nor the names of the project's * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ function initFivefish(){console.debug("Loaded. Waiting for DOM to be ready."),$(document).ready(onReady)}function hookTooltips(){$("header.hero-unit h1").popover({placement:"right"})}function hookSourceToggles(){$("div.method header i").click(function(e){var t=e.target,n=$(t).parents("div").get(0),r=$(n).find("div.method-source-code");console.debug("Toggling: %o",r),r.fadeToggle()})}function makeRankingTerm(e){return e.name.replace(/.*::/,"").toLowerCase()}function matchIndexItem(e){var t=this.query,n=makeRankingTerm(e),r=n.score(t,RankFuzziness);return r>=MatchThreshold?!0:!1}function sortIndexItems(e){var t=this.query;return e.sort(function(e,n){var r=makeRankingTerm(e),i=makeRankingTerm(n),s=r.score(t,RankFuzziness),o=i.score(t,RankFuzziness);return s>o?-1:s/g,"").replace(/\.(.|\n)*/,"."),n=pickItemIcon(e),r=makeRankingTerm(e),i=r.score(this.query,RankFuzziness),s=''+''+e.name+""+''+(i*10).toFixed()+""+"
"+''+t+""+"
",o=$(s);return o.data("searchitem",e),o}function updateSearchInput(e){var t=this.$menu.find(".active .search-item").data("searchitem");return console.debug("Updating search element for item %s",e),$("#navbar-search-target").val(t.link),t.name}function hookSearchForm(){$(".navbar-search .search-query").typeahead({source:SearchIndex,matcher:matchIndexItem,sorter:sortIndexItems,updater:updateSearchInput,highlighter:highlightMatchingItem}).change(function(e){var t=$("link[rel=prefix]").attr("href"),n=$("#navbar-search-target").val();n!=""?window.location.assign(t+"/"+n):console.error("Couldn't find selected element for change event %o.",e)})}function onSearchKey(e){$("input.search-query").focus()}function onReady(){console.debug("Ready!"),hookTooltips(),hookSourceToggles(),hookSearchForm(),$(document).bind("keydown","ctrl+/",onSearchKey)}const MatchThreshold=.5,RankFuzziness=.5;