mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-15 16:07:06 +03:00
Made the popup appear when you skip a sponsor and made it disappear after 2.5 seconds
This commit is contained in:
12
content.js
12
content.js
@@ -84,13 +84,18 @@ function sponsorCheck(sponsorTimes) { // Video skipping
|
||||
if (Math.abs(v.currentTime - lastTime) < 1 && sponsorTime[0] >= lastTime && sponsorTime[0] <= v.currentTime) {
|
||||
//skip it
|
||||
v.currentTime = sponsorTime[1];
|
||||
|
||||
//send out the message saying that a sponsor message was skipped
|
||||
openSkipNotice();
|
||||
|
||||
setTimeout(closeSkipNotice, 2500);
|
||||
}
|
||||
|
||||
lastTime = v.currentTime;
|
||||
});
|
||||
}
|
||||
|
||||
//The notice that tells the user that a sponsor was just skipped
|
||||
//Opens the notice that tells the user that a sponsor was just skipped
|
||||
function openSkipNotice(){
|
||||
var noticeElement = document.createElement("div");
|
||||
|
||||
@@ -120,6 +125,11 @@ function openSkipNotice(){
|
||||
referenceNode.prepend(noticeElement);
|
||||
}
|
||||
|
||||
//Closes the notice that tells the user that a sponsor was just skipped
|
||||
function closeSkipNotice(){
|
||||
document.getElementById("sponsorSkipNotice").remove();
|
||||
}
|
||||
|
||||
function sponsorMessageStarted() {
|
||||
let v = document.querySelector('video');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user