Changing js .live calls to .on for jquery 2.x

This commit is contained in:
Mikael Nordfeldth 2013-09-10 18:52:09 +02:00
parent 3858897c10
commit dfa1b15dd6
6 changed files with 74 additions and 70 deletions

View File

@ -65,8 +65,8 @@ $(document).ready(function() {
modal: true
});
$('.add_row').live('click', SN_WHITELIST.addRow);
$('.remove_row').live('click', SN_WHITELIST.removeRow);
$(document).on('click', '.add_row', SN_WHITELIST.addRow);
$(document).on('click', '.remove_row', SN_WHITELIST.removeRow);
SN_WHITELIST.updateButtons();
});

View File

@ -121,8 +121,8 @@ $(document).ready(function() {
source: 'finduser',
minLength: 2 });
$('.add_row').live('click', SN_EXTENDED.addRow);
$('.remove_row').live('click', SN_EXTENDED.removeRow);
$(document).on('click', '.add_row', SN_EXTENDED.addRow);
$(document).on('click', '.remove_row', SN_EXTENDED.removeRow);
$('input:checkbox[name$=current]').each(function () {
var input = $(this).parent().siblings('input[id$=-end]');
@ -131,7 +131,7 @@ $(document).ready(function() {
}
});
$('input:checkbox[name$=current]').live('click', function() {
$(document).on('click', 'input:checkbox[name$=current]', function () {
var input = $(this).parent().siblings('input[id$=-end]');
if ($(this).is(':checked')) {
$(input).val('');

View File

@ -5,14 +5,14 @@
$(function() {
// Notice lists...
$('.notice .author').live('mouseenter', function(e) {
$(document).on('mouseenter', '.notice .author', function(e) {
var notice = $(this).closest('.notice');
var popup = notice.find('.remote-profile-options');
if (popup.length) {
popup.fadeIn();
}
});
$('.notice').live('mouseleave', function(e) {
$(document).on('mouseleave', '.notice', function(e) {
var notice = $(this);
var popup = notice.find('.remote-profile-options');
if (popup.length) {
@ -21,14 +21,14 @@ $(function() {
});
// Profile lists...
$('.profile .avatar').live('mouseenter', function(e) {
$(document).on('mouseenter', '.profile .avatar', function(e) {
var profile = $(this).closest('.profile');
var popup = profile.find('.remote-profile-options');
if (popup.length) {
popup.fadeIn();
}
});
$('.profile').live('mouseleave', function(e) {
$(document).on('mouseleave', '.profile', function(e) {
var profile = $(this);
var popup = profile.find('.remote-profile-options');
if (popup.length) {

View File

@ -92,12 +92,15 @@ SN.U.DialogBox = {
};
SN.Init.Subscribe = function () {
$('.entity_subscribe .entity_remote_subscribe, .entity_tag .entity_remote_tag')
.live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; });
$(document).on('click',
'.entity_subscribe .entity_remote_subscribe, .entity_tag .entity_remote_tag',
function () { SN.U.DialogBox.Subscribe($(this)); return false; });
};
$(document).ready(function () {
SN.Init.Subscribe();
$('.form_remote_authorize').bind('submit', function() { $(this).addClass(SN.C.S.Processing); return true; });
$('.form_remote_authorize').bind('submit', function () {
$(this).addClass(SN.C.S.Processing); return true;
});
});

View File

@ -44,7 +44,7 @@ class OpenExternalLinkTargetPlugin extends Plugin
{
function onEndShowScripts($action)
{
$action->inlineScript('$("a[rel~=external]:not([class~=attachment])").live("click", function(){ window.open(this.href); return false; });');
$action->inlineScript('$(document).on("click", "a[rel~=external]:not([class~=attachment])", function () { window.open(this.href); return false; });');
return true;
}

View File

@ -23,10 +23,10 @@ var QnA = {
init: function () {
QnA.NoticeInlineAnswerSetup();
$('form.form_question_show').live('submit', function() {
$(document).on('submit', 'form.form_question_show', function () {
QnA.close(this);
});
$('form.form_answer_show').live('submit', function() {
$(document).on('submit', 'form.form_answer_show', function () {
QnA.close(this, true);
});
},
@ -161,8 +161,9 @@ var QnA = {
*/
NoticeInlineAnswerSetup: function () {
$('li.qna-dummy-placeholder input.placeholder')
.live('focus', function() {
$(document).on('focus',
'li.qna-dummy-placeholder input.placeholder',
function () {
var notice = $(this).closest('li.notice');
QnA.NoticeInlineAnswerTrigger(notice);
return false;