Fix archive redirection.
Some simplifications. g.THREAD -> g.THREADID
This commit is contained in:
parent
7af57026bc
commit
4629864981
@ -1643,7 +1643,7 @@ ArchiveLink =
|
|||||||
el: div
|
el: div
|
||||||
order: 90
|
order: 90
|
||||||
open: ({ID, thread, board}) ->
|
open: ({ID, thread, board}) ->
|
||||||
redirect = Redirect.to {ID, threadID: thread.ID, boardID: board.ID}
|
redirect = Redirect.to {postID: ID, threadID: thread.ID, boardID: board.ID}
|
||||||
redirect isnt "//boards.4chan.org/#{board}/"
|
redirect isnt "//boards.4chan.org/#{board}/"
|
||||||
subEntries: []
|
subEntries: []
|
||||||
|
|
||||||
@ -1666,12 +1666,12 @@ ArchiveLink =
|
|||||||
textContent: text
|
textContent: text
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
|
|
||||||
if type is 'post'
|
open = if type is 'post'
|
||||||
open: ({ID, thread, board}) ->
|
({ID, thread, board}) ->
|
||||||
el.href = Redirect.to {ID, threadID: thread.ID, boardID: board.ID}
|
el.href = Redirect.to {postID: ID, threadID: thread.ID, boardID: board.ID}
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
open = (post) ->
|
(post) ->
|
||||||
value = Filter[type] post
|
value = Filter[type] post
|
||||||
# We want to parse the exact same stuff as the filter does already.
|
# We want to parse the exact same stuff as the filter does already.
|
||||||
return false unless value
|
return false unless value
|
||||||
@ -1965,59 +1965,53 @@ Redirect =
|
|||||||
{boardID} = data
|
{boardID} = data
|
||||||
switch boardID
|
switch boardID
|
||||||
when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'
|
when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'
|
||||||
url = Redirect.path '//archive.foolz.us', 'foolfuuka', data
|
Redirect.path '//archive.foolz.us', 'foolfuuka', data
|
||||||
when 'u'
|
when 'u'
|
||||||
url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data
|
Redirect.path '//nsfw.foolz.us', 'foolfuuka', data
|
||||||
when 'int', 'out', 'po'
|
when 'int', 'out', 'po'
|
||||||
url = Redirect.path '//archive.thedarkcave.org', 'foolfuuka', data
|
Redirect.path '//archive.thedarkcave.org', 'foolfuuka', data
|
||||||
when 'ck', 'lit'
|
when 'ck', 'lit'
|
||||||
url = Redirect.path '//fuuka.warosu.org', 'fuuka', data
|
Redirect.path '//fuuka.warosu.org', 'fuuka', data
|
||||||
when 'diy', 'sci'
|
when 'diy', 'sci'
|
||||||
url = Redirect.path '//archive.installgentoo.net', 'fuuka', data
|
Redirect.path '//archive.installgentoo.net', 'fuuka', data
|
||||||
when 'cgl', 'g', 'mu', 'w'
|
when 'cgl', 'g', 'mu', 'w'
|
||||||
url = Redirect.path '//rbt.asia', 'fuuka', data
|
Redirect.path '//rbt.asia', 'fuuka', data
|
||||||
when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x'
|
when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x'
|
||||||
url = Redirect.path 'http://archive.heinessen.com', 'fuuka', data
|
Redirect.path 'http://archive.heinessen.com', 'fuuka', data
|
||||||
when 'c'
|
when 'c'
|
||||||
url = Redirect.path '//archive.nyafuu.org', 'fuuka', data
|
Redirect.path '//archive.nyafuu.org', 'fuuka', data
|
||||||
else
|
else
|
||||||
if data.threadID
|
if data.threadID then "//boards.4chan.org/#{boardID}/" else ''
|
||||||
url = "//boards.4chan.org/#{boardID}/"
|
|
||||||
url or ''
|
|
||||||
path: (base, archiver, data) ->
|
path: (base, archiver, data) ->
|
||||||
if data.isSearch
|
if data.isSearch
|
||||||
{boardID, type, value} = data
|
{boardID, type, value} = data
|
||||||
type =
|
type = if type is 'name'
|
||||||
if type is 'name'
|
'username'
|
||||||
'username'
|
else if type is 'MD5'
|
||||||
else if type is 'MD5'
|
'image'
|
||||||
'image'
|
else
|
||||||
else
|
type
|
||||||
type
|
|
||||||
value = encodeURIComponent value
|
value = encodeURIComponent value
|
||||||
return if archiver is 'foolfuuka'
|
return if archiver is 'foolfuuka'
|
||||||
"#{base}/#{boardID}/search/#{type}/#{value}"
|
"#{base}/#{boardID}/search/#{type}/#{value}"
|
||||||
else if type is 'image'
|
else if type is 'image'
|
||||||
"#{base}/#{boardID}/?task=search2&search_media_hash=#{value}"
|
"#{base}/#{boardID}/?task=search2&search_media_hash=#{value}"
|
||||||
else
|
else
|
||||||
"#{base}/#{boardID}/?task=search2&search_#{type}=#{value}"
|
"#{base}/#{boardID}/?task=search2&search_#{type}=#{value}"
|
||||||
|
|
||||||
{boardID, threadID, postID} = data
|
{boardID, threadID, postID} = data
|
||||||
# keep the number only if the location.hash was sent f.e.
|
# keep the number only if the location.hash was sent f.e.
|
||||||
postID = postID.match(/\d+/)[0] if postID and typeof postID is 'string'
|
path = if threadID
|
||||||
path =
|
"#{boardID}/thread/#{threadID}"
|
||||||
if threadID
|
else
|
||||||
"#{boardID}/thread/#{threadID}"
|
"#{boardID}/post/#{postID}"
|
||||||
else
|
|
||||||
"#{boardID}/post/#{postID}"
|
|
||||||
if archiver is 'foolfuuka'
|
if archiver is 'foolfuuka'
|
||||||
path += '/'
|
path += '/'
|
||||||
if threadID and postID
|
if threadID and postID
|
||||||
path +=
|
path += if archiver is 'foolfuuka'
|
||||||
if archiver is 'foolfuuka'
|
"##{postID}"
|
||||||
"##{postID}"
|
else
|
||||||
else
|
"#p#{postID}"
|
||||||
"#p#{postID}"
|
|
||||||
"#{base}/#{path}"
|
"#{base}/#{path}"
|
||||||
|
|
||||||
Build =
|
Build =
|
||||||
@ -2230,7 +2224,7 @@ Build =
|
|||||||
"</span><span class='dateTime postNum' data-utc=#{dateUTC}>#{date}" +
|
"</span><span class='dateTime postNum' data-utc=#{dateUTC}>#{date}" +
|
||||||
"<a href=#{"/#{boardID}/res/#{threadID}#p#{postID}"}>No.</a>" +
|
"<a href=#{"/#{boardID}/res/#{threadID}#p#{postID}"}>No.</a>" +
|
||||||
"<a href='#{
|
"<a href='#{
|
||||||
if g.VIEW is 'thread' and g.THREAD is +threadID
|
if g.VIEW is 'thread' and g.THREADID is +threadID
|
||||||
"javascript:quote(#{postID})"
|
"javascript:quote(#{postID})"
|
||||||
else
|
else
|
||||||
"/#{boardID}/res/#{threadID}#q#{postID}"
|
"/#{boardID}/res/#{threadID}#q#{postID}"
|
||||||
@ -2252,7 +2246,7 @@ Build =
|
|||||||
"<span class='postNum desktop'>" +
|
"<span class='postNum desktop'>" +
|
||||||
"<a href=#{"/#{boardID}/res/#{threadID}#p#{postID}"} title='Highlight this post'>No.</a>" +
|
"<a href=#{"/#{boardID}/res/#{threadID}#p#{postID}"} title='Highlight this post'>No.</a>" +
|
||||||
"<a href='#{
|
"<a href='#{
|
||||||
if g.VIEW is 'thread' and g.THREAD is +threadID
|
if g.VIEW is 'thread' and g.THREADID is +threadID
|
||||||
"javascript:quote(#{postID})"
|
"javascript:quote(#{postID})"
|
||||||
else
|
else
|
||||||
"/#{boardID}/res/#{threadID}#q#{postID}"
|
"/#{boardID}/res/#{threadID}#q#{postID}"
|
||||||
|
|||||||
@ -314,7 +314,7 @@ Main =
|
|||||||
else
|
else
|
||||||
'index'
|
'index'
|
||||||
if g.VIEW is 'thread'
|
if g.VIEW is 'thread'
|
||||||
g.THREAD = +pathname[3]
|
g.THREADID = +pathname[3]
|
||||||
|
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
when 'sys.4chan.org'
|
when 'sys.4chan.org'
|
||||||
@ -429,8 +429,8 @@ Main =
|
|||||||
if Conf['404 Redirect'] and g.VIEW is 'thread'
|
if Conf['404 Redirect'] and g.VIEW is 'thread'
|
||||||
href = Redirect.to
|
href = Redirect.to
|
||||||
boardID: g.BOARD.ID
|
boardID: g.BOARD.ID
|
||||||
threadID: g.THREAD.ID
|
threadID: g.THREADID
|
||||||
postID: location.hash
|
postID: +location.hash.match /\d+/ # post number or 0
|
||||||
location.href = href or "/#{g.BOARD}/"
|
location.href = href or "/#{g.BOARD}/"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -344,7 +344,7 @@ QR =
|
|||||||
$.addClass QR.nodes.el, 'dump'
|
$.addClass QR.nodes.el, 'dump'
|
||||||
resetThreadSelector: ->
|
resetThreadSelector: ->
|
||||||
if g.VIEW is 'thread'
|
if g.VIEW is 'thread'
|
||||||
QR.nodes.thread.value = g.THREAD
|
QR.nodes.thread.value = g.THREADID
|
||||||
else
|
else
|
||||||
QR.nodes.thread.value = 'new'
|
QR.nodes.thread.value = 'new'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user