Rewrite catalog links. #239
This commit is contained in:
parent
f0e2bce4ef
commit
2f8a509c71
@ -12,17 +12,29 @@ CatalogLinks =
|
|||||||
when "/#{g.BOARD}/catalog" then link.href = CatalogLinks.catalog()
|
when "/#{g.BOARD}/catalog" then link.href = CatalogLinks.catalog()
|
||||||
return
|
return
|
||||||
|
|
||||||
return unless Conf['Catalog Links']
|
if Conf['JSON Navigation'] and Conf['Use 4chan X Catalog']
|
||||||
CatalogLinks.el = el = UI.checkbox 'Header catalog links', ' Catalog Links'
|
Post.callbacks.push
|
||||||
el.id = 'toggleCatalog'
|
name: 'Catalog Link Rewrite'
|
||||||
|
cb: @node
|
||||||
|
CatalogThread.callbacks.push
|
||||||
|
name: 'Catalog Link Rewrite'
|
||||||
|
cb: @node
|
||||||
|
|
||||||
input = $ 'input', el
|
if Conf['Catalog Links']
|
||||||
$.on input, 'change', @toggle
|
CatalogLinks.el = el = UI.checkbox 'Header catalog links', ' Catalog Links'
|
||||||
$.sync 'Header catalog links', CatalogLinks.set
|
el.id = 'toggleCatalog'
|
||||||
|
input = $ 'input', el
|
||||||
|
$.on input, 'change', @toggle
|
||||||
|
$.sync 'Header catalog links', CatalogLinks.set
|
||||||
|
Header.menu.addEntry
|
||||||
|
el: el
|
||||||
|
order: 95
|
||||||
|
|
||||||
Header.menu.addEntry
|
node: ->
|
||||||
el: el
|
for a in $$ 'a', @nodes.comment
|
||||||
order: 95
|
if m = a.href.match /^https?:\/\/boards\.4chan\.org\/([^\/]+)\/catalog(#s=.*)?/
|
||||||
|
a.href = "//boards.4chan.org/#{m[1]}/#{m[2] or '#catalog'}"
|
||||||
|
return
|
||||||
|
|
||||||
# Set links on load or custom board list change.
|
# Set links on load or custom board list change.
|
||||||
# Called by Header when both board lists (header and footer) are ready.
|
# Called by Header when both board lists (header and footer) are ready.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user