forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'wip-mdl-27837' of git://github.com/rajeshtaneja/moodle
- Loading branch information
Showing
5 changed files
with
74 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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.checkboxname); | ||
} | ||
}, | ||
//Create checkbox for unmasking password | ||
add_checkbox : function(elementid, checkboxlabel) { | ||
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">'); | ||
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']}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters