make all quote links stub-tolerant

This commit is contained in:
ccd0 2014-06-17 02:25:09 -07:00
parent f25155ea8d
commit 0786f023f3
3 changed files with 12 additions and 8 deletions

View File

@ -23,6 +23,11 @@ Build =
-> n = (n + 1) % 3
sameThread: (boardID, threadID) ->
g.VIEW is 'thread' and g.BOARD.ID is boardID and g.THREADID is +threadID
postURL: (boardID, threadID, postID) ->
if Build.sameThread boardID, threadID
"\#p#{postID}"
else
"/#{boardID}/thread/#{threadID}\#p#{postID}"
postFromObject: (data, boardID) ->
o =
# id
@ -192,12 +197,11 @@ Build =
else
h_file = ''
if Build.sameThread boardID, threadID
postLink = "\#p#{postID}"
quoteLink = "javascript:quote('#{postID}');"
postLink = Build.postURL boardID, threadID, postID
quoteLink = if Build.sameThread boardID, threadID
"javascript:quote('#{postID}');"
else
postLink = "/#{boardID}/thread/#{threadID}\#p#{postID}"
quoteLink = "/#{boardID}/thread/#{threadID}\#q#{postID}"
"/#{boardID}/thread/#{threadID}\#q#{postID}"
if isSticky
h_sticky = " <img src='#{h_staticPath}sticky#{h_gifIcon}' alt='Sticky' title='Sticky' class='stickyIcon retina'>"

View File

@ -24,7 +24,7 @@ QuoteBacklink =
return if @isClone or !@quotes.length
markYours = Conf['Quick Reply'] and Conf['Mark Quotes of You'] and QR.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
a = $.el 'a',
href: "/#{@board}/thread/#{@thread}#p#{@}"
href: Build.postURL @board.ID, @thread.ID, @ID
className: if @isHidden then 'filtered backlink' else 'backlink'
textContent: (Conf['backlink'].replace /%id/, @ID) + (if markYours then '\u00A0(You)' else '')
for quote in @quotes

View File

@ -45,13 +45,13 @@ Quotify =
# Don't (Dead) when quotifying in an archived post,
# and we know the post still exists.
a = $.el 'a',
href: "/#{boardID}/thread/#{post.thread}#p#{postID}"
href: Build.postURL boardID, post.thread.ID, postID
className: 'quotelink'
textContent: quote
else
# Replace the .deadlink span if we can redirect.
a = $.el 'a',
href: "/#{boardID}/thread/#{post.thread}#p#{postID}"
href: Build.postURL boardID, post.thread.ID, postID
className: 'quotelink deadlink'
target: '_blank'
textContent: "#{quote}\u00A0(Dead)"