Skip to content

Instantly share code, notes, and snippets.

@fael
Created October 18, 2011 18:04
Show Gist options
  • Save fael/1296161 to your computer and use it in GitHub Desktop.
Save fael/1296161 to your computer and use it in GitHub Desktop.
Another jQuery Pattern Plugin
(function ($) {
$.extend({ //plugins without context. e.g: $.plugin();
firebugLite: function () {
var vars = {
keys: [],
sequence: "68,69,66,85,71",
loaded: false,
serviceURL: 'https://getfirebug.com/firebug-lite.js'
};
var fn = {
init: function () {
$(window).bind("keydown", events.onKey);
},
load: function () {
if (!vars.loaded) {
$.getScript(vars.serviceURL, function () {
vars.loaded = true;
});
}
}
};
var events = {
onKey: function (e) {
vars.keys.push(e.keyCode);
if (vars.keys.toString().indexOf(vars.sequence) == 0) {
fn.load();
}
}
};
fn.init();
}
});
$(function(){
$.firebugLite();
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment