7eee47b0d3
* Use ModeratorDir variable * Rename cookieHelper to cookie_helper for consistency * Use named constant instead of literals * Fix ability to upload when uploads are disabled The old code let people upload under the right conditions when uploads were disabled. (ie: User is banned and config.AdminAreStillAllowedTo is false) * Increase timeout (fixes #517) * Fix inconsistent indentation *.{js, css} (fix #583) * Fix negative page Temporary fix. The issue was that going to a negative page caused the sql query to have a negative offset. This caused an error in the database query. We need to cleanup this code, but this will work for now. * Fix wrong PG_DATA directory due to upgrade to 9.6 * Add server status link to FAQ * Fix failing tests * Clarify group_vars/all and hosts doc * Add a wrapper to protect /mod route * Fix login page not showing form errors
57 lignes
1,7 Kio
JavaScript
57 lignes
1,7 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 ymdOpt = { year: "numeric", month: "short", day: "numeric" };
|
|
var hmOpt = { hour: "numeric", minute: "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, ymdOpt);
|
|
}
|
|
|
|
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);
|
|
}
|
|
$(".date-comments").each(function(index, el) {
|
|
$(this).attr("title", el.innerText);
|
|
$(this).text(new Date($(this).attr("title")).toLocaleDateString(lang, ymdOpt) + " ");
|
|
$(this).append($('<span class="hidden-xs"></span>').text(new Date($(this).attr("title")).toLocaleTimeString(lang, hmOpt)))
|
|
});
|
|
/*Fixed-Navbar offset fix*/
|
|
window.onload = function() {
|
|
var shiftWindow = function() { scrollBy(0, -70) };
|
|
if (location.hash) shiftWindow();
|
|
window.addEventListener("hashchange", shiftWindow);
|
|
};
|
|
|
|
|
|
$('#mascot').bind('touchstart mousedown click', function(e){
|
|
var night = localStorage.getItem("night");
|
|
if(night == "true") {
|
|
$('#explosion')[0].play();
|
|
} else {
|
|
$('#nyaapassu')[0].play();
|
|
}
|
|
});
|