diff --git a/js/util.js b/js/util.js index c22802651a..a7adb803d3 100644 --- a/js/util.js +++ b/js/util.js @@ -106,7 +106,7 @@ var SN = { // StatusNet NDT = form.find('.notice_data-text:first'); - NDT.bind('keyup', function(e) { + NDT.on('keyup', function(e) { SN.U.Counter(form); }); @@ -120,8 +120,8 @@ var SN = { // StatusNet }, 50); }; // Note there's still no event for mouse-triggered 'delete'. - NDT.bind('cut', delayedUpdate) - .bind('paste', delayedUpdate); + NDT.on('cut', delayedUpdate) + .on('paste', delayedUpdate); } else { form.find('.count').text(jQuery.data(form[0], 'ElementData').MaxLength); @@ -251,7 +251,7 @@ var SN = { // StatusNet .addClass(SN.C.S.Processing) .find('.submit') .addClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, SN.C.S.Disabled); + .prop(SN.C.S.Disabled, true); }, error: function (xhr, textStatus, errorThrown) { // If the server end reported an error from StatusNet, @@ -269,7 +269,7 @@ var SN = { // StatusNet .removeClass(SN.C.S.Processing) .find('.submit') .removeClass(SN.C.S.Disabled) - .removeAttr(SN.C.S.Disabled); + .prop(SN.C.S.Disabled, false); }, success: function(data, textStatus) { if (typeof($('form', data)[0]) != 'undefined') { @@ -360,7 +360,7 @@ var SN = { // StatusNet .addClass(SN.C.S.Processing) .find('.submit') .addClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, SN.C.S.Disabled); + .prop(SN.C.S.Disabled, true); SN.U.normalizeGeoData(form); @@ -371,7 +371,7 @@ var SN = { // StatusNet .removeClass(SN.C.S.Processing) .find('.submit') .removeClass(SN.C.S.Disabled) - .removeAttr(SN.C.S.Disabled, SN.C.S.Disabled); + .prop(SN.C.S.Disabled, false); removeFeedback(); if (textStatus == 'timeout') { // @fixme i18n @@ -471,14 +471,14 @@ var SN = { // StatusNet form .removeClass(SN.C.S.Processing) .find('.submit') - .removeAttr(SN.C.S.Disabled) + .prop(SN.C.S.Disabled, false) .removeClass(SN.C.S.Disabled); form.find('[name=lat]').val(SN.C.I.NoticeDataGeo.NLat); form.find('[name=lon]').val(SN.C.I.NoticeDataGeo.NLon); form.find('[name=location_ns]').val(SN.C.I.NoticeDataGeo.NLNS); form.find('[name=location_id]').val(SN.C.I.NoticeDataGeo.NLID); - form.find('[name=notice_data-geo]').attr('checked', SN.C.I.NoticeDataGeo.NDG); + form.find('[name=notice_data-geo]').prop('checked', SN.C.I.NoticeDataGeo.NDG); } }); }, @@ -494,7 +494,7 @@ var SN = { // StatusNet .addClass(SN.C.S.Processing) .find('.submit') .addClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, SN.C.S.Disabled); + .prop(SN.C.S.Disabled, true); }, error: function (xhr, textStatus, errorThrown) { alert(errorThrown || textStatus); @@ -513,7 +513,7 @@ var SN = { // StatusNet .removeClass(SN.C.S.Processing) .find('.submit') .removeClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, false); + .prop(SN.C.S.Disabled, false); } }); }, @@ -528,7 +528,7 @@ var SN = { // StatusNet form.find('.submit') .addClass(SN.C.S.Processing) .addClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, SN.C.S.Disabled); + .prop(SN.C.S.Disabled, true); }, error: function (xhr, textStatus, errorThrown) { alert(errorThrown || textStatus); @@ -545,7 +545,7 @@ var SN = { // StatusNet form.removeClass(SN.C.S.Processing) .find('.submit') .removeClass(SN.C.S.Disabled) - .attr(SN.C.S.Disabled, false); + .prop(SN.C.S.Disabled, false); } } }); @@ -556,7 +556,7 @@ var SN = { // StatusNet SN.C.I.NoticeDataGeo.NLon = form.find('[name=lon]').val(); SN.C.I.NoticeDataGeo.NLNS = form.find('[name=location_ns]').val(); SN.C.I.NoticeDataGeo.NLID = form.find('[name=location_id]').val(); - SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').attr('checked'); // @fixme + SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').prop('checked'); // @fixme (does this still need to be fixed somehow?) var cookieValue = $.cookie(SN.C.S.NoticeDataGeoCookie); @@ -573,10 +573,10 @@ var SN = { // StatusNet } } if (cookieValue == 'disabled') { - SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').attr('checked', false).attr('checked'); + SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').prop('checked', false).prop('checked'); } else { - SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').attr('checked', true).attr('checked'); + SN.C.I.NoticeDataGeo.NDG = form.find('[name=notice_data-geo]').prop('checked', true).prop('checked'); } }, @@ -613,7 +613,7 @@ var SN = { // StatusNet * @access private */ NoticeReply: function() { - $('#content .notice_reply').live('click', function(e) { + $(document).on('click', '#content .notice_reply', function(e) { e.preventDefault(); var notice = $(this).closest('li.notice'); SN.U.NoticeInlineReplyTrigger(notice); @@ -678,8 +678,8 @@ var SN = { // StatusNet replyForm.find('input[name=inreplyto]').val(id); if (stripForm) { // Don't do this for old-school reply form, as they don't come back! - replyForm.find('#notice_to').attr('disabled', 'disabled').hide(); - replyForm.find('#notice_private').attr('disabled', 'disabled').hide(); + replyForm.find('#notice_to').prop('disabled', true).hide(); + replyForm.find('#notice_private').prop('disabled', true).hide(); replyForm.find('label[for=notice_to]').hide(); replyForm.find('label[for=notice_private]').hide(); } @@ -759,17 +759,17 @@ var SN = { // StatusNet * Setup function -- DOES NOT apply immediately. * * Sets up event handlers for inline reply mini-form placeholders. - * Uses 'live' rather than 'bind', so applies to future as well as present items. + * Uses 'on' rather than 'live' or 'bind', so applies to future as well as present items. */ NoticeInlineReplySetup: function() { $('li.notice-reply-placeholder input') - .live('focus', function() { + .on('focus', function() { var notice = $(this).closest('li.notice'); SN.U.NoticeInlineReplyTrigger(notice); return false; }); $('li.notice-reply-comments a') - .live('click', function() { + .on('click', function() { var url = $(this).attr('href'); var area = $(this).closest('.threaded-replies'); $.get(url, {ajax: 1}, function(data, textStatus, xhr) { @@ -788,11 +788,11 @@ var SN = { // StatusNet * Sets up event handlers for repeat forms to toss up a confirmation * popout before submitting. * - * Uses 'live' rather than 'bind', so applies to future as well as present items. + * Uses 'on' rather than 'live' or 'bind', so applies to future as well as present items. * */ NoticeRepeat: function() { - $('.form_repeat').live('click', function(e) { + $('.form_repeat').on('click', function(e) { e.preventDefault(); SN.U.NoticeRepeatConfirmation($(this)); @@ -824,7 +824,7 @@ var SN = { // StatusNet .addClass('submit_dialogbox') .removeClass('submit'); form.append(submit); - submit.bind('click', function() { SN.U.FormXHR(form); return false; }); + submit.on('click', function() { SN.U.FormXHR(form); return false; }); submit_i.hide(); @@ -1072,7 +1072,7 @@ var SN = { // StatusNet form.find('[name=lon]').val(''); form.find('[name=location_ns]').val(''); form.find('[name=location_id]').val(''); - form.find('[name=notice_data-geo]').attr('checked', false); + form.find('[name=notice_data-geo]').prop('checked', false); $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/' }); @@ -1114,7 +1114,7 @@ var SN = { // StatusNet form.find('[name=lon]').val(data.lon); form.find('[name=location_ns]').val(lns); form.find('[name=location_id]').val(lid); - form.find('[name=notice_data-geo]').attr('checked', true); + form.find('[name=notice_data-geo]').prop('checked', true); var cookieValue = { NLat: data.lat, @@ -1132,10 +1132,10 @@ var SN = { // StatusNet if (check.length > 0) { if ($.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') { - check.attr('checked', false); + check.prop('checked', false); } else { - check.attr('checked', true); + check.prop('checked', true); } var NGW = form.find('.notice_data-geo_wrap'); @@ -1145,7 +1145,7 @@ var SN = { // StatusNet .attr('title', label.text()); check.change(function() { - if (check.attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) { + if (check.prop('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) label .attr('title', NoticeDataGeo_text.ShareDisable) .addClass('checked'); @@ -1173,7 +1173,7 @@ var SN = { // StatusNet removeNoticeDataGeo('Location permission denied.'); break; case error.TIMEOUT: - //$('#'+SN.C.S.NoticeDataGeo).attr('checked', false); + //$('#'+SN.C.S.NoticeDataGeo).prop('checked', false); removeNoticeDataGeo('Location lookup timeout.'); break; } @@ -1208,7 +1208,7 @@ var SN = { // StatusNet form.find('[name=lon]').val(cookieValue.NLon); form.find('[name=location_ns]').val(cookieValue.NLNS); form.find('[name=location_id]').val(cookieValue.NLID); - form.find('[name=notice_data-geo]').attr('checked', cookieValue.NDG); + form.find('[name=notice_data-geo]').prop('checked', cookieValue.NDG); SN.U.NoticeGeoStatus(form, cookieValue.NLN, cookieValue.NLat, cookieValue.NLon, cookieValue.NLNU); label @@ -1238,7 +1238,7 @@ var SN = { // StatusNet if (wrapper.length == 0) { wrapper = $('