4chan - Redirect 404s to Archive

Redirects dead thread links to archives

13.11.2018 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        4chan - Redirect 404s to Archive
// @namespace   user@user
// @include     *://boards.4chan.org/*/thread/*
// @description Redirects dead thread links to archives
// @grant       none
// @run-at      document-end
// @version 0.0.1.20181113090434
// ==/UserScript==
var dead = document.evaluate('//title[text()="4chan - 404 Not Found"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

if (dead.singleNodeValue) {
  var url = window.location.href;
  var res = url.split("/");
  var board = res[3];
  var thread = res[5];
  switch(board) {
    case "b":
      var archive = "thebarchive.com";
      break;
    case "asp":
    case "cm":
    case "h":
    case "hc":
    case "hm":
    case "n":
    case "p":
    case "qa":
    case "r":
    case "s":
    case "soc":
    case "toy":
    case "y":
    case "a":
    case "an":
    case "biz":
    case "c":
    case "co":
    case "diy":
    case "fit":
    case "gd":
    case "gif":
    case "i":
    case "int":
    case "jp":
    case "k":
    case "m":
    case "mlp":
    case "out":
    case "po":
    case "r9k":
    case "s4s":
    case "sci":
    case "tg":
    case "tv":
    case "u":
    case "v":
    case "vg":
    case "vp":
    case "vr":
    case "wsg":
    case "adv":
    case "f":
    case "hr":
    case "o":
    case "pol":
    case "trv":
    case "x":
    case "3":
    case "cgl":
    case "ck":
    case "fa":
    case "g":
    case "ic":
    case "lit":
    case "mu":
    case "w":
    case "d":
    case "e":
    case "lgbt":
    case "t":
    case "wg":
    case "sp":
      var archive = "archived.moe";
      break;
    default:
      console.log("4chan redirect: no archive specified for board /" + board + "/");
      throw alert("no archive specified for board /" + board + "/");
  }
  window.location = "https://" + archive + "/" + board + "/thread/" + thread;
}