]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Some tweaks to wording in embedded wizard.
authorChris Porter <redacted>
Sat, 24 Apr 2010 03:38:56 +0000 (04:38 +0100)
committerChris Porter <redacted>
Sat, 24 Apr 2010 03:38:56 +0000 (04:38 +0100)
Allow look and feel to be turned off in embedded wizard.
All checkboxes/radio buttons are now labels.

js/jslib.js
js/ui/panes/embed.js
js/ui/panes/options.js

index bbf2c13642f497bcb4c75ce4bff5687b63c6f349..ba9acf0e3478d188f1b1f562334dee79e4708552 100644 (file)
@@ -238,7 +238,7 @@ qwebirc.util.importJS = function(name, watchFor, onload) {
   document.getElementsByTagName("head")[0].appendChild(script);
 }
 
-qwebirc.util.createInput = function(type, parent, name, selected) {
+qwebirc.util.createInput = function(type, parent, name, selected, id) {
   var r;
   if(Browser.Engine.trident) {
     if(name) {
@@ -246,12 +246,19 @@ qwebirc.util.createInput = function(type, parent, name, selected) {
     } else {
       name = "";
     }
-    r = $(document.createElement("<input type=\"" + type + "\"" + name + " " + (selected?" checked":"") + "/>"));
+    if(id) {
+      id = " id=\"" + escape(id) + "\"";
+    } else {
+      id = "";
+    }
+    r = $(document.createElement("<input type=\"" + type + "\"" + name + id + " " + (selected?" checked":"") + "/>"));
   } else {    
     r = new Element("input");
     r.type = type;
     if(name)
       r.name = name;
+    if(id)
+      r.id = id;
       
     if(selected)
       r.checked = true;
@@ -369,3 +376,8 @@ qwebirc.util.deviceHasKeyboard = function() {
   
   return v;
 }
+
+qwebirc.util.generateID_ID = 0;
+qwebirc.util.generateID = function() {
+  return "qqa-" + qwebirc.util.generateID_ID++;
+}
\ No newline at end of file
index 7a3fd1ef712da57699bf517f0fea8e3fc9804fce..82df28637d1e1e8a45e4022bb92f42667fe97e9e 100644 (file)
@@ -41,7 +41,6 @@ qwebirc.ui.EmbedWizard = new Class({
     this.options.uiOptions = options.uiOptions;
     this.options.baseURL = options.baseURL;
     this.options.optionsCallback = options.optionsCallback;
-    
     this.create(parent);
     this.addSteps();
   },
@@ -94,8 +93,12 @@ qwebirc.ui.EmbedWizard = new Class({
     var p = new Element("div");
     parent.appendChild(p);
 
-    var r = qwebirc.util.createInput("radio", p, name, selected);
-    p.appendChild(document.createTextNode(text));
+    var id = qwebirc.util.generateID();
+    var r = qwebirc.util.createInput("radio", p, name, selected, id);
+    
+    var label = new Element("label", {"for": id});
+    label.appendChild(document.createTextNode(text));
+    p.appendChild(label);
       
     return r;
   },
@@ -131,7 +134,7 @@ qwebirc.ui.EmbedWizard = new Class({
     
     var customnickDiv = new Element("div");
     this.customnick = this.newStep({
-      "title": "Nickname mode",
+      "title": "Choose a nickname mode",
       "first": "At startup would you like the client to use a random nickname, a preset nickname or a nickname of the users choice?",
       "hint": "It is recommended that you only use a preset nickname if the client is for your own personal use.",
       middle: customnickDiv
@@ -149,13 +152,20 @@ qwebirc.ui.EmbedWizard = new Class({
       "hint": "You need to display the dialog if you want the user to be able to set their nickname before connecting."
     });
 
-    var changeOptions = new Element("input");
-    changeOptions.type = "submit";
-    changeOptions.value = "Alter current look and feel";
-    changeOptions.addEvent("click", this.options.optionsCallback);
+    var changeOptions = new Element("div");
+    this.currentLF = this.newRadio(changeOptions, "Use the current look and feel (", "lookandfeel", true);
 
+    var alterButton = new Element("input");
+    alterButton.type = "submit";
+    alterButton.value = "alter";
+    alterButton.addEvent("click", this.options.optionsCallback);
+    changeOptions.firstChild.appendChild(alterButton);
+    changeOptions.firstChild.appendChild(document.createTextNode(")."));
+    
+    this.defaultLF = this.newRadio(changeOptions, "Use the default look and feel.", "lookandfeel");
+    
     this.lookandfeel = this.newStep({
-      "title": "Alter look and feel?",
+      "title": "Configure look and feel",
       "first": "The look and feel will be copied from the current settings.",
       middle: changeOptions
     });
@@ -167,7 +177,7 @@ qwebirc.ui.EmbedWizard = new Class({
     this.nicknameBox.addClass("text");
     this.nickname = this.newStep({
       "title": "Set nickname",
-      "first": "Enter the nickname you would like the client to use by default (use a . for a random number):",
+      "first": "Enter the nickname you would like the client to use by default:",
       "premove": function() {
         if(this.nicknameBox.value == "") {
           alert("You must supply a nickname.");
@@ -176,7 +186,8 @@ qwebirc.ui.EmbedWizard = new Class({
         }
         return true;
       }.bind(this),
-      middle: this.nicknameBox
+      middle: this.nicknameBox,
+      hint: "If you use a . (dot/period) then it will be substituted with a random number."
     }).addEvent("show", af.bind(this.nicknameBox));
 
     var codeDiv = new Element("div");
@@ -295,10 +306,12 @@ qwebirc.ui.EmbedWizard = new Class({
     if(connectdialog)
       URL.push("prompt=1");
 
-    var uioptions = this.options.uiOptions.serialise();
-    if(uioptions != "")
-      URL.push("uio=" + uioptions);
-      
+    if(this.currentLF.checked) {
+      var uioptions = this.options.uiOptions.serialise();
+      if(uioptions != "")
+        URL.push("uio=" + uioptions);
+    }
+    
     return this.options.baseURL + (URL.length>0?"?":"") + URL.join("&");
   }
 });
index 402213ab0763ed1f02f2b3d025f3d28360cb7c09..c6a5522105b5ace516a951902e4d4b92f2625557 100644 (file)
@@ -64,11 +64,11 @@ qwebirc.config.Input = new Class({
     
     this.render();
   },
-  createInput: function(type, parent, name, selected) {
+  createInput: function(type, parent, name, selected, id) {
     if(!$defined(parent))
       parent = this.parentElement;
 
-    return qwebirc.util.createInput(type, parent, name, selected);
+    return qwebirc.util.createInput(type, parent, name, selected, this.option.id);
   },
   FE: function(element, parent) {
     var n = new Element(element);
@@ -161,7 +161,7 @@ qwebirc.config.HueInput = new Class({
 qwebirc.config.CheckInput = new Class({
   Extends: qwebirc.config.Input,
   render: function() {
-    var i = this.createInput("checkbox");
+    var i = this.createInput("checkbox", null, null, null, this.id);
     this.mainElement = i;
     
     i.checked = this.value;
@@ -362,7 +362,11 @@ qwebirc.ui.OptionsPane = new Class({
       
       var row = FE("tr", tb);
       var cella = FE("td", row);
-      cella.set("text", x.label + ":");
+      
+      x.id = qwebirc.util.generateID();
+      var label = new Element("label", {"for": x.id});
+      cella.appendChild(label);
+      label.set("text", x.label + ":");
 
       var cellb = FE("td", row);
       this.boxList.push([x, new x.Element(cellb, x, i, this)]);