timestamps as title and not replacing text
This commit is contained in:
parent
cacd9d9bcc
commit
8ea3d74c8c
1 changed files with 1 additions and 16 deletions
|
|
@ -16,7 +16,6 @@ class AdminerReadableDates
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->prepend = <<<EOT
|
$this->prepend = <<<EOT
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(event) {
|
document.addEventListener('DOMContentLoaded', function(event) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
var tds = document.querySelectorAll('td[id^="val"]');
|
var tds = document.querySelectorAll('td[id^="val"]');
|
||||||
|
|
@ -24,24 +23,10 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
||||||
var text = tds[i].innerHTML.trim();
|
var text = tds[i].innerHTML.trim();
|
||||||
if (text.match(/^\d{10}$/)) {
|
if (text.match(/^\d{10}$/)) {
|
||||||
date.setTime(parseInt(text) * 1000);
|
date.setTime(parseInt(text) * 1000);
|
||||||
tds[i].oldDate = text;
|
tds[i].title = date.toLocaleString();
|
||||||
|
|
||||||
// tds[i].newDate = date.toUTCString().substr(5); // UTC format
|
|
||||||
tds[i].newDate = date.toLocaleString(); // Local format
|
|
||||||
// tds[i].newDate = date.toLocaleFormat('%e %b %Y %H:%M:%S'); // Custom format - works in Firefox only
|
|
||||||
|
|
||||||
tds[i].newDate = '<span style="color: #009900">' + tds[i].newDate + '</span>';
|
|
||||||
tds[i].innerHTML = tds[i].newDate;
|
|
||||||
tds[i].dateIsNew = true;
|
|
||||||
|
|
||||||
tds[i].addEventListener('click', function(event) {
|
|
||||||
this.innerHTML = (this.dateIsNew ? this.oldDate : this.newDate);
|
|
||||||
this.dateIsNew = !this.dateIsNew;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue