Update ContentScript.js

This commit is contained in:
Official Noob
2019-01-15 19:04:10 +00:00
committed by GitHub
parent 9011da564a
commit 2360bd3547

View File

@@ -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;
}