Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Less autistic date display

Cette révision appartient à :
sfan5 2017-05-05 15:55:25 +02:00
Parent 1d8246b556
révision 8828a07fdf
3 fichiers modifiés avec 40 ajouts et 4 suppressions

Voir le fichier

@ -22,12 +22,18 @@
var maxId = 5;
for (var i = 0; i < maxId; i++) {
var el = document.getElementById('page-' + i), n = prev + i;
if (el == null)
continue;
el.href = pageString + n + query;
el.innerHTML = n;
}
document.getElementById('page-next').href = pageString + next + query;
document.getElementById('page-prev').href = pageString + prev + query;
var e = document.getElementById('page-next');
if (e != null)
e.href = pageString + next + query;
var e = document.getElementById('page-prev');
if (e != null)
e.href = pageString + prev + query;
// Used by spoiler tags
function toggleLayer(elem) {
@ -36,3 +42,33 @@ function toggleLayer(elem) {
else
elem.classList.add("hide");
}
function formatDate(date) { // thanks stackoverflow
var monthNames = [
"January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December"
];
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear();
return day + ' ' + monthNames[monthIndex] + ' ' + year;
}
var list = document.getElementsByClassName("date-short");
for(var i in list) {
var e = list[i];
e.title = e.innerText;
e.innerText = formatDate(new Date(e.innerText));
}
var list = document.getElementsByClassName("date-full");
for(var i in list) {
var e = list[i];
e.title = e.innerText;
var date = new Date(e.innerText);
e.innerText = date.toDateString() + " " + date.toLocaleTimeString();
}

Voir le fichier

@ -31,7 +31,7 @@
{{.Name}}
</a>
</td>
<td class="date">{{.Date}}</td>
<td class="date date-short">{{.Date}}</td>
<td class="filesize">{{.Filesize}}</td>
<td>
<a href="{{.Magnet}}" target="_blank" title="Magnet link">

Voir le fichier

@ -19,7 +19,7 @@
</tr>
<tr>
<td>Date</td>
<td>{{.Date}}</td>
<td class="date-full">{{.Date}}</td>
</tr>
<tr>
<td>FileSize</td>