summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-12-04 14:06:44 +0100
committerBjörn Schießle <schiessle@owncloud.com>2012-12-18 13:39:09 +0100
commit1dd79cc8e16f2972b8a8fea03f4e8ecfc1db5ac9 (patch)
treed009405fd2d20325dda5acf71e2d4aca35bd709a /core/js
parentb0532c6343fa540160931f0e2cd650cc8efb7b81 (diff)
downloadnextcloud-server-1dd79cc8e16f2972b8a8fea03f4e8ecfc1db5ac9.tar.gz
nextcloud-server-1dd79cc8e16f2972b8a8fea03f4e8ecfc1db5ac9.zip
set password for shared links when the user press enter and when he leaves the password field
Diffstat (limited to 'core/js')
-rw-r--r--core/js/share.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/core/js/share.js b/core/js/share.js
index df5ebf008b4..984fce047b8 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -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('');