autofocus to password input after clicking the checkbox; code restructured; debug output added
This commit is contained in:
parent
c457e15b20
commit
d873f0da35
|
@ -526,26 +526,20 @@ $(document).ready(function() {
|
||||||
var itemType = $('#dropdown').data('item-type');
|
var itemType = $('#dropdown').data('item-type');
|
||||||
var itemSource = $('#dropdown').data('item-source');
|
var itemSource = $('#dropdown').data('item-source');
|
||||||
OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ);
|
OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ);
|
||||||
|
} else {
|
||||||
|
$('#linkPassText').focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#linkPassText').live('focusout keyup', function(event) {
|
$('#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 itemType = $('#dropdown').data('item-type');
|
||||||
var itemSource = $('#dropdown').data('item-source');
|
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() {
|
||||||
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').val('');
|
||||||
$('#linkPassText').attr('placeholder', t('core', 'Password protected'));
|
$('#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');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue