diff options
author | Official Noob <[email protected]> | 2019-01-15 19:04:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-01-15 19:04:10 +0000 |
commit | 2360bd3547a083ddf239ec9425c51a4a65db9a2b (patch) | |
tree | f14454ef7af28f41e44c9ed4bd4fa7052d0100fe | |
parent | 9011da564acc605394b17f1ff32ec3d8029995e7 (diff) | |
download | SponsorBlock-2360bd3547a083ddf239ec9425c51a4a65db9a2b.tar.gz SponsorBlock-2360bd3547a083ddf239ec9425c51a4a65db9a2b.zip |
Update ContentScript.js
-rw-r--r-- | ContentScript.js | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/ContentScript.js b/ContentScript.js index a24e181d..2e05e454 100644 --- a/ContentScript.js +++ b/ContentScript.js @@ -1,8 +1,7 @@ chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { - if (request.message === 'ytvideo') { - video_id = youtube_parser(document.URL); - SponsorsLookup(video_id); + if (request.message === 'ytvideoid') { + SponsorsLookup(request.id); } }); @@ -28,9 +27,3 @@ function SponsorCheck() { } }); } - -function youtube_parser(url) { - var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; - var match = url.match(regExp); - return (match && match[7].length == 11) ? match[7] : false; -} |