mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-27 21:01:00 +03:00
Update ContentScript.js
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user