mirror of
https://github.com/meowarex/TidaLuna-Plugins.git
synced 2026-06-18 03:43:10 +10:00
new standalone extension!!?!?
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
var h=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var B=(t,e)=>{for(var s in e)h(t,s,{get:e[s],enumerable:!0})},O=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of A(e))!R.call(t,n)&&n!==s&&h(t,n,{get:()=>e[n],enumerable:!(a=N(e,n))||a.enumerable});return t};var P=t=>O(h({},"__esModule",{value:!0}),t);var v={};B(v,{Tracer:()=>f,libTrace:()=>_});import{actions as C}from"@neptune";var f,_,E=k(()=>{"use strict";f=t=>{let e=c=>{let l=(...i)=>{c(t,...i)};return l.withContext=i=>(...p)=>{c(t,i,...p)},l},s=e(console.log),a=e(console.warn),n=e(console.error),r=e(console.debug),o=(c,l,i)=>{let p=m=>{c(m),l({message:`${t} - ${m}`,category:"OTHER",severity:i})};return p.withContext=m=>{let S=c.withContext(m);return d=>{S(d),d instanceof Error&&(d=d.message),l({message:`${t}.${m} - ${d}`,category:"OTHER",severity:i})}},p};return{log:s,warn:a,err:n,debug:r,msg:{log:o(s,C.message.messageInfo,"INFO"),warn:o(a,C.message.messageWarn,"WARN"),err:o(n,C.message.messageError,"ERROR")}}},_=f("[lib]")});E();var L=[];function w(t,e,s=1){let a=document.querySelector('[class*="moreContainer"'),n=document.createElement("button");n.style.width="32px",n.style.height="32px",n.style.border="none",n.classList.add("xcl_customButton");let r=document.createElement("img");r.src=e,r.style.width="100%",r.style.height="100%",n.onclick=t,n.appendChild(r);let o=Array.from(a.children);return s<=o.length?a.insertBefore(n,o[s-1]):a.appendChild(n),L.push(n),n}E();var D=f("[Clean View]"),M=`
|
||||
[data-test="footer-player"], [class*="tabItems"] {
|
||||
opacity: 0 !important;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
[class*="imageContainer"] {
|
||||
margin-top: 140px;
|
||||
}
|
||||
|
||||
[data-test="footer-player"]:hover, [class*="tabItems"]:hover {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
[data-test="header-container"] {
|
||||
opacity: 0;
|
||||
margin: -40px;
|
||||
}
|
||||
|
||||
[class*="nowPlayingContainer"] {
|
||||
padding-left: 6%;
|
||||
}
|
||||
`;function I(t){let e=document.createElement("style");return e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),document.head.appendChild(e),e}async function U(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.text()}catch(e){return D.msg.err(`Failed to fetch URL: ${e.message}`),null}}var b=!1,x,K=w(()=>{b?x&&x.remove():x=I(M),b=!b},"https://cdn.discordapp.com/attachments/1286571643807731783/1344515636675612712/image.png?ex=67c13143&is=67bfdfc3&hm=1573e29efdf882292922736e5ae2df6a87b7ad316add6fc498eee8ce799fb8e4&",2),$="https://raw.githubusercontent.com/ItzzExcel/neptune-projects/refs/heads/main/plugins/plugins/not-actual-fullscreen/src/separated-lyrics.css",T,u;(async()=>(T=await U($),u=I(T)))();function y(){let t=document.querySelector('[class^="trackTitleContainer"]');t&&t.addEventListener("DOMSubtreeModified",()=>{setTimeout(()=>{g()},300)})}var g=function(t=0){t===1&&setTimeout(()=>{g()},2e3);let e=document.querySelector('figure[class*="albumImage"] > div > div > div > img'),s;e&&(s=e.src,s=s.replace(/\d+x\d+/,"1280x1280"),e.src=s);let a=document.querySelector('[class*="nowPlayingContainer"]');if(a&&s){a.querySelectorAll(".corner-image").forEach(c=>c.remove());let r=document.createElement("img");r.src=s,r.className="corner-image",r.style.position="absolute",r.style.left="50%",r.style.top="50%",r.style.transform="translate(-50%, -50%)",r.style.width="75vw",r.style.height="150vh",r.style.objectFit="cover",r.style.zIndex="-1",r.style.filter="blur(100px) brightness(0.6) contrast(1.2) saturate(1)",r.style.animation="spin 35s linear infinite",a.appendChild(r);let o=document.createElement("img");if(o.src=s,o.className="corner-image",o.style.position="absolute",o.style.left="50%",o.style.top="50%",o.style.transform="translate(-50%, -50%)",o.style.width="75vw",o.style.height="150vh",o.style.objectFit="cover",o.style.zIndex="-1",o.style.filter="blur(100px) brightness(0.6) contrast(1.2) saturate(1)",o.style.animation="spin 35s linear infinite",a.appendChild(o),!document.querySelector("#spinAnimation")){let c=document.createElement("style");c.id="spinAnimation",c.textContent=`
|
||||
@keyframes spin {
|
||||
from { transform: translate(-50%, -50%) rotate(0deg); }
|
||||
to { transform: translate(-50%, -50%) rotate(360deg); }
|
||||
}
|
||||
`,document.head.appendChild(c)}}},F=function(){[...document.getElementsByClassName("corner-image")].forEach(t=>{t.remove()})},H=["playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION","playbackControls/MEDIA_PRODUCT_TRANSITION"],z=H.map(t=>intercept(t,()=>{g(1)}));y();y();y();y();function j(){u&&u.parentNode&&u.parentNode.removeChild(u)}function Y(){j(),z.forEach(e=>e()),F();let t=document.querySelector('div[class^="trackTitleContainer"]');t&&t.removeEventListener("DOMSubtreeModified",g)}export{Y as onUnload};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"Clean View","description":"Make your \"Now Playing View\" clean wherever you want.","author":"itzzexcel@github","hash":"91e3844b17858875c942928a666199e2","metafile":{"inputs":{"plugins/not-actual-fullscreen/src/tracer.js":{"bytes":1596,"imports":[{"path":"@neptune","kind":"import-statement","external":true}],"format":"esm"},"plugins/not-actual-fullscreen/src/ui.js":{"bytes":1170,"imports":[],"format":"esm"},"plugins/not-actual-fullscreen/src/index.js":{"bytes":6729,"imports":[{"path":"plugins/not-actual-fullscreen/src/tracer.js","kind":"import-statement","original":"./tracer"},{"path":"plugins/not-actual-fullscreen/src/ui.js","kind":"import-statement","original":"./ui"},{"path":"plugins/not-actual-fullscreen/src/tracer.js","kind":"require-call","original":"./tracer"}],"format":"esm"}},"outputs":{"plugins/not-actual-fullscreen/dist/index.js":{"imports":[{"path":"@neptune","kind":"import-statement","external":true}],"exports":["onUnload"],"entryPoint":"plugins/not-actual-fullscreen/src/index.js","inputs":{"plugins/not-actual-fullscreen/src/tracer.js":{"bytesInOutput":693},"plugins/not-actual-fullscreen/src/index.js":{"bytesInOutput":3344},"plugins/not-actual-fullscreen/src/ui.js":{"bytesInOutput":439}},"bytes":4946}}}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"canvas-confetti": "^1.6.0",
|
||||
"neptune-types": "1.0.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "Clean View",
|
||||
"description": "Make your \"Now Playing View\" clean wherever you want.",
|
||||
"author": "itzzexcel@github",
|
||||
"main": "./src/index.js"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
lockfileVersion: '6.1'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
canvas-confetti:
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.0
|
||||
|
||||
packages:
|
||||
|
||||
/canvas-confetti@1.6.0:
|
||||
resolution: {integrity: sha512-ej+w/m8Jzpv9Z7W7uJZer14Ke8P2ogsjg4ZMGIuq4iqUOqY2Jq8BNW42iGmNfRwREaaEfFIczLuZZiEVSYNHAA==}
|
||||
dev: false
|
||||
@@ -0,0 +1,205 @@
|
||||
require("./tracer");
|
||||
import { Tracer } from "./tracer";
|
||||
import * as ui from "./ui";
|
||||
|
||||
const trace = Tracer("[Clean View]");
|
||||
|
||||
const styles = `
|
||||
[data-test="footer-player"], [class*="tabItems"] {
|
||||
opacity: 0 !important;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
[class*="imageContainer"] {
|
||||
margin-top: 140px;
|
||||
}
|
||||
|
||||
[data-test="footer-player"]:hover, [class*="tabItems"]:hover {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
[data-test="header-container"] {
|
||||
opacity: 0;
|
||||
margin: -40px;
|
||||
}
|
||||
|
||||
[class*="nowPlayingContainer"] {
|
||||
padding-left: 6%;
|
||||
}
|
||||
`;
|
||||
|
||||
function ApplyCSS(style) {
|
||||
const styleElement = document.createElement("style");
|
||||
styleElement.type = "text/css";
|
||||
if (styleElement.styleSheet) styleElement.styleSheet.cssText = style;
|
||||
else styleElement.appendChild(document.createTextNode(style));
|
||||
|
||||
document.head.appendChild(styleElement);
|
||||
return styleElement;
|
||||
}
|
||||
|
||||
async function HttpGet(url) {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const content = await response.text();
|
||||
return content;
|
||||
} catch (error) {
|
||||
trace.msg.err(`Failed to fetch URL: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var isCleanView = false;
|
||||
var appliedStyle;
|
||||
const toggleCleanButton = ui.NewPlayerButton(() => {
|
||||
if (isCleanView) {
|
||||
if (appliedStyle) {
|
||||
appliedStyle.remove();
|
||||
}
|
||||
} else {
|
||||
appliedStyle = ApplyCSS(styles);
|
||||
}
|
||||
isCleanView = !isCleanView;
|
||||
}, "https://cdn.discordapp.com/attachments/1286571643807731783/1344515636675612712/image.png?ex=67c13143&is=67bfdfc3&hm=1573e29efdf882292922736e5ae2df6a87b7ad316add6fc498eee8ce799fb8e4&"
|
||||
, 2);
|
||||
|
||||
// STYLES FOR THE LYRICS
|
||||
const themeUrl = "https://raw.githubusercontent.com/ItzzExcel/neptune-projects/refs/heads/main/plugins/plugins/not-actual-fullscreen/src/separated-lyrics.css";
|
||||
|
||||
var style;
|
||||
var styleElement;
|
||||
|
||||
(async () => {
|
||||
style = await HttpGet(themeUrl);
|
||||
styleElement = ApplyCSS(style);
|
||||
})();
|
||||
|
||||
|
||||
function observeTrackTitle() {
|
||||
const trackTitleElement = document.querySelector('[class^="trackTitleContainer"]');
|
||||
if (trackTitleElement) {
|
||||
trackTitleElement.addEventListener('DOMSubtreeModified', () => {
|
||||
setTimeout(() => {
|
||||
// console.log("Track changed: " + trackTitleElement.querySelector("span").innerHTML + "\n")
|
||||
onTrackChanged();
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const onTrackChanged = function (method = 0) {
|
||||
// Tu amor tan liminal, tu amor tan liminal
|
||||
// - Ghouljaboy, 2021
|
||||
|
||||
if (method === 1) {
|
||||
setTimeout(() => {
|
||||
onTrackChanged();
|
||||
return;
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
let albumImageElement = document.querySelector('figure[class*="albumImage"] > div > div > div > img');
|
||||
let albumImageSrc;
|
||||
|
||||
if (albumImageElement) {
|
||||
albumImageSrc = albumImageElement.src;
|
||||
|
||||
// Set res to 1280x1280
|
||||
albumImageSrc = albumImageSrc.replace(/\d+x\d+/, '1280x1280');
|
||||
albumImageElement.src = albumImageSrc;
|
||||
}
|
||||
|
||||
// Setting background to the *="nowPlayingContainer" element
|
||||
let nowPlayingContainerElement = document.querySelector('[class*="nowPlayingContainer"]');
|
||||
if (nowPlayingContainerElement && albumImageSrc) {
|
||||
// Remove existing corner images if they exist
|
||||
const existingImages = nowPlayingContainerElement.querySelectorAll('.corner-image');
|
||||
existingImages.forEach(img => img.remove());
|
||||
|
||||
// Create and append center image
|
||||
const centerImg = document.createElement('img');
|
||||
centerImg.src = albumImageSrc;
|
||||
centerImg.className = 'corner-image';
|
||||
centerImg.style.position = 'absolute';
|
||||
centerImg.style.left = '50%';
|
||||
centerImg.style.top = '50%';
|
||||
centerImg.style.transform = 'translate(-50%, -50%)';
|
||||
centerImg.style.width = '75vw';
|
||||
centerImg.style.height = '150vh';
|
||||
centerImg.style.objectFit = 'cover';
|
||||
centerImg.style.zIndex = '-1';
|
||||
centerImg.style.filter = 'blur(100px) brightness(0.6) contrast(1.2) saturate(1)';
|
||||
centerImg.style.animation = 'spin 35s linear infinite';
|
||||
nowPlayingContainerElement.appendChild(centerImg);
|
||||
|
||||
const centerImg2 = document.createElement('img');
|
||||
centerImg2.src = albumImageSrc;
|
||||
centerImg2.className = 'corner-image';
|
||||
centerImg2.style.position = 'absolute';
|
||||
centerImg2.style.left = '50%';
|
||||
centerImg2.style.top = '50%';
|
||||
centerImg2.style.transform = 'translate(-50%, -50%)';
|
||||
centerImg2.style.width = '75vw';
|
||||
centerImg2.style.height = '150vh';
|
||||
centerImg2.style.objectFit = 'cover';
|
||||
centerImg2.style.zIndex = '-1';
|
||||
centerImg2.style.filter = 'blur(100px) brightness(0.6) contrast(1.2) saturate(1)';
|
||||
centerImg2.style.animation = 'spin 35s linear infinite';
|
||||
nowPlayingContainerElement.appendChild(centerImg2);
|
||||
|
||||
// Add keyframe animation if it doesn't exist
|
||||
if (!document.querySelector('#spinAnimation')) {
|
||||
const styleSheet = document.createElement('style');
|
||||
styleSheet.id = 'spinAnimation';
|
||||
styleSheet.textContent = `
|
||||
@keyframes spin {
|
||||
from { transform: translate(-50%, -50%) rotate(0deg); }
|
||||
to { transform: translate(-50%, -50%) rotate(360deg); }
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(styleSheet);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const cleanUpDynamicArt = function () {
|
||||
[...document.getElementsByClassName("corner-image")].forEach((element) => {
|
||||
element.remove();
|
||||
});
|
||||
};
|
||||
|
||||
const PLAYBACK_EVENTS = [
|
||||
"playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION",
|
||||
"playbackControls/MEDIA_PRODUCT_TRANSITION"
|
||||
];
|
||||
|
||||
const unsubscribeFunctions = PLAYBACK_EVENTS.map(event =>
|
||||
intercept(event, () => {
|
||||
onTrackChanged(1);
|
||||
})
|
||||
);
|
||||
|
||||
observeTrackTitle();
|
||||
observeTrackTitle();
|
||||
observeTrackTitle();
|
||||
observeTrackTitle();
|
||||
|
||||
function CleanUpCSS() {
|
||||
if (styleElement && styleElement.parentNode) {
|
||||
styleElement.parentNode.removeChild(styleElement);
|
||||
}
|
||||
}
|
||||
|
||||
export function onUnload() {
|
||||
CleanUpCSS();
|
||||
unsubscribeFunctions.forEach(unsubscribe => unsubscribe());
|
||||
cleanUpDynamicArt();
|
||||
|
||||
const trackTitleElement = document.querySelector('div[class^="trackTitleContainer"]');
|
||||
if (trackTitleElement) {
|
||||
trackTitleElement.removeEventListener('DOMSubtreeModified', onTrackChanged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* Credits to https://github.com/surfbryce for the fonts */
|
||||
@font-face {
|
||||
font-family: "AbyssFont";
|
||||
font-weight: 400;
|
||||
src: url("https://excel.lexploits.top/extra/tidal/LyricsRegular.woff2") format("woff2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "AbyssFont";
|
||||
font-weight: 500;
|
||||
src: url("https://excel.lexploits.top/extra/tidal/LyricsMedium.woff2") format("woff2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "AbyssFont";
|
||||
font-weight: 600;
|
||||
src: url("https://excel.lexploits.top/extra/tidal/LyricsSemibold.woff2") format("woff2");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "AbyssFont";
|
||||
font-weight: 700;
|
||||
src: url("https://excel.lexploits.top/extra/tidal/LyricsBold.woff2") format("woff2");
|
||||
}
|
||||
|
||||
[class*="lyricsText--"]>span[class*="active--"] {
|
||||
text-shadow: 0 0 2px #fff, 0 0 20px #fff;
|
||||
padding-left: 20px;
|
||||
transition-duration: 0.7s;
|
||||
font-size: 60px;
|
||||
}
|
||||
|
||||
[class*="lyricsText--"]>span {
|
||||
text-shadow: 0 0 0px transparent, 0 0 0px transparent;
|
||||
transition-duration: 0.25s;
|
||||
color: rgba(128, 128, 128, 0.4);
|
||||
font-size: 45px;
|
||||
}
|
||||
|
||||
[class*="lyricsText--"]>span:hover {
|
||||
text-shadow: 0 0 2px lightgray, 0 0 20px lightgray;
|
||||
color: lightgray;
|
||||
padding-left: 20px;
|
||||
transition-duration: 0.7s;
|
||||
}
|
||||
|
||||
[data-test="now-playing-track-title"] {
|
||||
text-shadow: 0 0 1px #fff, 0 0 30px #fff;
|
||||
}
|
||||
|
||||
[class^="bottomGradient"] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
[aria-label="Show credits"] {
|
||||
top: calc(var(--headerHeight) + 80px);
|
||||
}
|
||||
|
||||
[data-current] {
|
||||
transition: text-shadow 0.7s ease-in-out, text-shadow 0.7s ease-in-out padding 0.7s ease-in-out;
|
||||
}
|
||||
|
||||
[data-current="true"] {
|
||||
text-shadow: 0 0 2px #fff, 0 0 20px #fff;
|
||||
padding-left: 20px;
|
||||
transition-duration: 0.7s;
|
||||
}
|
||||
|
||||
[data-current="false"] {
|
||||
text-shadow: 0 0 0px transparent, 0 0 0px transparent;
|
||||
transition-duration: 0.25s;
|
||||
color: rgba(128, 128, 128, 0.4);
|
||||
}
|
||||
|
||||
[data-current="false"]:hover {
|
||||
text-shadow: 0 0 2px lightgray, 0 0 20px lightgray;
|
||||
color: lightgray;
|
||||
padding-left: 20px;
|
||||
transition-duration: 0.7s;
|
||||
}
|
||||
|
||||
[class^="lyricsContainer"]>div>div>span {
|
||||
margin-bottom: 2rem;
|
||||
opacity: 1;
|
||||
font-family: "AbyssFont", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
font-weight: 700;
|
||||
font-size: 43px !important;
|
||||
}
|
||||
|
||||
[class^="lyricsProvider"] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
[class^="syncButton"] {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Based on https://github.com/Inrixia/neptune-plugins/blob/3d28c9ea3252782da830698032dbb49dbe5b9fd6/plugins/_lib/trace.ts
|
||||
// Credits to inrixia
|
||||
|
||||
import { actions } from "@neptune";
|
||||
|
||||
export const Tracer = (source) => {
|
||||
const createLogger = (logger) => {
|
||||
const _logger = (...data) => {
|
||||
logger(source, ...data);
|
||||
return undefined;
|
||||
};
|
||||
_logger.withContext = (context) => (...data) => {
|
||||
logger(source, context, ...data);
|
||||
return undefined;
|
||||
};
|
||||
return _logger;
|
||||
};
|
||||
|
||||
const log = createLogger(console.log);
|
||||
const warn = createLogger(console.warn);
|
||||
const err = createLogger(console.error);
|
||||
const debug = createLogger(console.debug);
|
||||
|
||||
const createMessager = (logger, messager, severity) => {
|
||||
const _messager = (message) => {
|
||||
logger(message);
|
||||
messager({ message: `${source} - ${message}`, category: "OTHER", severity });
|
||||
return undefined;
|
||||
};
|
||||
_messager.withContext = (context) => {
|
||||
const loggerWithContext = logger.withContext(context);
|
||||
return (message) => {
|
||||
loggerWithContext(message);
|
||||
if (message instanceof Error) message = message.message;
|
||||
messager({ message: `${source}.${context} - ${message}`, category: "OTHER", severity });
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
return _messager;
|
||||
};
|
||||
|
||||
return {
|
||||
log,
|
||||
warn,
|
||||
err,
|
||||
debug,
|
||||
msg: {
|
||||
log: createMessager(log, actions.message.messageInfo, "INFO"),
|
||||
warn: createMessager(warn, actions.message.messageWarn, "WARN"),
|
||||
err: createMessager(err, actions.message.messageError, "ERROR"),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const libTrace = Tracer("[lib]");
|
||||
@@ -0,0 +1,39 @@
|
||||
var buttonElementList = [];
|
||||
|
||||
export function NewPlayerButton(callback, icon, customIndex = 1) {
|
||||
let iconHolder = document.querySelector("[class*=\"moreContainer\"");
|
||||
|
||||
let button = document.createElement("button");
|
||||
button.style.width = "32px";
|
||||
button.style.height = "32px";
|
||||
button.style.border = "none";
|
||||
button.classList.add("xcl_customButton");
|
||||
|
||||
let buttonIcon = document.createElement("img");
|
||||
buttonIcon.src = icon;
|
||||
buttonIcon.style.width = "100%";
|
||||
buttonIcon.style.height = "100%";
|
||||
button.onclick = callback;
|
||||
|
||||
button.appendChild(buttonIcon);
|
||||
|
||||
const children = Array.from(iconHolder.children);
|
||||
if (customIndex <= children.length) {
|
||||
iconHolder.insertBefore(button, children[customIndex - 1]);
|
||||
} else {
|
||||
iconHolder.appendChild(button);
|
||||
}
|
||||
|
||||
buttonElementList.push(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
export function CleanupButtons() {
|
||||
Array.from(buttonElementList).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
|
||||
Array.from(document.getElementsByClassName("xcl_customButton")).forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user