Tema: pozadina se primenjuje na stranicu tek posle čuvanja, preview ostaje izolovan
This commit is contained in:
@@ -113,20 +113,6 @@ document.addEventListener('alpine:init', () => {
|
||||
this.opacity = this.broj(this.$el.dataset.opacity, 50)
|
||||
this.blurPozadine = this.broj(this.$el.dataset.blurPozadine, 0)
|
||||
this.glassOpacity = this.broj(this.$el.dataset.glassOpacity, 10)
|
||||
// ažuriraj CSS custom properties kad se slajder pomera — promena se vidi odmah
|
||||
this.$watch('blur', () => this.primeniBg())
|
||||
this.$watch('opacity', () => this.primeniBg())
|
||||
this.$watch('blurPozadine', () => this.primeniBg())
|
||||
this.$watch('glassOpacity', () => this.primeniBg())
|
||||
},
|
||||
primeniBg() {
|
||||
const r = document.documentElement
|
||||
r.style.setProperty('--app-blur-bg', this.blurPozadine + 'px')
|
||||
r.style.setProperty('--app-blur-bg-inset', this.blurPozadine > 0 ? '-20px' : '0')
|
||||
r.style.setProperty('--app-overlay', this.opacity + '%')
|
||||
r.style.setProperty('--app-blur', this.blur + 'px')
|
||||
r.style.setProperty('--app-glass-sb', this.glassOpacity + '%')
|
||||
r.style.setProperty('--app-glass-el', this.glassOpacity + '%')
|
||||
},
|
||||
// vraća ceo broj iz vrednosti; ako nije broj, vraća podrazumevano (0 ostaje 0)
|
||||
broj(vrednost, podrazumevano) {
|
||||
|
||||
@@ -391,6 +391,21 @@
|
||||
if (brzina.value) document.body.dataset.brzinaAnimacije = brzina.value;
|
||||
else delete document.body.dataset.brzinaAnimacije;
|
||||
}
|
||||
// posle čuvanja stilova lične pozadine ažuriraj CSS custom properties
|
||||
var bgBlur = f.querySelector('[name="lokalna_pozadina_blur"]');
|
||||
if (bgBlur) {
|
||||
var r = document.documentElement;
|
||||
var bgBlurBg = parseInt(f.querySelector('[name="lokalna_pozadina_blur_pozadine"]').value) || 0;
|
||||
var bgOp = parseInt(f.querySelector('[name="lokalna_pozadina_opacity"]').value) || 0;
|
||||
var bgGlass = parseInt(f.querySelector('[name="lokalna_pozadina_glass_opacity"]').value) || 0;
|
||||
var bgBlurV = parseInt(bgBlur.value) || 0;
|
||||
r.style.setProperty('--app-blur-bg', bgBlurBg + 'px');
|
||||
r.style.setProperty('--app-blur-bg-inset', bgBlurBg > 0 ? '-20px' : '0');
|
||||
r.style.setProperty('--app-overlay', bgOp + '%');
|
||||
r.style.setProperty('--app-blur', bgBlurV + 'px');
|
||||
r.style.setProperty('--app-glass-sb', bgGlass + '%');
|
||||
r.style.setProperty('--app-glass-el', bgGlass + '%');
|
||||
}
|
||||
// promena teme zahteva reload (menja se ceo CSS fajl)
|
||||
if (f.querySelector('[name="lokalna_tema"]')) location.reload();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user