aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2012-12-13 17:46:48 +0100
committerMarc Alexander <admin@m-a-styles.de>2012-12-13 17:56:09 +0100
commita3f18caacc5f7c0392097099fff5189a7dfe63ce (patch)
tree2d4754210f0763ffe56b0c7e981ed72d6cf245e4 /phpBB/styles/prosilver/template
parent7efc37d1f9d4a4335fc91af147cd059c17b7d45e (diff)
downloadforums-a3f18caacc5f7c0392097099fff5189a7dfe63ce.tar
forums-a3f18caacc5f7c0392097099fff5189a7dfe63ce.tar.gz
forums-a3f18caacc5f7c0392097099fff5189a7dfe63ce.tar.bz2
forums-a3f18caacc5f7c0392097099fff5189a7dfe63ce.tar.xz
forums-a3f18caacc5f7c0392097099fff5189a7dfe63ce.zip
[ticket/10954] Only call $(this) once and reduce number of DOM traversals
PHPBB3-10954
Diffstat (limited to 'phpBB/styles/prosilver/template')
-rw-r--r--phpBB/styles/prosilver/template/ajax.js29
1 files changed, 20 insertions, 9 deletions
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 7752c00367..97b77f6217 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -6,26 +6,30 @@
phpbb.add_ajax_callback('mark_forums_read', function(res) {
var read_title = res.NO_UNREAD_POSTS;
var unread_title = res.UNREAD_POSTS;
+ var current_object;
$('li.row dl.forum_unread').each(function(e) {
- $(this).removeClass('forum_unread').addClass('forum_read');
- $(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
+ current_object = $(this);
+ current_object.removeClass('forum_unread').addClass('forum_read');
+ current_object.children('dt[title=' + unread_title + ']').attr('title', read_title);
});
$('li.row dl.forum_unread_subforum').each(function(e) {
- $(this).removeClass('forum_unread_subforum').addClass('forum_read_subforum');
- $(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
+ current_object = $(this);
+ current_object.removeClass('forum_unread_subforum').addClass('forum_read_subforum');
+ current_object.children('dt[title=' + unread_title + ']').attr('title', read_title);
});
$('li.row dl.forum_unread_locked').each(function(e) {
- $(this).removeClass('forum_unread_locked').addClass('forum_read_locked');
- $(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
+ current_object = $(this);
+ current_object.removeClass('forum_unread_locked').addClass('forum_read_locked');
+ current_object.children('dt[title=' + unread_title + ']').attr('title', read_title);
});
});
// This callback will mark all topic icons read
phpbb.add_ajax_callback('mark_topics_read', function(res) {
- var i,j;
+ var i,j, current_object;
var read_title = res.NO_UNREAD_POSTS;
var unread_title = res.UNREAD_POSTS;
var icons_array = [
@@ -42,9 +46,16 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) {
{
for (j = 0; j < icons_state.length; j++)
{
+ // Only topics can be hot
+ if ((icons_state[j] == '_hot' || icons_state[j] == '_hot_mine') && icons_array[i][0] != 'topic_unread')
+ {
+ continue;
+ }
+
$('li.row dl.' + icons_array[i][0] + icons_state[j]).each(function(e) {
- $(this).removeClass(icons_array[i][0] + icons_state[j]).addClass(icons_array[i][1] + icons_state[j]);
- $(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
+ current_object = $(this);
+ current_object.removeClass(icons_array[i][0] + icons_state[j]).addClass(icons_array[i][1] + icons_state[j]);
+ current_object.children('dt[title=' + unread_title + ']').attr('title', read_title);
});
}
}