From d5a788ae5b615c1b6b642c631884a4d936be2a4c Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 21 Jun 2012 19:16:05 +0100 Subject: [ticket/10949] Converted AJAX coding standards to new guidelines. Basically, moved parentheses to same line and changed variable names to camel case. PHPBB3-10949 --- phpBB/styles/prosilver/template/ajax.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'phpBB/styles') diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 54f34e4204..83335b23af 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -5,14 +5,12 @@ // This callback finds the post from the delete link, and removes it. phpbb.add_ajax_callback('post_delete', function() { var el = $(this), - post_id; - - if (el.attr('data-refresh') === undefined) - { - post_id = el[0].href.split('&p=')[1]; - var post = el.parents('#p' + post_id).css('pointer-events', 'none'); - if (post.hasClass('bg1') || post.hasClass('bg2')) - { + postId; + + if (el.attr('data-refresh') === undefined) { + postId = el[0].href.split('&p=')[1]; + var post = el.parents('#p' + postId).css('pointer-events', 'none'); + if (post.hasClass('bg1') || post.hasClass('bg2')) { var posts1 = post.nextAll('.bg1'); post.nextAll('.bg2').removeClass('bg2').addClass('bg1'); posts1.removeClass('bg1').addClass('bg2'); @@ -54,8 +52,7 @@ $('[data-ajax]').each(function() { ajax = $this.attr('data-ajax'), fn; - if (ajax !== 'false') - { + if (ajax !== 'false') { fn = (ajax !== 'true') ? ajax : null; phpbb.ajaxify({ selector: this, @@ -89,12 +86,9 @@ phpbb.ajaxify({ filter: function (data) { var action = $('#quick-mod-select').val(); - if (action === 'make_normal') - { + if (action === 'make_normal') { return $(this).find('select option[value="make_global"]').length > 0; - } - else if (action === 'lock' || action === 'unlock') - { + } else if (action === 'lock' || action === 'unlock') { return true; } -- cgit v1.2.1 From b5cc1ed683c1e8ca2e189e75e0e3302cc37c5fbf Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 4 Jan 2013 22:46:12 +0100 Subject: [ticket/10949] Converted missing code to new JS coding guidelines A few missing semi-colons were also added where needed. PHPBB3-10949 --- phpBB/styles/prosilver/template/ajax.js | 12 ++++++------ phpBB/styles/prosilver/template/timezone.js | 8 ++++---- phpBB/styles/subsilver2/template/timezone.js | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'phpBB/styles') diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index abe6152db1..7f5ab17f99 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -14,7 +14,7 @@ phpbb.closeDarkenWrapper = function(delay) { }; // This callback will mark all forum icons read -phpbb.add_ajax_callback('mark_forums_read', function(res) { +phpbb.addAjaxCallback('mark_forums_read', function(res) { var readTitle = res.NO_UNREAD_POSTS; var unreadTitle = res.UNREAD_POSTS; var iconsArray = { @@ -44,7 +44,7 @@ phpbb.add_ajax_callback('mark_forums_read', function(res) { }); // This callback will mark all topic icons read -phpbb.add_ajax_callback('mark_topics_read', function(res) { +phpbb.addAjaxCallback('mark_topics_read', function(res) { var readTitle = res.NO_UNREAD_POSTS; var unreadTitle = res.UNREAD_POSTS; var iconsArray = { @@ -91,7 +91,7 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) { }); // This callback finds the post from the delete link, and removes it. -phpbb.add_ajax_callback('post_delete', function() { +phpbb.addAjaxCallback('post_delete', function() { var el = $(this), postId; @@ -110,7 +110,7 @@ phpbb.add_ajax_callback('post_delete', function() { }); // This callback removes the approve / disapprove div or link. -phpbb.add_ajax_callback('post_approve', function(res) { +phpbb.addAjaxCallback('post_approve', function(res) { var remove = (res.approved) ? $(this) : $(this).parents('.post'); $(remove).css('pointer-events', 'none').fadeOut(function() { $(this).remove(); @@ -118,12 +118,12 @@ phpbb.add_ajax_callback('post_approve', function(res) { }); // This removes the parent row of the link or form that fired the callback. -phpbb.add_ajax_callback('row_delete', function() { +phpbb.addAjaxCallback('row_delete', function() { $(this).parents('tr').remove(); }); // This handles friend / foe additions removals. -phpbb.add_ajax_callback('zebra', function(res) { +phpbb.addAjaxCallback('zebra', function(res) { var zebra; if (res.success) { diff --git a/phpBB/styles/prosilver/template/timezone.js b/phpBB/styles/prosilver/template/timezone.js index da0a2b0bfd..af8206d12d 100644 --- a/phpBB/styles/prosilver/template/timezone.js +++ b/phpBB/styles/prosilver/template/timezone.js @@ -1,19 +1,19 @@ (function($) { // Avoid conflicts with other libraries $('#tz_date').change(function() { - phpbb.timezone_switch_date(false); + phpbb.timezoneSwitchDate(false); }); $('#tz_select_date_suggest').click(function(){ - phpbb.timezone_preselect_select(true); + phpbb.timezonePreselectSelect(true); }); $(document).ready( - phpbb.timezone_enable_date_selection + phpbb.timezoneEnableDateSelection ); $(document).ready( - phpbb.timezone_preselect_select($('#tz_select_date_suggest').attr('data-is-registration') == 'true') + phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('data-is-registration') == 'true') ); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/subsilver2/template/timezone.js b/phpBB/styles/subsilver2/template/timezone.js index da0a2b0bfd..af8206d12d 100644 --- a/phpBB/styles/subsilver2/template/timezone.js +++ b/phpBB/styles/subsilver2/template/timezone.js @@ -1,19 +1,19 @@ (function($) { // Avoid conflicts with other libraries $('#tz_date').change(function() { - phpbb.timezone_switch_date(false); + phpbb.timezoneSwitchDate(false); }); $('#tz_select_date_suggest').click(function(){ - phpbb.timezone_preselect_select(true); + phpbb.timezonePreselectSelect(true); }); $(document).ready( - phpbb.timezone_enable_date_selection + phpbb.timezoneEnableDateSelection ); $(document).ready( - phpbb.timezone_preselect_select($('#tz_select_date_suggest').attr('data-is-registration') == 'true') + phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('data-is-registration') == 'true') ); })(jQuery); // Avoid conflicts with other libraries -- cgit v1.2.1 From be7719443587d85402813211d78d7c562a93518b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Jan 2013 11:40:41 +0100 Subject: [ticket/10949] Remove not needed comma This comma might actually cause issues in browser. Therefore remove it. PHPBB3-10949 --- phpBB/styles/prosilver/template/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/styles') diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 7f5ab17f99..8583fb565c 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -20,7 +20,7 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) { var iconsArray = { 'forum_unread': 'forum_read', 'forum_unread_subforum': 'forum_read_subforum', - 'forum_unread_locked': 'forum_read_locked', + 'forum_unread_locked': 'forum_read_locked' }; $('li.row').find('dl[class*="forum_unread"]').each(function() { -- cgit v1.2.1