mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Fixed feature to show the notice to users again.
This commit is contained in:
@@ -244,8 +244,12 @@
|
|||||||
"description": "Used on Firefox Store Page"
|
"description": "Used on Firefox Store Page"
|
||||||
},
|
},
|
||||||
"noticeUpdate": {
|
"noticeUpdate": {
|
||||||
"message": "The notice has been upgraded! If you still don't like it, hit the never show button.",
|
"message": "The notice has been upgraded!",
|
||||||
"description": "The message displayed after the notice was 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": {
|
"setStartSponsorShortcut": {
|
||||||
"message": "Set key for start sponsor keybind"
|
"message": "Set key for start sponsor keybind"
|
||||||
|
|||||||
@@ -618,10 +618,11 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
|
|||||||
|
|
||||||
if (dontShowNoticeOld) {
|
if (dontShowNoticeOld) {
|
||||||
//show why this notice is showing
|
//show why this notice is showing
|
||||||
skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("noticeUpdate"));
|
skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("noticeUpdate"), chrome.i18n.getMessage("noticeUpdate2"));
|
||||||
|
|
||||||
//disable this setting
|
//remove this setting
|
||||||
chrome.storage.sync.set({"dontShowNoticeAgain": false});
|
chrome.storage.sync.remove(["dontShowNoticeAgain"]);
|
||||||
|
dontShowNoticeOld = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//auto-upvote this sponsor
|
//auto-upvote this sponsor
|
||||||
|
|||||||
8
popup.js
8
popup.js
@@ -136,9 +136,9 @@ function runThePopup() {
|
|||||||
|
|
||||||
//if the don't show notice again letiable is true, an option to
|
//if the don't show notice again letiable is true, an option to
|
||||||
// disable should be available
|
// disable should be available
|
||||||
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
|
chrome.storage.sync.get(["dontShowNotice"], function(result) {
|
||||||
let dontShowNoticeAgain = result.dontShowNoticeAgain;
|
let dontShowNotice = result.dontShowNotice;
|
||||||
if (dontShowNoticeAgain != undefined && dontShowNoticeAgain) {
|
if (dontShowNotice != undefined && dontShowNotice) {
|
||||||
SB.showNoticeAgain.style.display = "unset";
|
SB.showNoticeAgain.style.display = "unset";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -828,7 +828,7 @@ function runThePopup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showNoticeAgain() {
|
function showNoticeAgain() {
|
||||||
chrome.storage.sync.set({"dontShowNoticeAgain": false});
|
chrome.storage.sync.set({"dontShowNotice": false});
|
||||||
|
|
||||||
chrome.tabs.query({
|
chrome.tabs.query({
|
||||||
active: true,
|
active: true,
|
||||||
|
|||||||
@@ -294,13 +294,19 @@ class SkipNotice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addNoticeInfoMessage(message) {
|
addNoticeInfoMessage(message, message2) {
|
||||||
let previousInfoMessage = document.getElementById("sponsorTimesInfoMessage" + this.idSuffix);
|
let previousInfoMessage = document.getElementById("sponsorTimesInfoMessage" + this.idSuffix);
|
||||||
if (previousInfoMessage != null) {
|
if (previousInfoMessage != null) {
|
||||||
//remove it
|
//remove it
|
||||||
document.getElementById("sponsorSkipNotice" + this.idSuffix).removeChild(previousInfoMessage);
|
document.getElementById("sponsorSkipNotice" + this.idSuffix).removeChild(previousInfoMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let previousInfoMessage2 = document.getElementById("sponsorTimesInfoMessage" + this.idSuffix + "2");
|
||||||
|
if (previousInfoMessage2 != null) {
|
||||||
|
//remove it
|
||||||
|
document.getElementById("sponsorSkipNotice" + this.idSuffix).removeChild(previousInfoMessage2);
|
||||||
|
}
|
||||||
|
|
||||||
//add info
|
//add info
|
||||||
let thanksForVotingText = document.createElement("p");
|
let thanksForVotingText = document.createElement("p");
|
||||||
thanksForVotingText.id = "sponsorTimesInfoMessage" + this.idSuffix;
|
thanksForVotingText.id = "sponsorTimesInfoMessage" + this.idSuffix;
|
||||||
@@ -309,6 +315,16 @@ class SkipNotice {
|
|||||||
|
|
||||||
//add element to div
|
//add element to div
|
||||||
document.getElementById("sponsorSkipNotice" + this.idSuffix).insertBefore(thanksForVotingText, document.getElementById("sponsorSkipNoticeSpacer" + this.idSuffix));
|
document.getElementById("sponsorSkipNotice" + this.idSuffix).insertBefore(thanksForVotingText, document.getElementById("sponsorSkipNoticeSpacer" + this.idSuffix));
|
||||||
|
|
||||||
|
if (message2 !== undefined) {
|
||||||
|
let thanksForVotingText2 = document.createElement("p");
|
||||||
|
thanksForVotingText2.id = "sponsorTimesInfoMessage" + this.idSuffix + "2";
|
||||||
|
thanksForVotingText2.className = "sponsorTimesInfoMessage";
|
||||||
|
thanksForVotingText2.innerText = message2;
|
||||||
|
|
||||||
|
//add element to div
|
||||||
|
document.getElementById("sponsorSkipNotice" + this.idSuffix).insertBefore(thanksForVotingText2, document.getElementById("sponsorSkipNoticeSpacer" + this.idSuffix));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetNoticeInfoMessage() {
|
resetNoticeInfoMessage() {
|
||||||
@@ -355,6 +371,9 @@ class SkipNotice {
|
|||||||
|
|
||||||
//close this notice
|
//close this notice
|
||||||
close() {
|
close() {
|
||||||
|
//reset message
|
||||||
|
this.resetNoticeInfoMessage();
|
||||||
|
|
||||||
let notice = document.getElementById("sponsorSkipNotice" + this.idSuffix);
|
let notice = document.getElementById("sponsorSkipNotice" + this.idSuffix);
|
||||||
if (notice != null) {
|
if (notice != null) {
|
||||||
notice.remove();
|
notice.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user