Skip to content

Commit 5c78973

Browse files
authored
fix: gradient slider binding (#263)
1 parent ecb8b06 commit 5c78973

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

JS/Nebula.uc.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,10 @@
369369
// Save original
370370
this._origMethods.set(proto, proto.blendWithWhiteOverlay);
371371

372-
proto.blendWithWhiteOverlay = (baseColor, opacity) => {
373-
const val = +this.gradientSlider?.value ?? opacity;
372+
const moduleInstance = this;
373+
374+
proto.blendWithWhiteOverlay = function(baseColor, opacity) {
375+
const val = +moduleInstance.gradientSlider?.value ?? opacity;
374376
if (val === 0) {
375377
if (Array.isArray(baseColor)) {
376378
return `rgba(${baseColor.join(",")},0)`;
@@ -380,7 +382,8 @@
380382
}
381383
return "rgba(0,0,0,0)";
382384
}
383-
return this._origMethods.get(proto).call(this, baseColor, opacity);
385+
// Call the original method with the correct context
386+
return moduleInstance._origMethods.get(proto).call(this, baseColor, opacity);
384387
};
385388

386389
this._patched = true;
@@ -408,7 +411,7 @@
408411
Nebula.logger.log("🧹 [GradientSlider] Destroyed");
409412
}
410413
}
411-
414+
412415
// ========== NebulaTitlebarBackgroundModule ==========
413416
class NebulaTitlebarBackgroundModule {
414417
constructor() {
@@ -812,7 +815,7 @@
812815
constructor() {
813816
this.OVERLAY_ID = 'Nebula-media-cover-art';
814817
this.TOOLBAR_ITEM_SELECTOR = '#zen-media-controls-toolbar > toolbaritem';
815-
818+
816819
this.lastArtworkUrl = null;
817820
this.originalSetupMediaController = null;
818821
this.overlay = null;
@@ -1265,8 +1268,4 @@
12651268

12661269
// Start the core
12671270
Nebula.init();
1268-
1269-
12701271
})();
1271-
1272-

0 commit comments

Comments
 (0)