diff --git a/common/content/configbase.js b/common/content/configbase.js index c2ceda2d..62d681bd 100644 --- a/common/content/configbase.js +++ b/common/content/configbase.js @@ -27,26 +27,29 @@ the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ const configbase = { //{{{ - features: [], + autocommands: [], + + get browserModes() [modes.NORMAL], defaults: { guioptions: "rb" }, - guioptions: {}, - - autocommands: [], - dialogs: [], + features: [], + + guioptions: {}, + hasTabbrowser: false, - // they are sorted by relevance, not alphabetically helpFiles: [], + init: function () {}, + + ignoreKeys: {}, + optionDefaults: {}, scripts: [], - - init: function () {}, }; //}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/common/content/events.js b/common/content/events.js index 85af0be7..16795590 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1014,10 +1014,8 @@ function Events() //{{{ if (this.duringFeed != "") { - //Create a scalar constant for closure. let duringFeed = this.duringFeed; this.duringFeed = ""; - setTimeout(function () events.feedkeys(duringFeed, false, false, true), 0); } } @@ -1458,13 +1456,8 @@ function Events() //{{{ // XXX: ugly hack for now pass certain keys to Firefox as they are without beeping // also fixes key navigation in combo boxes, submitting forms, etc. // FIXME: breaks iabbr for now --mst - if (((config.name == "Xulmus" || config.name == "Vimperator") && liberator.mode == modes.NORMAL || liberator.mode == modes.INSERT)) - { - if (key == "") - return false; - else if (key == "" || key == "" || key == "") - return false; - } + if (key in config.ignoreKeys && (config.ignoreKeys[key] & liberator.mode)) + return false; // TODO: handle middle click in content area @@ -1601,8 +1594,8 @@ function Events() //{{{ else // if the key is neither a mapping nor the start of one { // the mode checking is necessary so that things like g do not beep - if (input.buffer != "" && !skipMap && (liberator.mode == modes.INSERT || - liberator.mode == modes.COMMAND_LINE || liberator.mode == modes.TEXTAREA)) + if (input.buffer != "" && !skipMap && + (liberator.mode & (modes.INSERT | modes.COMMAND_LINE | modes.TEXTAREA))) { // no map found -> refeed stuff in input.buffer (only while in INSERT, CO... modes) skipMap = true; // ignore maps while doing so diff --git a/common/content/liberator-overlay.js b/common/content/liberator-overlay.js index d7890d8a..9367098c 100644 --- a/common/content/liberator-overlay.js +++ b/common/content/liberator-overlay.js @@ -33,6 +33,7 @@ ["services.js", "liberator.js", + "configbase.js", "config.js", "util.js", "style.js", @@ -50,9 +51,9 @@ "template.js", "ui.js"].forEach(load); + modules.config.__proto__ = modules.configbase; prefix.unshift("chrome://" + modules.config.name.toLowerCase() + "/content/"); - if (modules.config.scripts) - modules.config.scripts.forEach(load); + modules.config.scripts.forEach(load); })() diff --git a/common/content/liberator.js b/common/content/liberator.js index a5c62840..f42b47cd 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1232,25 +1232,7 @@ const liberator = (function () //{{{ let start = Date.now(); liberator.log("Initializing liberator object...", 0); - config.features = config.features || []; config.features.push(getPlatformFeature()); - config.defaults = config.defaults || {}; - config.guioptions = config.guioptions || {}; - - // -> we can't use this, since config.browserModes might already be defined as a getter-only - // TODO: also change the other config.* defaults? - // config.browserModes = config.browserModes || [modes.NORMAL]; - if (!config.browserModes) - config.browserModes = [modes.NORMAL]; - config.mailModes = config.mailModes || [modes.NORMAL]; - // TODO: suitable defaults? - //config.mainWidget - //config.mainWindowID - //config.visualbellWindow - //config.styleableChrome - config.autocommands = config.autocommands || []; - config.dialogs = config.dialogs || []; - config.helpFiles = config.helpFiles || []; try { diff --git a/common/content/mappings.js b/common/content/mappings.js index c0202662..016bc5c8 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -28,8 +28,6 @@ the terms of any one of the MPL, the GPL or the LGPL. /** @scope modules */ -// Do NOT create instances of this class yourself, use the helper method -// mappings.add() instead /** * A class representing key mappings. Instances are created by the * {@link Mappings} class. diff --git a/common/content/tabs.js b/common/content/tabs.js index 53d96013..99061b9b 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -110,7 +110,7 @@ function Tabs() //{{{ } // hide tabs initially - if (config.name == "Vimperator") + if (config.hasTabbrowser) getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true; /////////////////////////////////////////////////////////////////////////////}}} diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 88e585f2..cad178f7 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -122,6 +122,16 @@ const config = { //{{{ "various.html", "index.html", "version.html" ], + get ignoreKeys() { + delete this.ignoreKeys; + return this.ignoreKeys = { + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + } + }, + optionDefaults: { showtabline: 2, }, diff --git a/xulmus/content/config.js b/xulmus/content/config.js index e0c477f9..004c8500 100644 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -165,6 +165,16 @@ const config = { //{{{ modes: [["PLAYER", { char: "p" }]], + get ignoreKeys() { + delete this.ignoreKeys; + return this.ignoreKeys = { + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + "": modes.NORMAL | modes.INSERT, + } + }, + optionDefaults: { showtabline: 2, },