Enhance UI/UX

This commit is contained in:
Oliver Falk
2022-12-30 12:00:01 +01:00
parent 0449e4f00a
commit f613b79ef9

View File

@@ -42,132 +42,191 @@
"&accessories_type=" + accessories_type + "&clothe_type=" + clothe_type + "&accessories_type=" + accessories_type + "&clothe_type=" + clothe_type +
"&clothe_color=" + clothe_color + "&clothe_graphic_type=" + clothe_graphic_type; "&clothe_color=" + clothe_color + "&clothe_graphic_type=" + clothe_graphic_type;
$("#avatar_image").attr('src', url); $("#avatar_image").attr('src', url);
// TODO: Wire up manipulating size
$("#avatar_image").attr('width', size + "px"); $("#avatar_image").attr('width', size + "px");
} }
</script> </script>
<h3>{% trans 'Adjust your avatar:' %}</h3> <h3>{% trans 'Adjust your avatar:' %}</h3>
<div> <div>
<div style="width:172px;margin-left:20px;float:left"> <div>
<img id="avatar_image" width="172px"> <div id="avatar_image_div">
<img id="avatar_image" width="172px" style="float:left;">
<script> <script>
update_image(); update_image();
</script> </script>
</div> </div>
<div> <div id="options">
<div class="btn-group form-group" role="group" style="float:none;"> <div class="form-group" role="group" style="float:right;width:50%">
<h3>{% trans 'Skin color' %}</h3> <label for="preview_size" class="form-label">{% trans 'Preview size'%}</label>
<input type="range" class="form-range" id="preview_size" min="16" max="500" step="1" value="172">
<script>
var preview_size = document.getElementById("preview_size");
preview_size.addEventListener("input", function() {
size = this.value;
update_image();
});
</script>
</div>
</div>
<hr style="clear:both;"/>
<div class="form-group" role="group" style="float:none;">
<label for="skincolor" class="form-label">{% trans 'Skin color'%}</label>
<div id="skincolor">
{% for color in SkinColor %} {% for color in SkinColor %}
<a class="button achoose" style="background:{{ color.main_value }};" onclick='skin_color="{{ color.value }}"; update_image();'>&nbsp;</a> <a class="button achoose" style="background:{{ color.main_value }};" onclick='skin_color="{{ color.value }}"; update_image();'>&nbsp;</a>
{% endfor %} {% endfor %}
</div> </div>
</div>
<br/> <br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Hair color' %}</h3> <div class="form-group" role="group" style="float:none;">
<label for="haircolor" class="form-label">{% trans 'Hair color'%}</label>
<div id="haircolor">
{% for color in HairColor %} {% for color in HairColor %}
<a class="button achoose" style="background:{{ color.main_value }};" onclick='hair_color="{{ color.value }}"; update_image();'>&nbsp;</a> <a class="button achoose" style="background:{{ color.main_value }};" onclick='hair_color="{{ color.value }}"; update_image();'>&nbsp;</a>
{% endfor %} {% endfor %}
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Facial hair type' %}</h3>
{% for type in FacialHairType %}
<a class="button" onclick='facial_hair_type="{{ type.value }}"; update_image();'>
{% if type.name == 'BEARD_MEDIUM' %}
Medium
{% elif type.name == 'BEARD_LIGHT' %}
Light
{% elif type.name == 'BEARD_MAJESTIC' %}
Majestic
{% elif type.name == 'MOUSTACHE_FANCY' %}
Moustache fancy
{% elif type.name == 'MOUSTACHE_MAGNUM' %}
Moustache magnum
{% else %}
Default
{% endif %}
</a>
{% endfor %}
</div> </div>
<br/> <br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Facial hair color' %}</h3> <div class="form-group" role="group" style="float:none;">
<label for="facialhairtype" class="form-label">{% trans 'Facial hair type' %}</label>
<input type="range" class="form-range" id="facialhairtype" min="0" max="5" step="1" value="0">
<script>
var elem = document.getElementById("facialhairtype");
facialhairtype.addEventListener("input", function() {
facial_hair_type = this.value;
var colordiv = document.getElementById("facialhaircolor").parentNode;
if(this.value != 0) {
colordiv.display = "block";
colordiv.removeAttribute("hidden");
} else {
colordiv.setAttribute("hidden", "hidden");
}
update_image();
});
</script>
</div>
<div hidden="hidden" class="form-group" style="float:none;">
<label for="facialhaircolor" class="form-label">{% trans 'Facial hair color'%}</label>
<div id="facialhaircolor">
{% for color in HairColor %} {% for color in HairColor %}
<a class="button achoose" style="background:{{ color.main_value }};" onclick='facial_hair_color="{{ color.value }}"; update_image();'>&nbsp;</a> <a class="button achoose" style="background:{{ color.main_value }};" onclick='facial_hair_color="{{ color.value }}"; update_image();'>&nbsp;</a>
{% endfor %} {% endfor %}
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Top Type' %}</h3>
{% for type in TopType %}
<a class="button" onclick='top_type="{{ type.value }}"; update_image();'>{{ type.name }}</a>
{% endfor %}
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;"> <div class="form-group" role="group" style="float:none;">
<h3>{% trans 'Hat color' %}</h3> <label for="toptype" class="form-label">{% trans 'Top type' %}</label>
<input type="range" class="form-range" id="toptype" min="0" max="34" step="1" value="0">
<script>
var elem = document.getElementById("toptype");
elem.addEventListener("input", function() {
top_type = this.value;
update_image();
});
</script>
</div>
<div class="form-group" role="group" style="float:none;">
<label for="hatcolor" class="form-label">{% trans 'Hat color'%}</label>
<div id="hatcolor">
{% for color in HatColor %} {% for color in HatColor %}
<a class="button achoose" style="background:{{ color.main_value }};" onclick='hat_color="{{ color.value }}"; update_image();'>&nbsp;</a> <a class="button achoose" style="background:{{ color.main_value }};" onclick='hat_color="{{ color.value }}"; update_image();'>&nbsp;</a>
{% endfor %} {% endfor %}
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Mouth type' %}</h3>
{% for type in MouthType %}
<a class="button" onclick='mouth_type="{{ type.value }}"; update_image();'>{{ type.name }}</a>
{% endfor %}
</div> </div>
<br/> <br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Eyes type' %}</h3> <div class="form-group" role="group" style="float:none;">
{% for type in EyesType %} <label for="mouthtype" class="form-label">{% trans 'Mouth type' %}</label>
<a class="button" onclick='eyes_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> <input type="range" class="form-range" id="mouthtype" min="0" max="11" step="1" value="0">
{% endfor %} <script>
var elem = document.getElementById("mouthtype");
elem.addEventListener("input", function() {
mouth_type = this.value;
update_image();
});
</script>
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;"> <div class="form-group" role="group" style="float:none;">
<h3>{% trans 'Eyebrow type' %}</h3> <label for="eyestype" class="form-label">{% trans 'Eyes type' %}</label>
{% for type in EyebrowType %} <input type="range" class="form-range" id="eyestype" min="0" max="11" step="1" value="0">
<a class="button" onclick='eyebrow_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> <script>
{% endfor %} var elem = document.getElementById("eyestype");
elem.addEventListener("input", function() {
eyes_type = this.value;
update_image();
});
</script>
</div> </div>
<!--
<br/> <div class="form-group" role="group" style="float:none;">
<div class="btn-group form-group" role="group" style="float:none;"> <label for="eyebrowtype" class="form-label">{% trans 'Eyerbrow type' %}</label>
<h3>{% trans 'Nose type' %}</h3> <input type="range" class="form-range" id="eyebrowtype" min="0" max="12" step="1" value="0">
{% for type in NoseType %} <script>
<a class="button" onclick='nose_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> var elem = document.getElementById("eyebrowtype");
{% endfor %} elem.addEventListener("input", function() {
eyebrow_type = this.value;
update_image();
});
</script>
</div> </div>
-->
<br/> <div class="form-group" role="group" style="float:none;">
<div class="btn-group form-group" role="group" style="float:none;"> <label for="accessoriestype" class="form-label">{% trans 'Accessories type' %}</label>
<h3>{% trans 'Glasses' %}</h3> <input type="range" class="form-range" id="accessoriestype" min="0" max="6" step="1" value="0">
{% for type in AccessoriesType %} <script>
<a class="button" onclick='accessories_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> var elem = document.getElementById("accessoriestype");
{% endfor %} elem.addEventListener("input", function() {
accessories_type = this.value;
update_image();
});
</script>
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;"> <div class="form-group" role="group" style="float:none;">
<h3>{% trans 'Clothe type' %}</h3> <label for="clothetype" class="form-label">{% trans 'Clothe type' %}</label>
{% for type in ClotheType %} <input type="range" class="form-range" id="clothetype" min="0" max="8" step="1" value="0">
<a class="button" onclick='clothe_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> <script>
{% endfor %} var elem = document.getElementById("clothetype");
elem.addEventListener("input", function() {
clothe_type = this.value;
var thediv = document.getElementById("clothegraphictype").parentNode;
if(this.value == 3) {
thediv.display = "block";
thediv.removeAttribute("hidden");
} else {
thediv.setAttribute("hidden", "hidden");
}
update_image();
});
</script>
</div> </div>
<br/>
<div class="btn-group form-group" role="group" style="float:none;"> <div class="form-group" role="group" style="float:none;">
<h3>{% trans 'Clothe color' %}</h3> <label for="clothegraphictype" class="form-label">{% trans 'Clothe color' %}</label>
<div id"=clothegraphictype">
{% for color in ClotheColor %} {% for color in ClotheColor %}
<a class="button achoose" style="background:{{ color.main_value }};" onclick='clothe_color="{{ color.value }}"; update_image();'>&nbsp;</a> <a class="button achoose" style="background:{{ color.main_value }};" onclick='clothe_color="{{ color.value }}"; update_image();'>&nbsp;</a>
{% endfor %} {% endfor %}
</div> </div>
</div>
<br/> <br/>
<div class="btn-group form-group" role="group" style="float:none;">
<h3>{% trans 'Clothe graphic type' %}</h3> <div hidden="hidden" class="form-group" role="group" style="float:none;">
{% for type in ClotheGraphicType %} <label for="clothegraphictype" class="form-label">{% trans 'Clothe graphic type' %}</label>
<a class="button" onclick='clothe_graphic_type="{{ type.value }}"; update_image();'>{{ type.name }}</a> <input type="range" class="form-range" id="clothegraphictype" min="0" max="10" step="1" value="0">
{% endfor %} <script>
var elem = document.getElementById("clothegraphictype");
elem.addEventListener("input", function() {
clothe_graphic_type = this.value;
update_image();
});
</script>
</div> </div>
</div> </div>