From 99d01bf59b114f1be592644ae1ed11d2201b7b12 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 21 Jul 2019 08:07:49 -0700 Subject: [PATCH] Link from native catalog to external catalog should read 'External Catalog' --- src/Miscellaneous/CatalogLinks.coffee | 9 +++++---- src/site/SW.tinyboard.coffee | 1 + src/site/SW.yotsuba.coffee | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index e0ae26d5e..982366c7b 100644 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -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' diff --git a/src/site/SW.tinyboard.coffee b/src/site/SW.tinyboard.coffee index cc78ec912..333bafc1b 100644 --- a/src/site/SW.tinyboard.coffee +++ b/src/site/SW.tinyboard.coffee @@ -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 '' diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index 38a74994c..ea28a78ac 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -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 ''