Permalink
Browse files

Newscript: use a <grid> and Scriptish_localizeDOM

  • Loading branch information...
nmaier committed Jun 28, 2011
1 parent fac6bb4 commit df7ef22935890ac383d76f8812790b78404f9113
Showing with 40 additions and 30 deletions.
  1. +4 −9 extension/content/js/newscript.js
  2. +36 −21 extension/content/newscript.xul
@@ -1,10 +1,13 @@
Components.utils.import("resource://scriptish/prefmanager.js");
Components.utils.import("resource://scriptish/scriptish.js");
Components.utils.import("resource://scriptish/utils/Scriptish_createUserScriptSource.js");
+Components.utils.import("resource://scriptish/utils/Scriptish_localizeDOM.js");
Components.utils.import("resource://scriptish/utils/Scriptish_stringBundle.js");
var $ = function(aID) document.getElementById(aID);
+Scriptish_localizeOnLoad(this);
+
var scriptContent = "";
try {
scriptContent = window.arguments[0]
@@ -13,15 +16,7 @@ try {
} catch(e) {}
window.addEventListener("load", function() {
- $("scriptish").setAttribute("title", Scriptish_stringBundle("menu.new"));
- $("scriptish").setAttribute("ondialogaccept", "return doInstall();");
- $("label-id").setAttribute("value", Scriptish_stringBundle("newscript.id"));
- $("label-name").setAttribute("value", Scriptish_stringBundle("newscript.name"));
- $("label-namespace").setAttribute("value", Scriptish_stringBundle("newscript.namespace"));
- $("label-description").setAttribute("value", Scriptish_stringBundle("newscript.description"));
- $("label-includes").setAttribute("value", Scriptish_stringBundle("newscript.includes"));
- $("label-excludes").setAttribute("value", Scriptish_stringBundle("newscript.excludes"));
- $("label-includes").setAttribute("value", Scriptish_stringBundle("newscript.includes"));
+ $("scriptish").addEventListener("dialogaccept", function() doInstall(), false);
// load defaults
$("id").value = Scriptish_prefRoot.getValue("newscript_id", "");
@@ -3,27 +3,42 @@
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="scriptish"
buttons="accept,cancel"
- orient="vertical">
+ orient="vertical"
+ title="menu.new"
+ localize="title"
+ >
<script type="application/x-javascript" src="chrome://scriptish/content/js/newscript.js" />
- <vbox>
- <label id="label-id" control="id"/>
- <textbox id="id"/>
- <separator class="thin"/>
- <label id="label-name" control="name"/>
- <textbox id="name"/>
- <separator class="thin"/>
- <label id="label-namespace" control="namespace"/>
- <textbox id="namespace"/>
- <separator class="thin"/>
- <label id="label-description" control="description"/>
- <textbox id="description"/>
- <separator class="thin"/>
- <label id="label-includes" control="includes"/>
- <textbox id="includes" multiline="true" rows="4" cols="60"/>
- <separator class="thin"/>
- <label id="label-excludes" control="excludes"/>
- <textbox id="excludes" multiline="true" rows="4" cols="60"/>
- <separator class="thin"/>
- </vbox>
+ <grid>
+ <columns>
+ <column />
+ <column flex="1"/>
+ </columns>
+ <rows>
+ <row>
+ <label id="label-id" control="id" value="newscript.id" localize="value"/>
+ <textbox id="id"/>
+ </row>
+ <row>
+ <label id="label-name" control="name" value="newscript.name" localize="value"/>
+ <textbox id="name"/>
+ </row>
+ <row>
+ <label id="label-namespace" control="namespace" value="newscript.namespace" localize="value"/>
+ <textbox id="namespace"/>
+ </row>
+ <row>
+ <label id="label-description" control="description" value="newscript.description" localize="value"/>
+ <textbox id="description"/>
+ </row>
+ <row>
+ <label id="label-includes" control="includes" value="newscript.includes" localize="value"/>
+ <textbox id="includes" multiline="true" rows="4" cols="60"/>
+ </row>
+ <row>
+ <label id="label-excludes" control="excludes" value="newscript.excludes" localize="value"/>
+ <textbox id="excludes" multiline="true" rows="4" cols="60"/>
+ </row>
+ </rows>
+ </grid>
</dialog>

0 comments on commit df7ef22

Please sign in to comment.