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

43 lignes
1,2 Kio
JavaScript
Brut Vue normale Historique

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");
More frontend shit (#731) * Torrent Mass Edit Api (WIP) * Torrents can be deleted in mass from frontend with api post request * Torrents status can be edited from frontend with api post request -- Look to function doc for more info on how to use it It is a WIP so it might not work =D * Finished Mass mod Api As per suggestion of @yiiTT in #720, I added: * Changing torrents category * Deletion of reports with deletion of a torrent * Changing owner of multiple torrents Commit also add some new translation strings. * Make some changes * Reports can now be cleared for the torrents selected without having to delete them * Users with no admin rights can't delete reports * Fix moveto to status moveto deprecated in api * Tested and works! Changes: * Updates only the colomns of torrent table * Moved categories config in config/torrents.go * Make sort arrows look a lot nicer * Add search icon into search input * Work on navbar, fix it on mobile view * Hide mascot on mobile views * Make torrent view work on mobile + minor improvements * Add status and various things to view * ACTUALLY FINISH VIEW PAGE * Forgot this file in last commit * wow user profile was easy * Work on profile page * remove language option * SEO improvement * forgot the fucking bracket * make description more weeb * add irony * add better irony * Update README.md * Make sort arrows look a lot nicer * Add search icon into search input * Work on navbar, fix it on mobile view * Hide mascot on mobile views * Make torrent view work on mobile + minor improvements * Add status and various things to view * ACTUALLY FINISH VIEW PAGE * wow user profile was easy * Work on profile page * remove language option * SEO improvement * forgot the fucking bracket * make description more weeb * add irony * add better irony
2017-05-25 02:20:30 +02:00
var ymdOpt = { year: "numeric", month: "2-digit", day: "2-digit" };
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
};