/* * 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(a){function b(b){var d=a(this),e=a(a(this).attr("data-dropdown")),f=d.hasClass("dropdown-open");b.preventDefault(),b.stopPropagation(),c();if(f||d.hasClass("dropdown-disabled"))return;e.css({left:e.hasClass("anchor-right")?d.offset().left-(e.outerWidth()-d.outerWidth()):d.offset().left,top:d.offset().top+d.outerHeight()}).show(),d.addClass("dropdown-open")}function c(b){var c=b?a(b.target).parents().andSelf():null;if(c&&c.is(".dropdown-menu")&&!c.is("A"))return;a("BODY").find(".dropdown-menu").hide().end().find("[data-dropdown]").removeClass("dropdown-open")}a.extend(a.fn,{dropdown:function(b,d){switch(b){case"hide":return c(),a(this);case"attach":return a(this).attr("data-dropdown",d);case"detach":return c(),a(this).removeAttr("data-dropdown");case"disable":return a(this).addClass("dropdown-disabled");case"enable":return c(),a(this).removeClass("dropdown-disabled")}}}),a(function(){a("BODY").on("click.dropdown","[data-dropdown]",b),a("HTML").on("click.dropdown",c)})}(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(a){function b(b){if(typeof b.data!="string")return;var c=b.handler,d=b.data.toLowerCase().split(" ");b.handler=function(b){if(!(this===b.target||!/textarea|select/i.test(b.target.nodeName)&&b.target.type!=="text"))return;var e=b.type!=="keypress"&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g,h="",i={};b.altKey&&e!=="alt"&&(h+="alt+"),b.ctrlKey&&e!=="ctrl"&&(h+="ctrl+"),b.metaKey&&!b.ctrlKey&&e!=="meta"&&(h+="meta+"),b.shiftKey&&e!=="shift"&&(h+="shift+"),e?i[h+e]=!0:(i[h+f]=!0,i[h+a.hotkeys.shiftNums[f]]=!0,h==="shift+"&&(i[a.hotkeys.shiftNums[f]]=!0));for(var j=0,k=d.length;j","/":"?","\\":"|"}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})})(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(a,b){if(this==a)return 1;if(a=="")return 0;var c=0,d=a.length,e=this,f=e.length,g,h,i=1,j;for(var k=0,l,m,n,o,p,q;k-1?q:Math.max(o,p);if(m===-1){if(b){i+=1-b;continue}return 0}l=.1,e[m]===n&&(l+=.1),m===0?(l+=.6,k===0&&(g=1)):e.charAt(m-1)===" "&&(l+=.8),e=e.substring(m+1,f),c+=l}return h=c/d,j=(h*(d/f)+h)/2,j/=i,g&&j+.15<1&&(j+=.15),j}; /** * 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(a){var b=a.target,c=$(b).parents("div").get(0),d=$(c).find("div.method-source-code");console.debug("Toggling: %o",d),d.fadeToggle()})}function makeRankingTerm(a){return a.name.replace(/.*::/,"").toLowerCase()}function matchIndexItem(a){var b=this.query,c=makeRankingTerm(a),d=c.score(b,RankFuzziness);return d>=MatchThreshold?!0:!1}function sortIndexItems(a){var b=this.query;return a.sort(function(a,c){var d=makeRankingTerm(a),e=makeRankingTerm(c),f=d.score(b,RankFuzziness),g=e.score(b,RankFuzziness);return f>g?-1:f/g,"").replace(/\.(.|\n)*/,"."),c=pickItemIcon(a),d=makeRankingTerm(a),e=d.score(this.query,RankFuzziness),f=''+''+a.name+""+''+(e*10).toFixed()+""+"
"+''+b+""+"
",g=$(f);return g.data("searchitem",a),g}function updateSearchInput(a){var b=this.$menu.find(".active .search-item").data("searchitem");return $("#navbar-search-target").val(b.link),b.name}function hookSearchForm(){$(".navbar-search .search-query").typeahead({source:SearchIndex,matcher:matchIndexItem,sorter:sortIndexItems,updater:updateSearchInput,highlighter:highlightMatchingItem}).change(function(){var a=$("link[rel=prefix]").attr("href"),b=$("#navbar-search-target").val();window.location.assign(a+"/"+b)})}function onSearchKey(a){$("input.search-query").focus()}function onReady(){console.debug("Ready!"),hookTooltips(),hookSourceToggles(),hookSearchForm(),$(document).bind("keydown","ctrl+/",onSearchKey)}const MatchThreshold=.5,RankFuzziness=.5;