diff options
author | Kris Maglione <maglione.k@gmail.com> | 2010-12-23 20:25:09 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2010-12-23 20:25:09 -0500 |
commit | 909a6583386203d54d4222c5c552a52303b8e2fb (patch) | |
tree | 952651c25847e79fbf7dc7852a185c2cab34a5b6 | |
parent | c66701339fe5a375b0d609ae1b9b731ac2430ca3 (diff) | |
download | pentadactyl-909a6583386203d54d4222c5c552a52303b8e2fb.tar.gz |
Some minor improvements to the previous changeset.
--HG--
branch : bootstrapped
-rw-r--r-- | common/content/dactyl.xul | 5 | ||||
-rw-r--r-- | common/content/statusline.js | 75 | ||||
-rw-r--r-- | common/modules/util.jsm | 2 |
3 files changed, 39 insertions, 43 deletions
diff --git a/common/content/dactyl.xul b/common/content/dactyl.xul index d800941f..20fc35f8 100644 --- a/common/content/dactyl.xul +++ b/common/content/dactyl.xul @@ -9,12 +9,9 @@ --> <?xml-stylesheet href="chrome://dactyl/skin/dactyl.css" type="text/css"?> + <!DOCTYPE overlay SYSTEM "dactyl.dtd" [ - <!ENTITY and "&&"> <!ENTITY dactyl.content "chrome://dactyl/content/"> - <!ENTITY commandline "if (window.dactyl) return dactyl.modules.commandline"> - <!ENTITY events "if (window.dactyl ∧ dactyl.modules.loaded.events) return dactyl.modules.events"> - <!ENTITY status "dactyl-statusline-field-"> ]> <overlay id="dactyl" diff --git a/common/content/statusline.js b/common/content/statusline.js index acd906ed..0d1a2f9d 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -12,52 +12,51 @@ const StatusLine = Module("statusline", { init: function () { let _commandline = "if (window.dactyl) return dactyl.modules.commandline"; - let _status = "dactyl-statusline-field-"; + let append = <e4x xmlns={XUL} xmlns:dactyl={NS}> + <statusbar id="status-bar" dactyl:highlight="StatusLine StatusNormal"> + <!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" --> + <hbox + style="background: inherit;" key="container" flex="1" hidden="false" align="center"> + <stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> + <hbox class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> + <label class="plain" key="mode" crop="end" collapsed="true"/> + <stack flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> + <textbox class="plain" key="url" crop="end" flex="1" readonly="true"/> + <textbox class="plain" key="message" crop="end" flex="1" readonly="true" dactyl:highlight="Normal StatusNormal"/> + </stack> + </hbox> + + <hbox key="commandline" hidden="false" class="dactyl-container" dactyl:highlight="Normal StatusNormal" collapsed="true"> + <label key="commandline-prompt" class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/> + <textbox key="commandline-command" class="dactyl-commandline-command plain" flex="1" type="text" timeout="100" + oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"} + onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/> + </hbox> + </stack> + <label class="plain" key="inputbuffer" flex="0"/> + <label class="plain" key="progress" flex="0"/> + <label class="plain" key="tabcount" flex="0"/> + <label class="plain" key="bufferposition" flex="0"/> + <label class="plain" key="zoomlevel" flex="0"/> + </hbox> + <!-- just hide them since other elements expect them --> + <statusbarpanel id="statusbar-display" hidden="true"/> + <statusbarpanel id="statusbar-progresspanel" hidden="true"/> + </statusbar> + </e4x>; + + for each (let attr in append..@key) + attr.parent().@id = "dactyl-statusline-field-" + attr; util.overlayWindow(window, { - append: <e4x xmlns={XUL} xmlns:dactyl={NS}> - <statusbar id="status-bar" dactyl:highlight="StatusLine StatusNormal"> - <!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" --> - <hbox - style="background: inherit;" id={_status + "container"} flex="1" hidden="false" align="center"> - <stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> - <hbox class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> - <label class="plain" id={_status + "mode"} crop="end" collapsed="true"/> - <stack flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine"> - <textbox class="plain" id={_status + "url"} crop="end" flex="1" readonly="true"/> - <textbox class="plain" id={_status + "message"} crop="end" flex="1" readonly="true" dactyl:highlight="Normal StatusNormal"/> - </stack> - </hbox> - - <hbox id={_status + "commandline"} hidden="false" class="dactyl-container" dactyl:highlight="Normal StatusNormal" collapsed="true"> - <label id={_status + "commandline-prompt"} class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/> - <textbox id={_status + "commandline-command"} class="dactyl-commandline-command plain" flex="1" type="text" timeout="100" - oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"} - onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/> - </hbox> - </stack> - <label class="plain" id={_status + "inputbuffer"} flex="0"/> - <label class="plain" id={_status + "progress"} flex="0"/> - <label class="plain" id={_status + "tabcount"} flex="0"/> - <label class="plain" id={_status + "bufferposition"} flex="0"/> - <label class="plain" id={_status + "zoomlevel"} flex="0"/> - </hbox> - <!-- just hide them since other elements expect them --> - <statusbarpanel id="statusbar-display" hidden="true"/> - <statusbarpanel id="statusbar-progresspanel" hidden="true"/> - </statusbar> - </e4x>.* + objects: this.widgets = { get status() this.container }, + append: append.* }); this._statusLine = document.getElementById("status-bar"); this.statusBar = document.getElementById("addon-bar") || this._statusLine; this.statusBar.collapsed = true; // it is later restored unless the user sets laststatus=0 - // our status bar fields - this.widgets = array(["container", "url", "inputbuffer", "progress", "tabcount", "bufferposition", "zoomlevel"] - .map(function (field) [field, document.getElementById("dactyl-statusline-field-" + field)])) - .toObject(); - this.widgets.status = this.widgets.container; if (this.statusBar.localName == "toolbar") { styles.system.add("addon-bar", config.styleableChrome, <css><![CDATA[ diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 76bc6c3a..37d5954b 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -916,7 +916,7 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) for (let [elem, xml, attr] in iterator) { if (elem = window.document.getElementById(elem)) { - fn(elem, util.xmlToDom(xml, window.document)); + fn(elem, util.xmlToDom(xml, window.document, obj.objects)); for each (let attr in attr || []) elem.setAttributeNS(attr.namespace(), attr.localName(), attr); } |