[Pkg-owncloud-commits] [owncloud] 175/394: set password for shared links when the user press enter and when he leaves the password field

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:57 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 395eace356e8e091aeae2df56cce165c29895173
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Tue Dec 4 14:06:44 2012 +0100

    set password for shared links when the user press enter and when he leaves the password field
---
 core/js/share.js |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/core/js/share.js b/core/js/share.js
index 50a9d0a..8f3f8fa 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -481,16 +481,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('');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list