Make scroll to post quoting you keybinds work on Tinyboard/vichan. #2171
This commit is contained in:
parent
f89f9a2bbb
commit
d41c0cf96d
@ -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
|
||||
|
||||
@ -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}) ->
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user