Fix color fallback

This commit is contained in:
Mister Rajoy
2020-12-09 19:27:37 +01:00
parent 4b7fdd2457
commit 4b40c1a784

View File

@@ -81,6 +81,7 @@
var name = option.name; var name = option.name;
var css = option.css; var css = option.css;
var description = option.description; var description = option.description;
//html += '<label><input is="emby-checkbox" class="chkLibrary" type="checkbox" data-mini="true" id="' + id + '" name="' + id + '" data-value="' + value + '" '+' /><span>' + name + '</span></label>'; //html += '<label><input is="emby-checkbox" class="chkLibrary" type="checkbox" data-mini="true" id="' + id + '" name="' + id + '" data-value="' + value + '" '+' /><span>' + name + '</span></label>';
html += '<div class="checkboxContainer checkboxContainer-withDescription"><label><input class = "checkbox" type="checkbox" is="emby-checkbox" id="' + id + '"name="' + id + '" data-css="' + css + '" '+' /><span>'+ name +'</span></label><div class="fieldDescription checkboxFieldDescription">'+description+'</div></div>' html += '<div class="checkboxContainer checkboxContainer-withDescription"><label><input class = "checkbox" type="checkbox" is="emby-checkbox" id="' + id + '"name="' + id + '" data-css="' + css + '" '+' /><span>'+ name +'</span></label><div class="fieldDescription checkboxFieldDescription">'+description+'</div></div>'
return html; return html;
@@ -169,11 +170,11 @@
var colorPickers = document.getElementsByClassName("color"); var colorPickers = document.getElementsByClassName("color");
for (let element of colorPickers) { for (let element of colorPickers) {
savedHtml += element.outerHTML savedHtml += element.outerHTML
if(element.getAttribute("data-mode")=="hex"){ if(element.getAttribute("data-mode")=="rgba"){
color=element.value;
}else if(element.getAttribute("data-mode")=="rgba"){
var rgbColor = hexToRgb( element.value); var rgbColor = hexToRgb( element.value);
color = rgbColor.r + "," +rgbColor.g +"," + rgbColor.b; color = rgbColor.r + "," +rgbColor.g +"," + rgbColor.b;
} else{
color=element.value;
} }
css+= element.getAttribute("data-css").replaceAll("$",color)+ "\n"; css+= element.getAttribute("data-css").replaceAll("$",color)+ "\n";
} }