Link from native catalog to external catalog should read 'External Catalog'

This commit is contained in:
ccd0 2019-07-21 08:07:49 -07:00
parent 0aeed5edaa
commit 99d01bf59b
3 changed files with 7 additions and 4 deletions

View File

@ -14,10 +14,11 @@ CatalogLinks =
link.href = CatalogLinks.index()
when "/#{g.BOARD}/catalog"
link.href = CatalogLinks.catalog()
if g.VIEW is 'catalog' and Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog']
if g.VIEW is 'catalog' and (catalogURL = CatalogLinks.catalog()) isnt g.SITE.urls.catalog?(g.BOARD)
catalogLink = link.parentNode.cloneNode true
catalogLink.firstElementChild.textContent = '<%= meta.name %> Catalog'
catalogLink.firstElementChild.href = CatalogLinks.catalog()
link2 = catalogLink.firstElementChild
link2.href = catalogURL
link2.textContent = if link2.hostname is location.hostname then '<%= meta.name %> Catalog' else 'External Catalog'
$.after link.parentNode, [$.tn(' '), catalogLink]
return
@ -101,7 +102,7 @@ CatalogLinks =
else if Conf['JSON Index'] and Conf['Use <%= meta.name %> Catalog']
if location.hostname in ['boards.4chan.org', 'boards.4channel.org'] and g.BOARD.ID is board and g.VIEW is 'index' then '#catalog' else "//#{BoardConfig.domain(board)}/#{board}/#catalog"
else
"//#{BoardConfig.domain(board)}/#{board}/catalog"
g.sites[siteID].urls.catalog?({siteID, boardID: board})
index: (board=g.BOARD.ID) ->
if Conf['JSON Index'] and board isnt 'f'

View File

@ -47,6 +47,7 @@ SW.tinyboard =
urls:
thread: ({siteID, boardID, threadID}) -> "#{Conf['siteProperties'][siteID]?.root or "http://#{siteID}/"}#{boardID}/res/#{threadID}.html"
catalog: ({siteID, boardID}) -> "#{Conf['siteProperties'][siteID]?.root or "http://#{siteID}/"}#{boardID}/catalog.html"
threadJSON: ({siteID, boardID, threadID}) ->
root = Conf['siteProperties'][siteID]?.root
if root then "#{root}#{boardID}/res/#{threadID}.json" else ''

View File

@ -4,6 +4,7 @@ SW.yotsuba =
urls:
thread: ({boardID, threadID}) -> "#{location.protocol}//#{BoardConfig.domain(boardID)}/#{boardID}/thread/#{threadID}"
catalog: ({boardID}) -> if boardID is 'f' then undefined else "#{location.protocol}//#{BoardConfig.domain(boardID)}/#{boardID}/catalog"
threadJSON: ({boardID, threadID}) -> "#{location.protocol}//a.4cdn.org/#{boardID}/thread/#{threadID}.json"
threadsListJSON: ({boardID}) -> "#{location.protocol}//a.4cdn.org/#{boardID}/threads.json"
archiveListJSON: ({boardID}) -> if BoardConfig.isArchived(boardID) then "#{location.protocol}//a.4cdn.org/#{boardID}/archive.json" else ''