mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-18 13:38:25 +03:00
Added UI to support picking out sponsors and submitting
This commit is contained in:
@@ -8,6 +8,11 @@ chrome.runtime.onMessage.addListener( // Detect URL Changes
|
||||
if (request.message === 'ytvideoid') { // Message from background script
|
||||
SponsorsLookup(request.id);
|
||||
}
|
||||
|
||||
//message from popup script
|
||||
if (request.message === 'sponsorStart') {
|
||||
sponsorMessageStarted();
|
||||
}
|
||||
});
|
||||
|
||||
function SponsorsLookup(id) {
|
||||
@@ -38,3 +43,15 @@ function youtube_parser(url) { // Returns with video id else returns false
|
||||
var match = url.match(regExp);
|
||||
return (match && match[7].length == 11) ? match[7] : false;
|
||||
}
|
||||
|
||||
function sponsorMessageStarted() {
|
||||
let v = document.querySelector('video');
|
||||
|
||||
console.log(v.currentTime)
|
||||
|
||||
//send back current time
|
||||
chrome.runtime.sendMessage({
|
||||
message: "time",
|
||||
time: v.currentTime
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user