mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Merge pull request #163 from ajayyy/experimental-ajay
Keybind edit, show notice again, ignore rate limits
This commit is contained in:
@@ -166,7 +166,7 @@
|
|||||||
"message": "Click the button below when the sponsorship starts and ends to record and\nsubmit it to the database."
|
"message": "Click the button below when the sponsorship starts and ends to record and\nsubmit it to the database."
|
||||||
},
|
},
|
||||||
"popupHint": {
|
"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": {
|
"lastTimes": {
|
||||||
"message": "Latest Sponsor Message Times Chosen"
|
"message": "Latest Sponsor Message Times Chosen"
|
||||||
@@ -242,5 +242,25 @@
|
|||||||
"sourceCode": {
|
"sourceCode": {
|
||||||
"message": "Source Code",
|
"message": "Source Code",
|
||||||
"description": "Used on Firefox Store Page"
|
"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: "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,28 +42,13 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
|||||||
|
|
||||||
//add help page on install
|
//add help page on install
|
||||||
chrome.runtime.onInstalled.addListener(function (object) {
|
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) {
|
chrome.storage.sync.get(["userID", "shownInstallPage"], function(result) {
|
||||||
const userID = result.userID;
|
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 there is no userID, then it is the first install.
|
||||||
if (!userID){
|
if (!userID){
|
||||||
// Show install page, if there is no user id
|
//open up the install page
|
||||||
// and there is no shownInstallPage.
|
chrome.tabs.create({url: chrome.extension.getURL("/help/"+chrome.i18n.getMessage("helpPage"))});
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
//generate a userID
|
//generate a userID
|
||||||
const newUserID = generateUserID();
|
const newUserID = generateUserID();
|
||||||
|
|||||||
62
content.js
62
content.js
@@ -80,13 +80,22 @@ chrome.storage.sync.get(["trackViewCount"], function(result) {
|
|||||||
|
|
||||||
//if the notice should not be shown
|
//if the notice should not be shown
|
||||||
//happens when the user click's the "Don't show notice again" button
|
//happens when the user click's the "Don't show notice again" button
|
||||||
|
//option renamed when new notice was made
|
||||||
var dontShowNotice = false;
|
var dontShowNotice = false;
|
||||||
chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) {
|
chrome.storage.sync.get(["dontShowNotice"], function(result) {
|
||||||
let dontShowNoticeAgain = result.dontShowNoticeAgain;
|
let dontShowNoticeAgain = result.dontShowNoticeAgain;
|
||||||
if (dontShowNoticeAgain != undefined) {
|
if (dontShowNoticeAgain != undefined) {
|
||||||
dontShowNotice = dontShowNoticeAgain;
|
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
|
//get messages from the background script and the popup
|
||||||
chrome.runtime.onMessage.addListener(messageListener);
|
chrome.runtime.onMessage.addListener(messageListener);
|
||||||
@@ -195,18 +204,32 @@ function messageListener(request, sender, sendResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for hotkey pressed
|
//check for hotkey pressed
|
||||||
document.onkeydown = function(e){
|
document.onkeydown = async function(e){
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
var key = e.key;
|
var key = e.key;
|
||||||
|
|
||||||
let video = document.getElementById("movie_player");
|
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
|
//is the video in focus, otherwise they could be typing a comment
|
||||||
if (document.activeElement === video) {
|
if (document.activeElement === video) {
|
||||||
if(key == ';'){
|
if(key == startSponsorKey.startSponsorKeybind){
|
||||||
//semicolon
|
//semicolon
|
||||||
startSponsorClicked();
|
startSponsorClicked();
|
||||||
} else if (key == "'") {
|
} else if (key == submitKey.submitKeybind) {
|
||||||
//single quote
|
//single quote
|
||||||
submitSponsorTimes();
|
submitSponsorTimes();
|
||||||
}
|
}
|
||||||
@@ -591,7 +614,16 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
|
|||||||
if (openNotice) {
|
if (openNotice) {
|
||||||
//send out the message saying that a sponsor message was skipped
|
//send out the message saying that a sponsor message was skipped
|
||||||
if (!dontShowNotice) {
|
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
|
//auto-upvote this sponsor
|
||||||
if (trackViewCount) {
|
if (trackViewCount) {
|
||||||
@@ -879,8 +911,8 @@ function vote(type, UUID, skipNotice) {
|
|||||||
if (response != undefined) {
|
if (response != undefined) {
|
||||||
//see if it was a success or failure
|
//see if it was a success or failure
|
||||||
if (skipNotice != null) {
|
if (skipNotice != null) {
|
||||||
if (response.successType == 1) {
|
if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
|
||||||
//success
|
//success (treat rate limits as a success)
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
skipNotice.afterDownvote.bind(skipNotice)();
|
skipNotice.afterDownvote.bind(skipNotice)();
|
||||||
}
|
}
|
||||||
@@ -912,7 +944,7 @@ function closeAllSkipNotices(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dontShowNoticeAgain() {
|
function dontShowNoticeAgain() {
|
||||||
chrome.storage.sync.set({"dontShowNoticeAgain": true});
|
chrome.storage.sync.set({"dontShowNotice": true});
|
||||||
|
|
||||||
dontShowNotice = true;
|
dontShowNotice = true;
|
||||||
|
|
||||||
@@ -920,15 +952,15 @@ function dontShowNoticeAgain() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sponsorMessageStarted(callback) {
|
function sponsorMessageStarted(callback) {
|
||||||
v = document.querySelector('video');
|
v = document.querySelector('video');
|
||||||
|
|
||||||
//send back current time
|
//send back current time
|
||||||
callback({
|
callback({
|
||||||
time: v.currentTime
|
time: v.currentTime
|
||||||
})
|
})
|
||||||
|
|
||||||
//update button
|
//update button
|
||||||
toggleStartSponsorButton();
|
toggleStartSponsorButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitSponsorTimes() {
|
function submitSponsorTimes() {
|
||||||
|
|||||||
8
firefox_manifest-extra.json
Normal file
8
firefox_manifest-extra.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"browser_specific_settings": {
|
||||||
|
"gecko": {
|
||||||
|
"id": "sponsorBlocker@ajay.app",
|
||||||
|
"strict_min_version": "57.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "__MSG_Name__",
|
"short_name": "__MSG_Name__",
|
||||||
"version": "1.1.9",
|
"version": "1.1.9.1",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
@@ -65,11 +65,5 @@
|
|||||||
"128": "icons/LogoSponsorBlocker128px.png",
|
"128": "icons/LogoSponsorBlocker128px.png",
|
||||||
"256": "icons/LogoSponsorBlocker256px.png"
|
"256": "icons/LogoSponsorBlocker256px.png"
|
||||||
},
|
},
|
||||||
"browser_specific_settings": {
|
|
||||||
"gecko": {
|
|
||||||
"id": "sponsorBlocker@ajay.app",
|
|
||||||
"strict_min_version": "57.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"manifest_version": 2
|
"manifest_version": 2
|
||||||
}
|
}
|
||||||
|
|||||||
13
popup.html
13
popup.html
@@ -172,6 +172,19 @@
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<h3>__MSG_Options__</h3>
|
<h3>__MSG_Options__</h3>
|
||||||
|
|
||||||
|
<span id="keybindButtons">
|
||||||
|
<button id="setStartSponsorKeybind" class="warningButton popupElement">__MSG_setStartSponsorShortcut__</button>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<button id="setSubmitKeybind" class="warningButton popupElement">__MSG_setSubmitKeybind__</button>
|
||||||
|
<br/>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<h2 id="keybindDescription" style="display: none" class="popupElement">__MSG_keybindDescription__</h2>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<button id="hideVideoPlayerControls" class="warningButton popupElement">__MSG_hideButtons__</button>
|
<button id="hideVideoPlayerControls" class="warningButton popupElement">__MSG_hideButtons__</button>
|
||||||
<button id="showVideoPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showButtons__</button>
|
<button id="showVideoPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showButtons__</button>
|
||||||
|
|||||||
51
popup.js
51
popup.js
@@ -70,6 +70,10 @@ function runThePopup() {
|
|||||||
"videoFound",
|
"videoFound",
|
||||||
"sponsorMessageTimes",
|
"sponsorMessageTimes",
|
||||||
"downloadedSponsorMessageTimes",
|
"downloadedSponsorMessageTimes",
|
||||||
|
// Keybinds
|
||||||
|
"setStartSponsorKeybind",
|
||||||
|
"setSubmitKeybind",
|
||||||
|
"keybindDescription"
|
||||||
].forEach(id => SB[id] = document.getElementById(id));
|
].forEach(id => SB[id] = document.getElementById(id));
|
||||||
|
|
||||||
//setup click listeners
|
//setup click listeners
|
||||||
@@ -79,6 +83,8 @@ function runThePopup() {
|
|||||||
SB.clearTimes.addEventListener("click", clearTimes);
|
SB.clearTimes.addEventListener("click", clearTimes);
|
||||||
SB.submitTimes.addEventListener("click", submitTimes);
|
SB.submitTimes.addEventListener("click", submitTimes);
|
||||||
SB.showNoticeAgain.addEventListener("click", showNoticeAgain);
|
SB.showNoticeAgain.addEventListener("click", showNoticeAgain);
|
||||||
|
SB.setStartSponsorKeybind.addEventListener("click", () => setKeybind(true));
|
||||||
|
SB.setSubmitKeybind.addEventListener("click", () => setKeybind(false));
|
||||||
SB.hideVideoPlayerControls.addEventListener("click", hideVideoPlayerControls);
|
SB.hideVideoPlayerControls.addEventListener("click", hideVideoPlayerControls);
|
||||||
SB.showVideoPlayerControls.addEventListener("click", showVideoPlayerControls);
|
SB.showVideoPlayerControls.addEventListener("click", showVideoPlayerControls);
|
||||||
SB.hideInfoButtonPlayerControls.addEventListener("click", hideInfoButtonPlayerControls);
|
SB.hideInfoButtonPlayerControls.addEventListener("click", hideInfoButtonPlayerControls);
|
||||||
@@ -104,6 +110,9 @@ function runThePopup() {
|
|||||||
|
|
||||||
//is this a YouTube tab?
|
//is this a YouTube tab?
|
||||||
let isYouTubeTab = false;
|
let isYouTubeTab = false;
|
||||||
|
|
||||||
|
// Is the start sponsor keybind currently being set
|
||||||
|
let setStartSponsorKeybind = false;
|
||||||
|
|
||||||
//see if discord link can be shown
|
//see if discord link can be shown
|
||||||
chrome.storage.sync.get(["hideDiscordLink"], function(result) {
|
chrome.storage.sync.get(["hideDiscordLink"], function(result) {
|
||||||
@@ -127,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";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -819,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,
|
||||||
@@ -1102,8 +1111,8 @@ function runThePopup() {
|
|||||||
}, function(response) {
|
}, function(response) {
|
||||||
if (response != undefined) {
|
if (response != undefined) {
|
||||||
//see if it was a success or failure
|
//see if it was a success or failure
|
||||||
if (response.successType == 1) {
|
if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
|
||||||
//success
|
//success (treat rate limits as a success)
|
||||||
addVoteMessage(chrome.i18n.getMessage("voted"), UUID)
|
addVoteMessage(chrome.i18n.getMessage("voted"), UUID)
|
||||||
} else if (response.successType == 0) {
|
} else if (response.successType == 0) {
|
||||||
//failure: duplicate vote
|
//failure: duplicate vote
|
||||||
@@ -1236,7 +1245,35 @@ function runThePopup() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setKeybind(startSponsorKeybind) {
|
||||||
|
document.getElementById("keybindButtons").style.display = "none";
|
||||||
|
|
||||||
|
document.getElementById("keybindDescription").style.display = "initial";
|
||||||
|
document.getElementById("keybindDescription").innerText = chrome.i18n.getMessage("keybindDescription");
|
||||||
|
|
||||||
|
setStartSponsorKeybind = startSponsorKeybind;
|
||||||
|
|
||||||
|
document.addEventListener("keydown", onKeybindSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeybindSet(e) {
|
||||||
|
e = e || window.event;
|
||||||
|
var key = e.key;
|
||||||
|
|
||||||
|
if (setStartSponsorKeybind) {
|
||||||
|
chrome.storage.sync.set({"startSponsorKeybind": key});
|
||||||
|
} else {
|
||||||
|
chrome.storage.sync.set({"submitKeybind": key});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.removeEventListener("keydown", onKeybindSet);
|
||||||
|
|
||||||
|
document.getElementById("keybindDescription").innerText = chrome.i18n.getMessage("keybindDescriptionComplete") + " " + key;
|
||||||
|
|
||||||
|
document.getElementById("keybindButtons").style.display = "unset";
|
||||||
|
}
|
||||||
|
|
||||||
//converts time in seconds to minutes
|
//converts time in seconds to minutes
|
||||||
function getTimeInMinutes(seconds) {
|
function getTimeInMinutes(seconds) {
|
||||||
let minutes = Math.floor(seconds / 60);
|
let minutes = Math.floor(seconds / 60);
|
||||||
|
|||||||
@@ -294,21 +294,37 @@ 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;
|
||||||
thanksForVotingText.className = "sponsorTimesInfoMessage";
|
thanksForVotingText.className = "sponsorTimesInfoMessage";
|
||||||
thanksForVotingText.innerText = message;
|
thanksForVotingText.innerText = message;
|
||||||
|
|
||||||
//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() {
|
||||||
@@ -337,7 +353,7 @@ class SkipNotice {
|
|||||||
thanksForVotingText.id = "sponsorTimesVoteButtonInfoMessage" + this.idSuffix;
|
thanksForVotingText.id = "sponsorTimesVoteButtonInfoMessage" + this.idSuffix;
|
||||||
thanksForVotingText.className = "sponsorTimesInfoMessage sponsorTimesVoteButtonMessage";
|
thanksForVotingText.className = "sponsorTimesInfoMessage sponsorTimesVoteButtonMessage";
|
||||||
thanksForVotingText.innerText = message;
|
thanksForVotingText.innerText = message;
|
||||||
|
|
||||||
//add element to div
|
//add element to div
|
||||||
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).prepend(thanksForVotingText);
|
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).prepend(thanksForVotingText);
|
||||||
}
|
}
|
||||||
@@ -348,13 +364,16 @@ class SkipNotice {
|
|||||||
//remove it
|
//remove it
|
||||||
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).removeChild(previousInfoMessage);
|
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).removeChild(previousInfoMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//show button again
|
//show button again
|
||||||
document.getElementById("sponsorTimesDownvoteButtonsContainer" + this.idSuffix).style.removeProperty("display");
|
document.getElementById("sponsorTimesDownvoteButtonsContainer" + this.idSuffix).style.removeProperty("display");
|
||||||
}
|
}
|
||||||
|
|
||||||
//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