mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 16:45:19 +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:
parent
61ef870fd5
commit
b90a56a409
@ -46,6 +46,7 @@ phpbb.add_ajax_callback('mark_topics_read', function(res) {
|
|||||||
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
|
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
|
||||||
var unreadClassSelectors = '';
|
var unreadClassSelectors = '';
|
||||||
var classArray = {};
|
var classArray = {};
|
||||||
|
var classNames = [];
|
||||||
|
|
||||||
$.each(iconsArray, function(unreadClass, readClass) {
|
$.each(iconsArray, function(unreadClass, readClass) {
|
||||||
$.each(iconsState, function(key, value) {
|
$.each(iconsState, function(key, value) {
|
||||||
@ -57,12 +58,11 @@ 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);
|
||||||
|
|
||||||
unreadClassSelectors += '.' + unreadClass + value + ',';
|
classNames[classNames.length] = unreadClass;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove trailing comma
|
unreadClassSelectors = '.' + classNames.join(',.');
|
||||||
unreadClassSelectors = unreadClassSelectors.substring(0, unreadClassSelectors.length - 1);
|
|
||||||
|
|
||||||
$('li.row').find(unreadClassSelectors).each(function() {
|
$('li.row').find(unreadClassSelectors).each(function() {
|
||||||
var currentObject = $(this);
|
var currentObject = $(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user