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.
*/
hijackTitlebarButtons: function() {
Object.keys(this.titlebarDispatch).map(function(val, idx) {
let fInfo = firetrayChrome.replaceCommand(val, firetrayChrome.titlebarDispatch[val]['new']);
this.titlebarDispatch.forEach(function(button) {
let fInfo = firetrayChrome.replaceCommand(button.id, button.new);
if (fInfo) {
firetrayChrome.titlebarDispatch[val]['old'] = fInfo[0];
firetray_log.debug('replaced command='+val+' type='+fInfo[1]+' func='+fInfo[0]);
firetrayChrome.titlebarDispatch[val]['type'] = fInfo[1];
button.old = fInfo[0];
firetray_log.debug('replaced command='+button.id+' type='+fInfo[1]+' func='+fInfo[0]);
button.type = fInfo[1];
}
});
},
titlebarDispatch: {
"titlebar-min": {new: function(e){
titlebarDispatch: [
{id: "titlebar-min", new: function(e){
firetray_log.debug(' titlebar-min clicked');
if (!firetray.Handler.onMinimize(firetrayChrome.winId))
firetrayChrome.applyDefaultCommand("titlebar-min");
}, old: null, type: null},
"titlebar-close": {new: function(e){
{id: "titlebar-close", new: function(e){
firetray_log.debug(' titlebar-close clicked');
if (!firetrayChrome.onClose(null)) {
firetrayChrome.applyDefaultCommand("titlebar-close");
}
}, old: null, type: null}
},
],
replaceCommand: function(eltId, func) {
let elt = document.getElementById(eltId);