replace live() with on() in core js

This commit is contained in:
Jörn Friedrich Dreyer 2013-01-18 22:38:44 +01:00
parent 5761bd771f
commit 22812c5f0d
8 changed files with 38 additions and 38 deletions

View File

@ -335,7 +335,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();
@ -361,16 +361,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;
});
@ -118,7 +118,7 @@ $(document).ready(function() {
var lastChecked;
// Sets the file link behaviour :
$('td.filename a').live('click',function(event) {
$('td.filename').on('click','a',function(event) {
if (event.ctrlKey || event.shiftKey) {
event.preventDefault();
if (event.shiftKey) {
@ -184,7 +184,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_Filestorage_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,7 +33,7 @@ $(document).ready(function() {
}
});
$('#externalStorage tbody tr').live('change', function() {
$('#externalStorage tbody').on('change', 'tr', function() {
if ($(this).hasClass('OC_Filestorage_Google') && $(this).find('[data-parameter="configured"]').val() != 'true') {
if ($(this).find('.mountPoint input').val() != '') {
if ($(this).find('.google').length == 0) {
@ -43,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_Filestorage_Google') && $(tr).find('[data-parameter="configured"]').val() != 'true' && $(tr).find('.google').length > 0) {
if ($(this).val() != '') {
@ -54,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) {
$('a.share').on('click', 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) {
$('#shareWithList').on('mouseenter', 'li', function(event) {
// Show permissions and unshare button
$(':hidden', this).filter(':not(.cruds)').show();
});
$('#shareWithList li').live('mouseleave', function(event) {
$('#shareWithList').on('mouseleave', '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() {
$('.showCruds').on('click', function() {
$(this).parent().find('.cruds').toggle();
});
$('.unshare').live('click', function() {
$('.unshare').on('click', 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() {
$('.permissions').on('change', 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() {
$('#linkCheckbox').on('change', 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() {
$('#linkText').on('click', function() {
$(this).focus();
$(this).select();
});
$('#showPassword').live('click', function() {
$('#showPassword').on('click', 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) {
$('#linkPassText').on('focusout keyup', 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() {
$('#expirationCheckbox').on('click', function() {
if (this.checked) {
OC.Share.showExpirationDate('');
} else {
@ -575,7 +575,7 @@ $(document).ready(function() {
}
});
$('#expirationDate').live('change', function() {
$('#expirationDate').on('change', 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) {
$('#emailPrivateLink').on('submit', function(event) {
event.preventDefault();
var link = $('#linkText').val();
var itemType = $('#dropdown').data('item-type');

View File

@ -262,7 +262,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();
@ -270,7 +270,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');
@ -298,11 +298,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');
@ -336,7 +336,7 @@ $(document).ready(function () {
});
$('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();
@ -355,7 +355,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();
@ -391,7 +391,7 @@ $(document).ready(function () {
}
});
$('input.quota-other').live('blur', function () {
$('input.quota-other').on('blur', function () {
$(this).change();
})
@ -438,7 +438,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;