So reverted modif from date-short Added new date-comments to have hours on them (when screen is big enough) Edited the view for displaying date comments, they were displayed on the border (even with old date-short)
49 lignes
No EOL
1,6 Kio
JavaScript
49 lignes
No EOL
1,6 Kio
JavaScript
function toggleNightMode() {
|
|
var night = localStorage.getItem("night");
|
|
if(night == "true") {
|
|
document.getElementsByTagName("head")[0].removeChild(darkStyleLink);
|
|
} else {
|
|
document.getElementsByTagName("head")[0].appendChild(darkStyleLink);
|
|
}
|
|
localStorage.setItem("night", (night == "true") ? "false" : "true");
|
|
}
|
|
|
|
// Used by spoiler tags
|
|
function toggleLayer(elem) {
|
|
if (elem.classList.contains("hide"))
|
|
elem.classList.remove("hide");
|
|
else
|
|
elem.classList.add("hide");
|
|
}
|
|
|
|
// Date formatting
|
|
var lang = $("html").attr("lang");
|
|
var shortOpt = { year: "numeric", month: "short", day: "numeric" };
|
|
|
|
var list = document.getElementsByClassName("date-short");
|
|
for(var i in list) {
|
|
var e = list[i];
|
|
e.title = e.innerText;
|
|
e.innerText = new Date(e.innerText).toLocaleString(lang, shortOpt);
|
|
}
|
|
|
|
var list = document.getElementsByClassName("date-full");
|
|
for(var i in list) {
|
|
var e = list[i];
|
|
e.title = e.innerText;
|
|
e.innerText = new Date(e.innerText).toLocaleString(lang);
|
|
}
|
|
|
|
var list = document.getElementsByClassName("date-comments");
|
|
for(var i in list) {
|
|
var e = list[i];
|
|
e.title = e.innerText;
|
|
e.innerText = new Date(e.title).toLocaleDateString(lang, { year: "numeric", month: "short", day: "numeric"}) + " ";
|
|
$(e).append($('<span class="hidden-xs"></span>').text(new Date(e.title).toLocaleTimeString(lang, { hour:"numeric", minute:"numeric" })))
|
|
}
|
|
/*Fixed-Navbar offset fix*/
|
|
window.onload = function() {
|
|
var shiftWindow = function() { scrollBy(0, -70) };
|
|
if (location.hash) shiftWindow();
|
|
window.addEventListener("hashchange", shiftWindow);
|
|
}; |