ThreadUpdater.disconnect()
This commit is contained in:
parent
32641549f2
commit
798ab20f35
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -408,6 +408,8 @@ Header =
|
|||||||
$.add shortcut, el
|
$.add shortcut, el
|
||||||
$.prepend Header.shortcuts, shortcut
|
$.prepend Header.shortcuts, shortcut
|
||||||
|
|
||||||
|
rmShortcut: (el) ->
|
||||||
|
$.rm el.parentElement
|
||||||
|
|
||||||
menuToggle: (e) ->
|
menuToggle: (e) ->
|
||||||
Header.menu.toggle e, @, g
|
Header.menu.toggle e, @, g
|
||||||
|
|||||||
@ -257,71 +257,67 @@ Main =
|
|||||||
<%= grunt.file.read('src/General/css/photon.css').replace(/\s+/g, ' ').trim() %>
|
<%= grunt.file.read('src/General/css/photon.css').replace(/\s+/g, ' ').trim() %>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
features:
|
features:
|
||||||
'Polyfill': Polyfill
|
'Polyfill': Polyfill
|
||||||
'Emoji': Emoji
|
'Redirect': Redirect
|
||||||
'Style': Style
|
'Header': Header
|
||||||
'Mascots': MascotTools
|
'Catalog Links': CatalogLinks
|
||||||
'Rice': Rice
|
'Settings': Settings
|
||||||
'Banner': Banner
|
'Index Generator': Index
|
||||||
'Announcements': GlobalMessage
|
'Announcement Hiding': PSAHiding
|
||||||
'Archive Redirection': Redirect
|
'Fourchan thingies': Fourchan
|
||||||
'Header': Header
|
'Emoji': Emoji
|
||||||
'Catalog Links': CatalogLinks
|
'Color User IDs': IDColor
|
||||||
'Settings': Settings
|
'Custom CSS': CustomCSS
|
||||||
'Index Generator': Index
|
'Linkify': Linkify
|
||||||
'Announcement Hiding': PSAHiding
|
'Reveal Spoilers': RemoveSpoilers
|
||||||
'Fourchan thingies': Fourchan
|
'Resurrect Quotes': Quotify
|
||||||
'Color User IDs': IDColor
|
'Filter': Filter
|
||||||
'Custom CSS': CustomCSS
|
'Thread Hiding Buttons': ThreadHiding
|
||||||
'Linkify': Linkify
|
'Reply Hiding Buttons': PostHiding
|
||||||
'Reveal Spoilers': RemoveSpoilers
|
'Recursive': Recursive
|
||||||
'Resurrect Quotes': Quotify
|
'Strike-through Quotes': QuoteStrikeThrough
|
||||||
'Filter': Filter
|
'Quick Reply': QR
|
||||||
'Thread Hiding Buttons': ThreadHiding
|
'Menu': Menu
|
||||||
'Reply Hiding Buttons': PostHiding
|
'Report Link': ReportLink
|
||||||
'Recursive': Recursive
|
'Thread Hiding (Menu)': ThreadHiding.menu
|
||||||
'Strike-through Quotes': QuoteStrikeThrough
|
'Reply Hiding (Menu)': PostHiding.menu
|
||||||
'Quick Reply': QR
|
'Delete Link': DeleteLink
|
||||||
'Menu': Menu
|
'Filter (Menu)': Filter.menu
|
||||||
'Report Link': ReportLink
|
'Download Link': DownloadLink
|
||||||
'Thread Hiding (Menu)': ThreadHiding.menu
|
'Archive Link': ArchiveLink
|
||||||
'Reply Hiding (Menu)': PostHiding.menu
|
'Quote Inlining': QuoteInline
|
||||||
'Delete Link': DeleteLink
|
'Quote Previewing': QuotePreview
|
||||||
'Filter (Menu)': Filter.menu
|
'Quote Backlinks': QuoteBacklink
|
||||||
'Download Link': DownloadLink
|
'Mark Quotes of You': QuoteYou
|
||||||
'Archive Link': ArchiveLink
|
'Mark OP Quotes': QuoteOP
|
||||||
'Quote Inlining': QuoteInline
|
'Mark Cross-thread Quotes': QuoteCT
|
||||||
'Quote Previewing': QuotePreview
|
'Anonymize': Anonymize
|
||||||
'Quote Backlinks': QuoteBacklink
|
'Time Formatting': Time
|
||||||
'Mark Quotes of You': QuoteYou
|
'Relative Post Dates': RelativeDates
|
||||||
'Mark OP Quotes': QuoteOP
|
'File Info Formatting': FileInfo
|
||||||
'Mark Cross-thread Quotes': QuoteCT
|
'Fappe Tyme': FappeTyme
|
||||||
'Anonymize': Anonymize
|
'Gallery': Gallery
|
||||||
'Time Formatting': Time
|
'Gallery (menu)': Gallery.menu
|
||||||
'Relative Post Dates': RelativeDates
|
'Sauce': Sauce
|
||||||
'File Info Formatting': FileInfo
|
'Image Expansion': ImageExpand
|
||||||
'Fappe Tyme': FappeTyme
|
'Image Expansion (Menu)': ImageExpand.menu
|
||||||
'Gallery': Gallery
|
|
||||||
'Gallery (menu)': Gallery.menu
|
|
||||||
'Sauce': Sauce
|
|
||||||
'Image Expansion': ImageExpand
|
|
||||||
'Image Expansion (Menu)': ImageExpand.menu
|
|
||||||
'Reveal Spoiler Thumbnails': RevealSpoilers
|
'Reveal Spoiler Thumbnails': RevealSpoilers
|
||||||
'Image Loading': ImageLoader
|
'Image Loading': ImageLoader
|
||||||
'Image Hover': ImageHover
|
'Image Hover': ImageHover
|
||||||
'Thread Expansion': ExpandThread
|
'Thread Expansion': ExpandThread
|
||||||
'Thread Excerpt': ThreadExcerpt
|
'Thread Excerpt': ThreadExcerpt
|
||||||
'Favicon': Favicon
|
'Favicon': Favicon
|
||||||
'Unread': Unread
|
'Unread': Unread
|
||||||
'Quote Threading': QuoteThreading
|
'Quote Threading': QuoteThreading
|
||||||
'Thread Updater': ThreadUpdater
|
'Thread Stats': ThreadStats
|
||||||
'Thread Stats': ThreadStats
|
'Thread Updater': ThreadUpdater
|
||||||
'Thread Watcher': ThreadWatcher
|
'Thread Watcher': ThreadWatcher
|
||||||
'Thread Watcher (Menu)': ThreadWatcher.menu
|
'Thread Watcher (Menu)': ThreadWatcher.menu
|
||||||
'Index Navigation': Nav
|
'Index Navigation': Nav
|
||||||
'Keybinds': Keybinds
|
'Keybinds': Keybinds
|
||||||
'Show Dice Roll': Dice
|
'Show Dice Roll': Dice
|
||||||
|
'Banner': Banner
|
||||||
|
|
||||||
clean: ->
|
clean: ->
|
||||||
delete g.posts[id] for id of g.posts
|
delete g.posts[id] for id of g.posts
|
||||||
|
|||||||
@ -24,6 +24,7 @@ UI = do ->
|
|||||||
constructor: (@type) ->
|
constructor: (@type) ->
|
||||||
# Doc here: https://github.com/MayhemYDG/4chan-x/wiki/Menu-API
|
# Doc here: https://github.com/MayhemYDG/4chan-x/wiki/Menu-API
|
||||||
$.on d, 'AddMenuEntry', @addEntry
|
$.on d, 'AddMenuEntry', @addEntry
|
||||||
|
$.on d, 'rmMenuEntry', @rmEntry
|
||||||
@entries = []
|
@entries = []
|
||||||
|
|
||||||
makeMenu: ->
|
makeMenu: ->
|
||||||
@ -189,6 +190,12 @@ UI = do ->
|
|||||||
@parseEntry entry
|
@parseEntry entry
|
||||||
@entries.push entry
|
@entries.push entry
|
||||||
|
|
||||||
|
rmEntry: (e) =>
|
||||||
|
entry = e.detail
|
||||||
|
return if entry.type isnt @type
|
||||||
|
index = @entries.indexOf entry
|
||||||
|
@entries.splice index, 1
|
||||||
|
|
||||||
parseEntry: (entry) ->
|
parseEntry: (entry) ->
|
||||||
{el, subEntries} = entry
|
{el, subEntries} = entry
|
||||||
$.addClass el, 'entry'
|
$.addClass el, 'entry'
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
ThreadUpdater =
|
ThreadUpdater =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
||||||
|
|
||||||
|
ThreadUpdater.connect.call @
|
||||||
|
|
||||||
|
connect: ->
|
||||||
if Conf['Updater and Stats in Header']
|
if Conf['Updater and Stats in Header']
|
||||||
@dialog = sc = $.el 'span',
|
@dialog = sc = $.el 'span',
|
||||||
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>"
|
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>"
|
||||||
@ -22,10 +25,10 @@ ThreadUpdater =
|
|||||||
@status = $ '#update-status', sc
|
@status = $ '#update-status', sc
|
||||||
@isUpdating = Conf['Auto Update']
|
@isUpdating = Conf['Auto Update']
|
||||||
|
|
||||||
$.on @timer, 'click', ThreadUpdater.update
|
$.on @timer, 'click', @update
|
||||||
$.on @status, 'click', ThreadUpdater.update
|
$.on @status, 'click', @update
|
||||||
|
|
||||||
subEntries = []
|
@subEntries = []
|
||||||
for name, conf of Config.updater.checkbox
|
for name, conf of Config.updater.checkbox
|
||||||
checked = if Conf[name] then 'checked' else ''
|
checked = if Conf[name] then 'checked' else ''
|
||||||
el = $.el 'label',
|
el = $.el 'label',
|
||||||
@ -34,20 +37,20 @@ ThreadUpdater =
|
|||||||
input = el.firstElementChild
|
input = el.firstElementChild
|
||||||
$.on input, 'change', $.cb.checked
|
$.on input, 'change', $.cb.checked
|
||||||
if input.name is 'Scroll BG'
|
if input.name is 'Scroll BG'
|
||||||
$.on input, 'change', ThreadUpdater.cb.scrollBG
|
$.on input, 'change', @cb.scrollBG
|
||||||
ThreadUpdater.cb.scrollBG()
|
@cb.scrollBG()
|
||||||
else if input.name is 'Auto Update'
|
else if input.name is 'Auto Update'
|
||||||
$.on input, 'change', ThreadUpdater.cb.update
|
$.on input, 'change', @cb.update
|
||||||
subEntries.push el: el
|
subEntries.push el: el
|
||||||
|
|
||||||
settings = $.el 'span',
|
@settings = $.el 'span',
|
||||||
innerHTML: '<a href=javascript:;>Interval</a>'
|
innerHTML: '<a href=javascript:;>Interval</a>'
|
||||||
|
|
||||||
$.on settings, 'click', @intervalShortcut
|
$.on @settings, 'click', @intervalShortcut
|
||||||
|
|
||||||
subEntries.push el: settings
|
subEntries.push el: settings
|
||||||
|
|
||||||
$.event 'AddMenuEntry',
|
$.event 'AddMenuEntry', @entry =
|
||||||
type: 'header'
|
type: 'header'
|
||||||
el: $.el 'span',
|
el: $.el 'span',
|
||||||
textContent: 'Updater'
|
textContent: 'Updater'
|
||||||
@ -57,6 +60,35 @@ ThreadUpdater =
|
|||||||
Thread.callbacks.push
|
Thread.callbacks.push
|
||||||
name: 'Thread Updater'
|
name: 'Thread Updater'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
|
disconnect: ->
|
||||||
|
if Conf['Updater and Stats in Header']
|
||||||
|
Header.rmShortcut @dialog
|
||||||
|
else
|
||||||
|
$.rmClass doc, 'float'
|
||||||
|
$.rm @dialog
|
||||||
|
|
||||||
|
$.off @timer, 'click', @update
|
||||||
|
$.off @status, 'click', @update
|
||||||
|
|
||||||
|
for entry in @entry.subEntries
|
||||||
|
{el} = entry
|
||||||
|
input = el.firstElementChild
|
||||||
|
$.off input, 'change', $.cb.checked
|
||||||
|
$.off input, 'change', @cb.scrollBG
|
||||||
|
$.off input, 'change', @cb.update
|
||||||
|
|
||||||
|
$.off @settings, 'click', @intervalShortcut
|
||||||
|
|
||||||
|
$.event 'rmMenuEntry', @entry
|
||||||
|
|
||||||
|
delete @checkPostCount
|
||||||
|
delete @timer
|
||||||
|
delete @status
|
||||||
|
delete @isUpdating
|
||||||
|
delete @entry
|
||||||
|
|
||||||
|
Thread.callbacks.rm 'Thread Updater'
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
ThreadUpdater.thread = @
|
ThreadUpdater.thread = @
|
||||||
|
|||||||
@ -2,7 +2,7 @@ Unread =
|
|||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Favicon'] and !Conf['Desktop Notifications']
|
return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Favicon'] and !Conf['Desktop Notifications']
|
||||||
|
|
||||||
Unread.connect()
|
Unread.connect.call this
|
||||||
|
|
||||||
connect: ->
|
connect: ->
|
||||||
@db = new DataBoard 'lastReadPosts', @sync
|
@db = new DataBoard 'lastReadPosts', @sync
|
||||||
@ -21,12 +21,12 @@ Unread =
|
|||||||
Unread.db.disconnect()
|
Unread.db.disconnect()
|
||||||
$.rm hr, parent if parent = (hr = Unread.hr).parentElement
|
$.rm hr, parent if parent = (hr = Unread.hr).parentElement
|
||||||
|
|
||||||
delete Unread[name] for name in ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost']
|
delete @[name] for name in ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost']
|
||||||
|
|
||||||
$.off d, '4chanXInitFinished', Unread.ready
|
$.off d, '4chanXInitFinished', @ready
|
||||||
$.off d, 'ThreadUpdate', Unread.onUpdate
|
$.off d, 'ThreadUpdate', @onUpdate
|
||||||
$.off d, 'scroll visibilitychange', Unread.read
|
$.off d, 'scroll visibilitychange', @read
|
||||||
$.off d, 'visibilitychange', Unread.setLine if Conf['Unread Line']
|
$.off d, 'visibilitychange', @setLine if Conf['Unread Line']
|
||||||
|
|
||||||
Thread.callbacks.rm 'Unread'
|
Thread.callbacks.rm 'Unread'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user