Skip to content

Instantly share code, notes, and snippets.

@satyr satyr/noautohide.ubiq.js
Last active May 11, 2016

Embed
What would you like to do?
function cmd_toggle_autohide(){
displayMessage(toggleAutoHide(context.chromeWindow.gUbiquity), this);
}
function toggleAutoHide(U){
var p = U.msgPanel, nah = noAutoHide(p), b = nah !== 'on';
p.setAttribute('noautohide', b);
p[(b ? 'add' : 'remove') +'EventListener']('keydown', manualHide, false);
return nah;
}
function noAutoHide(p){
return p.getAttribute('noautohide') === 'true' ? 'on' : 'off';
}
function manualHide(e){
if(e.keyCode !== e.DOM_VK_ESCAPE) return;
e.preventDefault();
e.stopPropagation();
this.hidePopup();
}
CmdUtils.onUbiquityLoad(toggleAutoHide);
$.extend(cmd_toggle_autohide, {
icon: 'chrome://ubiquity/skin/icons/favicon.ico',
author: 'satyr', license: 'MIT',
}).__defineGetter__('description', function tah_desc(){
var U = (context.chromeWindow || Utils.currentChromeWindow).gUbiquity;
return ((U ? 'Turns '+ noAutoHide(U.msgPanel).bold() : 'Toggles') +
" the auto-hiding behavior of Ubiquity panel.");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.