]> source.dussan.org Git - nextcloud-server.git/commitdiff
autofocus to password input after clicking the checkbox; code restructured; debug...
authorBjörn Schießle <schiessle@owncloud.com>
Fri, 14 Dec 2012 12:13:01 +0000 (13:13 +0100)
committerBjörn Schießle <schiessle@owncloud.com>
Tue, 18 Dec 2012 12:39:52 +0000 (13:39 +0100)
core/js/share.js

index c218c2c1233b8917d1c8bdf21a9eab59144b9a7a..98ceceb3a4927d31e31e4cc7ed2abf25276ea217 100644 (file)
@@ -526,29 +526,23 @@ $(document).ready(function() {
                        var itemType = $('#dropdown').data('item-type');
                        var itemSource = $('#dropdown').data('item-source');
                        OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ);
+               } else {
+                       $('#linkPassText').focus();
                }
        });
 
        $('#linkPassText').live('focusout keyup', function(event) {
-               if ( event.type == 'focusout' || event.keyCode == 13 ) {
+               if ( $('#linkPassText').val() != '' && (event.type == 'focusout' || event.keyCode == 13) ) {
                        var itemType = $('#dropdown').data('item-type');
                        var itemSource = $('#dropdown').data('item-source');
-                       if ( $('#linkPassText').attr('passwordChanged') == 'true' ) {
-                               OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.PERMISSION_READ, function() {
-                                       $('#linkPassText').val('');
-                                       $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
-                                       $('#linkPassText').attr('passwordChanged', 'false');
-                               });
-                       }
+                       OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.PERMISSION_READ, function() {
+                               console.log("password set to: '" + $('#linkPassText').val() +"' by event: " + event.type);
+                               $('#linkPassText').val('');
+                               $('#linkPassText').attr('placeholder', t('core', 'Password protected'));
+                       });
                }
        });
 
-       $('#linkPassText').live('focusout keyup', function(event) {
-               if ( event.keyCode != 13 ) {
-                       $('#linkPassText').attr('passwordChanged', 'true');     
-               }
-       });
-       
        $('#expirationCheckbox').live('click', function() {
                if (this.checked) {
                        OC.Share.showExpirationDate('');