From 012732edc77a1596b34cdba9b4ac94b29da7648b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 31 Dec 2010 02:11:48 -0500 Subject: Decent filtering for :extrehash. Fix tab bar layout after rehash with go+=n. Cleanup. --- common/content/commandline.js | 2 +- common/content/commands.js | 19 +++++++++++-------- common/content/dactyl.js | 9 ++++++--- common/content/tabs.js | 2 ++ 4 files changed, 20 insertions(+), 12 deletions(-) (limited to 'common/content') diff --git a/common/content/commandline.js b/common/content/commandline.js index 4b297915..76296218 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -160,7 +160,7 @@ var CommandWidgets = Class("CommandWidgets", { } }); - let fontSize = util.computedStyle(document.getElementById(config.mainWindowId)).fontSize; + let fontSize = util.computedStyle(document.documentElement).fontSize; styles.registerSheet("chrome://dactyl/skin/dactyl.css"); styles.system.add("font-size", "chrome://dactyl/content/buffer.xhtml", "body { font-size: " + fontSize + "; }"); diff --git a/common/content/commands.js b/common/content/commands.js index 9f1d2624..eb10a156 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -318,13 +318,15 @@ var Command = Class("Command", { }, { bindMacro: function (args, default_, params) { let process = util.identity; - let makeParams = function makeParams() - let (args = arguments) - params.map(function (name, i) [name, process(args[i])]).toObject(); + if (callable(params)) - makeParams = function makeParams(args) array(Iterator(params.apply(this, arguments))).map(function ([k, v]) [k, process(v)]).toObject(); + function makeParams(self, args) + array.toObject([[k, process(v)] + for ([k, v] in iter(params.apply(this, args)))]) else if (params) - params = array(params); + function makeParams(self, args) + array.toObject([[name, process(args[i])] + for ([i, name] in Iterator(params))]); let rhs = args.literalArg; let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_); @@ -335,18 +337,19 @@ var Command = Class("Command", { case "-keys": let silent = args["-silent"]; rhs = events.canonicalKeys(rhs, true); - var action = function action(args) events.feedkeys(action.macro(args), noremap, silent); + var action = function action() events.feedkeys(action.macro(makeParams(this, arguments)), + noremap, silent); action.macro = util.compileMacro(rhs, true); break; case "-ex": - action = function action() commands.execute(action.macro, makeParams.apply(this, arguments), + action = function action() commands.execute(action.macro, makeParams(this, arguments), false, null, action.sourcing); action.macro = util.compileMacro(rhs, true); action.sourcing = io.sourcing && update({}, io.sourcing); break; case "-javascript": if (callable(params)) - action = dactyl.userEval("(function action() { with (action.makeParams.apply(this, arguments)) {" + args.literalArg + "} })"); + action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })"); else action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array); process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index e568c43d..e77d04a0 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -601,7 +601,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { if (context && context.INFO instanceof XML) { let info = context.INFO; if (info.*.@lang.length()) { - let langs = set([String(a) for each (a in info.*.@lang)]); + let langs = set(String(a) for each (a in info.*.@lang)); let lang = [window.navigator.language, window.navigator.language.replace(/-.*/, ""), "en", "en-US", info.*.@lang[0] @@ -1477,7 +1477,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { function () { dactyl.quit(true); }); }, - commands: function (_dactyl, _modules, _window) { + commands: function () { commands.add(["addo[ns]"], "Manage available Extensions and Themes", function () { @@ -1667,7 +1667,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { addon.userDisabled = false; }); }, - filter: function ({ item }) !item.userDisabled, + get filter() { + let ids = set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}")))); + return function ({ item }) !item.userDisabled && set.has(ids, item.id); + }, perm: "disable" }, { diff --git a/common/content/tabs.js b/common/content/tabs.js index 404f5969..0583c177 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -973,6 +973,8 @@ var Tabs = Module("tabs", { } if (value !== "multitab" || !dactyl.has("Gecko2")) config.tabStrip.collapsed = false; + if (config.tabbrowser.tabContainer._positionPinnedTabs) + config.tabbrowser.tabContainer._positionPinnedTabs(); return value; }, completer: function (context) [ -- cgit v1.2.3