[refactor] improve update

This commit is contained in:
zombieFox 2020-06-17 22:01:22 +01:00
parent 99dbba64dd
commit b972e2cc83

View File

@ -982,20 +982,12 @@ var update = (function() {
arrayItem.accent.color[key] = 0; arrayItem.accent.color[key] = 0;
}; };
}; };
if (arrayItem.accent.color) {
arrayItem.accent.rgb = { arrayItem.accent.rgb = {
r: arrayItem.accent.color.r, r: arrayItem.accent.color.r,
g: arrayItem.accent.color.g, g: arrayItem.accent.color.g,
b: arrayItem.accent.color.b b: arrayItem.accent.color.b
}; };
delete arrayItem.accent.color; delete arrayItem.accent.color;
} else if (!arrayItem.accent.rgb) {
arrayItem.accent.rgb = {
r: 0,
g: 0,
b: 0
};
};
arrayItem.accent.hsl = { arrayItem.accent.hsl = {
h: 0, h: 0,
s: 0, s: 0,
@ -1021,7 +1013,6 @@ var update = (function() {
} }
}; };
arrayItem.image = ""; arrayItem.image = "";
if (!arrayItem.visual) {
arrayItem.visual = { arrayItem.visual = {
display: arrayItem.display, display: arrayItem.display,
letter: arrayItem.letter, letter: arrayItem.letter,
@ -1034,9 +1025,6 @@ var update = (function() {
if (arrayItem.visual.letter == null) { if (arrayItem.visual.letter == null) {
arrayItem.visual.letter = ""; arrayItem.visual.letter = "";
}; };
};
if (arrayItem.visual) {
if (arrayItem.visual.icon) {
if (arrayItem.visual.icon.label == null) { if (arrayItem.visual.icon.label == null) {
arrayItem.visual.icon.label = ""; arrayItem.visual.icon.label = "";
}; };
@ -1046,11 +1034,6 @@ var update = (function() {
if (arrayItem.visual.icon.prefix == null) { if (arrayItem.visual.icon.prefix == null) {
arrayItem.visual.icon.prefix = ""; arrayItem.visual.icon.prefix = "";
}; };
};
};
if (arrayItem.visual.image == null) {
arrayItem.visual.image = "";
};
}); });
}); });
@ -1083,19 +1066,11 @@ var update = (function() {
b: 0 b: 0
} }
}; };
if (!data.state.link.item.display.visual) {
data.state.link.item.display.visual = data.state.link.item.display.letcon; data.state.link.item.display.visual = data.state.link.item.display.letcon;
};
if (data.state.link.item.display.letcon) {
delete 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 = { data.state.link.item.display.visual.image = {
size: 3 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";
} else if (data.state.link.item.display.order == "nameletcon") { } else if (data.state.link.item.display.order == "nameletcon") {