From 215b630addbd68c4916f9dcf772f71bedab6a513 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 07:46:09 -0500 Subject: [PATCH 01/11] Fix copyright info in addons.jsm. --HG-- extra : transplant_source : %7C%B8a%3BI%F3%5C%F7%09%CA%DAp%16%AB%AC%E4%8F%F8%05%98 --- common/modules/addons.jsm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 8dad4c78..80090bb7 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -1,4 +1,5 @@ -// Copyright (c) 2011 by Kris Maglione +// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2010 by Doug Kearns // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. From 08104aee80b11c4e30259cd50df69763be40f219 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 08:53:58 -0500 Subject: [PATCH 02/11] Linkify 'restart' in :addons. --HG-- extra : transplant_source : %EA%88%BD%A9%8FB%DD%24%A4%CC%3E%F9I%87%FB%8A7%C8%11%CC --- common/content/dactyl.js | 3 +++ common/modules/addons.jsm | 8 ++++++-- common/skin/dactyl.css | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 8c65f810..d169299d 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -37,6 +37,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let elem = event.originalTarget; dactyl.help(elem.getAttribute("tag") || elem.textContent); }; + this.commands["dactyl.restart"] = function (event) { + dactyl.restart(); + }; }, cleanup: function () { diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 80090bb7..ed971c1c 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -145,6 +145,7 @@ var Addon = Class("Addon", { this.nodes = { commandTarget: this }; + XML.ignoreWhitespace = true; util.xmlToDom(
  • @@ -189,6 +190,9 @@ var Addon = Class("Addon", { compare: function compare(other) String.localeCompare(this.name, other.name), get statusInfo() { + XML.ignoreWhitespace = XML.prettyPrinting = false; + default xml namespace = XHTML; + let info = this.isActive ? enabled : disabled; @@ -205,7 +209,7 @@ var Addon = Class("Addon", { pending = ["Enabled", "upgraded"]; if (pending) return <>{info} ({pending[1]} -  on restart); +  on restart); return info; }, @@ -269,6 +273,7 @@ var AddonList = Class("AddonList", { message: Class.memoize(function () { + XML.ignoreWhitespace = true; util.xmlToDom(
    • Name @@ -535,7 +540,6 @@ var addonErrors = array.toObject([ [AddonManager.ERROR_CORRUPT_FILE, "The file appears to be corrupt"], [AddonManager.ERROR_FILE_ACCESS, "There was an error accessing the filesystem"]]); - endModule(); } catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); } diff --git a/common/skin/dactyl.css b/common/skin/dactyl.css index 116df39b..43788990 100644 --- a/common/skin/dactyl.css +++ b/common/skin/dactyl.css @@ -83,6 +83,9 @@ input[type=file][dactyl|highlight~=HintElem] { url-prefix(dactyl:), url-prefix(resource://dactyl) { +*:-moz-any-link { + color: green; +} *:-moz-any-link:hover { text-decoration: underline; } From 2df1de7ad1ce4c02fae8c163f232885633d62ebc Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 09:21:31 -0500 Subject: [PATCH 03/11] Fix wheel scrolling in the MOW. --HG-- extra : transplant_source : %BD%8C6%3DN%BB%CF%BB%9C.%1Cc%D7vpV%A2v%C3%06 --- common/content/commandline.js | 11 +++++++---- common/content/dactyl.js | 1 + common/content/statusline.js | 1 + common/modules/addons.jsm | 6 +++--- common/skin/dactyl.css | 1 - 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 075e3810..ddc8b55a 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -12,6 +12,7 @@ var CommandWidgets = Class("CommandWidgets", { init: function () { let _status = "dactyl-statusline-field-"; + XML.ignoreWhitespace = true; util.overlayWindow(window, { append: @@ -166,10 +167,9 @@ var CommandWidgets = Class("CommandWidgets", { let fontSize = util.computedStyle(document.documentElement).fontSize; styles.registerSheet("resource://dactyl-skin/dactyl.css"); styles.system.add("font-size", "dactyl://content/buffer.xhtml", - "body { font-size: " + fontSize + "; }"); - }, - cleanup: function cleanup() { - styles.unregisterSheet("resource://dactyl-skin/dactyl.css"); + "body { font-size: " + fontSize + "; } \ + html|html > xul|scrollbar { visibility: collapse !important; }", + true); }, addElement: function (obj) { const self = this; @@ -474,6 +474,9 @@ var CommandLine = Module("commandline", { dactyl.trapErrors(callback, self, value != null ? value : commandline.command); } }, + cleanup: function cleanup() { + styles.unregisterSheet("resource://dactyl-skin/dactyl.css"); + }, /** * Determines whether the command line should be visible. diff --git a/common/content/dactyl.js b/common/content/dactyl.js index d169299d..f05f893e 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -212,6 +212,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { bell: document.getElementById("dactyl-bell"), strut: document.getElementById("dactyl-bell-strut") } + XML.ignoreWhitespace = true; if (!elems.bell) util.overlayWindow(window, { objects: elems, diff --git a/common/content/statusline.js b/common/content/statusline.js index 84bafca4..090366ed 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -39,6 +39,7 @@ var StatusLine = Module("statusline", { ]]>)({ padding: util.OS.isMacOSX ? "padding-right: 10px !important;" : "" })); } + XML.ignoreWhitespace = true; let _commandline = "if (window.dactyl) return dactyl.modules.commandline"; let prepend = diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index ed971c1c..f3778cff 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -83,14 +83,14 @@ var actions = { enable: { name: "exte[nable]", description: "Enable an extension", - action: function (addon) addon.userDisabled = false, + action: function (addon) { addon.userDisabled = false; }, filter: function ({ item }) item.userDisabled, perm: "enable" }, disable: { name: "extd[isable]", description: "Disable an extension", - action: function (addon) addon.userDisabled = true, + action: function (addon) { addon.userDisabled = true; }, filter: function ({ item }) !item.userDisabled, perm: "disable" }, @@ -125,7 +125,7 @@ var actions = { toggle: { name: "extt[oggle]", description: "Toggle an extension's enabled status", - action: function (addon) addon.userDisabled = !addon.userDisabled + action: function (addon) { addon.userDisabled = !addon.userDisabled; } }, update: { name: "extu[pdate]", diff --git a/common/skin/dactyl.css b/common/skin/dactyl.css index 43788990..df1c4cfe 100644 --- a/common/skin/dactyl.css +++ b/common/skin/dactyl.css @@ -187,7 +187,6 @@ statusbarpanel { .dactyl-completions, #dactyl-multiline-output, #dactyl-multiline-input { - overflow: hidden; background-color: white; color: black; } From ef75a4c4142bd4c37d7080a10cb25b3888c86624 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 10:14:01 -0500 Subject: [PATCH 04/11] Add totals columns to the download manager. --HG-- extra : transplant_source : %A4%9E%BE%15.%EC%EFk%E1F%9D%A8%3A%D1E%06%5B%A9%60%1D --- common/modules/downloads.jsm | 33 ++++++++++++++++++++++++++++----- common/modules/util.jsm | 3 ++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index 1eb3acd1..6d15f788 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -190,15 +190,18 @@ var DownloadList = Class("DownloadList", Source
    • -
    • - Totals: +
    • + Totals:  Clear - - - + + / + + +
    , this.document, this.nodes); @@ -253,6 +256,25 @@ var DownloadList = Class("DownloadList", for (let node in values(this.nodes)) if (node.update && node.update != update) node.update(); + this.updateProgress(); + }, + + timeRemaining: Infinity, + + updateProgress: function updateProgress() { + let downloads = values(this.downloads).toArray(); + + let self = Object.create(this); + for (let prop in values(["amountTransferred", "size", "speed", "timeRemaining"])) + this[prop] = downloads.reduce(function (acc, dl) dl[prop] + acc, 0); + + Download.prototype.updateProgress.call(self); + + let active = downloads.filter(function (dl) dl.alive).length; + if (active) + this.nodes.total.textContent = active + " active"; + else for (let key in values(["total", "percent", "time"])) + this.nodes[key].textContent = ""; }, observers: { @@ -290,6 +312,7 @@ var DownloadList = Class("DownloadList", try { if (download.id in this.downloads) this.downloads[download.id].updateProgress(); + this.updateProgress(); } catch (e) { util.reportError(e); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index a58a116e..7ee979c8 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -672,6 +672,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), * @returns {string} */ formatSeconds: function formatSeconds(seconds) { + function pad(n, val) ("0000000" + val).substr(-Math.max(n, String(val).length)); function div(num, denom) [Math.round(num / denom), Math.round(num % denom)]; let days, hours, minutes; @@ -683,7 +684,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (hours) return hours + "h " + minutes + "m"; if (minutes) - return minutes + ":" + seconds; + return minutes + ":" + pad(2, seconds); return seconds + "s"; }, From 282bc0e3fa3b8b413ea4a12d90709d64a3aee106 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:31:44 -0500 Subject: [PATCH 05/11] Add horribly formatted :help versions page. --HG-- extra : transplant_source : %C3%C4%DAw9%B5%A8%3B%03y%9F%91X%1A%0Fk%14%B0%9F%02 --- common/content/dactyl.js | 66 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f05f893e..332f5672 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -619,8 +619,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }); // Process plugin help entries. - XML.ignoreWhiteSpace = false; - XML.prettyPrinting = false; + XML.ignoreWhiteSpace = XML.prettyPrinting = false; let body = XML(); for (let [, context] in Iterator(plugins.contexts)) @@ -654,6 +653,69 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { .toXMLString())); fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help]; + fileMap["versions"] = function () { + let NEWS = util.httpGet(config.addon.getResourceURI("NEWS").spec).responseText; + + let re = util.regexp( \s*) + (?P [-*+]) \x20 + (?P .*\n + (?: \1\x20\x20.*\n | \s*\n)* ) + | + (?P + (?: ^ [^\S\n]* + (?:[^-*+\s] | [-*+]\S) + .*\n + )+ + ) + | + (?: ^ [^\S\n]* \n) + + ]]>, "gmy"); + + default xml namespace = NS; + function rec(text, level) { + let res = <>; + let list, space; + + for (let match in re.iterate(text)) { + if (match.char) { + if (!list) + res += list =
      ; + list.* +=
    • {rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1)}
    • ; + } + else if (match.par) { + list = null; + if (level == 0 && /^.*:\n$/.test(match.par)) + res +=

      {template.linkifyHelp(match.par.slice(0, -1), true)}

      ; + else { + let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(match.par); + res +=

      { + a ? {a} : "" + }{ + template.linkifyHelp(b, true) + }

      ; + } + } + } + return res; + } + + XML.prettyPrinting = XML.ignoreWhitespace = false; + return ["application/xml", + '\n' + + '\n' + + '\n' + + unescape(encodeURI( // UTF-8 handling hack. + +

      Versions

      + + + {rec(NEWS, 0)} +
      .toXMLString())) + ] + } + default xml namespace = NS; overlayMap["index"] = function () ['text/xml;charset=UTF-8', From b36eb5e8a0bb82aec2701fcba5ee881d84d47866 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:41:49 -0500 Subject: [PATCH 06/11] Make :help versions slightly less horrible. --HG-- extra : transplant_source : %80%0F%11%F2%D5%25q%DF%FF%0D%9D%CD%9F%A2%DA%D5%E0%3C%C1%3D --- common/modules/config.jsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 29708a70..c81456da 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -592,8 +592,8 @@ var ConfigBase = Class("ConfigBase", { HelpOrderedList3;ol[level="3"],ol ol ol;dactyl://help/* list-style: outside lower-roman; HelpOrderedList4;ol[level="4"],ol ol ol ol;dactyl://help/* list-style: outside decimal; - HelpList;html|ul;dactyl://help/* display: block; list-style: outside disc; - HelpListItem;html|li;dactyl://help/* display: list-item; + HelpList;html|ul;dactyl://help/* display: block; list-style-position: outside; margin: 1em 0; + HelpListItem;html|li;dactyl://help/* display: list-item; HelpNote color: red; font-weight: bold; From 1f73e13ffe0b6783b6c49dfd8e5952a304ae9502 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:43:24 -0500 Subject: [PATCH 07/11] Extend previous change to OLs, too. --HG-- extra : transplant_source : %27m%E6%7E%FEU%5C%A8%93%82%DE%BA%96%23%C6%F5B%1CM%09 --- common/modules/config.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index c81456da..d87ea02b 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -586,7 +586,7 @@ var ConfigBase = Class("ConfigBase", { HelpTOC HelpTOC>ol ol margin-left: -1em; - HelpOrderedList;ol;dactyl://help/* + HelpOrderedList;ol;dactyl://help/* margin: 1em 0; HelpOrderedList1;ol[level="1"],ol;dactyl://help/* list-style: outside decimal; display: block; HelpOrderedList2;ol[level="2"],ol ol;dactyl://help/* list-style: outside upper-alpha; HelpOrderedList3;ol[level="3"],ol ol ol;dactyl://help/* list-style: outside lower-roman; From a7f885fa860906ae2799d02fb542e3758b104158 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:47:59 -0500 Subject: [PATCH 08/11] Fix some formatting issues in starting.xml. --HG-- extra : transplant_source : %CA%DC%2A%3A%A1%84W%CE%7F%27gk%BE%14%FC%EDf%BE%CE%D3 --- common/locale/en-US/starting.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/locale/en-US/starting.xml b/common/locale/en-US/starting.xml index 678a4f6e..eeedc1d1 100644 --- a/common/locale/en-US/starting.xml +++ b/common/locale/en-US/starting.xml @@ -17,7 +17,7 @@

      Command-line options can be passed to &dactyl.appName; via the -&dactyl.name; &dactyl.host; option. These are passed as single string argument. - E.g., &dactyl.hostbin; -&dactyl.name; ++cmd 'set exrc' +u 'tempRcFile' ++noplugin + E.g., &dactyl.hostbin; -&dactyl.name; ++cmd 'set exrc' +u 'tempRcFile' ++noplugin

      @@ -52,9 +52,9 @@

      The file rcfile is used for user initialization commands. If rcfile is - "NORC" then no startup initialization is performed except for the loading of + NORC then no startup initialization is performed except for the loading of plugins, i.e., steps 1. and 2. in initialization are skipped. If rcfile - is "NONE" then plugin loading is also skipped. + is NONE then plugin loading is also skipped.

      @@ -89,7 +89,7 @@ ~/_&dactyl.name;rc Windows only. If this file exists, its contents - are executed and $MY_&dactyl.idName;RC set to its path. + are executed and $MY_&dactyl.idName;RC set to its path.
    • ~/.&dactyl.name;rc @@ -116,8 +116,8 @@
      • noloadplugins is set,
      • -
      • the ++noplugin command-line option was specified, or
      • -
      • the +u=NONE command-line option was specified.
      • +
      • the ++noplugin command-line option was specified, or
      • +
      • the +u=NONE command-line option was specified.

      @@ -132,11 +132,11 @@

        -
      • On Unix and Mac, the environment variable $HOME is used.
      • +
      • On Unix and Mac, the environment variable $HOME is used.
      • On Windows, &dactyl.appName; checks for the existence of - %HOME%, then %USERPROFILE%, and then - %HOMEDRIVE%%HOMEPATH%. It uses the first one it + %HOME%, then %USERPROFILE%, and then + %HOMEDRIVE%%HOMEPATH%. It uses the first one it finds.
      From 772a942050e2f1d25c0cd0b83383a51e4c8d681d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:48:49 -0500 Subject: [PATCH 09/11] Fix some formatting issues in starting.xml. --HG-- extra : transplant_source : %B0V%0D%E6%E5%7C%FF%15%95%E0%00%AFP%22%A3P%13%A2%BDd --- common/locale/en-US/starting.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/locale/en-US/starting.xml b/common/locale/en-US/starting.xml index eeedc1d1..2205d601 100644 --- a/common/locale/en-US/starting.xml +++ b/common/locale/en-US/starting.xml @@ -22,6 +22,7 @@ +c + +c command

      @@ -35,6 +36,7 @@ ++cmd + ++cmd command

      @@ -48,6 +50,7 @@ +u + +u rcfile

      @@ -61,6 +64,7 @@ ++noplugin + ++noplugin

      Prevents plugin scripts from being loaded at startup. See loadplugins.

      From bb63c1ff42b2da8d79b247d2b225ebd88dba8eaa Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:49:49 -0500 Subject: [PATCH 10/11] Fix some formatting issues in starting.xml. --HG-- extra : transplant_source : %92qD%99N%C9t%E7K%19%7D%D6%D1%A2%8Eq%5C%87%F3k --- common/locale/en-US/starting.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locale/en-US/starting.xml b/common/locale/en-US/starting.xml index 2205d601..cd9ca6c9 100644 --- a/common/locale/en-US/starting.xml +++ b/common/locale/en-US/starting.xml @@ -170,7 +170,7 @@ :res :restart :restart - +

      Force &dactyl.host; to restart. Useful when installing extensions.

      From acf73951d47804e93ea8b83d1bfb26fa075a98c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 24 Jan 2011 21:58:33 +0100 Subject: [PATCH 11/11] Add tags et al. for the versions help page. --HG-- extra : transplant_source : qA%92iB%F2%DFC%AC%1D%D5%02%F2w%98%1B%0A2%FF%FD --- common/content/about.xul | 4 +--- common/content/dactyl.js | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/common/content/about.xul b/common/content/about.xul index 353a2eea..433402c8 100644 --- a/common/content/about.xul +++ b/common/content/about.xul @@ -22,9 +22,7 @@ by Kris Maglione, Doug Kearns, et al. type :q<Enter> to exit type :help<Enter> or <F1> for on-line help type :help faq<Enter> for the FAQ page - +type :help versions<Enter> for version info diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 332f5672..6293114c 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -708,13 +708,14 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { unescape(encodeURI( // UTF-8 handling hack. -

      Versions

      +

      {config.appName} Versions

      {rec(NEWS, 0)}
      .toXMLString())) ] } + addTags("versions", util.httpGet("dactyl://help/versions").responseXML); default xml namespace = NS;