mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-15 16:07:06 +03:00
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -68,11 +68,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
args: builds/ChromeExtension.zip
|
args: builds/ChromeExtension.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
uses: Shopify/upload-to-release@master
|
uses: Shopify/upload-to-release@master
|
||||||
with:
|
with:
|
||||||
args: builds/FirefoxExtension.zip
|
args: builds/FirefoxExtension.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "__MSG_Name__",
|
"short_name": "__MSG_Name__",
|
||||||
"version": "1.2.21",
|
"version": "1.2.22",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
|
|||||||
@@ -425,5 +425,20 @@
|
|||||||
},
|
},
|
||||||
"mobileUpdateInfo": {
|
"mobileUpdateInfo": {
|
||||||
"message": "m.youtube.com is now supported"
|
"message": "m.youtube.com is now supported"
|
||||||
|
},
|
||||||
|
"exportOptions": {
|
||||||
|
"message": "Import/Export All Options"
|
||||||
|
},
|
||||||
|
"whatExportOptions": {
|
||||||
|
"message": "This is your entire configuration in JSON. This includes your userID, so be sure to share this wisely."
|
||||||
|
},
|
||||||
|
"setOptions": {
|
||||||
|
"message": "Set Options"
|
||||||
|
},
|
||||||
|
"exportOptionsWarning": {
|
||||||
|
"message": "Warning: Changing the options is permanent and can break your install. Are you sure you would like to do this? Make sure to backup your old one just in case."
|
||||||
|
},
|
||||||
|
"incorrectlyFormattedOptions": {
|
||||||
|
"message": "This JSON is not formatted correctly. Your options have not been changed."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,6 +305,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div option-type="private-text-change" sync-option="*" confirm-message="exportOptionsWarning">
|
||||||
|
<div class="option-button trigger-button">
|
||||||
|
__MSG_exportOptions__
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div class="small-description">__MSG_whatExportOptions__</div>
|
||||||
|
|
||||||
|
<div class="option-hidden-section hidden">
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<input class="option-text-box" type="text">
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div class="option-button text-change-set">
|
||||||
|
__MSG_setOptions__
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,12 @@ var lastPreviewBarUpdate;
|
|||||||
var durationListenerSetUp = false;
|
var durationListenerSetUp = false;
|
||||||
|
|
||||||
// Is the video currently being switched
|
// Is the video currently being switched
|
||||||
var switchingVideos = false;
|
var switchingVideos = null;
|
||||||
|
|
||||||
|
// Used by the play and playing listeners to make sure two aren't
|
||||||
|
// called at the same time
|
||||||
|
var lastCheckTime = 0;
|
||||||
|
var lastCheckVideoTime = -1;
|
||||||
|
|
||||||
//the channel this video is about
|
//the channel this video is about
|
||||||
var channelURL;
|
var channelURL;
|
||||||
@@ -238,6 +243,9 @@ document.onkeydown = function(e: KeyboardEvent){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetValues() {
|
function resetValues() {
|
||||||
|
lastCheckTime = 0;
|
||||||
|
lastCheckVideoTime = -1;
|
||||||
|
|
||||||
//reset sponsor times
|
//reset sponsor times
|
||||||
sponsorTimes = null;
|
sponsorTimes = null;
|
||||||
UUIDs = [];
|
UUIDs = [];
|
||||||
@@ -250,6 +258,8 @@ function resetValues() {
|
|||||||
|
|
||||||
//reset sponsor data found check
|
//reset sponsor data found check
|
||||||
sponsorDataFound = false;
|
sponsorDataFound = false;
|
||||||
|
|
||||||
|
switchingVideos = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function videoIDChange(id) {
|
async function videoIDChange(id) {
|
||||||
@@ -264,8 +274,6 @@ async function videoIDChange(id) {
|
|||||||
//id is not valid
|
//id is not valid
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
|
||||||
switchingVideos = true;
|
|
||||||
|
|
||||||
// Wait for options to be ready
|
// Wait for options to be ready
|
||||||
await utils.wait(() => Config.config !== null, 5000, 1);
|
await utils.wait(() => Config.config !== null, 5000, 1);
|
||||||
|
|
||||||
@@ -501,9 +509,24 @@ function sponsorsLookup(id: string, channelIDPromise?) {
|
|||||||
|
|
||||||
video.addEventListener('play', () => {
|
video.addEventListener('play', () => {
|
||||||
switchingVideos = false;
|
switchingVideos = false;
|
||||||
startSponsorSchedule();
|
|
||||||
|
// Make sure it doesn't get double called with the playing event
|
||||||
|
if (lastCheckVideoTime !== video.currentTime && Date.now() - lastCheckTime > 2000) {
|
||||||
|
lastCheckTime = Date.now();
|
||||||
|
lastCheckVideoTime = video.currentTime;
|
||||||
|
|
||||||
|
startSponsorSchedule();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
video.addEventListener('playing', () => {
|
||||||
|
// Make sure it doesn't get double called with the play event
|
||||||
|
if (lastCheckVideoTime !== video.currentTime && Date.now() - lastCheckTime > 2000) {
|
||||||
|
lastCheckTime = Date.now();
|
||||||
|
lastCheckVideoTime = video.currentTime;
|
||||||
|
|
||||||
|
startSponsorSchedule();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
video.addEventListener('playing', () => startSponsorSchedule());
|
|
||||||
video.addEventListener('seeked', () => {
|
video.addEventListener('seeked', () => {
|
||||||
if (!video.paused) startSponsorSchedule();
|
if (!video.paused) startSponsorSchedule();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ async function init() {
|
|||||||
|
|
||||||
textChangeInput.value = Config.config[textChangeOption];
|
textChangeInput.value = Config.config[textChangeOption];
|
||||||
|
|
||||||
textChangeSetButton.addEventListener("click", () => {
|
textChangeSetButton.addEventListener("click", async () => {
|
||||||
// See if anything extra must be done
|
// See if anything extra must be done
|
||||||
switch (textChangeOption) {
|
switch (textChangeOption) {
|
||||||
case "serverAddress":
|
case "serverAddress":
|
||||||
@@ -86,6 +86,18 @@ async function init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Permission needed on Firefox
|
||||||
|
if (utils.isFirefox()) {
|
||||||
|
let permissionSuccess = await new Promise((resolve, reject) => {
|
||||||
|
chrome.permissions.request({
|
||||||
|
origins: [textChangeInput.value + "/"],
|
||||||
|
permissions: []
|
||||||
|
}, resolve);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!permissionSuccess) return;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,6 +273,8 @@ function invidiousOnClick(checkbox: HTMLInputElement, option: string) {
|
|||||||
if (!granted) {
|
if (!granted) {
|
||||||
Config.config[option] = false;
|
Config.config[option] = false;
|
||||||
checkbox.checked = false;
|
checkbox.checked = false;
|
||||||
|
} else {
|
||||||
|
checkbox.checked = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -347,15 +361,50 @@ function activatePrivateTextChange(element: HTMLElement) {
|
|||||||
element.querySelector(".option-hidden-section").classList.remove("hidden");
|
element.querySelector(".option-hidden-section").classList.remove("hidden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textBox.value = Config.config[option];
|
let result = Config.config[option];
|
||||||
|
|
||||||
|
// See if anything extra must be done
|
||||||
|
switch (option) {
|
||||||
|
case "*":
|
||||||
|
result = JSON.stringify(Config.localConfig);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
textBox.value = result;
|
||||||
|
|
||||||
let setButton = element.querySelector(".text-change-set");
|
let setButton = element.querySelector(".text-change-set");
|
||||||
setButton.addEventListener("click", () => {
|
setButton.addEventListener("click", () => {
|
||||||
let confirmMessage = element.getAttribute("confirm-message");
|
let confirmMessage = element.getAttribute("confirm-message");
|
||||||
|
|
||||||
if (confirmMessage === null || confirm(chrome.i18n.getMessage(confirmMessage))) {
|
if (confirmMessage === null || confirm(chrome.i18n.getMessage(confirmMessage))) {
|
||||||
Config.config[option] = textBox.value;
|
|
||||||
|
// See if anything extra must be done
|
||||||
|
switch (option) {
|
||||||
|
case "*":
|
||||||
|
try {
|
||||||
|
let newConfig = JSON.parse(textBox.value);
|
||||||
|
for (const key in newConfig) {
|
||||||
|
Config.config[key] = newConfig[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
if (newConfig.supportInvidious) {
|
||||||
|
let checkbox = <HTMLInputElement> document.querySelector("#support-invidious > label > label > input");
|
||||||
|
|
||||||
|
checkbox.checked = true;
|
||||||
|
invidiousOnClick(checkbox, "supportInvidious");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
alert(chrome.i18n.getMessage("incorrectlyFormattedOptions"));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Config.config[option] = textBox.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -383,4 +432,4 @@ function validateServerAddress(input: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user