Skip to content
Permalink
Browse files

add sanity/compatibility check to timestamps.js

  • Loading branch information...
ilya
ilya committed Sep 10, 2019
1 parent a7844c4 commit ab440d65656c6ba412c8ab1db6665b7035072ce1
Showing with 20 additions and 18 deletions.
  1. +20 −18 default/template/js/timestamps.js.template
@@ -1,27 +1,29 @@
// == begin timestamps.js
function ShowTimestamps() {
var d = new Date();
var curTime = Math.floor(d.getTime() / 1000);
if (window.getElementsByClassName) {
var d = new Date();
var curTime = Math.floor(d.getTime() / 1000);

var changeLogged = 0;

var changeLogged = 0;

var te = document.getElementsByClassName("timestamp");//#todo nn3 compat for loop
for (var i = 0; i < te.length; i++) {
if (te[i].title) {
} else {
te[i].setAttribute('title', te[i].innerHTML);
var te = document.getElementsByClassName("timestamp");//#todo nn3 compat for loop
for (var i = 0; i < te.length; i++) {
if (te[i].title) {
} else {
te[i].setAttribute('title', te[i].innerHTML);
}
if (te[i].innerHTML != LongAgo(0 - (curTime - te[i].title))) {
te[i].innerHTML = LongAgo(0 - (curTime - te[i].title));
changeLogged++;
}
}
if (te[i].innerHTML != LongAgo(0 - (curTime - te[i].title))) {
te[i].innerHTML = LongAgo(0 - (curTime - te[i].title));
changeLogged++;

if (changeLogged) {
setTimeout(ShowTimestamps, 5000);
} else {
setTimeout(ShowTimestamps, 15000);
}
}

if (changeLogged) {
setTimeout(ShowTimestamps, 5000);
} else {
setTimeout(ShowTimestamps, 15000);
}
}

function LongAgo(seconds) { // returns string with time units

0 comments on commit ab440d6

Please sign in to comment.
You can’t perform that action at this time.