Cleaning.

This commit is contained in:
foudfou 2014-05-25 21:52:06 +02:00
parent be74126c96
commit 7aca24c88a
1 changed files with 9 additions and 10 deletions

View File

@ -74,30 +74,29 @@ var firetrayChrome = { // each new window gets a new firetrayChrome !
* we override the fake buttons' default actions. * we override the fake buttons' default actions.
*/ */
hijackTitlebarButtons: function() { hijackTitlebarButtons: function() {
Object.keys(this.titlebarDispatch).map(function(val, idx) { this.titlebarDispatch.forEach(function(button) {
let fInfo = firetrayChrome.replaceCommand(val, firetrayChrome.titlebarDispatch[val]['new']); let fInfo = firetrayChrome.replaceCommand(button.id, button.new);
if (fInfo) { if (fInfo) {
firetrayChrome.titlebarDispatch[val]['old'] = fInfo[0]; button.old = fInfo[0];
firetray_log.debug('replaced command='+val+' type='+fInfo[1]+' func='+fInfo[0]); firetray_log.debug('replaced command='+button.id+' type='+fInfo[1]+' func='+fInfo[0]);
firetrayChrome.titlebarDispatch[val]['type'] = fInfo[1]; button.type = fInfo[1];
} }
}); });
}, },
titlebarDispatch: { titlebarDispatch: [
"titlebar-min": {new: function(e){ {id: "titlebar-min", new: function(e){
firetray_log.debug(' titlebar-min clicked'); firetray_log.debug(' titlebar-min clicked');
if (!firetray.Handler.onMinimize(firetrayChrome.winId)) if (!firetray.Handler.onMinimize(firetrayChrome.winId))
firetrayChrome.applyDefaultCommand("titlebar-min"); firetrayChrome.applyDefaultCommand("titlebar-min");
}, old: null, type: null}, }, old: null, type: null},
{id: "titlebar-close", new: function(e){
"titlebar-close": {new: function(e){
firetray_log.debug(' titlebar-close clicked'); firetray_log.debug(' titlebar-close clicked');
if (!firetrayChrome.onClose(null)) { if (!firetrayChrome.onClose(null)) {
firetrayChrome.applyDefaultCommand("titlebar-close"); firetrayChrome.applyDefaultCommand("titlebar-close");
} }
}, old: null, type: null} }, old: null, type: null}
}, ],
replaceCommand: function(eltId, func) { replaceCommand: function(eltId, func) {
let elt = document.getElementById(eltId); let elt = document.getElementById(eltId);