diff options
author | Ajay Ramachandran <[email protected]> | 2019-07-28 23:53:39 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2019-07-28 23:53:39 -0400 |
commit | 6358ba2e118ea606b5a8cf66050db96a7dc4250d (patch) | |
tree | 6f43ea5497f05cc1b643099766c8834d101277fc | |
parent | acb3c6762900911cdeb12d478f34350f51b7ee77 (diff) | |
parent | 2415784eee4a868909fe9ea7e5661b61e7f353ac (diff) | |
download | SponsorBlock-6358ba2e118ea606b5a8cf66050db96a7dc4250d.tar.gz SponsorBlock-6358ba2e118ea606b5a8cf66050db96a7dc4250d.zip |
Merge pull request #44 from ajayyy/experimentalv1.0.14
Added discord link to popup
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | popup.css | 10 | ||||
-rw-r--r-- | popup.html | 14 | ||||
-rw-r--r-- | popup.js | 31 |
4 files changed, 56 insertions, 1 deletions
diff --git a/manifest.json b/manifest.json index e1c82d75..c46fc801 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "SponsorBlock - YouTube Sponsorship Blocker", "short_name": "SponsorBlock", - "version": "1.0.13", + "version": "1.0.14", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "content_scripts": [ { @@ -25,6 +25,16 @@ body { filter: brightness(80%); } +#discordButtonContainer { + font-size: 12px; +} + +.smallLink { + font-size: 10px; + text-decoration: underline; + cursor: pointer; +} + .greenButton { background-color:#ec1c1c; -moz-border-radius:28px; @@ -100,6 +100,20 @@ </div> + <div id="discordButtonContainer" style="display: none"> + <br/> + + <a href="https://discord.gg/QnmVMpU" target="_blank"><img src="https://www.logolynx.com/images/logolynx/1b/1bcc0f0aefe71b2c8ce66ffe8645d365.png" height="32px"/></a> + + <br/> + + Come join the official discord server to give suggestions and feedback! + + <br/> + + <span id="hideDiscordButton" class="smallLink">Hide this</span> + </div> + <div id="optionsButtonContainer"> <br/> <br/> @@ -20,6 +20,9 @@ SB.sponsorTimesContributionsDisplayEndWord = document.getElementById("sponsorTim SB.sponsorTimesViewsContainer = document.getElementById("sponsorTimesViewsDisplayContainer"); SB.sponsorTimesViewsDisplay = document.getElementById("sponsorTimesViewsDisplayDisplay"); SB.sponsorTimesViewsDisplayEndWord = document.getElementById("sponsorTimesViewsDisplayDisplayEndWord"); +// discordButtons +SB.discordButtonContainer = document.getElementById("discordButtonContainer"); +SB.hideDiscordButton = document.getElementById("hideDiscordButton"); //setup click listeners SB.sponsorStart.addEventListener("click", sendSponsorStartMessage); @@ -32,6 +35,8 @@ SB.disableSponsorViewTracking.addEventListener("click", disableSponsorViewTracki SB.enableSponsorViewTracking.addEventListener("click", enableSponsorViewTracking); SB.optionsButton.addEventListener("click", openOptions); SB.reportAnIssue.addEventListener("click", reportAnIssue); +SB.hideDiscordButton.addEventListener("click", hideDiscordButton); + //if true, the button now selects the end time var startTimeChosen = false; @@ -45,6 +50,26 @@ var currentVideoID = null; //is this a YouTube tab? var isYouTubeTab = false; +//see if discord link can be shown +chrome.storage.sync.get(["hideDiscordLink"], function(result) { + let hideDiscordLink = result.hideDiscordLink; + if (hideDiscordLink == undefined || !hideDiscordLink) { + chrome.storage.sync.get(["hideDiscordLaunches"], function(result) { + let hideDiscordLaunches = result.hideDiscordLaunches; + //only if less than 5 launches + if (hideDiscordLaunches == undefined || hideDiscordLaunches < 10) { + SB.discordButtonContainer.style.display = null; + + if (hideDiscordLaunches == undefined) { + hideDiscordButton = 1; + } + + chrome.storage.sync.set({"hideDiscordLaunches": hideDiscordButton + 1}); + } + }); + } +}); + //if the don't show notice again variable is true, an option to // disable should be available chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) { @@ -543,6 +568,12 @@ function vote(type, UUID) { }); } +function hideDiscordButton() { + chrome.storage.sync.set({"hideDiscordLink": false}); + + SB.discordButtonContainer.style.display = "none"; +} + //converts time in seconds to minutes:seconds function getFormattedTime(seconds) { let minutes = Math.floor(seconds / 60); |