Commit d2ae1b32 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch 'fix-handling-of-zero-platinum-members' into 'main'

[BUGFIX] Fix JS error if no banners available

See merge request !11
parents 0fd9ec62 564eb166
Pipeline #22946 failed with stages
in 15 seconds
......@@ -3,15 +3,14 @@ let randombanners = {} || window.randombanners;
/**
* Mix banner
*
* @param {string} element
* @param {string} selector
*/
randombanners.shuffle = function (element) {
$element = document.querySelector(element);
randombanners.shuffle = function (selector) {
let $element = document.querySelector(selector);
if ($(element).children.length > 1) {
$element = document.querySelector(element);
for (let i = $(element).children.length; i >= 0; i--) {
$element.appendChild($element.children[Math.random() * i | 0]);
if ($element !== null && $element.children.length > 1) {
for (let i = $element.children.length; i > 0; i--) {
$element.appendChild($element.children[Math.floor(Math.random() * i)]);
}
}
};
......@@ -19,9 +18,8 @@ randombanners.shuffle = function (element) {
(function () {
randombanners.shuffle('.t3js-banners');
// alert every 2 seconds
// shuffle every 8 seconds
setInterval(function () {
randombanners.shuffle('.t3js-banners')
}, 8000);
})();
......@@ -22,5 +22,5 @@ $EM_CONF['randombanners'] = [
'uploadfolder' => 0,
'createDirs' => '',
'clearcacheonload' => 0,
'version' => '2.1.1',
'version' => '2.1.2',
];
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment