diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index 1df9afccb..2a18fa150 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,4 +1,4 @@ - +
#{postCount} / #{fileCount} / #{pageCount} diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 20a03e56b..0e5c3098c 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -15,6 +15,11 @@ Build = thumbRotate: do -> n = 0 -> n = (n + 1) % 2 + path: (boardID, threadID, postID, fragment) -> + path = "/#{boardID}/thread/#{threadID}" + path += "/#{g.SLUG}" if g.SLUG? and threadID is g.THREADID + path += "##{fragment or 'p'}#{postID}" if postID + path postFromObject: (data, boardID) -> o = # id @@ -175,7 +180,7 @@ Build = if isOP and g.VIEW is 'index' pageNum = Index.liveThreadIDs.indexOf(postID) // Index.threadsNumPerPage + 1 pageIcon = " Page #{pageNum}" - replyLink = "   [Reply]" + replyLink = "   [Reply]" else pageIcon = replyLink = '' @@ -203,12 +208,12 @@ Build = ' ' + "#{date} " + "" + - "No." + + "No." + "#{postID}" + pageIcon + sticky + closed + replyLink + '' + @@ -220,11 +225,11 @@ Build = '
' + # Fix quote pathnames in index or cross-{board,thread} posts for quote in $$ '.quotelink', container href = quote.getAttribute 'href' - continue if href[0] is '/' # Cross-board quote, or board link - href = "#{threadID}#{href}" if href[0] is '#' - quote.href = "/#{boardID}/thread/#{href}" # Fix pathnames + continue unless href[0] is '#' + quote.href = Build.path boardID, threadID, href[2..] container @@ -236,7 +241,7 @@ Build = $.el 'a', className: 'summary' textContent: text.join ' ' - href: "/#{boardID}/thread/#{threadID}" + href: Build.path boardID, threadID thread: (board, data) -> Build.spoilerRange[board] = data.custom_spoiler diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 5b61ccacb..e464f91fb 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -14,6 +14,7 @@ Main = return if g.VIEW is 'thread' g.THREADID = +pathname[3] + g.SLUG = pathname[4] if pathname[4]? # flatten Config into Conf # and get saved or default values diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 45580ee4d..51a5e1e6b 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -187,7 +187,7 @@ Keybinds = open: (thread, tab) -> return if g.VIEW isnt 'index' - url = "/#{thread.board}/thread/#{thread}" + url = Build.path thread.board.ID, thread.ID if tab $.open url else diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 551a3da41..5d3a9f2ca 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -587,9 +587,9 @@ QR = QR.cooldown.set {req, post, isReply, threadID} URL = if threadID is postID # new thread - "/#{g.BOARD}/thread/#{threadID}" + Build.path g.BOARD.ID, threadID else if g.VIEW is 'index' and !QR.cooldown.auto and Conf['Open Post in New Tab'] # replying from the index - "/#{g.BOARD}/thread/#{threadID}#p#{postID}" + Build.path g.BOARD.ID, threadID, postID if URL if Conf['Open Post in New Tab'] $.open URL diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index 03e11b980..d5a4ea67f 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -49,7 +49,7 @@ QuoteBacklink = buildBacklink: (quoted, quoter) -> frag = QuoteBacklink.frag.cloneNode true a = frag.lastElementChild - a.href = "/#{quoter.board}/thread/#{quoter.thread}#p#{quoter}" + a.href = Build.path quoter.board.ID, quoter.thread.ID, quoter.ID a.textContent = text = QuoteBacklink.funk quoter.ID if quoter.isDead $.addClass a, 'deadlink' diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index d3866921e..b6c997d5d 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -40,7 +40,7 @@ Quotify = # Don't add 'deadlink' when quotifying in an archived post, # and we don't know if the post died yet. a = $.el 'a', - href: "/#{boardID}/thread/#{post.thread}#p#{postID}" + href: Build.path boardID, post.thread.ID, postID className: if post.isDead then 'quotelink deadlink' else 'quotelink' textContent: quote $.extend a.dataset, {boardID, threadID: post.thread.ID, postID}