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"
|
||||
},
|
||||
"noticeUpdate": {
|
||||
"message": "The notice has been upgraded! If you still don't like it, hit the never show button.",
|
||||
"description": "The message displayed after the notice was upgraded."
|
||||
"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"
|
||||
|
||||
@@ -618,10 +618,11 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
|
||||
|
||||
if (dontShowNoticeOld) {
|
||||
//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
|
||||
chrome.storage.sync.set({"dontShowNoticeAgain": false});
|
||||
//remove this setting
|
||||
chrome.storage.sync.remove(["dontShowNoticeAgain"]);
|
||||
dontShowNoticeOld = false;
|
||||
}
|
||||
|
||||
//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
|
||||
// disable should be available
|
||||
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
|
||||
let dontShowNoticeAgain = result.dontShowNoticeAgain;
|
||||
if (dontShowNoticeAgain != undefined && dontShowNoticeAgain) {
|
||||
chrome.storage.sync.get(["dontShowNotice"], function(result) {
|
||||
let dontShowNotice = result.dontShowNotice;
|
||||
if (dontShowNotice != undefined && dontShowNotice) {
|
||||
SB.showNoticeAgain.style.display = "unset";
|
||||
}
|
||||
});
|
||||
@@ -828,7 +828,7 @@ function runThePopup() {
|
||||
}
|
||||
|
||||
function showNoticeAgain() {
|
||||
chrome.storage.sync.set({"dontShowNoticeAgain": false});
|
||||
chrome.storage.sync.set({"dontShowNotice": false});
|
||||
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
|
||||
@@ -294,13 +294,19 @@ class SkipNotice {
|
||||
}
|
||||
}
|
||||
|
||||
addNoticeInfoMessage(message) {
|
||||
addNoticeInfoMessage(message, message2) {
|
||||
let previousInfoMessage = document.getElementById("sponsorTimesInfoMessage" + this.idSuffix);
|
||||
if (previousInfoMessage != null) {
|
||||
//remove it
|
||||
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
|
||||
let thanksForVotingText = document.createElement("p");
|
||||
thanksForVotingText.id = "sponsorTimesInfoMessage" + this.idSuffix;
|
||||
@@ -309,6 +315,16 @@ class SkipNotice {
|
||||
|
||||
//add element to div
|
||||
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() {
|
||||
@@ -355,6 +371,9 @@ class SkipNotice {
|
||||
|
||||
//close this notice
|
||||
close() {
|
||||
//reset message
|
||||
this.resetNoticeInfoMessage();
|
||||
|
||||
let notice = document.getElementById("sponsorSkipNotice" + this.idSuffix);
|
||||
if (notice != null) {
|
||||
notice.remove();
|
||||
|
||||
Reference in New Issue
Block a user