diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-08-11 14:03:17 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-08-11 14:03:17 -0400 |
commit | c4a40df0b79f9f9f56bfd22adf72ed5d9de9cccc (patch) | |
tree | fabe7f723dbae5992205592acc594eb5ba4420d8 /common | |
parent | ac3f218620ac77a2809346c50bcd752fb62db839 (diff) | |
download | pentadactyl-c4a40df0b79f9f9f56bfd22adf72ed5d9de9cccc.tar.gz |
Add n_s and n_S.
Diffstat (limited to 'common')
-rw-r--r-- | common/content/browser.js | 8 | ||||
-rw-r--r-- | common/content/history.js | 32 | ||||
-rw-r--r-- | common/locale/en-US/browsing.xml | 36 | ||||
-rw-r--r-- | common/modules/base.jsm | 6 | ||||
-rw-r--r-- | common/modules/sanitizer.jsm | 20 |
5 files changed, 64 insertions, 38 deletions
diff --git a/common/content/browser.js b/common/content/browser.js index 5a6ba5ef..38ffda2c 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -220,6 +220,14 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), "Open one or more URLs, based on current location", function () { CommandExMode().open("open " + decode(buffer.uri.spec)); }); + mappings.add([modes.NORMAL], ["s"], + "Open a search prompt", + function () { CommandExMode().open("open " + options["defsearch"] + " "); }); + + mappings.add([modes.NORMAL], ["S"], + "Open a search prompt for a new tab", + function () { CommandExMode().open("tabopen " + options["defsearch"] + " "); }); + mappings.add([modes.NORMAL], ["t"], "Open one or more URLs in a new tab", function () { CommandExMode().open("tabopen "); }); diff --git a/common/content/history.js b/common/content/history.js index cbd62a94..5218a81d 100644 --- a/common/content/history.js +++ b/common/content/history.js @@ -21,19 +21,18 @@ var History = Module("history", { for (let [k, v] in Iterator(filter)) query[k] = v; - order = order || "+date"; - dactyl.assert((order = /^([+-])(.+)/.exec(order)) && - (order = "SORT_BY_" + order[2].toUpperCase() + "_" + - (order[1] == "+" ? "ASCENDING" : "DESCENDING")) && - order in options, - _("error.invalidSort", order)); - - options.sortingMode = options[order]; + let _order = /^([+-])(.+)/.exec(order || "+date"); + dactyl.assert(_order, _("error.invalidSort", order)); + + _order = "SORT_BY_" + _order[2].toUpperCase() + "_" + + (_order[1] == "+" ? "ASCENDING" : "DESCENDING"); + dactyl.assert(_order in options, _("error.invalidSort", order)); + + options.sortingMode = options[_order]; options.resultType = options.RESULTS_AS_URI; if (maxItems > 0) options.maxResults = maxItems; - // execute the query let root = services.history.executeQuery(query, options).root; root.containerOpen = true; let items = iter(util.range(0, root.childCount)).map(function (i) { @@ -44,7 +43,7 @@ var History = Module("history", { icon: node.icon ? node.icon : DEFAULT_FAVICON }; }).toArray(); - root.containerOpen = false; // close a container after using it! + root.containerOpen = false; return items; }, @@ -58,12 +57,11 @@ var History = Module("history", { obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val) }); obj.__iterator__ = function () array.iterItems(this); - for (let i in util.range(0, sh.count)) { - obj[i] = update(Object.create(sh.getEntryAtIndex(i, false)), - { index: i }); - memoize(obj[i], "icon", - function () services.favicon.getFaviconImageForPage(this.URI).spec); - } + for (let item in iter(sh.SHistoryEnumerator, Ci.nsIHistoryEntry)) + obj.push(update(Object.create(item), { + index: obj.length, + icon: Class.memoize(function () services.favicon.getFaviconImageForPage(this.URI).spec) + })); return obj; }, @@ -87,7 +85,7 @@ var History = Module("history", { try { sh.index = Math.constrain(sh.index + steps, 0, sh.length - 1); } - catch (e) {} // We get NS_ERROR_FILE_NOT_FOUND if files in history don't exist + catch (e if e.result == Cr.NS_ERROR_FILE_NOT_FOUND) {} }, /** diff --git a/common/locale/en-US/browsing.xml b/common/locale/en-US/browsing.xml index f94e21a1..7ec79549 100644 --- a/common/locale/en-US/browsing.xml +++ b/common/locale/en-US/browsing.xml @@ -87,6 +87,16 @@ </item> <item> + <tags>O</tags> + <spec>O</spec> + <description short="true"> + <p> + Open an <ex>:open</ex> prompt followed by the current URL. + </p> + </description> +</item> + +<item> <tags>T</tags> <spec>T</spec> <description short="true"> @@ -97,6 +107,22 @@ </item> <item> + <tags>s</tags> + <spec>s</spec> + <description short="true"> + <p>Open a search prompt.</p> + </description> +</item> + +<item> + <tags>S</tags> + <spec>S</spec> + <description short="true"> + <p>Open a search prompt for a new tab.</p> + </description> +</item> + +<item> <tags>:tabdu :tabduplicate</tags> <spec>:<oa>count</oa>tabdu<oa>plicate</oa><oa>!</oa></spec> <description> @@ -109,16 +135,6 @@ </item> <item> - <tags>O</tags> - <spec>O</spec> - <description short="true"> - <p> - Open an <ex>:open</ex> prompt followed by the current URL. - </p> - </description> -</item> - -<item> <tags>w :winopen :wopen</tags> <spec>:wino<oa>pen</oa><oa>!</oa> <oa>args</oa></spec> <spec>w</spec> diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 066db165..0c8c82f4 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -1297,9 +1297,13 @@ function octal(decimal) parseInt(decimal, 8); * function. * * @param {object} obj + * @param {nsIJSIID} iface The interface to which to query all elements. * @returns {Generator} */ -function iter(obj) { +function iter(obj, iface) { + if (arguments.length == 2 && iface instanceof Ci.nsIJSIID) + return iter(obj).map(function (item) item.QueryInterface(iface)); + let args = arguments; let res = Iterator(obj); diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index ef45cf5a..886121d1 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -369,19 +369,17 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(), iterCookies: function iterCookies(host) { - for (let c in iter(services.cookies)) { - c.QueryInterface(Ci.nsICookie2); - if (!host || util.isSubdomain(c.rawHost, host) || c.host[0] == "." && c.host.length < host.length && host.indexOf(c.host) == host.length - c.host.length) + for (let c in iter(services.cookies, Ci.nsICookie2)) + if (!host || util.isSubdomain(c.rawHost, host) || + c.host[0] == "." && c.host.length < host.length + && host.indexOf(c.host) == host.length - c.host.length) yield c; - } }, iterPermissions: function iterPermissions(host) { - for (let p in iter(services.permissions)) { - p.QueryInterface(Ci.nsIPermission); + for (let p in iter(services.permissions, Ci.nsIPermission)) if (!host || util.isSubdomain(p.host, host)) yield p; - } } }, { load: function (dactyl, modules, window) { @@ -390,16 +388,18 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef sanitizer.ranAtShutdown = false; }, autocommands: function (dactyl, modules, window) { + const { autocommands } = modules; + storage.addObserver("private-mode", function (key, event, value) { - modules.autocommands.trigger("PrivateMode", { state: value }); + autocommands.trigger("PrivateMode", { state: value }); }, window); storage.addObserver("sanitizer", function (key, event, value) { if (event == "domain") - modules.autocommands.trigger("SanitizeDomain", { domain: value }); + autocommands.trigger("SanitizeDomain", { domain: value }); else if (!value[1]) - modules.autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] }); + autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] }); }, window); }, commands: function (dactyl, modules, window) { |