From b74dc804d6d3471c3f48ae2961f4d4d6b79656b9 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 24 Mar 2022 19:27:09 +0100 Subject: [PATCH] dont open in a new tab for internal urls --- ui/component/button/view.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/component/button/view.jsx b/ui/component/button/view.jsx index a41f065d5..7821fd883 100644 --- a/ui/component/button/view.jsx +++ b/ui/component/button/view.jsx @@ -145,11 +145,19 @@ const Button = forwardRef((props: Props, ref: any) => { ); + // check if the link is for odysee.com + function isAnOdyseeLink(urlString) { + return urlString.indexOf('https://odysee.com') !== -1 || urlString.indexOf('http://odysee.com') !== -1; + } + + // if it's an internal link we won't open a new tab + const isAnInternalLink = (href || navigate) && (isAnOdyseeLink(href) || isAnOdyseeLink(navigate)); + if (href || (navigate && navigate.startsWith('http'))) { // TODO: replace the below with an outbound link tracker for matomo return (