mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-11 09:30:46 +01:00
Merge pull request #44 from ajayyy/experimental
Added discord link to popup
This commit is contained in:
commit
6358ba2e11
4 changed files with 56 additions and 1 deletions
|
@ -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": [
|
||||
{
|
||||
|
|
10
popup.css
10
popup.css
|
@ -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;
|
||||
|
|
14
popup.html
14
popup.html
|
@ -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/>
|
||||
|
|
31
popup.js
31
popup.js
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue