]> git.aero2k.de Git - dfde/quickmods.git/commitdiff
Redirect to archive if topic is gone
authorJTH <JTH@debianforum.de>
Fri, 30 Sep 2022 18:12:53 +0000 (20:12 +0200)
committerThorsten <mail@aero2k.de>
Mon, 3 Oct 2022 21:24:23 +0000 (23:24 +0200)
quickmod.user.js

index 8307483c482d05ee5db1301391e94543336d32bc..8dbbd140f67ca32fbbec5c73f6d05bbee4e20f56 100644 (file)
@@ -114,6 +114,13 @@ function prefixSubject(input, reason) {
     return subject.slice(0, maxLen);
 }
 
+function redirectToArchive() {
+    /* TODO: Make the location configurable, redirect to homepage, "Aktive
+     * Themen", "Neue Beiträge", or other?
+     */
+    window.location = `./viewforum.php?f=${ARCHIVFORUMID}`;
+}
+
 async function remove_post_handler(event) {
     const post = event.currentTarget.closest('.post');
     const usernameElem = post.querySelector(".author .username,.author .username-coloured");
@@ -210,10 +217,7 @@ function updatePageAfterSplit(post) {
     if (document.querySelectorAll(".post").length > 1) {
         post.parentNode.removeChild(post);
     } else {
-        /* TODO: Make the location configurable, redirect to homepage, "Aktive
-         * Themen", "Neue Beiträge", or other?
-         */
-        window.location = "/";
+        redirectToArchive();
     }
 }