let timeBox = document.getElementsByClassName('c-timestamp');
let i = 0;
while(i < timeBox.length) {
var date = new Date( timeBox[i].getAttribute('data-ts') * 1000);
var dateFormate = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
dateFormate = dateFormate + '-' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
var currentText = timeBox[i].getElementsByClassName('c-timestamp__label')[0].innerHTML;
if (! currentText.includes(dateFormate)){
timeBox[i].getElementsByClassName('c-timestamp__label')[0].innerHTML = currentText + ' (' + dateFormate + ')';
}
i = i + 1;
}
Last active
April 11, 2025 12:32
-
-
Save risyomei/cdd23e1b523b54062a1ac7eb87f7f0e4 to your computer and use it in GitHub Desktop.
function myLoop() {
setTimeout(function() {
let timeBox = document.getElementsByClassName('c-timestamp');
let i = 0;
while(i < timeBox.length) {
var date = new Date( timeBox[i].getAttribute('data-ts') * 1000);
var dateFormate = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
dateFormate = dateFormate + '-' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
var currentText = timeBox[i].getElementsByClassName('c-timestamp__label')[0].innerHTML;
if (! currentText.includes(dateFormate)){
timeBox[i].getElementsByClassName('c-timestamp__label')[0].innerHTML = currentText + ' (' + dateFormate + ')';
}
i = i + 1;
}
myLoop();
}, 15000)
}
(function() {
myLoop();
})();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is exactly what I was looking for! Thank you, @risyomei!!