Merge pull request #1229 from owncloud/from_live_to_on

replace live() with on() in core js
This commit is contained in:
Thomas Müller 2013-02-03 21:55:54 -08:00
commit 04b97a1906
8 changed files with 39 additions and 40 deletions

View File

@ -309,7 +309,7 @@ var FileList={
$(document).ready(function(){
$('#notification').hide();
$('#notification .undo').live('click', function(){
$('#notification').on('click', '.undo', function(){
if (FileList.deleteFiles) {
$.each(FileList.deleteFiles,function(index,file){
$('tr').filterAttr('data-file',file).show();
@ -335,16 +335,16 @@ $(document).ready(function(){
FileList.lastAction = null;
OC.Notification.hide();
});
$('#notification .replace').live('click', function() {
$('#notification').on('click', '.replace', function() {
OC.Notification.hide(function() {
FileList.replace($('#notification').data('oldName'), $('#notification').data('newName'), $('#notification').data('isNewFile'));
});
});
$('#notification .suggest').live('click', function() {
$('#notification').on('click', '.suggest', function() {
$('tr').filterAttr('data-file', $('#notification').data('oldName')).show();
OC.Notification.hide();
});
$('#notification .cancel').live('click', function() {
$('#notification').on('click', '.cancel', function() {
if ($('#notification').data('isNewFile')) {
FileList.deleteCanceled = false;
FileList.deleteFiles = [$('#notification').data('oldName')];

View File

@ -110,7 +110,7 @@ $(document).ready(function() {
}
// Triggers invisible file input
$('#upload a').live('click', function() {
$('#upload a').on('click', function() {
$(this).parent().children('#file_upload_start').trigger('click');
return false;
});
@ -123,7 +123,7 @@ $(document).ready(function() {
var lastChecked;
// Sets the file link behaviour :
$('td.filename a').live('click',function(event) {
$('#fileList').on('click','td.filename a',function(event) {
if (event.ctrlKey || event.shiftKey) {
event.preventDefault();
if (event.shiftKey) {
@ -189,7 +189,7 @@ $(document).ready(function() {
procesSelection();
});
$('td.filename input:checkbox').live('change',function(event) {
$('#fileList').on('change', 'td.filename input:checkbox',function(event) {
if (event.shiftKey) {
var last = $(lastChecked).parent().parent().prevAll().length;
var first = $(this).parent().parent().prevAll().length;

View File

@ -36,7 +36,7 @@ $(document).ready(function() {
}
});
$('#externalStorage tbody tr input').live('keyup', function() {
$('#externalStorage tbody').on('keyup', 'tr input', function() {
var tr = $(this).parent().parent();
if ($(tr).hasClass('\\\\OC\\\\Files\\\\Storage\\\\Dropbox') && $(tr).find('[data-parameter="configured"]').val() != 'true') {
var config = $(tr).find('.configuration');
@ -52,7 +52,7 @@ $(document).ready(function() {
}
});
$('.dropbox').live('click', function(event) {
$('.dropbox').on('click', function(event) {
event.preventDefault();
var app_key = $(this).parent().find('[data-parameter="app_key"]').val();
var app_secret = $(this).parent().find('[data-parameter="app_secret"]').val();

View File

@ -33,8 +33,7 @@ $(document).ready(function() {
}
});
$('#externalStorage tbody tr').live('change', function() {
console.log('hello');
$('#externalStorage tbody').on('change', 'tr', function() {
if ($(this).hasClass('\\\\OC\\\\Files\\\\Storage\\\\Google') && $(this).find('[data-parameter="configured"]').val() != 'true') {
if ($(this).find('.mountPoint input').val() != '') {
if ($(this).find('.google').length == 0) {
@ -44,7 +43,7 @@ $(document).ready(function() {
}
});
$('#externalStorage tbody tr .mountPoint input').live('keyup', function() {
$('#externalStorage tbody').on('keyup', 'tr .mountPoint input', function() {
var tr = $(this).parent().parent();
if ($(tr).hasClass('\\\\OC\\\\Files\\\\Storage\\\\Google') && $(tr).find('[data-parameter="configured"]').val() != 'true' && $(tr).find('.google').length > 0) {
if ($(this).val() != '') {
@ -55,7 +54,7 @@ $(document).ready(function() {
}
});
$('.google').live('click', function(event) {
$('.google').on('click', function(event) {
event.preventDefault();
var tr = $(this).parent().parent();
var configured = $(this).parent().find('[data-parameter="configured"]');

View File

@ -71,7 +71,7 @@ OC.MountConfig={
$(document).ready(function() {
$('.chzn-select').chosen();
$('#selectBackend').live('change', function() {
$('#selectBackend').on('change', function() {
var tr = $(this).parent().parent();
$('#externalStorage tbody').append($(tr).clone());
$('#externalStorage tbody tr').last().find('.mountPoint input').val('');
@ -135,11 +135,11 @@ $(document).ready(function() {
return defaultMountPoint+append;
}
$('#externalStorage td').live('change', function() {
$('#externalStorage').on('change', 'td', function() {
OC.MountConfig.saveStorage($(this).parent());
});
$('td.remove>img').live('click', function() {
$('td.remove>img').on('click', function() {
var tr = $(this).parent().parent();
var mountPoint = $(tr).find('.mountPoint input').val();
if ( ! mountPoint) {

View File

@ -50,7 +50,7 @@ var OCCategories= {
$('#category_dialog').remove();
},
open : function(event, ui) {
$('#category_addinput').live('input',function() {
$('#category_addinput').on('input',function() {
if($(this).val().length > 0) {
$('#category_addbutton').removeAttr('disabled');
}
@ -61,7 +61,7 @@ var OCCategories= {
$('#category_addbutton').attr('disabled', 'disabled');
return false;
});
$('#category_addbutton').live('click',function(e) {
$('#category_addbutton').on('click',function(e) {
e.preventDefault();
if($('#category_addinput').val().length > 0) {
OCCategories.add($('#category_addinput').val());

View File

@ -410,7 +410,7 @@ $(document).ready(function() {
firstDay: firstDay
});
}
$('a.share').live('click', function(event) {
$('#fileList').on('click', 'a.share', function(event) {
event.stopPropagation();
if ($(this).data('item-type') !== undefined && $(this).data('item') !== undefined) {
var itemType = $(this).data('item-type');
@ -444,12 +444,12 @@ $(document).ready(function() {
}
});
$('#shareWithList li').live('mouseenter', function(event) {
$('#fileList').on('mouseenter', '#dropdown #shareWithList li', function(event) {
// Show permissions and unshare button
$(':hidden', this).filter(':not(.cruds)').show();
});
$('#shareWithList li').live('mouseleave', function(event) {
$('#fileList').on('mouseleave', '#dropdown #shareWithList li', function(event) {
// Hide permissions and unshare button
if (!$('.cruds', this).is(':visible')) {
$('a', this).hide();
@ -462,11 +462,11 @@ $(document).ready(function() {
}
});
$('.showCruds').live('click', function() {
$('#fileList').on('click', '#dropdown .showCruds', function() {
$(this).parent().find('.cruds').toggle();
});
$('.unshare').live('click', function() {
$('#fileList').on('click', '#dropdown .unshare', function() {
var li = $(this).parent();
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
@ -483,7 +483,7 @@ $(document).ready(function() {
});
});
$('.permissions').live('change', function() {
$('#fileList').on('change', '#dropdown .permissions', function() {
if ($(this).attr('name') == 'edit') {
var li = $(this).parent().parent()
var checkboxes = $('.permissions', li);
@ -510,7 +510,7 @@ $(document).ready(function() {
OC.Share.setPermissions($('#dropdown').data('item-type'), $('#dropdown').data('item-source'), $(li).data('share-type'), $(li).data('share-with'), permissions);
});
$('#linkCheckbox').live('change', function() {
$('#fileList').on('change', '#dropdown #linkCheckbox', function() {
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
if (this.checked) {
@ -532,12 +532,12 @@ $(document).ready(function() {
}
});
$('#linkText').live('click', function() {
$('#fileList').on('click', '#dropdown #linkText', function() {
$(this).focus();
$(this).select();
});
$('#showPassword').live('click', function() {
$('#fileList').on('click', '#dropdown #showPassword', function() {
$('#linkPass').toggle('blind');
if (!$('#showPassword').is(':checked') ) {
var itemType = $('#dropdown').data('item-type');
@ -548,7 +548,7 @@ $(document).ready(function() {
}
});
$('#linkPassText').live('focusout keyup', function(event) {
$('#fileList').on('focusout keyup', '#dropdown #linkPassText', function(event) {
if ( $('#linkPassText').val() != '' && (event.type == 'focusout' || event.keyCode == 13) ) {
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
@ -560,7 +560,7 @@ $(document).ready(function() {
}
});
$('#expirationCheckbox').live('click', function() {
$('#fileList').on('click', '#dropdown #expirationCheckbox', function() {
if (this.checked) {
OC.Share.showExpirationDate('');
} else {
@ -575,7 +575,7 @@ $(document).ready(function() {
}
});
$('#expirationDate').live('change', function() {
$('#fileList').on('change', '#dropdown #expirationDate', function() {
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'setExpirationDate', itemType: itemType, itemSource: itemSource, date: $(this).val() }, function(result) {
@ -586,7 +586,7 @@ $(document).ready(function() {
});
$('#emailPrivateLink').live('submit', function(event) {
$('#fileList').on('submit', '#dropdown #emailPrivateLink', function(event) {
event.preventDefault();
var link = $('#linkText').val();
var itemType = $('#dropdown').data('item-type');

View File

@ -263,7 +263,7 @@ $(document).ready(function () {
UserList.applyMultiplySelect($(element));
});
$('td.remove>a').live('click', function (event) {
$('table').on('click', 'td.remove>a', function (event) {
var row = $(this).parent().parent();
var uid = $(row).attr('data-uid');
$(row).hide();
@ -271,7 +271,7 @@ $(document).ready(function () {
UserList.do_delete(uid);
});
$('td.password>img').live('click', function (event) {
$('table').on('click', 'td.password>img', function (event) {
event.stopPropagation();
var img = $(this);
var uid = img.parent().parent().attr('data-uid');
@ -299,11 +299,11 @@ $(document).ready(function () {
img.css('display', '');
});
});
$('td.password').live('click', function (event) {
$('table').on('click', 'td.password', function (event) {
$(this).children('img').click();
});
$('td.displayName>img').live('click', function (event) {
$('table').on('click', 'td.displayName>img', function (event) {
event.stopPropagation();
var img = $(this);
var uid = img.parent().parent().attr('data-uid');
@ -332,12 +332,12 @@ $(document).ready(function () {
img.css('display', '');
});
});
$('td.displayName').live('click', function (event) {
$('table').on('click', 'td.displayName', function (event) {
$(this).children('img').click();
});
$('select.quota, select.quota-user').live('change', function () {
$('select.quota, select.quota-user').on('change', function () {
var select = $(this);
var uid = $(this).parent().parent().parent().attr('data-uid');
var quota = $(this).val();
@ -356,7 +356,7 @@ $(document).ready(function () {
$(select).data('previous', $(select).val());
})
$('input.quota-other').live('change', function () {
$('input.quota-other').on('change', function () {
var uid = $(this).parent().parent().parent().attr('data-uid');
var quota = $(this).val();
var select = $(this).prev();
@ -392,7 +392,7 @@ $(document).ready(function () {
}
});
$('input.quota-other').live('blur', function () {
$('input.quota-other').on('blur', function () {
$(this).change();
})
@ -439,7 +439,7 @@ $(document).ready(function () {
});
// Handle undo notifications
OC.Notification.hide();
$('#notification .undo').live('click', function () {
$('#notification').on('click', '.undo', function () {
if ($('#notification').data('deleteuser')) {
$('tbody tr').filterAttr('data-uid', UserList.deleteUid).show();
UserList.deleteCanceled = true;