mirror of
https://github.com/9001/copyparty.git
synced 2026-06-20 13:12:26 -06:00
fix firefox accent color load
This commit is contained in:
parent
4a90df0b93
commit
9be5a4277a
|
|
@ -1340,12 +1340,11 @@ ebi('op_cfg').innerHTML = (
|
||||||
|
|
||||||
// accent color
|
// accent color
|
||||||
function parseColor (strColor) {
|
function parseColor (strColor) {
|
||||||
var s = new Option().style;
|
var s = new Option().style;
|
||||||
s.color = strColor;
|
s.color = strColor;
|
||||||
return s.color !== '' ? s.color : '';
|
return s.color !== '' ? s.color : '';
|
||||||
}
|
}
|
||||||
function setColor (color) {
|
function setColor (color) {
|
||||||
|
|
||||||
accent = color;
|
accent = color;
|
||||||
swrite('accent', accent);
|
swrite('accent', accent);
|
||||||
var a = accent || '#fc5';
|
var a = accent || '#fc5';
|
||||||
|
|
@ -1353,12 +1352,18 @@ function setColor (color) {
|
||||||
document.documentElement.style.setProperty('--a', a);
|
document.documentElement.style.setProperty('--a', a);
|
||||||
}
|
}
|
||||||
ebi('accent').oninput = ebi('accent_picker').oninput = function () {
|
ebi('accent').oninput = ebi('accent_picker').oninput = function () {
|
||||||
if(this == ebi('accent'))
|
|
||||||
ebi('accent_picker').value = this.value;
|
|
||||||
else if(this == ebi('accent_picker'))
|
|
||||||
ebi('accent').value = this.value;
|
|
||||||
|
|
||||||
var validcolor = parseColor(this.value);
|
var validcolor = parseColor(this.value);
|
||||||
|
console.log(this.value);
|
||||||
|
|
||||||
|
if(this == ebi('accent')){
|
||||||
|
ebi('accent_picker').value = this.value;
|
||||||
|
}
|
||||||
|
else if(this == ebi('accent_picker')){
|
||||||
|
if(this.value == '#000000')
|
||||||
|
validcolor = ''; // firefox submits the color picker value on browser startup
|
||||||
|
ebi('accent').value = this.value;
|
||||||
|
}
|
||||||
|
|
||||||
clmod(ebi('accent'), 'invalid', this.value.length != 0 && validcolor.length == 0);
|
clmod(ebi('accent'), 'invalid', this.value.length != 0 && validcolor.length == 0);
|
||||||
if(validcolor == accent)
|
if(validcolor == accent)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1367,9 +1372,11 @@ ebi('accent').oninput = ebi('accent_picker').oninput = function () {
|
||||||
setColor(validcolor);
|
setColor(validcolor);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
var accent = ebi('accent').value = ebi('accent_picker').value = sread('accent');
|
var accent = sread('accent');
|
||||||
if(accent){
|
if(accent && accent.length > 3){
|
||||||
|
console.log('read accent color from settings: ' + accent);
|
||||||
document.documentElement.style.setProperty('--a', parseColor(accent));
|
document.documentElement.style.setProperty('--a', parseColor(accent));
|
||||||
|
ebi('accent').value = ebi('accent_picker').value = accent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// navpane
|
// navpane
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue