Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/public/js/main.js

58 lignes
1,5 Kio
JavaScript
Brut Vue normale Historique

var explosion = document.getElementById("explosion");
var nyanpassu = document.getElementById("nyanpassu");
2017-05-07 18:19:37 +02:00
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");
2017-05-07 18:19:37 +02:00
}
2017-05-05 12:59:56 +02:00
// Used by spoiler tags
function toggleLayer(elem) {
if (elem.classList.contains("hide"))
elem.classList.remove("hide");
else
elem.classList.add("hide");
}
2017-05-05 15:55:25 +02:00
// Date formatting
Frontend rewrite (DONE) (#723) * Remove Bootstrap and Jquery, and create basic nav * More improvements to navbar, as well as work on _badgemenu * Complete navbar HTML, obviously it still looks horrendous * Change layout on torrent table, using grids. * Remove Bootstrap and Jquery, and create basic nav * More improvements to navbar, as well as work on _badgemenu * Complete navbar HTML, obviously it still looks horrendous * Change layout on torrent table, using grids. * HOLY FUCK INDEX IS /DONE/ * DO UPLOAD PAGE, DELETE OLD SHITTY CSS * Complete login page * Remove Bootstrap and Jquery, and create basic nav * More improvements to navbar, as well as work on _badgemenu * Complete navbar HTML, obviously it still looks horrendous * Change layout on torrent table, using grids. * Remove Bootstrap and Jquery, and create basic nav * More improvements to navbar, as well as work on _badgemenu * Complete navbar HTML, obviously it still looks horrendous * HOLY FUCK INDEX IS /DONE/ * DO UPLOAD PAGE, DELETE OLD SHITTY CSS * Complete login page * Begin work on profile page * fucking git, man * Damn, that looks sexy * Complete login and register pages, include very minimal grid system, and delete all of view template * Do view page! * Finish view even more * Fix dates and filesizes in torrent table * Improve comment/captcha input * Actually add magnet and torrent buttons * Add open-iconic instead of fontawesome * Improve user side-panel * Rename Category_* to CategoryName * Beginning to finish up * Implement themes and add basic mobile support to front page * Fix some slight color errors * Fix captcha on dark * magnet and torrent links on view
2017-05-24 06:20:51 +02:00
var lang = document.getElementsByTagName("html")[0].getAttribute("lang");
var ymdOpt = { year: "numeric", month: "short", day: "numeric" };
2017-05-18 02:43:17 +02:00
var hmOpt = { hour: "numeric", minute: "numeric" };
2017-05-05 15:55:25 +02:00
var list = document.getElementsByClassName("date-short");
for(var i in list) {
var e = list[i];
e.title = e.innerText;
2017-05-18 02:44:36 +02:00
e.innerText = new Date(e.innerText).toLocaleString(lang, ymdOpt);
2017-05-05 15:55:25 +02:00
}
var list = document.getElementsByClassName("date-full");
for(var i in list) {
var e = list[i];
e.title = e.innerText;
2017-05-17 13:21:48 +02:00
e.innerText = new Date(e.innerText).toLocaleString(lang);
2017-05-05 15:55:25 +02:00
}
/*Fixed-Navbar offset fix*/
window.onload = function() {
var shiftWindow = function() { scrollBy(0, -70) };
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
2017-05-18 02:43:17 +02:00
};
function playVoice() {
switch (theme) {
case "tomorrow.css":
explosion.play();
break;
default:
nyanpassu.volume = 0.5;
nyanpassu.play();
break;
}
}