mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +03:00
Add option to disable $ link
This commit is contained in:
@@ -724,5 +724,11 @@
|
|||||||
"voteRejectedWarning": {
|
"voteRejectedWarning": {
|
||||||
"message": "Vote rejected due to a warning. Click to open a chat to resolve it, or come back later when you have time.",
|
"message": "Vote rejected due to a warning. Click to open a chat to resolve it, or come back later when you have time.",
|
||||||
"description": "This is an integrated chat panel that will appearing allowing them to talk to the Discord/Matrix chat without leaving their browser."
|
"description": "This is an integrated chat panel that will appearing allowing them to talk to the Discord/Matrix chat without leaving their browser."
|
||||||
|
},
|
||||||
|
"Donate": {
|
||||||
|
"message": "Donate"
|
||||||
|
},
|
||||||
|
"hideDonationLink": {
|
||||||
|
"message": "Hide Donation Link"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<link href="styles.css" rel="stylesheet"/>
|
<link href="styles.css" rel="stylesheet"/>
|
||||||
|
|
||||||
|
<script src="../js/vendor.js"></script>
|
||||||
|
<script src="../js/help.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -16,7 +19,11 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<p class="createdBy">Created By <a href="https://ajay.app">Ajay Ramachandran</a> <img src="https://ajay.app/newprofilepic.jpg" height="30" class="profilepiccircle"/></p>
|
<p class="createdBy">
|
||||||
|
<img src="https://ajay.app/newprofilepic.jpg" height="30" class="profilepiccircle"/>
|
||||||
|
Created By <a href="https://ajay.app">Ajay Ramachandran</a>
|
||||||
|
<a href="https://sponsor.ajay.app/donate" target="_blank" rel="noopener" id="sbDonate">(Donate)</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Thanks for installing SponsorBlock. By using this extension, you agree to the <a href="https://gist.github.com/ajayyy/aa9f8ded2b573d4f73a3ffa0ef74f796">Privacy Policy</a> and <a href="https://gist.github.com/ajayyy/9e8100f069348e0bc062641f34d6af12">Terms of Use</a>.
|
Thanks for installing SponsorBlock. By using this extension, you agree to the <a href="https://gist.github.com/ajayyy/aa9f8ded2b573d4f73a3ffa0ef74f796">Privacy Policy</a> and <a href="https://gist.github.com/ajayyy/9e8100f069348e0bc062641f34d6af12">Terms of Use</a>.
|
||||||
|
|||||||
@@ -184,3 +184,7 @@ h1,h2,h3,h4,h5,h6 {
|
|||||||
svg {
|
svg {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sbDonate {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
@@ -365,3 +365,7 @@ svg {
|
|||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sbDonate {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
@@ -19,7 +19,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<p class="createdBy titleBar">__MSG_createdBy__ <a href="https://ajay.app">Ajay Ramachandran</a> <img src="../icons/newprofilepic.jpg" height="30" class="profilepiccircle"/></p>
|
<p class="createdBy titleBar">
|
||||||
|
<img src="../icons/newprofilepic.jpg" height="30" class="profilepiccircle"/>
|
||||||
|
__MSG_createdBy__
|
||||||
|
<a href="https://ajay.app">Ajay Ramachandran</a>
|
||||||
|
<a href="https://sponsor.ajay.app/donate" target="_blank" rel="noopener" id="sbDonate">(__MSG_Donate__)</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<h1>__MSG_Options__</h1>
|
<h1>__MSG_Options__</h1>
|
||||||
|
|
||||||
@@ -452,6 +457,24 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<div option-type="toggle" toggle-type="reverse" sync-option="showDonationLink" no-safari="true">
|
||||||
|
<label class="switch-container">
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" checked>
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<div class="switch-label">
|
||||||
|
__MSG_hideDonationLink__
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<div option-type="private-text-change" sync-option="userID" confirm-message="userIDChangeWarning">
|
<div option-type="private-text-change" sync-option="userID" confirm-message="userIDChangeWarning">
|
||||||
<div class="option-button trigger-button">
|
<div class="option-button trigger-button">
|
||||||
__MSG_changeUserID__
|
__MSG_changeUserID__
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ interface SBConfig {
|
|||||||
refetchWhenNotFound: boolean,
|
refetchWhenNotFound: boolean,
|
||||||
ytInfoPermissionGranted: boolean,
|
ytInfoPermissionGranted: boolean,
|
||||||
allowExpirements: boolean,
|
allowExpirements: boolean,
|
||||||
|
showDonationLink: boolean,
|
||||||
autoHideInfoButton: boolean,
|
autoHideInfoButton: boolean,
|
||||||
autoSkipOnMusicVideos: boolean,
|
autoSkipOnMusicVideos: boolean,
|
||||||
|
|
||||||
@@ -181,6 +182,7 @@ const Config: SBObject = {
|
|||||||
refetchWhenNotFound: true,
|
refetchWhenNotFound: true,
|
||||||
ytInfoPermissionGranted: false,
|
ytInfoPermissionGranted: false,
|
||||||
allowExpirements: true,
|
allowExpirements: true,
|
||||||
|
showDonationLink: true,
|
||||||
autoHideInfoButton: true,
|
autoHideInfoButton: true,
|
||||||
autoSkipOnMusicVideos: false,
|
autoSkipOnMusicVideos: false,
|
||||||
|
|
||||||
|
|||||||
9
src/help.ts
Normal file
9
src/help.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', init);
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
if (!showDonationLink()) {
|
||||||
|
document.getElementById("sbDonate").style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ window.SB = Config;
|
|||||||
|
|
||||||
import Utils from "./utils";
|
import Utils from "./utils";
|
||||||
import CategoryChooser from "./render/CategoryChooser";
|
import CategoryChooser from "./render/CategoryChooser";
|
||||||
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', init);
|
window.addEventListener('DOMContentLoaded', init);
|
||||||
@@ -28,6 +29,10 @@ async function init() {
|
|||||||
|
|
||||||
await utils.wait(() => Config.config !== null);
|
await utils.wait(() => Config.config !== null);
|
||||||
|
|
||||||
|
if (!showDonationLink()) {
|
||||||
|
document.getElementById("sbDonate").style.visibility = "hidden";
|
||||||
|
}
|
||||||
|
|
||||||
// Set all of the toggle options to the correct option
|
// Set all of the toggle options to the correct option
|
||||||
const optionsContainer = document.getElementById("options");
|
const optionsContainer = document.getElementById("options");
|
||||||
const optionsElements = optionsContainer.querySelectorAll("*");
|
const optionsElements = optionsContainer.querySelectorAll("*");
|
||||||
|
|||||||
132
src/popup.ts
132
src/popup.ts
@@ -3,6 +3,7 @@ import Config from "./config";
|
|||||||
import Utils from "./utils";
|
import Utils from "./utils";
|
||||||
import { SponsorTime, SponsorHideType } from "./types";
|
import { SponsorTime, SponsorHideType } from "./types";
|
||||||
import { Message, MessageResponse } from "./messageTypes";
|
import { Message, MessageResponse } from "./messageTypes";
|
||||||
|
import { showDonationLink } from "./utils/configUtils";
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
interface MessageListener {
|
interface MessageListener {
|
||||||
@@ -12,7 +13,7 @@ interface MessageListener {
|
|||||||
class MessageHandler {
|
class MessageHandler {
|
||||||
messageListener: MessageListener;
|
messageListener: MessageListener;
|
||||||
|
|
||||||
constructor (messageListener?: MessageListener) {
|
constructor(messageListener?: MessageListener) {
|
||||||
this.messageListener = messageListener;
|
this.messageListener = messageListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,14 +108,14 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
"sbDonate"
|
"sbDonate"
|
||||||
].forEach(id => PageElements[id] = document.getElementById(id));
|
].forEach(id => PageElements[id] = document.getElementById(id));
|
||||||
|
|
||||||
// Hide donate button on safari
|
// Hide donate button if wanted (Safari, or user choice)
|
||||||
if (navigator.vendor === "Apple Computer, Inc.") {
|
if (!showDonationLink()) {
|
||||||
PageElements.sbDonate.style.display = "none";
|
PageElements.sbDonate.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup click listeners
|
//setup click listeners
|
||||||
PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage);
|
PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage);
|
||||||
PageElements.whitelistToggle.addEventListener("change", function() {
|
PageElements.whitelistToggle.addEventListener("change", function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
whitelistChannel();
|
whitelistChannel();
|
||||||
} else {
|
} else {
|
||||||
@@ -122,7 +123,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
PageElements.whitelistForceCheck.addEventListener("click", openOptions);
|
PageElements.whitelistForceCheck.addEventListener("click", openOptions);
|
||||||
PageElements.toggleSwitch.addEventListener("change", function() {
|
PageElements.toggleSwitch.addEventListener("change", function () {
|
||||||
toggleSkipping(!this.checked);
|
toggleSkipping(!this.checked);
|
||||||
});
|
});
|
||||||
PageElements.submitTimes.addEventListener("click", submitTimes);
|
PageElements.submitTimes.addEventListener("click", submitTimes);
|
||||||
@@ -174,7 +175,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
if (userID != undefined) {
|
if (userID != undefined) {
|
||||||
//there are probably some views on these submissions then
|
//there are probably some views on these submissions then
|
||||||
//get the amount of views from the sponsors submitted
|
//get the amount of views from the sponsors submitted
|
||||||
utils.sendRequestToServer("GET", "/api/getViewsForUser?userID=" + userID, function(response) {
|
utils.sendRequestToServer("GET", "/api/getViewsForUser?userID=" + userID, function (response) {
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
const viewCount = JSON.parse(response.responseText).viewCount;
|
const viewCount = JSON.parse(response.responseText).viewCount;
|
||||||
if (viewCount != 0) {
|
if (viewCount != 0) {
|
||||||
@@ -191,7 +192,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//get this time in minutes
|
//get this time in minutes
|
||||||
utils.sendRequestToServer("GET", "/api/getSavedTimeForUser?userID=" + userID, function(response) {
|
utils.sendRequestToServer("GET", "/api/getSavedTimeForUser?userID=" + userID, function (response) {
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
const minutesSaved = JSON.parse(response.responseText).timeSaved;
|
const minutesSaved = JSON.parse(response.responseText).timeSaved;
|
||||||
if (minutesSaved != 0) {
|
if (minutesSaved != 0) {
|
||||||
@@ -237,7 +238,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
getSegmentsFromContentScript(false);
|
getSegmentsFromContentScript(false);
|
||||||
|
|
||||||
function onTabs(tabs, updating: boolean): void {
|
function onTabs(tabs, updating: boolean): void {
|
||||||
messageHandler.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) {
|
messageHandler.sendMessage(tabs[0].id, { message: 'getVideoID' }, function (result) {
|
||||||
if (result !== undefined && result.videoID) {
|
if (result !== undefined && result.videoID) {
|
||||||
currentVideoID = result.videoID;
|
currentVideoID = result.videoID;
|
||||||
creatingSegment = result.creatingSegment;
|
creatingSegment = result.creatingSegment;
|
||||||
@@ -262,7 +263,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
|
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'isInfoFound', updating},
|
{ message: 'isInfoFound', updating },
|
||||||
infoFound
|
infoFound
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -274,8 +275,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, (tabs) => onTabs(tabs, updating));
|
}, (tabs) => onTabs(tabs, updating));
|
||||||
}
|
}
|
||||||
|
|
||||||
function infoFound(request: {found: boolean, sponsorTimes: SponsorTime[]}) {
|
function infoFound(request: { found: boolean, sponsorTimes: SponsorTime[] }) {
|
||||||
if(chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
//This page doesn't have the injected content script, or at least not yet
|
//This page doesn't have the injected content script, or at least not yet
|
||||||
displayNoVideo();
|
displayNoVideo();
|
||||||
return;
|
return;
|
||||||
@@ -306,8 +307,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'isChannelWhitelisted'},
|
{ message: 'isChannelWhitelisted' },
|
||||||
function(response) {
|
function (response) {
|
||||||
if (response.value) {
|
if (response.value) {
|
||||||
PageElements.whitelistChannel.style.display = "none";
|
PageElements.whitelistChannel.style.display = "none";
|
||||||
PageElements.unwhitelistChannel.style.display = "unset";
|
PageElements.unwhitelistChannel.style.display = "unset";
|
||||||
@@ -315,7 +316,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
document.querySelectorAll('.SBWhitelistIcon')[0].classList.add("rotated");
|
document.querySelectorAll('.SBWhitelistIcon')[0].classList.add("rotated");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +328,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, (tabs) => {
|
}, (tabs) => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{from: 'popup', message: 'sponsorStart'},
|
{ from: 'popup', message: 'sponsorStart' },
|
||||||
async (response) => {
|
async (response) => {
|
||||||
startSponsorCallback(response);
|
startSponsorCallback(response);
|
||||||
|
|
||||||
@@ -351,7 +352,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function startSponsorCallback(response: {creatingSegment: boolean}) {
|
function startSponsorCallback(response: { creatingSegment: boolean }) {
|
||||||
creatingSegment = response.creatingSegment;
|
creatingSegment = response.creatingSegment;
|
||||||
|
|
||||||
// Only update the segments after a segment was created
|
// Only update the segments after a segment was created
|
||||||
@@ -364,12 +365,12 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//display the video times from the array at the top, in a different section
|
//display the video times from the array at the top, in a different section
|
||||||
function displayDownloadedSponsorTimes(request: {found: boolean, sponsorTimes: SponsorTime[]}) {
|
function displayDownloadedSponsorTimes(request: { found: boolean, sponsorTimes: SponsorTime[] }) {
|
||||||
if (request.sponsorTimes != undefined) {
|
if (request.sponsorTimes != undefined) {
|
||||||
// Sort list by start time
|
// Sort list by start time
|
||||||
const segmentTimes = request.sponsorTimes
|
const segmentTimes = request.sponsorTimes
|
||||||
.sort((a, b) => a.segment[1] - b.segment[1])
|
.sort((a, b) => a.segment[1] - b.segment[1])
|
||||||
.sort((a, b) => a.segment[0] - b.segment[0]);
|
.sort((a, b) => a.segment[0] - b.segment[0]);
|
||||||
|
|
||||||
//add them as buttons to the issue reporting container
|
//add them as buttons to the issue reporting container
|
||||||
const container = document.getElementById("issueReporterTimeButtons");
|
const container = document.getElementById("issueReporterTimeButtons");
|
||||||
@@ -446,7 +447,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
voteButtonsContainer.appendChild(uuidButton);
|
voteButtonsContainer.appendChild(uuidButton);
|
||||||
|
|
||||||
//add click listener to open up vote panel
|
//add click listener to open up vote panel
|
||||||
sponsorTimeButton.addEventListener("click", function() {
|
sponsorTimeButton.addEventListener("click", function () {
|
||||||
voteButtonsContainer.classList.toggle("voteButtonsContainer--hide");
|
voteButtonsContainer.classList.toggle("voteButtonsContainer--hide");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -478,7 +479,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'submitTimes'},
|
{ message: 'submitTimes' },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -499,11 +500,11 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
|
|
||||||
//make the options div visible
|
//make the options div visible
|
||||||
function openOptions() {
|
function openOptions() {
|
||||||
chrome.runtime.sendMessage({"message": "openConfig"});
|
chrome.runtime.sendMessage({ "message": "openConfig" });
|
||||||
}
|
}
|
||||||
|
|
||||||
function openHelp() {
|
function openHelp() {
|
||||||
chrome.runtime.sendMessage({"message": "openHelp"});
|
chrome.runtime.sendMessage({ "message": "openHelp" });
|
||||||
}
|
}
|
||||||
|
|
||||||
//make the options username setting option visible
|
//make the options username setting option visible
|
||||||
@@ -597,8 +598,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'getChannelID'},
|
{ message: 'getChannelID' },
|
||||||
function(response) {
|
function (response) {
|
||||||
if (!response.channelID) {
|
if (!response.channelID) {
|
||||||
alert(chrome.i18n.getMessage("channelDataNotFound") + " https://github.com/ajayyy/SponsorBlock/issues/753");
|
alert(chrome.i18n.getMessage("channelDataNotFound") + " https://github.com/ajayyy/SponsorBlock/issues/753");
|
||||||
return;
|
return;
|
||||||
@@ -630,10 +631,10 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id, {
|
tabs[0].id, {
|
||||||
message: 'whitelistChange',
|
message: 'whitelistChange',
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -648,38 +649,38 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'getChannelID'},
|
{ message: 'getChannelID' },
|
||||||
function(response) {
|
function (response) {
|
||||||
//get whitelisted channels
|
//get whitelisted channels
|
||||||
let whitelistedChannels = Config.config.whitelistedChannels;
|
let whitelistedChannels = Config.config.whitelistedChannels;
|
||||||
if (whitelistedChannels == undefined) {
|
if (whitelistedChannels == undefined) {
|
||||||
whitelistedChannels = [];
|
whitelistedChannels = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove this channel
|
//remove this channel
|
||||||
const index = whitelistedChannels.indexOf(response.channelID);
|
const index = whitelistedChannels.indexOf(response.channelID);
|
||||||
whitelistedChannels.splice(index, 1);
|
whitelistedChannels.splice(index, 1);
|
||||||
|
|
||||||
//change button
|
//change button
|
||||||
PageElements.whitelistChannel.style.display = "unset";
|
PageElements.whitelistChannel.style.display = "unset";
|
||||||
PageElements.unwhitelistChannel.style.display = "none";
|
PageElements.unwhitelistChannel.style.display = "none";
|
||||||
document.querySelectorAll('.SBWhitelistIcon')[0].classList.remove("rotated");
|
document.querySelectorAll('.SBWhitelistIcon')[0].classList.remove("rotated");
|
||||||
|
|
||||||
//save this
|
//save this
|
||||||
Config.config.whitelistedChannels = whitelistedChannels;
|
Config.config.whitelistedChannels = whitelistedChannels;
|
||||||
|
|
||||||
//send a message to the client
|
//send a message to the client
|
||||||
messageHandler.query({
|
messageHandler.query({
|
||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id, {
|
tabs[0].id, {
|
||||||
message: 'whitelistChange',
|
message: 'whitelistChange',
|
||||||
value: false
|
value: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -694,12 +695,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
}, tabs => {
|
}, tabs => {
|
||||||
messageHandler.sendMessage(
|
messageHandler.sendMessage(
|
||||||
tabs[0].id,
|
tabs[0].id,
|
||||||
{message: 'refreshSegments'},
|
{ message: 'refreshSegments' },
|
||||||
(response) => {
|
(response) => {
|
||||||
infoFound(response);
|
infoFound(response);
|
||||||
stopAnimation();
|
stopAnimation();
|
||||||
}
|
}
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,7 +709,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
* Should skipping be disabled (visuals stay)
|
* Should skipping be disabled (visuals stay)
|
||||||
*/
|
*/
|
||||||
function toggleSkipping(disabled) {
|
function toggleSkipping(disabled) {
|
||||||
Config.config.disableSkipping = disabled;
|
Config.config.disableSkipping = disabled;
|
||||||
|
|
||||||
let hiddenButton = PageElements.disableSkipping;
|
let hiddenButton = PageElements.disableSkipping;
|
||||||
let shownButton = PageElements.enableSkipping;
|
let shownButton = PageElements.enableSkipping;
|
||||||
@@ -728,13 +730,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
* @param {float} seconds
|
* @param {float} seconds
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function getFormattedHours(minutes) {
|
function getFormattedHours(minutes) {
|
||||||
minutes = Math.round(minutes * 10) / 10
|
minutes = Math.round(minutes * 10) / 10
|
||||||
const hours = Math.floor(minutes / 60);
|
const hours = Math.floor(minutes / 60);
|
||||||
return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1);
|
return (hours > 0 ? hours + "h " : "") + (minutes % 60).toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//end of function
|
//end of function
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chrome.tabs != undefined) {
|
if (chrome.tabs != undefined) {
|
||||||
|
|||||||
5
src/utils/configUtils.ts
Normal file
5
src/utils/configUtils.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import Config from "../config";
|
||||||
|
|
||||||
|
export function showDonationLink(): boolean {
|
||||||
|
return navigator.vendor !== "Apple Computer, Inc." && Config.config.showDonationLink;
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ module.exports = env => ({
|
|||||||
background: path.join(__dirname, srcDir + 'background.ts'),
|
background: path.join(__dirname, srcDir + 'background.ts'),
|
||||||
content: path.join(__dirname, srcDir + 'content.ts'),
|
content: path.join(__dirname, srcDir + 'content.ts'),
|
||||||
options: path.join(__dirname, srcDir + 'options.ts'),
|
options: path.join(__dirname, srcDir + 'options.ts'),
|
||||||
|
help: path.join(__dirname, srcDir + 'help.ts'),
|
||||||
permissions: path.join(__dirname, srcDir + 'permissions.ts')
|
permissions: path.join(__dirname, srcDir + 'permissions.ts')
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
|||||||
Reference in New Issue
Block a user