fix: removal of snowballing memory problems in JS countdowns

This commit is contained in:
Martin Ambrus
2017-08-28 18:56:52 +02:00
parent dfc076b88d
commit 8c2343bdbb
2 changed files with 17 additions and 7 deletions
+3 -3
View File
@@ -132,7 +132,7 @@ window
// IE MooTools Fix // IE MooTools Fix
if (Browser.Engine.trident) // für IE if (Browser.Engine.trident) // fr IE
{ {
@@ -372,7 +372,7 @@ var BBEditor = new Class ({
/** /**
* Fügt den klickbaren Objekten die Events hinzu * Fgt den klickbaren Objekten die Events hinzu
* *
@@ -402,7 +402,7 @@ var BBEditor = new Class ({
/** /**
* Fügt einen ausgewählten Tag in die * Fgt einen ausgewhlten Tag in die
* Textarea ein * Textarea ein
+14 -4
View File
@@ -62,12 +62,22 @@ executeCounter();}
function executeCounter(){ function executeCounter(){
for(var i in ab){ for(var i in ab){
wb = db() - cb; wb = db() - cb;
xb = rb(ab[i].counter_time + wb); if (ab[i] && ab[i]['counter_time']) {
xb = rb(ab[i].counter_time + wb);
} else {
xb = 0;
}
ab[i].node.innerHTML = xb; ab[i].node.innerHTML = xb;
} }
for(i in bb){ for(i in bb){
wb = db() - cb; wb = db() - cb;
yb = bb[i].counter_time - wb;
if (bb[i] && bb[i]['counter_time']) {
yb = bb[i].counter_time - wb;
} else {
eb = 0;
yb = -1;
}
// console.log('yb: ' + yb); // console.log('yb: ' + yb);
if(eb == 0 && yb < 0){ if(eb == 0 && yb < 0){
bb[i] = null; bb[i] = null;
@@ -86,9 +96,9 @@ function executeCounter(){
xb=rb(yb); xb=rb(yb);
bb[i].node.innerHTML = xb; bb[i].node.innerHTML = xb;
} }
if(eb == 0 && yb >= 0){ /*if(eb == 0 && yb >= 0){
setTimeout("executeCounter()",1000); setTimeout("executeCounter()",1000);
} }*/
} }
setTimeout("executeCounter()",1000); setTimeout("executeCounter()",1000);
} }