[ticket/10954] Simplify marking forums read and fix topic marking

PHPBB3-10954
This commit is contained in:
Marc Alexander 2012-12-15 23:48:33 +01:00
parent b90a56a409
commit f4ff335369

View file

@ -6,19 +6,20 @@
phpbb.add_ajax_callback('mark_forums_read', function(res) { phpbb.add_ajax_callback('mark_forums_read', function(res) {
var readTitle = res.NO_UNREAD_POSTS; var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS; var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
'forum_unread': 'forum_read',
'forum_unread_subforum': 'forum_read_subforum',
'forum_unread_locked': 'forum_read_locked'
};
$('li.row').find('dl.forum_unread, dl.forum_unread_subforum, dl.forum_unread_locked').each(function() { $('li.row').find('dl.forum_unread, dl.forum_unread_subforum, dl.forum_unread_locked').each(function() {
var currentObject = $(this); var currentObject = $(this);
if (currentObject.hasClass('forum_unread')) { $.each(iconsArray, function(unreadClass, readClass) {
currentObject.removeClass('forum_unread').addClass('forum_read'); if (currentObject.hasClass(unreadClass)) {
} currentObject.removeClass(unreadClass).addClass(readClass);
else if (currentObject.hasClass('forum_unread_subforum')) { }
currentObject.removeClass('forum_unread_subforum').addClass('forum_read_subforum'); });
}
else {
currentObject.removeClass('forum_unread_locked').addClass('forum_read_locked');
}
currentObject.children('dt[title=' + unreadTitle + ']').attr('title', readTitle); currentObject.children('dt[title=' + unreadTitle + ']').attr('title', readTitle);
}); });
@ -58,7 +59,7 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) {
currentClass[unreadClass + value] = readClass + value; currentClass[unreadClass + value] = readClass + value;
$.extend(classArray, currentClass); $.extend(classArray, currentClass);
classNames[classNames.length] = unreadClass; classNames[classNames.length] = unreadClass + value;
}); });
}); });