From f4f13449dc8875089925cb6d3571b50b9a4ce5f8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 28 Jun 2012 23:06:35 +0200 Subject: [PATCH] Add /sp/ archive redirection. Update /u/ archive redirection. --- 4chan_x.user.js | 20 +++++++++++++++----- changelog | 2 ++ script.coffee | 14 +++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4b78c72ad..87a3b757a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4013,10 +4013,12 @@ case 'a': case 'jp': case 'm': + case 'sp': case 'tg': - case 'u': case 'vg': return "//archive.foolz.us/" + board + "/full_image/" + filename; + case 'u': + return "//nsfw.foolz.us/" + board + "/full_image/" + filename; } }, post: function(board, postID) { @@ -4025,15 +4027,17 @@ case 'co': case 'jp': case 'm': + case 'sp': case 'tg': case 'tv': - case 'u': case 'v': case 'vg': case 'dev': case 'foolz': - case 'kuku': return "//archive.foolz.us/api/chan/post/board/" + board + "/num/" + postID + "/format/json"; + case 'u': + case 'kuku': + return "//nsfw.foolz.us/api/chan/post/board/" + board + "/num/" + postID + "/format/json"; } }, thread: function(board, threadID, postID) { @@ -4047,19 +4051,25 @@ case 'co': case 'jp': case 'm': + case 'sp': case 'tg': case 'tv': - case 'u': case 'v': case 'vg': case 'dev': case 'foolz': - case 'kuku': url = "//archive.foolz.us/" + path + "/"; if (threadID && postID) { url += "#" + postID; } break; + case 'u': + case 'kuku': + url = "//nsfw.foolz.us/" + path + "/"; + if (threadID && postID) { + url += "#" + postID; + } + break; case 'lit': url = "//fuuka.warosu.org/" + path; if (threadID && postID) { diff --git a/changelog b/changelog index 1723e3b25..5af3e760e 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Add /sp/ archive redirection. 2.33.4 - Mayhem diff --git a/script.coffee b/script.coffee index 8d6bd53c1..316e66c3f 100644 --- a/script.coffee +++ b/script.coffee @@ -3141,8 +3141,10 @@ Redirect = image: (board, filename) -> # Do not use g.BOARD, the image url can originate from a cross-quote. switch board - when 'a', 'jp', 'm', 'tg', 'u', 'vg' + when 'a', 'jp', 'm', 'sp', 'tg', 'vg' "//archive.foolz.us/#{board}/full_image/#{filename}" + when 'u' + "//nsfw.foolz.us/#{board}/full_image/#{filename}" # these will work whenever https://github.com/eksopl/fuuka/issues/23 is done # when 'cgl', 'g', 'w' # "//archive.rebeccablacktech.com/#{board}/full_image/#{filename}" @@ -3152,8 +3154,10 @@ Redirect = # "https://md401.homelinux.net/4chan/cgi-board.pl/#{board}/full_image/#{filename}" post: (board, postID) -> switch board - when 'a', 'co', 'jp', 'm', 'tg', 'tv', 'u', 'v', 'vg', 'dev', 'foolz', 'kuku' + when 'a', 'co', 'jp', 'm', 'sp', 'tg', 'tv', 'v', 'vg', 'dev', 'foolz' "//archive.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" + when 'u', 'kuku' + "//nsfw.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" thread: (board, threadID, postID) -> # keep the number only if the location.hash was sent f.e. postID = postID.match(/\d+/)[0] if postID @@ -3163,10 +3167,14 @@ Redirect = else "#{board}/post/#{postID}" switch board - when 'a', 'co', 'jp', 'm', 'tg', 'tv', 'u', 'v', 'vg', 'dev', 'foolz', 'kuku' + when 'a', 'co', 'jp', 'm', 'sp', 'tg', 'tv', 'v', 'vg', 'dev', 'foolz' url = "//archive.foolz.us/#{path}/" if threadID and postID url += "##{postID}" + when 'u', 'kuku' + url = "//nsfw.foolz.us/#{path}/" + if threadID and postID + url += "##{postID}" when 'lit' url = "//fuuka.warosu.org/#{path}" if threadID and postID