-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added support for iFrames (beta) (#3). - Removed redundant code.
- Loading branch information
1 parent
4200579
commit 5d49e9f
Showing
12 changed files
with
152 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# 1.0.4 (25013) | ||
# 1.0.5 (25014) | ||
|
||
## Release Notes | ||
|
||
- Added the ability to translate interface into other languages (#9). | ||
- Added Polish language. | ||
- Added support for iFrames (beta) (#3). | ||
- Removed redundant code. | ||
|
||
> [!WARNING] | ||
> File `-unsigned.xpi` will most likely not work in your browser. Use the signed version (`-signed.xpi`) or download from [Mozilla Add-ons](https://addons.mozilla.org/firefox/addon/redirecttube/). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.redirecttube-redirection-button { | ||
position: absolute; | ||
z-index: 10000; | ||
height: 47px; | ||
padding: 0 10px; | ||
background-color: #171717cc; | ||
color: #fff; | ||
font: 400 16px/16px "YouTube Noto",Roboto,Arial,Helvetica,sans-serif; | ||
border: none; | ||
border-radius: 0 2px 2px 0; | ||
transition: all 0.3s; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
function addButtonIframe(iframe, buttonName) { | ||
if (!iframe || iframe.dataset.buttonAdded === "true") return; | ||
|
||
const rect = iframe.getBoundingClientRect(); | ||
const button = document.createElement("button"); | ||
|
||
button.textContent = buttonName; | ||
button.classList.add("redirecttube-redirection-button"); | ||
button.style.top = `${window.scrollY + rect.bottom - 110}px`; | ||
button.style.left = `${window.scrollX + rect.left}px`; | ||
|
||
button.addEventListener("click", () => { | ||
redirecttubeOpenInFreeTube(iframe.src); | ||
}); | ||
|
||
document.body.appendChild(button); | ||
} | ||
|
||
window.addEventListener("resize", updateButtons); | ||
|
||
window.addEventListener("scroll", updateButtons); | ||
|
||
function updateButtons() { | ||
const buttons = document.querySelectorAll(".redirecttube-redirection-button"); | ||
buttons.forEach((button) => button.remove()); | ||
processIframes(localStorage.getItem("redirecttubeButtonName")); | ||
} | ||
|
||
function processIframes(buttonName) { | ||
const iframes = document.querySelectorAll("iframe"); | ||
iframes.forEach((iframe) => { | ||
if ( | ||
iframe.src.includes("youtube.com/embed") || | ||
iframe.src.includes("youtube-nocookie.com/embed") | ||
) { | ||
addButtonIframe(iframe, buttonName); | ||
} | ||
}); | ||
} | ||
|
||
chrome.runtime.onMessage.addListener((request) => { | ||
if (request.redirecttubeIframeButton === "iframeButtonYes") { | ||
processIframes(request.redirecttubeButtonName); | ||
} | ||
localStorage.setItem("redirecttubeButtonName", request.redirecttubeButtonName); | ||
}); | ||
|
||
function redirecttubeOpenInFreeTube(src) { | ||
let newUrl = "freetube://" + src; | ||
window.open(newUrl, "_blank"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters