diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index b9fe1f5a..3fccef75 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -166,7 +166,7 @@
"message": "Click the button below when the sponsorship starts and ends to record and\nsubmit it to the database."
},
"popupHint": {
- "message": "Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit."
+ "message": "Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit. (This can be changed in the options)"
},
"lastTimes": {
"message": "Latest Sponsor Message Times Chosen"
@@ -242,5 +242,25 @@
"sourceCode": {
"message": "Source Code",
"description": "Used on Firefox Store Page"
+ },
+ "noticeUpdate": {
+ "message": "The notice has been upgraded!",
+ "description": "The first line of the message displayed after the notice was upgraded."
+ },
+ "noticeUpdate2": {
+ "message": "If you still don't like it, hit the never show button.",
+ "description": "The second line of the message displayed after the notice was upgraded."
+ },
+ "setStartSponsorShortcut": {
+ "message": "Set key for start sponsor keybind"
+ },
+ "setSubmitKeybind": {
+ "message": "Set key for submission keybind"
+ },
+ "keybindDescription": {
+ "message": "Select a key by typing it"
+ },
+ "keybindDescriptionComplete": {
+ "message": "The keybind has been set to: "
}
}
diff --git a/background.js b/background.js
index e397bb16..1f8aad75 100644
--- a/background.js
+++ b/background.js
@@ -42,28 +42,13 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
//add help page on install
chrome.runtime.onInstalled.addListener(function (object) {
- // TODO (shownInstallPage): remove shownInstallPage logic after sufficient amount of time,
- // so that people have time to upgrade and move to shownInstallPage-free code.
chrome.storage.sync.get(["userID", "shownInstallPage"], function(result) {
const userID = result.userID;
- // TODO (shownInstallPage): delete row below
- const shownInstallPage = result.shownInstallPage;
// If there is no userID, then it is the first install.
if (!userID){
- // Show install page, if there is no user id
- // and there is no shownInstallPage.
- // TODO (shownInstallPage): remove this if statement, but leave contents
- if (!shownInstallPage){
- //open up the install page
- chrome.tabs.create({url: chrome.extension.getURL("/help/"+chrome.i18n.getMessage("helpPage"))});
- }
-
- // TODO (shownInstallPage): delete if statement and contents
- // If shownInstallPage is set, remove it.
- if (!!shownInstallPage){
- chrome.storage.sync.remove("shownInstallPage");
- }
+ //open up the install page
+ chrome.tabs.create({url: chrome.extension.getURL("/help/"+chrome.i18n.getMessage("helpPage"))});
//generate a userID
const newUserID = generateUserID();
diff --git a/content.js b/content.js
index fb0b13b0..f0db497b 100644
--- a/content.js
+++ b/content.js
@@ -80,13 +80,22 @@ chrome.storage.sync.get(["trackViewCount"], function(result) {
//if the notice should not be shown
//happens when the user click's the "Don't show notice again" button
+//option renamed when new notice was made
var dontShowNotice = false;
-chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
+chrome.storage.sync.get(["dontShowNotice"], function(result) {
let dontShowNoticeAgain = result.dontShowNoticeAgain;
if (dontShowNoticeAgain != undefined) {
dontShowNotice = dontShowNoticeAgain;
}
});
+//load the legacy option to hide the notice
+var dontShowNoticeOld = false;
+chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
+ let dontShowNoticeAgain = result.dontShowNoticeAgain;
+ if (dontShowNoticeAgain != undefined) {
+ dontShowNoticeOld = dontShowNoticeAgain;
+ }
+});
//get messages from the background script and the popup
chrome.runtime.onMessage.addListener(messageListener);
@@ -195,18 +204,32 @@ function messageListener(request, sender, sendResponse) {
}
//check for hotkey pressed
-document.onkeydown = function(e){
+document.onkeydown = async function(e){
e = e || window.event;
var key = e.key;
let video = document.getElementById("movie_player");
+ let startSponsorKey = await new Promise((resolve, reject) => {
+ chrome.storage.sync.get(["startSponsorKeybind"], (result) => resolve(result));
+ });
+ let submitKey = await new Promise((resolve, reject) => {
+ chrome.storage.sync.get(["submitKeybind"], (result) => resolve(result));
+ });
+
+ if (startSponsorKey.startSponsorKeybind === undefined) {
+ startSponsorKey.startSponsorKeybind = ";"
+ }
+ if (submitKey.submitKeybind === undefined) {
+ submitKey.submitKeybind = "'"
+ }
+
//is the video in focus, otherwise they could be typing a comment
if (document.activeElement === video) {
- if(key == ';'){
+ if(key == startSponsorKey.startSponsorKeybind){
//semicolon
startSponsorClicked();
- } else if (key == "'") {
+ } else if (key == submitKey.submitKeybind) {
//single quote
submitSponsorTimes();
}
@@ -591,7 +614,16 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
if (openNotice) {
//send out the message saying that a sponsor message was skipped
if (!dontShowNotice) {
- new SkipNotice(this, currentUUID);
+ let skipNotice = new SkipNotice(this, currentUUID);
+
+ if (dontShowNoticeOld) {
+ //show why this notice is showing
+ skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("noticeUpdate"), chrome.i18n.getMessage("noticeUpdate2"));
+
+ //remove this setting
+ chrome.storage.sync.remove(["dontShowNoticeAgain"]);
+ dontShowNoticeOld = false;
+ }
//auto-upvote this sponsor
if (trackViewCount) {
@@ -879,8 +911,8 @@ function vote(type, UUID, skipNotice) {
if (response != undefined) {
//see if it was a success or failure
if (skipNotice != null) {
- if (response.successType == 1) {
- //success
+ if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
+ //success (treat rate limits as a success)
if (type == 0) {
skipNotice.afterDownvote.bind(skipNotice)();
}
@@ -912,7 +944,7 @@ function closeAllSkipNotices(){
}
function dontShowNoticeAgain() {
- chrome.storage.sync.set({"dontShowNoticeAgain": true});
+ chrome.storage.sync.set({"dontShowNotice": true});
dontShowNotice = true;
@@ -920,15 +952,15 @@ function dontShowNoticeAgain() {
}
function sponsorMessageStarted(callback) {
- v = document.querySelector('video');
+ v = document.querySelector('video');
- //send back current time
- callback({
- time: v.currentTime
- })
+ //send back current time
+ callback({
+ time: v.currentTime
+ })
- //update button
- toggleStartSponsorButton();
+ //update button
+ toggleStartSponsorButton();
}
function submitSponsorTimes() {
diff --git a/firefox_manifest-extra.json b/firefox_manifest-extra.json
new file mode 100644
index 00000000..7625cd66
--- /dev/null
+++ b/firefox_manifest-extra.json
@@ -0,0 +1,8 @@
+{
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "sponsorBlocker@ajay.app",
+ "strict_min_version": "57.0"
+ }
+ }
+}
diff --git a/manifest.json b/manifest.json
index 494ac8b0..e7fae867 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "__MSG_Name__",
- "version": "1.1.9",
+ "version": "1.1.9.1",
"default_locale": "en",
"description": "__MSG_Description__",
"content_scripts": [
@@ -65,11 +65,5 @@
"128": "icons/LogoSponsorBlocker128px.png",
"256": "icons/LogoSponsorBlocker256px.png"
},
- "browser_specific_settings": {
- "gecko": {
- "id": "sponsorBlocker@ajay.app",
- "strict_min_version": "57.0"
- }
- },
"manifest_version": 2
}
diff --git a/popup.html b/popup.html
index ac89c9b5..a2923eb0 100644
--- a/popup.html
+++ b/popup.html
@@ -172,6 +172,19 @@