mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
Attempting to make better subscription buttons for TPL and .onion lists (#742)
* Update SubscribeButton.tsx * Update SubscribeButton.tsx * Added an Onion-button test link * Corrected 1 link * Added 1 missing paranthesis * Coding is greek to me * Adding comparison numbers or something * Realised that -1 would reverse a statement * Update SubscribeButton.tsx * Had forgot to remove leftover code * Paranthesises are difficult to keep track of
This commit is contained in:
parent
eb731a1d6f
commit
c1eb75e4bc
2 changed files with 23 additions and 9 deletions
|
|
@ -13664,7 +13664,8 @@
|
|||
"syntaxId": 3,
|
||||
"updatedDate": "2019-03-27T21:25:33+00:00",
|
||||
"viewUrl": "https://gitlab.com/intr0/DomainVoider/raw/master/DomainVoider.txt",
|
||||
"viewUrlMirror1": "https://notabug.org/-intr0/DomainVoider/raw/master/DomainVoider.txt"
|
||||
"viewUrlMirror1": "https://notabug.org/-intr0/DomainVoider/raw/master/DomainVoider.txt",
|
||||
"viewUrlMirror2": "http://vivmyccb3jdb7yij.onion/intr0/DomainVoider/raw/master/DomainVoider.txt"
|
||||
},
|
||||
{
|
||||
"id": 1297,
|
||||
|
|
|
|||
|
|
@ -10,20 +10,33 @@ interface IProps {
|
|||
export const SubscribeButton = (props: IProps) => {
|
||||
let buttonClass: string | undefined;
|
||||
let titlePrefix: string;
|
||||
|
||||
if (props.url.indexOf("https://") === -1) {
|
||||
|
||||
if (props.url.indexOf(".onion/") > 0) {
|
||||
buttonClass = "btn-success";
|
||||
titlePrefix = "Tor address - ";
|
||||
} else if (props.url.indexOf("http://") === 0) {
|
||||
buttonClass = "btn-danger";
|
||||
titlePrefix = "Not Secure - ";
|
||||
} else {
|
||||
buttonClass = undefined;
|
||||
titlePrefix = "";
|
||||
}
|
||||
|
||||
|
||||
const hrefTitle = `&title=${encodeURIComponent(props.name)}`;
|
||||
const href = `abp:subscribe?location=${encodeURIComponent(props.url)}${hrefTitle}`;
|
||||
const title =
|
||||
`${titlePrefix}Subscribe to ${props.name
|
||||
} with a browser extension supporting the \"abp:\" protocol (e.g. uBlock Origin, Adblock Plus).`;
|
||||
let href;
|
||||
if (props.url.indexOf(".tpl") > 0)
|
||||
{
|
||||
href = `https://raw.githubusercontent.com/collinbarrett/FilterLists/master/data/TPLSubscriptionAssistant.html`;
|
||||
} else {
|
||||
href = `abp:subscribe?location=${encodeURIComponent(props.url)}${hrefTitle}`;
|
||||
};
|
||||
let title;
|
||||
if (props.url.indexOf(".tpl") > 0)
|
||||
{
|
||||
title = `${titlePrefix}Visit a TPL archive from which ${props.name} can be subscribed to with Internet Explorer.`;
|
||||
} else {
|
||||
title = `${titlePrefix}Subscribe to ${props.name} with a browser extension supporting the \"abp:\" protocol (e.g. uBlock Origin, Adblock Plus).`;
|
||||
};
|
||||
|
||||
return props.url
|
||||
? <LinkButton href={href}
|
||||
|
|
@ -31,4 +44,4 @@ export const SubscribeButton = (props: IProps) => {
|
|||
buttonClass={buttonClass}
|
||||
text={props.text || "Subscribe"}/>
|
||||
: null;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue