1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-07 08:05:25 +02:00

[ticket/10954] Join array of class names instead of creating a string

Previously the string for selecting the correct classes was created
directly. Due to that a subsequent comma had to be removed. By joining the
array of class names with a separator this can be omitted.

PHPBB3-10954
This commit is contained in:
Marc Alexander 2012-12-15 23:23:32 +01:00
parent 61ef870fd5
commit b90a56a409

View File

@ -46,6 +46,7 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) {
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
var unreadClassSelectors = '';
var classArray = {};
var classNames = [];
$.each(iconsArray, function(unreadClass, readClass) {
$.each(iconsState, function(key, value) {
@ -57,12 +58,11 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) {
currentClass[unreadClass + value] = readClass + value;
$.extend(classArray, currentClass);
unreadClassSelectors += '.' + unreadClass + value + ',';
classNames[classNames.length] = unreadClass;
});
});
// Remove trailing comma
unreadClassSelectors = unreadClassSelectors.substring(0, unreadClassSelectors.length - 1);
unreadClassSelectors = '.' + classNames.join(',.');
$('li.row').find(unreadClassSelectors).each(function() {
var currentObject = $(this);