aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOfficial Noob <[email protected]>2019-01-15 18:29:25 +0000
committerGitHub <[email protected]>2019-01-15 18:29:25 +0000
commita229b645e302f47509dfb619fe019d33a04fb830 (patch)
tree023e0a80ceb0f3c2248b2e62bce0ebe8860b7118
parentec470408441d64b99a46b5e4af5d6151cfe74690 (diff)
downloadSponsorBlock-a229b645e302f47509dfb619fe019d33a04fb830.tar.gz
SponsorBlock-a229b645e302f47509dfb619fe019d33a04fb830.zip
Update ContentScript.js
-rw-r--r--ContentScript.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/ContentScript.js b/ContentScript.js
index 571eb9fb..a24e181d 100644
--- a/ContentScript.js
+++ b/ContentScript.js
@@ -1,11 +1,13 @@
-var v = document.querySelector('video')
-video_id = youtube_parser(document.URL);
-
-if (video_id) {
- SponsorsLookup(video_id);
-}
+chrome.runtime.onMessage.addListener(
+ function(request, sender, sendResponse) {
+ if (request.message === 'ytvideo') {
+ video_id = youtube_parser(document.URL);
+ SponsorsLookup(video_id);
+ }
+});
function SponsorsLookup(id) {
+ v = document.querySelector('video')
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', 'https://officialnoob.github.io/YTSponsorSkip-Dataset/' + id, true);
xmlhttp.onreadystatechange = function () {