ReplyHiding -> PostHiding

This commit is contained in:
Nicolas Stepien 2013-04-03 18:27:06 +02:00
parent dda20916b4
commit fd587bff22
2 changed files with 36 additions and 36 deletions

View File

@ -890,7 +890,7 @@ Filter =
# Hide # Hide
if result.hide if result.hide
if @isReply if @isReply
ReplyHiding.hide @, result.stub PostHiding.hide @, result.stub
else if g.VIEW is 'index' else if g.VIEW is 'index'
ThreadHiding.hide @thread, result.stub ThreadHiding.hide @thread, result.stub
else else
@ -1204,7 +1204,7 @@ ThreadHiding =
threadRoot.nextElementSibling.hidden = threadRoot.nextElementSibling.hidden =
threadRoot.hidden = thread.isHidden = false threadRoot.hidden = thread.isHidden = false
ReplyHiding = PostHiding =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link']
@ -1215,14 +1215,14 @@ ReplyHiding =
node: -> node: ->
return if !@isReply or @isClone return if !@isReply or @isClone
if data = ReplyHiding.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID} if data = PostHiding.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
if data.thisPost if data.thisPost
ReplyHiding.hide @, data.makeStub, data.hideRecursively PostHiding.hide @, data.makeStub, data.hideRecursively
else else
Recursive.apply ReplyHiding.hide, @, data.makeStub, true Recursive.apply PostHiding.hide, @, data.makeStub, true
Recursive.add ReplyHiding.hide, @, data.makeStub, true Recursive.add PostHiding.hide, @, data.makeStub, true
return unless Conf['Reply Hiding'] return unless Conf['Reply Hiding']
$.replace $('.sideArrows', @nodes.root), ReplyHiding.makeButton @, 'hide' $.replace $('.sideArrows', @nodes.root), PostHiding.makeButton @, 'hide'
menu: menu:
init: -> init: ->
@ -1236,7 +1236,7 @@ ReplyHiding =
apply = $.el 'a', apply = $.el 'a',
textContent: 'Apply' textContent: 'Apply'
href: 'javascript:;' href: 'javascript:;'
$.on apply, 'click', ReplyHiding.menu.hide $.on apply, 'click', PostHiding.menu.hide
thisPost = $.el 'label', thisPost = $.el 'label',
innerHTML: '<input type=checkbox name=thisPost checked> This post' innerHTML: '<input type=checkbox name=thisPost checked> This post'
@ -1252,7 +1252,7 @@ ReplyHiding =
open: (post) -> open: (post) ->
if !post.isReply or post.isClone or post.isHidden if !post.isReply or post.isClone or post.isHidden
return false return false
ReplyHiding.menu.post = post PostHiding.menu.post = post
true true
subEntries: [{el: apply}, {el: thisPost}, {el: replies}, {el: makeStub}] subEntries: [{el: apply}, {el: thisPost}, {el: replies}, {el: makeStub}]
@ -1264,7 +1264,7 @@ ReplyHiding =
apply = $.el 'a', apply = $.el 'a',
textContent: 'Apply' textContent: 'Apply'
href: 'javascript:;' href: 'javascript:;'
$.on apply, 'click', ReplyHiding.menu.show $.on apply, 'click', PostHiding.menu.show
thisPost = $.el 'label', thisPost = $.el 'label',
innerHTML: '<input type=checkbox name=thisPost> This post' innerHTML: '<input type=checkbox name=thisPost> This post'
@ -1278,9 +1278,9 @@ ReplyHiding =
open: (post) -> open: (post) ->
if !post.isReply or post.isClone or !post.isHidden if !post.isReply or post.isClone or !post.isHidden
return false return false
unless data = ReplyHiding.db.get {boardID: post.board.ID, threadID: post.thread.ID, postID: post.ID} unless data = PostHiding.db.get {boardID: post.board.ID, threadID: post.thread.ID, postID: post.ID}
return false return false
ReplyHiding.menu.post = post PostHiding.menu.post = post
thisPost.firstChild.checked = post.isHidden thisPost.firstChild.checked = post.isHidden
replies.firstChild.checked = if data?.hideRecursively? then data.hideRecursively else Conf['Recursive Hiding'] replies.firstChild.checked = if data?.hideRecursively? then data.hideRecursively else Conf['Recursive Hiding']
true true
@ -1290,30 +1290,30 @@ ReplyHiding =
thisPost = $('input[name=thisPost]', parent).checked thisPost = $('input[name=thisPost]', parent).checked
replies = $('input[name=replies]', parent).checked replies = $('input[name=replies]', parent).checked
makeStub = $('input[name=makeStub]', parent).checked makeStub = $('input[name=makeStub]', parent).checked
{post} = ReplyHiding.menu {post} = PostHiding.menu
if thisPost if thisPost
ReplyHiding.hide post, makeStub, replies PostHiding.hide post, makeStub, replies
else if replies else if replies
Recursive.apply ReplyHiding.hide, post, makeStub, true Recursive.apply PostHiding.hide, post, makeStub, true
Recursive.add ReplyHiding.hide, post, makeStub, true Recursive.add PostHiding.hide, post, makeStub, true
else else
return return
ReplyHiding.saveHiddenState post, true, thisPost, makeStub, replies PostHiding.saveHiddenState post, true, thisPost, makeStub, replies
$.event 'CloseMenu' $.event 'CloseMenu'
show: -> show: ->
parent = @parentNode parent = @parentNode
thisPost = $('input[name=thisPost]', parent).checked thisPost = $('input[name=thisPost]', parent).checked
replies = $('input[name=replies]', parent).checked replies = $('input[name=replies]', parent).checked
{post} = ReplyHiding.menu {post} = PostHiding.menu
if thisPost if thisPost
ReplyHiding.show post, replies PostHiding.show post, replies
else if replies else if replies
Recursive.apply ReplyHiding.show, post, true Recursive.apply PostHiding.show, post, true
Recursive.rm ReplyHiding.hide, post, true Recursive.rm PostHiding.hide, post, true
else else
return return
if data = ReplyHiding.db.get {boardID: post.board.ID, threadID: post.thread.ID, postID: post.ID} if data = PostHiding.db.get {boardID: post.board.ID, threadID: post.thread.ID, postID: post.ID}
ReplyHiding.saveHiddenState post, !(thisPost and replies), !thisPost, data.makeStub, !replies PostHiding.saveHiddenState post, !(thisPost and replies), !thisPost, data.makeStub, !replies
$.event 'CloseMenu' $.event 'CloseMenu'
makeButton: (post, type) -> makeButton: (post, type) ->
@ -1321,7 +1321,7 @@ ReplyHiding =
className: "#{type}-reply-button" className: "#{type}-reply-button"
innerHTML: "<span>[&nbsp;#{if type is 'hide' then '-' else '+'}&nbsp;]</span>" innerHTML: "<span>[&nbsp;#{if type is 'hide' then '-' else '+'}&nbsp;]</span>"
href: 'javascript:;' href: 'javascript:;'
$.on a, 'click', ReplyHiding.toggle $.on a, 'click', PostHiding.toggle
a a
saveHiddenState: (post, isHiding, thisPost, makeStub, hideRecursively) -> saveHiddenState: (post, isHiding, thisPost, makeStub, hideRecursively) ->
@ -1334,25 +1334,25 @@ ReplyHiding =
thisPost: thisPost isnt false # undefined -> true thisPost: thisPost isnt false # undefined -> true
makeStub: makeStub makeStub: makeStub
hideRecursively: hideRecursively hideRecursively: hideRecursively
ReplyHiding.db.set data PostHiding.db.set data
else else
ReplyHiding.db.delete data PostHiding.db.delete data
toggle: -> toggle: ->
post = Get.postFromNode @ post = Get.postFromNode @
if post.isHidden if post.isHidden
ReplyHiding.show post PostHiding.show post
else else
ReplyHiding.hide post PostHiding.hide post
ReplyHiding.saveHiddenState post, post.isHidden PostHiding.saveHiddenState post, post.isHidden
hide: (post, makeStub=Conf['Stubs'], hideRecursively=Conf['Recursive Hiding']) -> hide: (post, makeStub=Conf['Stubs'], hideRecursively=Conf['Recursive Hiding']) ->
return if post.isHidden return if post.isHidden
post.isHidden = true post.isHidden = true
if hideRecursively if hideRecursively
Recursive.apply ReplyHiding.hide, post, makeStub, true Recursive.apply PostHiding.hide, post, makeStub, true
Recursive.add ReplyHiding.hide, post, makeStub, true Recursive.add PostHiding.hide, post, makeStub, true
for quotelink in Get.allQuotelinksLinkingTo post for quotelink in Get.allQuotelinksLinkingTo post
$.addClass quotelink, 'filtered' $.addClass quotelink, 'filtered'
@ -1361,7 +1361,7 @@ ReplyHiding =
post.nodes.root.hidden = true post.nodes.root.hidden = true
return return
a = ReplyHiding.makeButton post, 'show' a = PostHiding.makeButton post, 'show'
postInfo = postInfo =
if Conf['Anonymize'] if Conf['Anonymize']
'Anonymous' 'Anonymous'
@ -1383,8 +1383,8 @@ ReplyHiding =
post.nodes.root.hidden = false post.nodes.root.hidden = false
post.isHidden = false post.isHidden = false
if showRecursively if showRecursively
Recursive.apply ReplyHiding.show, post, true Recursive.apply PostHiding.show, post, true
Recursive.rm ReplyHiding.hide, post Recursive.rm PostHiding.hide, post
for quotelink in Get.allQuotelinksLinkingTo post for quotelink in Get.allQuotelinksLinkingTo post
$.rmClass quotelink, 'filtered' $.rmClass quotelink, 'filtered'
return return

View File

@ -349,14 +349,14 @@ Main =
initFeature 'Resurrect Quotes', Quotify initFeature 'Resurrect Quotes', Quotify
initFeature 'Filter', Filter initFeature 'Filter', Filter
initFeature 'Thread Hiding', ThreadHiding initFeature 'Thread Hiding', ThreadHiding
initFeature 'Reply Hiding', ReplyHiding initFeature 'Reply Hiding', PostHiding
initFeature 'Recursive', Recursive initFeature 'Recursive', Recursive
initFeature 'Strike-through Quotes', QuoteStrikeThrough initFeature 'Strike-through Quotes', QuoteStrikeThrough
initFeature 'Quick Reply', QR initFeature 'Quick Reply', QR
initFeature 'Menu', Menu initFeature 'Menu', Menu
initFeature 'Report Link', ReportLink initFeature 'Report Link', ReportLink
initFeature 'Thread Hiding (Menu)', ThreadHiding.menu initFeature 'Thread Hiding (Menu)', ThreadHiding.menu
initFeature 'Reply Hiding (Menu)', ReplyHiding.menu initFeature 'Reply Hiding (Menu)', PostHiding.menu
initFeature 'Delete Link', DeleteLink initFeature 'Delete Link', DeleteLink
initFeature 'Filter (Menu)', Filter.menu initFeature 'Filter (Menu)', Filter.menu
initFeature 'Download Link', DownloadLink initFeature 'Download Link', DownloadLink