From 28ba2df7d4e4e2f9a0d607b39a242f221f872fb6 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 10 Jul 2019 17:00:54 -0700 Subject: [PATCH] Make `Volume in New Tab` and `Loop in New Tab` work on Tinyboard/vichan sites. --- src/main/Main.coffee | 4 ++-- src/site/SW.tinyboard.coffee | 3 +++ src/site/SW.yotsuba.coffee | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/Main.coffee b/src/main/Main.coffee index dfca86789..5cc32ba62 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -156,9 +156,9 @@ Main = PostSuccessful.init() return - if ImageHost.test hostname + if g.SITE.isFileURL() $.asap (-> d.readyState isnt 'loading'), -> - if Conf['404 Redirect'] and g.SITE.is404?() + if g.SITE.software is 'yotsuba' and Conf['404 Redirect'] and g.SITE.is404?() Redirect.navigate 'file', { boardID: g.BOARD.ID filename: pathname[pathname.length - 1] diff --git a/src/site/SW.tinyboard.coffee b/src/site/SW.tinyboard.coffee index 85b0e0b5c..86c8fb335 100644 --- a/src/site/SW.tinyboard.coffee +++ b/src/site/SW.tinyboard.coffee @@ -132,6 +132,9 @@ SW.tinyboard = bgColoredEl: -> $.el 'div', className: 'post reply' + isFileURL: -> + /\/src\/[^\/]+/.test(location.pathname) + parseNodes: (post, nodes) -> # Add vichan's span.poster_id around the ID if not already present. return if nodes.uniqueID diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index ab9a8ffea..00d5b37c3 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -91,6 +91,9 @@ SW.yotsuba = isAuxiliaryPage: -> location.hostname not in ['boards.4chan.org', 'boards.4channel.org'] + isFileURL: -> + ImageHost.test(location.hostname) + scriptData: -> for script in $$ 'script:not([src])', d.head return script.textContent if /\bcooldowns *=/.test script.textContent