Finish Quote Resurrection. Close #253.

This commit is contained in:
Nicolas Stepien 2012-03-12 14:16:26 +01:00
parent 326a269e14
commit 305a567f9d
2 changed files with 26 additions and 18 deletions

View File

@ -3363,7 +3363,7 @@
href = "#" + id; href = "#" + id;
className = 'quotelink'; className = 'quotelink';
} else { } else {
href = "#"; href = Redirect.thread(board, id, 'post');
className = null; className = null;
} }
nodes.push($.el('a', { nodes.push($.el('a', {
@ -3550,8 +3550,11 @@
return "http://archive.foolz.us/" + href[3] + "/full_image/" + href[5]; return "http://archive.foolz.us/" + href[3] + "/full_image/" + href[5];
} }
}, },
thread: function() { thread: function(board, id, mode) {
if (!conf['404 Redirect']) return; if (board == null) board = g.BOARD;
if (id == null) id = g.THREAD_ID;
if (mode == null) mode = 'thread';
if (!(conf['404 Redirect'] || mode === 'post')) return;
switch (g.BOARD) { switch (g.BOARD) {
case 'a': case 'a':
case 'jp': case 'jp':
@ -3561,13 +3564,13 @@
case 'u': case 'u':
case 'v': case 'v':
case 'vg': case 'vg':
return "http://archive.foolz.us/" + g.BOARD + "/thread/" + g.THREAD_ID + "/"; return "http://archive.foolz.us/" + board + "/thread/" + id + "/";
case 'lit': case 'lit':
return "http://fuuka.warosu.org/" + g.BOARD + "/thread/" + g.THREAD_ID; return "http://fuuka.warosu.org/" + board + "/" + mode + "/" + id;
case 'diy': case 'diy':
case 'g': case 'g':
case 'sci': case 'sci':
return "http://archive.installgentoo.net/" + g.BOARD + "/thread/" + g.THREAD_ID; return "http://archive.installgentoo.net/" + board + "/" + mode + "/" + id;
case '3': case '3':
case 'adv': case 'adv':
case 'an': case 'an':
@ -3590,9 +3593,13 @@
case 'trv': case 'trv':
case 'vp': case 'vp':
case 'x': case 'x':
return "http://archive.no-ip.org/" + g.BOARD + "/thread/" + g.THREAD_ID; return "http://archive.no-ip.org/" + board + "/" + mode + "/" + id;
default: default:
return "http://boards.4chan.org/" + g.BOARD + "/"; if (mode === 'thread') {
return "http://boards.4chan.org/" + board + "/";
} else {
return null;
}
} }
} }
}; };

View File

@ -2806,9 +2806,7 @@ Quotify =
href = "##{id}" href = "##{id}"
className = 'quotelink' className = 'quotelink'
else else
# TODO manage links if board is archived href = Redirect.thread board, id, 'post'
# Here be archive link
href = "#"
className = null className = null
nodes.push $.el 'a', nodes.push $.el 'a',
@ -2982,19 +2980,22 @@ Redirect =
switch href[3] switch href[3]
when 'a', 'jp', 'm', 'tg', 'u', 'vg' when 'a', 'jp', 'm', 'tg', 'u', 'vg'
"http://archive.foolz.us/#{href[3]}/full_image/#{href[5]}" "http://archive.foolz.us/#{href[3]}/full_image/#{href[5]}"
thread: -> thread: (board=g.BOARD, id=g.THREAD_ID, mode='thread') ->
return unless conf['404 Redirect'] return unless conf['404 Redirect'] or mode is 'post'
switch g.BOARD switch g.BOARD
when 'a', 'jp', 'm', 'tg', 'tv', 'u', 'v', 'vg' when 'a', 'jp', 'm', 'tg', 'tv', 'u', 'v', 'vg'
"http://archive.foolz.us/#{g.BOARD}/thread/#{g.THREAD_ID}/" "http://archive.foolz.us/#{board}/thread/#{id}/"
when 'lit' when 'lit'
"http://fuuka.warosu.org/#{g.BOARD}/thread/#{g.THREAD_ID}" "http://fuuka.warosu.org/#{board}/#{mode}/#{id}"
when 'diy', 'g', 'sci' when 'diy', 'g', 'sci'
"http://archive.installgentoo.net/#{g.BOARD}/thread/#{g.THREAD_ID}" "http://archive.installgentoo.net/#{board}/#{mode}/#{id}"
when '3', 'adv', 'an', 'ck', 'co', 'fa', 'fit', 'int', 'k', 'mu', 'n', 'o', 'p', 'po', 'pol', 'r9k', 'soc', 'sp', 'toy', 'trv', 'vp', 'x' when '3', 'adv', 'an', 'ck', 'co', 'fa', 'fit', 'int', 'k', 'mu', 'n', 'o', 'p', 'po', 'pol', 'r9k', 'soc', 'sp', 'toy', 'trv', 'vp', 'x'
"http://archive.no-ip.org/#{g.BOARD}/thread/#{g.THREAD_ID}" "http://archive.no-ip.org/#{board}/#{mode}/#{id}"
else else
"http://boards.4chan.org/#{g.BOARD}/" if mode is 'thread'
"http://boards.4chan.org/#{board}/"
else
null
ImageHover = ImageHover =
init: -> init: ->