]> source.dussan.org Git - nextcloud-server.git/commitdiff
set password for shared links when the user press enter and when he leaves the passwo...
authorBjörn Schießle <schiessle@owncloud.com>
Tue, 4 Dec 2012 13:06:44 +0000 (14:06 +0100)
committerBjörn Schießle <schiessle@owncloud.com>
Tue, 18 Dec 2012 12:39:09 +0000 (13:39 +0100)
core/js/share.js

index df5ebf008b4d840b7b9d89a52749ce815f26fcea..984fce047b8c32be2c184a86afb19d8fc7eb0b65 100644 (file)
@@ -520,16 +520,26 @@ $(document).ready(function() {
                $('#linkPass').toggle('blind');
        });
 
-       $('#linkPassText').live('focusout', function(event) {
-               var itemType = $('#dropdown').data('item-type');
-               var itemSource = $('#dropdown').data('item-source');
-               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('placeholder', t('core', 'Password protected'));
+       $('#linkPassText').live('focusout keyup', function(event) {
+               if ( 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');
+                               });
+                       }
+               }
        });
 
+       $('#linkPassText').live('focusout keyup', function(event) {
+               if ( event.keyCode != 13 ) {
+                       $('#linkPassText').attr('passwordChanged', 'true');     
+               }
+       });
+       
        $('#expirationCheckbox').live('click', function() {
                if (this.checked) {
                        OC.Share.showExpirationDate('');