diff options
author | Björn Schießle <schiessle@owncloud.com> | 2012-12-14 13:13:01 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2012-12-18 13:39:52 +0100 |
commit | d873f0da3500e1f9eef89d4b73ec635f9c927636 (patch) | |
tree | 88d045b57055aa79985cb4808e6932397329e6f9 /core/js | |
parent | c457e15b201632bec5f0ad0030f7e0259485b0e0 (diff) | |
download | nextcloud-server-d873f0da3500e1f9eef89d4b73ec635f9c927636.tar.gz nextcloud-server-d873f0da3500e1f9eef89d4b73ec635f9c927636.zip |
autofocus to password input after clicking the checkbox; code restructured; debug output added
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/core/js/share.js b/core/js/share.js index c218c2c1233..98ceceb3a49 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -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(''); |