[refactor] improve update

This commit is contained in:
zombieFox 2020-06-17 21:37:36 +01:00
parent 73ee77431b
commit 99dbba64dd

View File

@ -982,12 +982,20 @@ var update = (function() {
arrayItem.accent.color[key] = 0; arrayItem.accent.color[key] = 0;
}; };
}; };
arrayItem.accent.rgb = { if (arrayItem.accent.color) {
r: arrayItem.accent.color.r, arrayItem.accent.rgb = {
g: arrayItem.accent.color.g, r: arrayItem.accent.color.r,
b: arrayItem.accent.color.b g: arrayItem.accent.color.g,
b: arrayItem.accent.color.b
};
delete arrayItem.accent.color;
} else if (!arrayItem.accent.rgb) {
arrayItem.accent.rgb = {
r: 0,
g: 0,
b: 0
};
}; };
delete arrayItem.accent.color;
arrayItem.accent.hsl = { arrayItem.accent.hsl = {
h: 0, h: 0,
s: 0, s: 0,
@ -1013,26 +1021,35 @@ var update = (function() {
} }
}; };
arrayItem.image = ""; arrayItem.image = "";
arrayItem.visual = { if (!arrayItem.visual) {
display: arrayItem.display, arrayItem.visual = {
letter: arrayItem.letter, display: arrayItem.display,
image: "", letter: arrayItem.letter,
icon: arrayItem.icon image: "",
icon: arrayItem.icon
};
delete arrayItem.display;
delete arrayItem.letter;
delete arrayItem.icon;
if (arrayItem.visual.letter == null) {
arrayItem.visual.letter = "";
};
}; };
delete arrayItem.display; if (arrayItem.visual) {
delete arrayItem.letter; if (arrayItem.visual.icon) {
delete arrayItem.icon; if (arrayItem.visual.icon.label == null) {
if (arrayItem.visual.letter == null) { arrayItem.visual.icon.label = "";
arrayItem.visual.letter = ""; };
if (arrayItem.visual.icon.name == null) {
arrayItem.visual.icon.name = "";
};
if (arrayItem.visual.icon.prefix == null) {
arrayItem.visual.icon.prefix = "";
};
};
}; };
if (arrayItem.visual.icon.label == null) { if (arrayItem.visual.image == null) {
arrayItem.visual.icon.label = ""; arrayItem.visual.image = "";
};
if (arrayItem.visual.icon.name == null) {
arrayItem.visual.icon.name = "";
};
if (arrayItem.visual.icon.prefix == null) {
arrayItem.visual.icon.prefix = "";
}; };
}); });
@ -1066,10 +1083,18 @@ var update = (function() {
b: 0 b: 0
} }
}; };
data.state.link.item.display.visual = data.state.link.item.display.letcon; if (!data.state.link.item.display.visual) {
delete data.state.link.item.display.letcon; data.state.link.item.display.visual = data.state.link.item.display.letcon;
data.state.link.item.display.visual.image = { };
size: 3 if (data.state.link.item.display.letcon) {
delete data.state.link.item.display.letcon;
};
if (data.state.link.item.display.visual) {
if (!data.state.link.item.display.visual.image) {
data.state.link.item.display.visual.image = {
size: 3
};
};
}; };
if (data.state.link.item.display.order == "letconname") { if (data.state.link.item.display.order == "letconname") {
data.state.link.item.display.order = "visualname"; data.state.link.item.display.order = "visualname";