don't use event for adding to menu internally
This commit is contained in:
parent
3d28405268
commit
efc852464f
@ -198,7 +198,7 @@ Filter =
|
||||
# Add a sub entry for each filter type.
|
||||
entry.subEntries.push Filter.menu.createSubEntry type[0], type[1]
|
||||
|
||||
$.event 'AddMenuEntry', entry
|
||||
UI.addMenuEntry entry
|
||||
|
||||
createSubEntry: (text, type) ->
|
||||
el = $.el 'a',
|
||||
|
||||
@ -39,7 +39,7 @@ PostHiding =
|
||||
replies = UI.checkbox 'replies', ' Hide replies', Conf['Recursive Hiding']
|
||||
makeStub = UI.checkbox 'makeStub', ' Make stub', Conf['Stubs']
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: div
|
||||
order: 20
|
||||
@ -75,7 +75,7 @@ PostHiding =
|
||||
href: 'javascript:;'
|
||||
$.on hideStubLink, 'click', PostHiding.menu.hideStub
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: div
|
||||
order: 20
|
||||
@ -96,7 +96,7 @@ PostHiding =
|
||||
el: replies
|
||||
]
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: hideStubLink
|
||||
order: 15
|
||||
|
||||
@ -80,7 +80,7 @@ ThreadHiding =
|
||||
|
||||
makeStub = UI.checkbox 'Stubs', ' Make stub'
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: div
|
||||
order: 20
|
||||
@ -97,7 +97,7 @@ ThreadHiding =
|
||||
href: 'javascript:;'
|
||||
$.on div, 'click', ThreadHiding.menu.show
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: div
|
||||
order: 20
|
||||
@ -112,7 +112,7 @@ ThreadHiding =
|
||||
href: 'javascript:;'
|
||||
$.on hideStubLink, 'click', ThreadHiding.menu.hideStub
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: hideStubLink
|
||||
order: 15
|
||||
|
||||
@ -54,7 +54,7 @@ Header =
|
||||
|
||||
@addShortcut menuButton
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Header'
|
||||
|
||||
@ -55,7 +55,7 @@ Index =
|
||||
when 'Anchor Hidden Threads'
|
||||
$.on input, 'change', @cb.sort
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Index Navigation'
|
||||
|
||||
@ -17,6 +17,12 @@ UI = do ->
|
||||
|
||||
el
|
||||
|
||||
menus = {}
|
||||
addMenuEntry = (entry) ->
|
||||
menus[entry.type].addEntry {detail: entry}
|
||||
rmMenuEntry = (entry) ->
|
||||
menus[entry.type].addEntry {detail: entry}
|
||||
|
||||
class Menu
|
||||
currentMenu = null
|
||||
lastToggledButton = null
|
||||
@ -26,6 +32,7 @@ UI = do ->
|
||||
$.on d, 'AddMenuEntry', @addEntry
|
||||
$.on d, 'rmMenuEntry', @rmEntry
|
||||
@entries = []
|
||||
menus[@type] = @
|
||||
|
||||
makeMenu: ->
|
||||
menu = $.el 'div',
|
||||
@ -386,4 +393,6 @@ UI = do ->
|
||||
Menu: Menu
|
||||
hover: hoverstart
|
||||
checkbox: checkbox
|
||||
addMenuEntry: addMenuEntry
|
||||
rmMenuEntry: rmMenuEntry
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ FappeTyme =
|
||||
FappeTyme[lc] = input = el.firstElementChild
|
||||
$.on input, 'change', FappeTyme.cb.toggle.bind input
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: el
|
||||
order: 97
|
||||
|
||||
@ -61,7 +61,7 @@ Gallery =
|
||||
for name of Config.gallery
|
||||
{el} = createSubEntry name
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'gallery'
|
||||
el: el
|
||||
order: 0
|
||||
@ -235,7 +235,7 @@ Gallery =
|
||||
for name of Config.gallery
|
||||
subEntries.push createSubEntry name
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: el
|
||||
order: 105
|
||||
|
||||
@ -249,7 +249,7 @@ ImageExpand =
|
||||
for name, conf of Config.imageExpansion
|
||||
subEntries.push createSubEntry name, conf[1]
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: el
|
||||
order: 105
|
||||
|
||||
@ -19,7 +19,7 @@ ImageLoader =
|
||||
@el = prefetch.firstElementChild
|
||||
$.on @el, 'change', @toggle
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: prefetch
|
||||
order: 104
|
||||
|
||||
@ -25,7 +25,7 @@ ArchiveLink =
|
||||
# Add a sub entry for each type.
|
||||
entry.subEntries.push @createSubEntry type[0], type[1]
|
||||
|
||||
$.event 'AddMenuEntry', entry
|
||||
UI.addMenuEntry entry
|
||||
|
||||
createSubEntry: (text, type) ->
|
||||
el = $.el 'a',
|
||||
|
||||
@ -26,7 +26,7 @@ DeleteLink =
|
||||
$.on fileEl, 'click', DeleteLink.delete
|
||||
true
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: div
|
||||
order: 40
|
||||
|
||||
@ -17,7 +17,7 @@ DownloadLink =
|
||||
else
|
||||
new Notice 'error', "Could not download #{file.URL}", 30
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: a
|
||||
order: 100
|
||||
|
||||
@ -7,7 +7,7 @@ ReportLink =
|
||||
href: 'javascript:;'
|
||||
textContent: 'Report this post'
|
||||
$.on a, 'click', ReportLink.report
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'post'
|
||||
el: a
|
||||
order: 10
|
||||
|
||||
@ -19,7 +19,7 @@ PSAHiding =
|
||||
href: 'javascript:;'
|
||||
order: 50
|
||||
open: -> psa.hidden
|
||||
$.event 'AddMenuEntry', entry
|
||||
UI.addMenuEntry entry
|
||||
$.on entry.el, 'click', PSAHiding.toggle
|
||||
|
||||
PSAHiding.btn = btn = $.el 'span',
|
||||
|
||||
@ -8,7 +8,7 @@ CatalogLinks =
|
||||
$.on input, 'change', @toggle
|
||||
$.sync 'Header catalog links', CatalogLinks.set
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: el
|
||||
order: 95
|
||||
|
||||
@ -52,7 +52,7 @@ ThreadUpdater =
|
||||
|
||||
subEntries.push el: @settings
|
||||
|
||||
$.event 'AddMenuEntry', @entry =
|
||||
UI.addMenuEntry @entry =
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Updater'
|
||||
@ -85,7 +85,7 @@ ThreadUpdater =
|
||||
@set 'timer', null
|
||||
@set 'status', 'Offline'
|
||||
|
||||
$.event 'rmMenuEntry', @entry
|
||||
UI.rmMenuEntry @entry
|
||||
|
||||
if Conf['Updater and Stats in Header']
|
||||
Header.rmShortcut @dialog
|
||||
|
||||
@ -238,7 +238,7 @@ ThreadWatcher =
|
||||
return if g.VIEW isnt 'thread'
|
||||
entryEl = $.el 'a',
|
||||
href: 'javascript:;'
|
||||
$.event 'AddMenuEntry',
|
||||
UI.addMenuEntry
|
||||
type: 'header'
|
||||
el: entryEl
|
||||
order: 60
|
||||
@ -297,7 +297,7 @@ ThreadWatcher =
|
||||
entry.el.href = 'javascript:;' if entry.el.nodeName is 'A'
|
||||
$.on entry.el, 'click', cb if cb
|
||||
@refreshers.push refresh.bind entry if refresh
|
||||
$.event 'AddMenuEntry', entry
|
||||
UI.addMenuEntry entry
|
||||
return
|
||||
createSubEntry: (name, desc) ->
|
||||
entry =
|
||||
|
||||
@ -13,7 +13,7 @@ QuoteThreading =
|
||||
input = $ 'input', @controls
|
||||
$.on input, 'change', @toggle
|
||||
|
||||
$.event 'AddMenuEntry', @entry =
|
||||
UI.addMenuEntry @entry =
|
||||
type: 'header'
|
||||
el: @controls
|
||||
order: 98
|
||||
@ -29,7 +29,7 @@ QuoteThreading =
|
||||
input = $ 'input', @controls
|
||||
$.off input, 'change', @toggle
|
||||
|
||||
$.event 'rmMenuEntry', @entry
|
||||
UI.rmMenuEntry @entry
|
||||
|
||||
delete @enabled
|
||||
delete @controls
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user