mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 09:59:41 +05:00
feat: add a browser extensions
This commit is contained in:
parent
6d4d320da8
commit
a42d3c3c79
16 changed files with 114 additions and 0 deletions
30
extension/firefox/main.js
Normal file
30
extension/firefox/main.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
// find a container and an open in app link with button
|
||||
const container = document.querySelector('div[style="text-align: center;"]');
|
||||
const openInAppLink = document.querySelector('a[href^="anixart"');
|
||||
const openInAppLinkButton = openInAppLink.querySelector("button");
|
||||
openInAppLinkButton.style = "margin-top: 0px !important;"; // disable default button margin
|
||||
openInAppLinkButton.classList = "btn btn-secondary"; // change default button from primary to secondary
|
||||
|
||||
// create a custom footer
|
||||
const footer = document.createElement("div");
|
||||
footer.style =
|
||||
"display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 20px;";
|
||||
|
||||
// create and set custom link
|
||||
const link = document.createElement("a");
|
||||
const button = document.createElement("button");
|
||||
button.style = "margin-top: 0px !important;";
|
||||
button.classList = "btn btn-primary";
|
||||
button.textContent = "Открыть в Anix";
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const pathname = url.pathname;
|
||||
link.href = `https://anix.wah.su${pathname}`;
|
||||
link.appendChild(button);
|
||||
|
||||
// append link and open in app link to footer
|
||||
footer.appendChild(link);
|
||||
footer.appendChild(openInAppLink);
|
||||
|
||||
// append footer to container
|
||||
container.appendChild(footer);
|
Loading…
Add table
Add a link
Reference in a new issue