From 1cda15e8f98d0788286e461fe25879a865bb49e5 Mon Sep 17 00:00:00 2001 From: ItzzExcel <98148217+ItzzExcel@users.noreply.github.com> Date: Mon, 24 Feb 2025 23:09:35 -0600 Subject: [PATCH] Actually fixed now... --- plugins/plugins/oled-theme/dist/index.js | 4 +- plugins/plugins/oled-theme/dist/manifest.json | 2 +- plugins/plugins/oled-theme/src/index.js | 45 ++++++++++++------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/plugins/plugins/oled-theme/dist/index.js b/plugins/plugins/oled-theme/dist/index.js index 34de185..159725e 100644 --- a/plugins/plugins/oled-theme/dist/index.js +++ b/plugins/plugins/oled-theme/dist/index.js @@ -1,6 +1,6 @@ -var f=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(t&&(e=t(t=0)),e);var A=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},O=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of w(e))!S.call(t,c)&&c!==r&&f(t,c,{get:()=>e[c],enumerable:!(a=I(e,c))||a.enumerable});return t};var N=t=>O(f({},"__esModule",{value:!0}),t);var T={};A(T,{Tracer:()=>h,libTrace:()=>R});import{actions as C}from"@neptune";var h,R,E=k(()=>{"use strict";h=t=>{let e=s=>{let m=(...l)=>{s(t,...l)};return m.withContext=l=>(...y)=>{s(t,l,...y)},m},r=e(console.log),a=e(console.warn),c=e(console.error),o=e(console.debug),n=(s,m,l)=>{let y=u=>{s(u),m({message:`${t} - ${u}`,category:"OTHER",severity:l})};return y.withContext=u=>{let x=s.withContext(u);return d=>{x(d),d instanceof Error&&(d=d.message),m({message:`${t}.${u} - ${d}`,category:"OTHER",severity:l})}},y};return{log:r,warn:a,err:c,debug:o,msg:{log:n(r,C.message.messageInfo,"INFO"),warn:n(a,C.message.messageWarn,"WARN"),err:n(c,C.message.messageError,"ERROR")}}},R=h("[lib]")});E();import{intercept as p}from"@neptune";E();var v=h("[OLED Theme]"),_="https://raw.githubusercontent.com/ItzzExcel/neptune-projects/refs/heads/main/themes/black-neptune-theme.css",b,g;function P(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}function U(){g&&g.parentNode&&g.parentNode.removeChild(g)}async function D(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 v.msg.err(`Failed to fetch URL: ${e.message}`),null}}(async()=>(b=await D(_),g=P(b)))();var i=function(t=0){t===1&&setTimeout(()=>{i()},2e3);let e=document.querySelector('figure[class*="albumImage"] > div > div > div > img'),r;e&&(r=e.src,r=r.replace(/\d+x\d+/,"1280x1280"),e.src=r);let a=document.querySelector('[class*="nowPlayingContainer"]');if(a&&r){a.querySelectorAll(".corner-image").forEach(s=>s.remove());let o=document.createElement("img");o.src=r,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);let n=document.createElement("img");if(n.src=r,n.className="corner-image",n.style.position="absolute",n.style.left="50%",n.style.top="50%",n.style.transform="translate(-50%, -50%)",n.style.width="75vw",n.style.height="150vh",n.style.objectFit="cover",n.style.zIndex="-1",n.style.filter="blur(100px) brightness(0.6) contrast(1.2) saturate(1)",n.style.animation="spin 35s linear infinite",a.appendChild(n),!document.querySelector("#spinAnimation")){let s=document.createElement("style");s.id="spinAnimation",s.textContent=` +var g=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var A=(e,t)=>()=>(e&&(t=e(e=0)),t);var v=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},k=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of I(t))!S.call(e,c)&&c!==r&&g(e,c,{get:()=>t[c],enumerable:!(a=x(t,c))||a.enumerable});return e};var N=e=>k(g({},"__esModule",{value:!0}),e);var b={};v(b,{Tracer:()=>y,libTrace:()=>R});import{actions as f}from"@neptune";var y,R,h=A(()=>{"use strict";y=e=>{let t=s=>{let i=(...l)=>{s(e,...l)};return i.withContext=l=>(...p)=>{s(e,l,...p)},i},r=t(console.log),a=t(console.warn),c=t(console.error),o=t(console.debug),n=(s,i,l)=>{let p=m=>{s(m),i({message:`${e} - ${m}`,category:"OTHER",severity:l})};return p.withContext=m=>{let w=s.withContext(m);return u=>{w(u),u instanceof Error&&(u=u.message),i({message:`${e}.${m} - ${u}`,category:"OTHER",severity:l})}},p};return{log:r,warn:a,err:c,debug:o,msg:{log:n(r,f.message.messageInfo,"INFO"),warn:n(a,f.message.messageWarn,"WARN"),err:n(c,f.message.messageError,"ERROR")}}},R=y("[lib]")});h();import{intercept as O}from"@neptune";h();var _=y("[OLED Theme]"),L="https://raw.githubusercontent.com/ItzzExcel/neptune-projects/refs/heads/main/themes/black-neptune-theme.css",C,d,T=new MutationObserver(e=>{e.forEach(()=>{E()})});function P(){let e=document.querySelector('span[data-test="now-playing-track-title"]');e&&T.observe(e,{characterData:!0,childList:!0,subtree:!0,innerHTML:!0})}function D(e){let t=document.createElement("style");return t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),document.head.appendChild(t),t}function U(){d&&d.parentNode&&d.parentNode.removeChild(d)}async function $(e){try{let t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.text()}catch(t){return _.msg.err(`Failed to fetch URL: ${t.message}`),null}}(async()=>(C=await $(L),d=D(C)))();var E=function(e=0){e===1&&setTimeout(()=>{E()},2e3);let t=document.querySelector('figure[class*="albumImage"] > div > div > div > img'),r;t&&(r=t.src,r=r.replace(/\d+x\d+/,"1280x1280"),t.src=r);let a=document.querySelector('[class*="nowPlayingContainer"]');if(a&&r){a.querySelectorAll(".corner-image").forEach(s=>s.remove());let o=document.createElement("img");o.src=r,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);let n=document.createElement("img");if(n.src=r,n.className="corner-image",n.style.position="absolute",n.style.left="50%",n.style.top="50%",n.style.transform="translate(-50%, -50%)",n.style.width="75vw",n.style.height="150vh",n.style.objectFit="cover",n.style.zIndex="-1",n.style.filter="blur(100px) brightness(0.6) contrast(1.2) saturate(1)",n.style.animation="spin 35s linear infinite",a.appendChild(n),!document.querySelector("#spinAnimation")){let s=document.createElement("style");s.id="spinAnimation",s.textContent=` @keyframes spin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } } - `,document.head.appendChild(s)}}},$=function(){[...document.getElementsByClassName("corner-image")].forEach(t=>{t.remove()})},L=p("playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION",i),q=p("playbackControls/MEDIA_PRODUCT_TRANSITION",i),F=p("playbackControls/SEEK",i),z=p("playbackControls/SET_PLAYBACK_STATE",i),H=p("playbackControls/TIME_UPDATE",i);function Y(){U(),L(),q(),F(),z(),H(),$()}export{Y as onUnload}; + `,document.head.appendChild(s)}}},q=function(){[...document.getElementsByClassName("corner-image")].forEach(e=>{e.remove()})},F=["playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION","playbackControls/MEDIA_PRODUCT_TRANSITION","playbackControls/SEEK","playbackControls/SET_PLAYBACK_STATE","playbackControls/TIME_UPDATE","playbackControls/"],M=F.map(e=>O(e,E));P();function Y(){U(),M.forEach(e=>e()),q(),T.disconnect()}export{Y as onUnload}; diff --git a/plugins/plugins/oled-theme/dist/manifest.json b/plugins/plugins/oled-theme/dist/manifest.json index 6a92ef9..7c81faa 100644 --- a/plugins/plugins/oled-theme/dist/manifest.json +++ b/plugins/plugins/oled-theme/dist/manifest.json @@ -1 +1 @@ -{"name":"Dark Abyss (OLED Theme)","description":"A working themem, ong.","author":"itzzexcel@github","hash":"f197c4479672784c42c856eae4408da9","metafile":{"inputs":{"plugins/oled-theme/src/tracer.js":{"bytes":1596,"imports":[{"path":"@neptune","kind":"import-statement","external":true}],"format":"esm"},"plugins/oled-theme/src/index.js":{"bytes":6084,"imports":[{"path":"plugins/oled-theme/src/tracer.js","kind":"import-statement","original":"./tracer"},{"path":"@neptune","kind":"import-statement","external":true},{"path":"plugins/oled-theme/src/tracer.js","kind":"require-call","original":"./tracer"}],"format":"esm"}},"outputs":{"plugins/oled-theme/dist/index.js":{"imports":[{"path":"@neptune","kind":"import-statement","external":true},{"path":"@neptune","kind":"import-statement","external":true}],"exports":["onUnload"],"entryPoint":"plugins/oled-theme/src/index.js","inputs":{"plugins/oled-theme/src/tracer.js":{"bytesInOutput":693},"plugins/oled-theme/src/index.js":{"bytesInOutput":2516}},"bytes":3679}}}} \ No newline at end of file +{"name":"Dark Abyss (OLED Theme)","description":"A working themem, ong.","author":"itzzexcel@github","hash":"87194c52bf7eb9f6793d820bd540a2c0","metafile":{"inputs":{"plugins/oled-theme/src/tracer.js":{"bytes":1596,"imports":[{"path":"@neptune","kind":"import-statement","external":true}],"format":"esm"},"plugins/oled-theme/src/index.js":{"bytes":6154,"imports":[{"path":"plugins/oled-theme/src/tracer.js","kind":"import-statement","original":"./tracer"},{"path":"@neptune","kind":"import-statement","external":true},{"path":"plugins/oled-theme/src/tracer.js","kind":"require-call","original":"./tracer"}],"format":"esm"}},"outputs":{"plugins/oled-theme/dist/index.js":{"imports":[{"path":"@neptune","kind":"import-statement","external":true},{"path":"@neptune","kind":"import-statement","external":true}],"exports":["onUnload"],"entryPoint":"plugins/oled-theme/src/index.js","inputs":{"plugins/oled-theme/src/tracer.js":{"bytesInOutput":693},"plugins/oled-theme/src/index.js":{"bytesInOutput":2750}},"bytes":3913}}}} \ No newline at end of file diff --git a/plugins/plugins/oled-theme/src/index.js b/plugins/plugins/oled-theme/src/index.js index fb924a4..1253472 100644 --- a/plugins/plugins/oled-theme/src/index.js +++ b/plugins/plugins/oled-theme/src/index.js @@ -7,6 +7,21 @@ const themeUrl = "https://raw.githubusercontent.com/ItzzExcel/neptune-projects/r let style; let styleElement; +const titleObserver = new MutationObserver((mutations) => { + mutations.forEach(() => { + onTrackChanged(); + }); +}); + +function observeTrackTitle() { + const trackTitleElement = document.querySelector('span[data-test="now-playing-track-title"]'); + if (trackTitleElement) { + titleObserver.observe(trackTitleElement, { + characterData: true, + childList: true + }); + } +} function ApplyCSS(style) { const styleElement = document.createElement("style"); @@ -136,26 +151,24 @@ const cleanUpDynamicArt = function () { // element.style.animation = "spin 20s linear infinite"; // }); // } +const PLAYBACK_EVENTS = [ + "playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION", + "playbackControls/MEDIA_PRODUCT_TRANSITION", + "playbackControls/SEEK", + "playbackControls/SET_PLAYBACK_STATE", + "playbackControls/TIME_UPDATE", + "playbackControls/" +]; -const unOnTrackChanged1 = intercept("playbackControls/PREFILL_MEDIA_PRODUCT_TRANSITION", onTrackChanged); -const unOnTrackChanged2 = intercept("playbackControls/MEDIA_PRODUCT_TRANSITION", onTrackChanged); -const unOnTrackChanged3 = intercept("playbackControls/SEEK", onTrackChanged); -const unOnTrackChanged4 = intercept("playbackControls/SET_PLAYBACK_STATE", onTrackChanged); -const unOnTrackChanged5 = intercept("playbackControls/TIME_UPDATE", onTrackChanged); -// const unOnTrackPaused1 = intercept("playbackControls/STOP", onTrackPaused); -// const unOnTrackPaused2 = intercept("playbackControls/PAUSE", onTrackPaused); -// const unOnTrackResumed = intercept("playbackControls/PLAY", onTrackResumed); +const unsubscribeFunctions = PLAYBACK_EVENTS.map(event => + intercept(event, onTrackChanged) +); +observeTrackTitle(); export function onUnload() { CleanUpCSS(); - unOnTrackChanged1(); - unOnTrackChanged2(); - unOnTrackChanged3(); - unOnTrackChanged4(); - unOnTrackChanged5(); + unsubscribeFunctions.forEach(unsubscribe => unsubscribe()); cleanUpDynamicArt(); - // unOnTrackPaused1(); - // unOnTrackPaused2(); - // unOnTrackResumed(); + titleObserver.disconnect(); } \ No newline at end of file