Fix thread hiding init.
This commit is contained in:
parent
1b5695ac82
commit
64b5da652f
@ -1049,7 +1049,6 @@ ThreadHiding =
|
|||||||
return if g.VIEW isnt 'index' or !Conf['Thread Hiding'] and !Conf['Thread Hiding Link']
|
return if g.VIEW isnt 'index' or !Conf['Thread Hiding'] and !Conf['Thread Hiding Link']
|
||||||
|
|
||||||
Misc.clearThreads "hiddenThreads.#{g.BOARD}"
|
Misc.clearThreads "hiddenThreads.#{g.BOARD}"
|
||||||
@getHiddenThreads()
|
|
||||||
@syncFromCatalog()
|
@syncFromCatalog()
|
||||||
Thread::callbacks.push
|
Thread::callbacks.push
|
||||||
name: 'Thread Hiding'
|
name: 'Thread Hiding'
|
||||||
@ -1068,23 +1067,24 @@ ThreadHiding =
|
|||||||
|
|
||||||
syncFromCatalog: ->
|
syncFromCatalog: ->
|
||||||
# Sync hidden threads from the catalog into the index.
|
# Sync hidden threads from the catalog into the index.
|
||||||
hiddenThreadsOnCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {}
|
ThreadHiding.getHiddenThreads (hiddenThreads) ->
|
||||||
{threads} = ThreadHiding.hiddenThreads
|
{threads} = hiddenThreads
|
||||||
|
hiddenThreadsOnCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {}
|
||||||
|
|
||||||
# Add threads that were hidden in the catalog.
|
# Add threads that were hidden in the catalog.
|
||||||
for threadID of hiddenThreadsOnCatalog
|
for threadID of hiddenThreadsOnCatalog
|
||||||
continue if threadID of threads
|
continue if threadID of threads
|
||||||
threads[threadID] = {}
|
threads[threadID] = {}
|
||||||
|
|
||||||
# Remove threads that were un-hidden in the catalog.
|
# Remove threads that were un-hidden in the catalog.
|
||||||
for threadID of threads
|
for threadID of threads
|
||||||
continue if threadID of threads
|
continue if threadID of threads
|
||||||
delete threads[threadID]
|
delete threads[threadID]
|
||||||
|
|
||||||
if Object.keys(threads).length
|
if Object.keys(threads).length
|
||||||
$.set "hiddenThreads.#{g.BOARD}", ThreadHiding.hiddenThreads
|
$.set "hiddenThreads.#{g.BOARD}", ThreadHiding.hiddenThreads
|
||||||
else
|
else
|
||||||
$.delete "hiddenThreads.#{g.BOARD}"
|
$.delete "hiddenThreads.#{g.BOARD}"
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user