first commit
This commit is contained in:
13
popup.js
Normal file
13
popup.js
Normal file
@@ -0,0 +1,13 @@
|
||||
document.getElementById('redirectBtn').addEventListener('click', function() {
|
||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
||||
var currentTab = tabs[0];
|
||||
var videoID = currentTab.url.match(/watch\?v=([a-zA-Z0-9_-]+)/);
|
||||
|
||||
if(videoID && videoID[1]) {
|
||||
var newURL = 'https://piped.video/watch?v=' + videoID[1];
|
||||
chrome.tabs.update(currentTab.id, {url: newURL});
|
||||
} else {
|
||||
alert("This doesn't seem to be a valid YouTube video URL.");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user