From 31ab0d87070560b1060710ec72afabcfea3e595e Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 16 Jun 2014 22:52:48 -0700 Subject: [PATCH] update HTML --- src/General/Build.coffee | 26 ++++++++++++++++---------- src/General/html/Build/post.html | 16 ++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 30284fe23..319aeef70 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -22,6 +22,8 @@ Build = thumbRotate: do -> n = 0 -> n = (n + 1) % 3 + sameThread: (boardID, threadID) -> + g.VIEW is 'thread' and g.BOARD.ID is boardID and g.THREADID is +threadID postFromObject: (data, boardID) -> o = # id @@ -85,8 +87,10 @@ Build = if isOP h_sideArrows = '' + h_subject = "#{E subject} " else h_sideArrows = "
>>
" + h_subject = '' h_postClass = "post #{if isOP then 'op' else 'reply'}#{if capcode is 'admin_highlight' then ' highlightPost' else ''}" @@ -183,15 +187,18 @@ Build = else h_file = '' - if g.VIEW is 'thread' and g.THREADID is +threadID - h_quoteLink = "javascript:quote(#{+postID})" + if Build.sameThread boardID, threadID + postLink = "\#p#{postID}" + quoteLink = "javascript:quote('#{postID}');" else - h_quoteLink = "/#{E boardID}/thread/#{+threadID}\#q#{+postID}" + postLink = "/#{boardID}/thread/#{threadID}\#p#{postID}" + quoteLink = "/#{boardID}/thread/#{threadID}\#q#{postID}" if isSticky h_sticky = " Sticky" else h_sticky = '' + if isClosed h_closed = " Closed" else @@ -209,18 +216,17 @@ Build = h_replyLink = '' container = $.el 'div', - id: "pc#{postID}" className: "postContainer #{if isOP then 'op' else 'reply'}Container" - innerHTML: <%= grunt.file.read('src/General/html/Build/post.html').replace(/>\s+/g, '>').replace(/\s+ + id: "pc#{postID}" + innerHTML: <%= grunt.file.read('src/General/html/Build/post.html').replace(/\r?\n\s*/g, '') %> # Fix pathnames for quote in $$ '.quotelink', container href = quote.getAttribute 'href' - continue if href[0] is '/' # Cross-board quote, or board link - if href[0] is '#' - quote.href = "/#{boardID}/thread/#{threadID}#{href}" - else - quote.href = "/#{boardID}/thread/#{href}" + if (href[0] is '#') and !(Build.sameThread boardID, threadID) + quote.href = "/#{boardID}/thread/#{threadID}" + href + else if (match = href.match /^\/([^\/]+)\/thread\/(\d+)/) and (Build.sameThread match[1], match[2]) + quote.href = href.match(/(#[^#]*)?$/)[0] or '#' container diff --git a/src/General/html/Build/post.html b/src/General/html/Build/post.html index 30147d121..851e483e8 100755 --- a/src/General/html/Build/post.html +++ b/src/General/html/Build/post.html @@ -3,24 +3,24 @@ #{if isOP then h_file else ''} -
- - #{' '}#{E subject}#{' '} + #{if isOP then '' else h_file} -
#{h_comment}
#{' '} +
#{h_comment}
"""