/* * 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); /** * Fivefish Javascript * $Id$ * * @author Michael Granger * */ /** * A Bootstrap component for the index search interface. Inherits from Bootstrap's * modal component, and borrows a bunch of code from the typeahead component. * * @version $Rev$ * @requires bootstrap.modal.js */ function initFivefish(){console.debug("Loaded. Waiting for DOM to be ready."),$(document).ready(onReady)}function hookTooltips(){$("header.hero-unit h1").popover({placement:"right"})}function hookKeyboardShortcuts(){$.each(keyboardShortcuts,function(a,b){console.debug("Registering shortcut: %s -> %o",a,b),$("body").bind("keyup",a,b)})}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 doIncrementalSearch(){}function hookSearchOverlay(){console.debug("Setting up searchbox"),$("#incremental-search").searchbox(SearchIndex),$("#search-button").click(function(){$("#incremental-search").searchbox("show")})}function onReady(){console.debug("Ready!"),hookTooltips(),hookKeyboardShortcuts(),hookSourceToggles(),hookSearchOverlay()}(function(a){"use strict";var b=function(a,b){this.init("searchbox",a,b)};b.prototype=a.extend({},a.fn.modal.Constructor.prototype,{constructor:b,init:function(b,c,d){this.$element=a(b),this.$input=this.$element.find(".search-input"),this.$meth_list=this.$element.find(".method-search-results dl"),this.$mod_list=this.$element.find(".module-search-results dl"),this.$file_list=this.$element.find(".file-search-results dl"),this.options=d,this.data(c),this.listen()},data:function(a){return a&&(console.debug("Populating searchbox with index data: %o",a),this.data=a),this.data},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this))},keyup:function(a){var b=a.which;console.debug("Keycode: %d",b),b===27&&this.hide(),a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()}}),a.fn.searchbox=function(c,d){return this.each(function(){var e=a(this),f=e.data("searchbox"),g=typeof c=="object"?c:[],h=a.extend({},a.fn.modal.defaults,e.data(),typeof d=="object"&&d);f||(console.debug("Creating a new searchbox for data: %s",typeof g),f=new b(this,g,h),e.data("searchbox",f)),typeof c=="string"&&f[c]()})},a.fn.searchbox.Constructor=b,a.fn.searchbox.defaults=a.extend({},a.fn.modal.defaults)})(window.jQuery);var keyboardShortcuts={"/":function(a){$("#incremental-search").searchbox("show")},"shift+/":function(a){$("#shortcut-help").modal()}};