Make features in Unread work on tinyboard with exception of Unread Favicon.
This commit is contained in:
parent
a26b991189
commit
b4ffb42a33
@ -34,7 +34,7 @@ Unread =
|
|||||||
textContent: 'Test Post Order'
|
textContent: 'Test Post Order'
|
||||||
$.on testLink, 'click', ->
|
$.on testLink, 'click', ->
|
||||||
list1 = (x.ID for x in Unread.order.order())
|
list1 = (x.ID for x in Unread.order.order())
|
||||||
list2 = (+x.id[2..] for x in $$ '.postContainer')
|
list2 = (+x.id.match(/\d*$/)[0] for x in $$ (if Site.isOPContainerThread then "#{Site.selectors.thread}, " else '') + Site.selectors.postContainer)
|
||||||
pass = do ->
|
pass = do ->
|
||||||
return false unless list1.length is list2.length
|
return false unless list1.length is list2.length
|
||||||
for i in [0...list1.length] by 1
|
for i in [0...list1.length] by 1
|
||||||
@ -79,12 +79,12 @@ Unread =
|
|||||||
|
|
||||||
position = Unread.positionPrev()
|
position = Unread.positionPrev()
|
||||||
while position
|
while position
|
||||||
{root} = position.data.nodes
|
{bottom} = position.data.nodes
|
||||||
if !root.getBoundingClientRect().height
|
if !bottom.getBoundingClientRect().height
|
||||||
# Don't try to scroll to posts with display: none
|
# Don't try to scroll to posts with display: none
|
||||||
position = position.prev
|
position = position.prev
|
||||||
else
|
else
|
||||||
Header.scrollToIfNeeded root, true
|
Header.scrollToIfNeeded bottom, true
|
||||||
break
|
break
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ Unread =
|
|||||||
body: post.commentDisplay()
|
body: post.commentDisplay()
|
||||||
icon: Favicon.logo
|
icon: Favicon.logo
|
||||||
notif.onclick = ->
|
notif.onclick = ->
|
||||||
Header.scrollToIfNeeded post.nodes.root, true
|
Header.scrollToIfNeeded post.nodes.bottom, true
|
||||||
window.focus()
|
window.focus()
|
||||||
notif.onshow = ->
|
notif.onshow = ->
|
||||||
setTimeout ->
|
setTimeout ->
|
||||||
@ -162,9 +162,9 @@ Unread =
|
|||||||
count = 0
|
count = 0
|
||||||
while Unread.position
|
while Unread.position
|
||||||
{ID, data} = Unread.position
|
{ID, data} = Unread.position
|
||||||
{root} = data.nodes
|
{bottom} = data.nodes
|
||||||
break unless !root.getBoundingClientRect().height or # post has been hidden
|
break unless !bottom.getBoundingClientRect().height or # post has been hidden
|
||||||
Header.getBottomOf(root) > -1 # post is completely read
|
Header.getBottomOf(bottom) > -1 # post is completely read
|
||||||
count++
|
count++
|
||||||
Unread.posts.delete ID
|
Unread.posts.delete ID
|
||||||
Unread.postsQuotingYou.delete ID
|
Unread.postsQuotingYou.delete ID
|
||||||
@ -200,7 +200,7 @@ Unread =
|
|||||||
return unless Conf['Unread Line']
|
return unless Conf['Unread Line']
|
||||||
if Unread.hr.hidden or d.hidden or (force is true)
|
if Unread.hr.hidden or d.hidden or (force is true)
|
||||||
if (Unread.linePosition = Unread.positionPrev())
|
if (Unread.linePosition = Unread.positionPrev())
|
||||||
$.after Unread.linePosition.data.nodes.root, Unread.hr
|
$.after (Unread.linePosition.data.nodes.bottom), Unread.hr
|
||||||
else
|
else
|
||||||
$.rm Unread.hr
|
$.rm Unread.hr
|
||||||
Unread.hr.hidden = Unread.linePosition is Unread.order.last
|
Unread.hr.hidden = Unread.linePosition is Unread.order.last
|
||||||
@ -220,7 +220,7 @@ Unread =
|
|||||||
|
|
||||||
Unread.saveThreadWatcherCount()
|
Unread.saveThreadWatcherCount()
|
||||||
|
|
||||||
if Conf['Unread Favicon']
|
if Conf['Unread Favicon'] and Site.software is 'yotsuba'
|
||||||
{isDead} = Unread.thread
|
{isDead} = Unread.thread
|
||||||
Favicon.el.href =
|
Favicon.el.href =
|
||||||
if countQuotingYou
|
if countQuotingYou
|
||||||
|
|||||||
@ -11,12 +11,13 @@ class Post
|
|||||||
@boardID = @board.ID
|
@boardID = @board.ID
|
||||||
@fullID = "#{@board}.#{@ID}"
|
@fullID = "#{@board}.#{@ID}"
|
||||||
@context = @
|
@context = @
|
||||||
|
@isReply = (@ID isnt @threadID)
|
||||||
|
|
||||||
root.dataset.fullID = @fullID
|
root.dataset.fullID = @fullID
|
||||||
|
|
||||||
@nodes = @parseNodes root
|
@nodes = @parseNodes root
|
||||||
|
|
||||||
if not (@isReply = @ID isnt @threadID)
|
if not @isReply
|
||||||
@thread.OP = @
|
@thread.OP = @
|
||||||
for key in ['isSticky', 'isClosed', 'isArchived']
|
for key in ['isSticky', 'isClosed', 'isArchived']
|
||||||
@thread[key] = if (selector = Site.selectors.icons[key]) then !!$(selector, @nodes.info) else false
|
@thread[key] = if (selector = Site.selectors.icons[key]) then !!$(selector, @nodes.info) else false
|
||||||
@ -69,6 +70,7 @@ class Post
|
|||||||
info = $ s.infoRoot, post
|
info = $ s.infoRoot, post
|
||||||
nodes =
|
nodes =
|
||||||
root: root
|
root: root
|
||||||
|
bottom: if @isReply or !Site.isOPContainerThread then root else $(s.opBottom, root)
|
||||||
post: post
|
post: post
|
||||||
info: info
|
info: info
|
||||||
comment: $ s.comment, post
|
comment: $ s.comment, post
|
||||||
|
|||||||
@ -1067,6 +1067,9 @@ span.hide-announcement {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
border-color: rgb(255,0,0);
|
border-color: rgb(255,0,0);
|
||||||
}
|
}
|
||||||
|
.unread-line + br {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.unread-mark-read {
|
.unread-mark-read {
|
||||||
float: right;
|
float: right;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|||||||
@ -29,7 +29,6 @@ SW.tinyboard =
|
|||||||
'Comment Expansion'
|
'Comment Expansion'
|
||||||
'Thread Expansion'
|
'Thread Expansion'
|
||||||
'Favicon'
|
'Favicon'
|
||||||
'Unread'
|
|
||||||
'Quote Threading'
|
'Quote Threading'
|
||||||
'Thread Stats'
|
'Thread Stats'
|
||||||
'Thread Updater'
|
'Thread Updater'
|
||||||
@ -64,6 +63,7 @@ SW.tinyboard =
|
|||||||
threadDivider: 'div[id^="thread_"] > hr:last-of-type'
|
threadDivider: 'div[id^="thread_"] > hr:last-of-type'
|
||||||
summary: '.omitted'
|
summary: '.omitted'
|
||||||
postContainer: '.reply' # postContainer is thread for OP
|
postContainer: '.reply' # postContainer is thread for OP
|
||||||
|
opBottom: '.op'
|
||||||
infoRoot: '.intro'
|
infoRoot: '.intro'
|
||||||
info:
|
info:
|
||||||
subject: '.subject'
|
subject: '.subject'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user