From d51d917fa48b3f57cf464d164f8ac11eb77443f5 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Thu, 13 Mar 2014 16:09:00 +0600 Subject: [PATCH] [#345] remove deprecated live event --- app/assets/javascripts/application.js | 4 +- app/assets/javascripts/design/all.js | 6 +-- app/assets/javascripts/extra/filter_labels.js | 2 +- app/assets/javascripts/extra/profile.js | 2 +- app/assets/javascripts/extra/tracker.js | 46 +++++++++---------- app/assets/javascripts/login.js | 6 +-- app/assets/javascripts/tour.js | 2 +- .../admin/register_requests/index.html.haml | 4 +- app/views/admin/users/index.html.haml | 2 +- .../platforms/_connection_info.html.haml | 6 +-- .../projects/base/_branch_select.html.haml | 2 +- app/views/projects/base/_repo_block.html.haml | 2 +- app/views/projects/projects/index.html.haml | 10 ++-- app/views/projects/wiki/_git_access.html.haml | 2 +- .../javascripts/pirobox_extended_min.js | 2 +- 15 files changed, 49 insertions(+), 49 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9946b1663..e2427d249 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -53,11 +53,11 @@ $(document).ready(function() { disableNotifierCbx($(this)); }); - $('div.information > div.profile > a').live('click', function(e) { + $('div.information > div.profile > a').on('click', function(e) { e.preventDefault(); }); - $('.more_activities').live('click', function(){ + $('.more_activities').on('click', function(){ var button = $(this); $.ajax({ type: 'GET', diff --git a/app/assets/javascripts/design/all.js b/app/assets/javascripts/design/all.js index 2f9896da8..8ba672900 100644 --- a/app/assets/javascripts/design/all.js +++ b/app/assets/javascripts/design/all.js @@ -19,7 +19,7 @@ $(document).ready(function() { }); - $('.data-expander').live('click', function(e) { + $('.data-expander').on('click', function(e) { var $button = $(e.target); var id = "#content-" + $button.attr('id'); var $slider = $(id); @@ -27,7 +27,7 @@ $(document).ready(function() { $button.toggleClass('expanded collapsed'); }); }); - + function showActivity(elem) { $("#activity-bottom"+elem).slideToggle("slow"); var img = document.getElementById("expand" + elem).className; @@ -38,7 +38,7 @@ $(document).ready(function() { } } - $('div.information > div.user').live('click', function() { + $('div.information > div.user').on('click', function() { dropbox.slideToggle("slow"); }); }); diff --git a/app/assets/javascripts/extra/filter_labels.js b/app/assets/javascripts/extra/filter_labels.js index 5dd23a47e..593f9e92d 100644 --- a/app/assets/javascripts/extra/filter_labels.js +++ b/app/assets/javascripts/extra/filter_labels.js @@ -1,6 +1,6 @@ $(document).ready(function() { - $(".div-filter-labels").live('click', function() { + $(".div-filter-labels").on('click', function() { var flag = this.id; flag = flag.replace("label-","flag-"); var bg = $("#"+flag).css("background-color"); diff --git a/app/assets/javascripts/extra/profile.js b/app/assets/javascripts/extra/profile.js index 668632151..5c42c42f2 100644 --- a/app/assets/javascripts/extra/profile.js +++ b/app/assets/javascripts/extra/profile.js @@ -23,7 +23,7 @@ $(document).ready(function() { return false; } - profile_vis_buttons.live('click', function () { + profile_vis_buttons.on('click', function () { profile_vis_buttons.toggleClass('active'); return load_profile_projects(); }); diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index 072e1fcdf..f287fff87 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -1,6 +1,6 @@ $(document).ready(function() { - $("#manage-labels").live('click', function () { + $("#manage-labels").on('click', function () { var toggled = $(this).data('toggled'); $(this).data('toggled', !toggled); if (!toggled) { @@ -13,16 +13,16 @@ $(document).ready(function() { } }); - $("div.div-tracker-labels").live('click', function() { + $("div.div-tracker-labels").on('click', function() { return send_index_tracker_request('GET'); }); - $("#table1.issues-table .pagination a").live('click', function() { + $("#table1.issues-table .pagination a").on('click', function() { updatePagination($(this)); return send_index_tracker_request('GET'); }); - $(".issues-filter .tabnav-tabs li").live('click', function() { + $(".issues-filter .tabnav-tabs li").on('click', function() { var li = $(this); var items = $('.issues-filter .tabnav-tabs'); if (li.hasClass('list-browser-sorts')) { @@ -39,23 +39,23 @@ $(document).ready(function() { return send_index_tracker_request('GET'); }); - $("#filter_issues #myradio1").live('change', function(event) { + $("#filter_issues #myradio1").on('change', function(event) { return send_index_tracker_request('GET'); }); - $('.ajax_search_form').live('submit', function() { + $('.ajax_search_form').on('submit', function() { return send_index_tracker_request('GET', $(this).attr("action")); }); - $('#add_label').live('click', function() { + $('#add_label').on('click', function() { return send_index_tracker_request('POST', $(this).attr("href"), $('#new_label').serialize()); }); - $('.righter #update_label').live('click', function() { + $('.righter #update_label').on('click', function() { return send_index_tracker_request('POST', $(this).attr("href"), $(this).parents('#update_label').serialize()); }); - $('.colors .choose').live('click', function() { + $('.colors .choose').on('click', function() { var parent = $(this).parents('.colors'); parent.find('.choose.selected').removeClass('selected'); $(this).addClass('selected'); @@ -63,18 +63,18 @@ $(document).ready(function() { return false; }); - $('.custom_color').live('click', function() { + $('.custom_color').on('click', function() { $(this).siblings('#label_color').toggle(); return false; }); - $('article a.edit_label').live('click', function() { + $('article a.edit_label').on('click', function() { $(this).parents('.label.edit').siblings('.label.edit').find('.edit_label_form').hide(); $(this).parents('.label.edit').find('.edit_label_form').toggle(); return false; }); - $('.delete_label').live('click', function() { + $('.delete_label').on('click', function() { return send_index_tracker_request('POST', $(this).attr('href')); }); @@ -112,15 +112,15 @@ $(document).ready(function() { return search_items(path, data, dom); }); - $('.users-search-popup .header .icon-remove-circle').live('click', function() { + $('.users-search-popup .header .icon-remove-circle').on('click', function() { $('.users-search-popup').hide(); }); - $('#assigned-container .icon-share').live('click', function() { + $('#assigned-container .icon-share').on('click', function() { $('#assigned-popup').show(); }); - $('#assigned-popup .people.selected').live('click', function() { + $('#assigned-popup .people.selected').on('click', function() { var form = $('#assigned-popup .edit_assignee'); var item = $(this); if (form.length == 0) { @@ -141,7 +141,7 @@ $(document).ready(function() { return false; }); - $('.add_label.label').live('click', function() { + $('.add_label.label').on('click', function() { $(this).addClass('selected').removeClass('add_label').addClass('remove_label'); $(this).find('.labeltext').addClass('selected'); var style = $(this).find('.flag').attr('style'); @@ -155,7 +155,7 @@ $(document).ready(function() { labels.append($(this).find('#'+$(this).attr('id'))); }); - $('.remove_label.label.selected').live('click', function() { + $('.remove_label.label.selected').on('click', function() { var id = $(this).attr('id'); $('.manage_labels, #active_labels').find('#'+id+'.label.selected.remove_label').remove(); var form = $('.form.issue'); @@ -171,7 +171,7 @@ $(document).ready(function() { $('.manage_labels').find('#'+$(this).attr('id')).remove(); }); - $('.issue_status.switch_issue_status').live('click', function () { + $('.issue_status.switch_issue_status').on('click', function () { var button = $(this); var status = (button.hasClass('switcher')) ? 'closed' : 'open'; var form = $('#update_issue_status'); @@ -192,17 +192,17 @@ $(document).ready(function() { return false; }); - $('#edit_issue_content').live('click', function() { + $('#edit_issue_content').on('click', function() { $('.edit_form.issue').fadeIn('fast'); $(this).fadeOut('fast'); }); - $('#cancel_edit_issue_content').live('click', function() { + $('#cancel_edit_issue_content').on('click', function() { $('.edit_form.issue').fadeOut('fast'); $('#edit_issue_content').fadeIn('fast'); }); - $('.edit_form.issue').live('submit', function() { + $('.edit_form.issue').on('submit', function() { var form = $(this); form.parent().find('.flash').remove(); $.ajax({ @@ -222,14 +222,14 @@ $(document).ready(function() { return false; }); - $('.button.manage_labels').live('click', function() { + $('.button.manage_labels').on('click', function() { $('.button.update_labels').fadeIn(0); $('.current_labels .label .labeltext.selected').parent().addClass('remove_label selected').removeClass('nopointer'); $('.current_labels .label .labeltext:not(.selected)').parent().addClass('add_label').removeClass('nopointer'); $(this).fadeOut(0); }); - $('.button.update_labels').live('click', function() { + $('.button.update_labels').on('click', function() { var form = $('form.edit_labels.issue'); $.ajax({ type: 'POST', diff --git a/app/assets/javascripts/login.js b/app/assets/javascripts/login.js index 34f328c64..3307fd90a 100644 --- a/app/assets/javascripts/login.js +++ b/app/assets/javascripts/login.js @@ -4,16 +4,16 @@ $(document).ready(function() { var login_default = $('#login_default').val(); var pass_default = $('#password_default').val(); - $('.registartion-input').live('keydown', function() { + $('.registartion-input').on('keydown', function() { var id = $(this).attr('id'); if(id == 'user_login' || id == 'user_password') { id = 'login_error'} $('.error.'+id).fadeOut('slow'); - }).live('focus', function() { + }).on('focus', function() { var id = $(this).attr('id'); if(id == 'user_login' && $(this).val() == login_default) { $(this).val('')} else if(id == 'user_password' && $(this).val() == pass_default) { $(this).val('')} $(this).addClass('registartion-input-focus').removeClass('registartion-input-error'); - }).live('blur', function() { + }).on('blur', function() { var id = $(this).attr('id'); if(id == 'user_login' && $(this).val() == '') { $(this).val(login_default)} else if(id == 'user_password' && $(this).val() == '') { $(this).val(pass_default)} diff --git a/app/assets/javascripts/tour.js b/app/assets/javascripts/tour.js index a3d336e53..d8e413952 100644 --- a/app/assets/javascripts/tour.js +++ b/app/assets/javascripts/tour.js @@ -5,7 +5,7 @@ //= require ./design/all $(document).ready(function() { - $('div.information > div.profile > a').live('click', function(e) { + $('div.information > div.profile > a').on('click', function(e) { e.preventDefault(); }); }); \ No newline at end of file diff --git a/app/views/admin/register_requests/index.html.haml b/app/views/admin/register_requests/index.html.haml index 045d87d72..d4bf2368f 100644 --- a/app/views/admin/register_requests/index.html.haml +++ b/app/views/admin/register_requests/index.html.haml @@ -45,12 +45,12 @@ var change_update_type = function (type) { $('input#update_type').val(type); }; - $('#approve_registration').live('click', function(e) { + $('#approve_registration').on('click', function(e) { //set update_type to 'approve' change_update_type('approve'); $form.submit(); }); - $('#reject_registration').live('click', function(e) { + $('#reject_registration').on('click', function(e) { //set update_type to 'reject' change_update_type('reject'); $form.submit(); diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 178cf6a4f..b6644d6c1 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -33,6 +33,6 @@ = render 'submenu' :javascript - $('#users_filter[type="radio"]').live('change', function(){ + $('#users_filter[type="radio"]').on('change', function(){ $('#datatable').dataTable().fnDraw(); }); diff --git a/app/views/platforms/platforms/_connection_info.html.haml b/app/views/platforms/platforms/_connection_info.html.haml index 5838944ba..c2569c7cf 100644 --- a/app/views/platforms/platforms/_connection_info.html.haml +++ b/app/views/platforms/platforms/_connection_info.html.haml @@ -27,9 +27,9 @@ $('#command_string').val(list[$platform.val()][$arch.val()]); // alert('hello'); } - $("select#platform").live('change', path_getter); - $("select#arch").live('change', path_getter); - $("textarea#command_string").live('click', function() { + $("select#platform").on('change', path_getter); + $("select#arch").on('change', path_getter); + $("textarea#command_string").on('click', function() { this.select(); }); path_getter(); diff --git a/app/views/projects/base/_branch_select.html.haml b/app/views/projects/base/_branch_select.html.haml index 7c81e5ab2..4bee2ccee 100644 --- a/app/views/projects/base/_branch_select.html.haml +++ b/app/views/projects/base/_branch_select.html.haml @@ -7,7 +7,7 @@ :javascript $(document).ready(function() { - $('select#branch_selector').live('change', function(e) { + $('select#branch_selector').on('change', function(e) { $form = $('form#branch_changer'); $form.attr('action', $(this).val()); $form.submit(); diff --git a/app/views/projects/base/_repo_block.html.haml b/app/views/projects/base/_repo_block.html.haml index 3d302ba6b..df1cdca7b 100644 --- a/app/views/projects/base/_repo_block.html.haml +++ b/app/views/projects/base/_repo_block.html.haml @@ -48,7 +48,7 @@ .both :javascript $(document).ready(function() { - $('#url').live('click', function() { + $('#url').on('click', function() { $(this).select(); }); }); diff --git a/app/views/projects/projects/index.html.haml b/app/views/projects/projects/index.html.haml index f6bf486bf..13f4ddf37 100644 --- a/app/views/projects/projects/index.html.haml +++ b/app/views/projects/projects/index.html.haml @@ -93,7 +93,7 @@ }); var $search = $('#search'); - $search.live('blur', function() { + $search.on('blur', function() { $this = $(this); if ($this.val() == '') { $this.val('#{ t('layout.find_project') }'); @@ -101,7 +101,7 @@ } return true; }); - $search.live('focus', function() { + $search.on('focus', function() { $this = $(this); if ($this.val() == '#{ t('layout.find_project') }') { $this.val(''); @@ -109,13 +109,13 @@ } return true; }); - $search.live('keyup', function() { + $search.on('keyup', function() { oTable.fnFilter(this.value); }); - $(".div-filter-labels").live('click', function() { + $(".div-filter-labels").on('click', function() { oTable.dataTable().fnDraw(); }); - $('#filter_projects').live('submit', function() { + $('#filter_projects').on('submit', function() { return false; }); }); diff --git a/app/views/projects/wiki/_git_access.html.haml b/app/views/projects/wiki/_git_access.html.haml index 412711528..c6b69b342 100644 --- a/app/views/projects/wiki/_git_access.html.haml +++ b/app/views/projects/wiki/_git_access.html.haml @@ -10,7 +10,7 @@ $('.name #url-field').text(link.attr('href')); $('.role').text(link.attr('data-permissions')); - $('.name a').live('click', function(e) { + $('.name a').on('click', function(e) { e.preventDefault(); $('.name #url-field').text($(this).attr('href')); $('.role').text($(this).attr('data-permissions')); diff --git a/vendor/assets/javascripts/pirobox_extended_min.js b/vendor/assets/javascripts/pirobox_extended_min.js index cf7a90ea9..3da49093f 100644 --- a/vendor/assets/javascripts/pirobox_extended_min.js +++ b/vendor/assets/javascripts/pirobox_extended_min.js @@ -28,6 +28,6 @@ div_reg.piroFadeIn(300,function(){div_reg.load(p_link);piro_loader.hide();});bre div_reg.piroFadeIn(300,function(){$(p_link).clone(true).appendTo(div_reg).piroFadeIn(300);piro_loader.hide();});break case'gallery':div_reg.css('overflow','hidden');resize.css('overflow','hidden');$('.my_frame').remove();piro_close.add(btn_info).add(piro_capt).hide();if(descr==""){piro_capt.html('');}else{piro_capt.html('

'+descr+'

');} animate_image();break;case'single':piro_close.add(btn_info).add(piro_capt).hide();div_reg.html('').css('overflow','hidden');resize.css('overflow','hidden');$('.my_frame').remove();if(descr==""){piro_capt.html('');}else{piro_capt.html('

'+descr+'

');} -animate_image();break}}});$('.immagine').live('click',function(){piro_capt.slideToggle(200);});function close_all(){if($('.piro_close').is(':visible')){$('.my_frame').remove();wrapper.add(div_reg).add(resize).stop();var ie_sucks=wrapper;if($.browser.msie){ie_sucks=div_reg.add(piro_bg);$('.div_reg img').remove();}else{ie_sucks=wrapper.add(piro_bg);} +animate_image();break}}});$('.immagine').on('click',function(){piro_capt.slideToggle(200);});function close_all(){if($('.piro_close').is(':visible')){$('.my_frame').remove();wrapper.add(div_reg).add(resize).stop();var ie_sucks=wrapper;if($.browser.msie){ie_sucks=div_reg.add(piro_bg);$('.div_reg img').remove();}else{ie_sucks=wrapper.add(piro_bg);} ie_sucks.piroFadeOut(200,function(){div_reg.html('');piro_loader.add(piro_capt).add(btn_info).hide();$('.nav_container').hide();piro_bg.add(wrapper).hide().css('visibility','visible');});}} piro_close.add(piro_loader).add(piro_bg).bind('click',function(y){y.preventDefault();close_all();});}})(jQuery); \ No newline at end of file