MDL-43302 JavaScript: Migrate moodle-form-passwordunmask to use Shifter
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 23 Dec 2013 08:40:28 +0000 (16:40 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 23 Dec 2013 08:40:28 +0000 (16:40 +0800)
lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js [new file with mode: 0644]
lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js [new file with mode: 0644]
lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js [new file with mode: 0644]
lib/form/yui/passwordunmask/passwordunmask.js [deleted file]
lib/form/yui/src/passwordunmask/build.json [new file with mode: 0644]
lib/form/yui/src/passwordunmask/js/passwordunmask.js [new file with mode: 0644]
lib/form/yui/src/passwordunmask/meta/passwordunmask.json [new file with mode: 0644]

diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js
new file mode 100644 (file)
index 0000000..8ec50a7
Binary files /dev/null and b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js differ
diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js
new file mode 100644 (file)
index 0000000..6c426ff
Binary files /dev/null and b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js differ
diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js
new file mode 100644 (file)
index 0000000..8ec50a7
Binary files /dev/null and b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js differ
diff --git a/lib/form/yui/passwordunmask/passwordunmask.js b/lib/form/yui/passwordunmask/passwordunmask.js
deleted file mode 100644 (file)
index 1bbefcc..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-YUI.add('moodle-form-passwordunmask', function(Y) {
-    var PASSWORDUNMASK = function() {
-        PASSWORDUNMASK.superclass.constructor.apply(this, arguments);
-    }
-
-    Y.extend(PASSWORDUNMASK, Y.Base, {
-        //Initialize checkbox if id is passed
-        initializer : function(params) {
-            if (params && params.formid) {
-               this.add_checkbox(params.formid, params.checkboxlabel, params.checkboxname);
-            }
-        },
-        //Create checkbox for unmasking password
-        add_checkbox : function(elementid, checkboxlabel, checkboxname) {
-            var node = Y.one('#'+elementid);
-
-            //retaining unmask div from previous implementation.
-            var unmaskdiv = Y.Node.create('<div id="'+elementid+'unmaskdiv" class="unmask"></div>');
-
-            //Add checkbox for unmasking to unmaskdiv
-            var unmaskchb = Y.Node.create('<input id="'+elementid+'unmask" type="checkbox" name="'+
-                checkboxname+'unmask">');
-            unmaskdiv.appendChild(unmaskchb);
-            //Attach event using static javascript function for unmasking password.
-            unmaskchb.on('click', function() {unmaskPassword(elementid);});
-
-            //Add label for checkbox to unmaskdiv
-            var unmasklabel = Y.Node.create('<label for="'+elementid+'unmask">'+checkboxlabel+'</label>');
-            unmaskdiv.appendChild(unmasklabel);
-
-            //Insert unmask div in the same div as password input.
-            node.get('parentNode').insert(unmaskdiv, node.get('lastNode'));
-        }
-    });
-
-    M.form = M.form || {};
-    M.form.passwordunmask = function(params) {
-        return new PASSWORDUNMASK(params);
-    }
-}, '@VERSION@', {requires:['base', 'node']});
diff --git a/lib/form/yui/src/passwordunmask/build.json b/lib/form/yui/src/passwordunmask/build.json
new file mode 100644 (file)
index 0000000..9ad9dac
--- /dev/null
@@ -0,0 +1,10 @@
+{
+    "name": "moodle-form-passwordunmask",
+    "builds": {
+        "moodle-form-passwordunmask": {
+            "jsfiles": [
+                "passwordunmask.js"
+            ]
+        }
+    }
+}
diff --git a/lib/form/yui/src/passwordunmask/js/passwordunmask.js b/lib/form/yui/src/passwordunmask/js/passwordunmask.js
new file mode 100644 (file)
index 0000000..63b4748
--- /dev/null
@@ -0,0 +1,39 @@
+var PASSWORDUNMASK = function() {
+    PASSWORDUNMASK.superclass.constructor.apply(this, arguments);
+};
+
+Y.extend(PASSWORDUNMASK, Y.Base, {
+    // Initialize checkbox if id is passed.
+    initializer : function(params) {
+        if (params && params.formid) {
+            this.add_checkbox(params.formid, params.checkboxlabel, params.checkboxname);
+        }
+    },
+
+    // Create checkbox for unmasking password.
+    add_checkbox : function(elementid, checkboxlabel, checkboxname) {
+        var node = Y.one('#'+elementid);
+
+        // Retaining unmask div from previous implementation.
+        var unmaskdiv = Y.Node.create('<div id="'+elementid+'unmaskdiv" class="unmask"></div>');
+
+        // Add checkbox for unmasking to unmaskdiv.
+        var unmaskchb = Y.Node.create('<input id="'+elementid+'unmask" type="checkbox" name="'+
+            checkboxname+'unmask">');
+        unmaskdiv.appendChild(unmaskchb);
+        // Attach event using static javascript function for unmasking password.
+        unmaskchb.on('click', function() {unmaskPassword(elementid);});
+
+        // Add label for checkbox to unmaskdiv.
+        var unmasklabel = Y.Node.create('<label for="'+elementid+'unmask">'+checkboxlabel+'</label>');
+        unmaskdiv.appendChild(unmasklabel);
+
+        // Insert unmask div in the same div as password input.
+        node.get('parentNode').insert(unmaskdiv, node.get('lastNode'));
+    }
+});
+
+M.form = M.form || {};
+M.form.passwordunmask = function(params) {
+    return new PASSWORDUNMASK(params);
+};
diff --git a/lib/form/yui/src/passwordunmask/meta/passwordunmask.json b/lib/form/yui/src/passwordunmask/meta/passwordunmask.json
new file mode 100644 (file)
index 0000000..1830917
--- /dev/null
@@ -0,0 +1,8 @@
+{
+    "moodle-form-passwordunmask": {
+        "requires": [
+            "node",
+            "base"
+        ]
+    }
+}