diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee index b3d49600b..d49c5457b 100644 --- a/src/Quotelinks/QuoteYou.coffee +++ b/src/Quotelinks/QuoteYou.coffee @@ -92,7 +92,8 @@ QuoteYou = cb: seek: (type) -> - $.rmClass highlight, 'highlight' if highlight = $ '.highlight' + {highlight} = g.SITE.classes + $.rmClass highlighted, highlight if (highlighted = $ ".#{highlight}") unless QuoteYou.lastRead and doc.contains(QuoteYou.lastRead) and $.hasClass(QuoteYou.lastRead, 'quotesYou') if not (post = QuoteYou.lastRead = $ '.quotesYou') @@ -111,12 +112,16 @@ QuoteYou = QuoteYou.cb.scroll posts[if type is 'following' then 0 else posts.length - 1] scroll: (root) -> - post = $ '.post', root - if !post.getBoundingClientRect().height + post = Get.postFromRoot root + if !post.nodes.post.getBoundingClientRect().height return false else QuoteYou.lastRead = root - location.href = "##{post.id}" - Header.scrollTo post - $.addClass post, 'highlight' + location.href = Get.url('post', post) + Header.scrollTo post.nodes.post + if post.isReply + sel = "#{g.SITE.selectors.postContainer}#{g.SITE.selectors.highlightable.reply}" + node = post.nodes.root + node = $ sel, node unless node.matches(sel) + $.addClass node, g.SITE.classes.highlight return true diff --git a/src/site/SW.tinyboard.coffee b/src/site/SW.tinyboard.coffee index 74aea824e..b30327cc9 100644 --- a/src/site/SW.tinyboard.coffee +++ b/src/site/SW.tinyboard.coffee @@ -45,6 +45,7 @@ SW.tinyboard = urls: thread: ({siteID, boardID, threadID}) -> "#{Conf['siteProperties'][siteID]?.root or "http://#{siteID}/"}#{boardID}/res/#{threadID}.html" + post: ({postID}) -> "##{postID}" index: ({siteID, boardID}) -> "#{Conf['siteProperties'][siteID]?.root or "http://#{siteID}/"}#{boardID}/" catalog: ({siteID, boardID}) -> "#{Conf['siteProperties'][siteID]?.root or "http://#{siteID}/"}#{boardID}/catalog.html" threadJSON: ({siteID, boardID, threadID}) -> diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index d9af44255..44521b85a 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -4,6 +4,7 @@ SW.yotsuba = urls: thread: ({boardID, threadID}) -> "#{location.protocol}//#{BoardConfig.domain(boardID)}/#{boardID}/thread/#{threadID}" + post: ({postID}) -> "#p#{postID}" index: ({boardID}) -> "#{location.protocol}//#{BoardConfig.domain(boardID)}/#{boardID}/" catalog: ({boardID}) -> if boardID is 'f' then undefined else "#{location.protocol}//#{BoardConfig.domain(boardID)}/#{boardID}/catalog" threadJSON: ({boardID, threadID}) -> "#{location.protocol}//a.4cdn.org/#{boardID}/thread/#{threadID}.json"