diff options
author | Ajay Ramachandran <[email protected]> | 2022-04-11 01:28:52 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-04-11 01:28:52 -0400 |
commit | c6e3d110712dafa37013604e0ad3c5544a6f4f39 (patch) | |
tree | 1828197008d8025d7442400d3a2817f18e919801 | |
parent | 42eceb3efd78768512199eff326d11d006117311 (diff) | |
parent | ae7f1f228f38a7c53bda0537fdf5c36e911aa577 (diff) | |
download | SponsorBlock-c6e3d110712dafa37013604e0ad3c5544a6f4f39.tar.gz SponsorBlock-c6e3d110712dafa37013604e0ad3c5544a6f4f39.zip |
Merge pull request #1276 from MRuy/beta-server-warning
Add beta server warning to popup
-rw-r--r-- | public/_locales/en/messages.json | 6 | ||||
-rw-r--r-- | public/popup.css | 10 | ||||
-rw-r--r-- | public/popup.html | 4 | ||||
-rw-r--r-- | src/popup.ts | 10 |
4 files changed, 29 insertions, 1 deletions
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 1d3e9f15..c63626eb 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -929,5 +929,11 @@ }, "youtubeKeybindWarning": { "message": "This is a built-in YouTube shortcut. Are you sure you want to use it?" + }, + "betaServerWarning": { + "message": "BETA Server is enabled!" + }, + "openOptionsPage": { + "message": "Open options page" } } diff --git a/public/popup.css b/public/popup.css index 31b68092..48af762e 100644 --- a/public/popup.css +++ b/public/popup.css @@ -544,3 +544,13 @@ #sponsorBlockPopupBody .hidden { display: none !important; } + +#sbBetaServerWarning { + padding: 8px; + font-size: 1em; + font-weight: 700; + word-break: break-word; + color: var(--sb-main-fg-color); + background: var(--sb-red-bg-color); + cursor: pointer; +} diff --git a/public/popup.html b/public/popup.html index 78001e86..c94dddbc 100644 --- a/public/popup.html +++ b/public/popup.html @@ -11,6 +11,10 @@ <body id="sponsorBlockPopupBody"> <div id="sponsorblockPopup" class="sponsorBlockPageBody sb-preload"> + <div id="sbBetaServerWarning" class="hidden" title="__MSG_openOptionsPage__"> + __MSG_betaServerWarning__ + </div> + <header class="sbPopupLogo"> <img src="icons/IconSponsorBlocker256px.png" alt="SponsorBlock" width="40" height="40" id="sponsorBlockPopupLogo"> <p class="u-mZ">SponsorBlock</p> diff --git a/src/popup.ts b/src/popup.ts index cbf92917..e06db4d1 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -111,7 +111,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { "sbDonate", "sponsorTimesDonateContainer", "sbConsiderDonateLink", - "sbCloseDonate" + "sbCloseDonate", + "sbBetaServerWarning" ].forEach(id => PageElements[id] = document.getElementById(id)); // Hide donate button if wanted (Safari, or user choice) @@ -120,6 +121,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { } PageElements.sbDonate.addEventListener("click", () => Config.config.donateClicked = Config.config.donateClicked + 1); + if (Config.config.testingServer) { + PageElements.sbBetaServerWarning.classList.remove("hidden"); + PageElements.sbBetaServerWarning.addEventListener("click", function () { + openOptionsAt("advanced"); + }); + } + //setup click listeners PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage); PageElements.whitelistToggle.addEventListener("change", function () { |