]> source.dussan.org Git - nextcloud-server.git/commitdiff
Initial Commit : Password Toggle Button hides if no input present
authorraghunayyar <me@iraghu.com>
Sun, 24 Mar 2013 23:00:09 +0000 (04:30 +0530)
committerraghunayyar <me@iraghu.com>
Sun, 24 Mar 2013 23:00:09 +0000 (04:30 +0530)
core/js/js.js

index b237c6fcf5b2a7fb60b071c166763cc8403ec71e..93d4c0a03e5bcaa341fa0b072ed4619603f53e51 100644 (file)
@@ -638,9 +638,21 @@ $(document).ready(function(){
        });
 
        // 'show password' checkbox
-       $('#password').showPassword();
-       $('#adminpass').showPassword(); 
-       $('#pass2').showPassword();
+       
+       var hideToggleBtn = function(input, label) {
+               // 'show password' checkbox
+               input.showPassword().keyup(function(){
+                       if (input.val().length == 0) {
+                               label.hide();
+                       } else {
+                               label.css("display", "inline").show();
+                       }
+               });
+               label.hide();
+       };
+       hideToggleBtn($('#password'), $('label[for=show]'));
+       hideToggleBtn($('#adminpass'), $('label[for=show]'));
+       hideToggleBtn($('#pass2'), $('label[for=personal-show]'));
 
        //use infield labels
        $("label.infield").inFieldLabels({