diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js index 3367f21..e8319fe 100644 --- a/src/chrome/content/overlay.js +++ b/src/chrome/content/overlay.js @@ -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);