first commit

This commit is contained in:
2024-02-16 22:50:11 +01:00
commit 5f7ba1d7f4
10 changed files with 123 additions and 0 deletions

13
popup.js Normal file
View 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.");
}
});
});