Fix #12 - Add expand tag (#13)

* Fix #12 - Add expand tag

* Add Chinese translation
This commit is contained in:
Misode
2019-09-11 23:40:47 +02:00
committed by GitHub
parent ecbc381c8d
commit d54255669c
4 changed files with 19 additions and 1 deletions

View File

@@ -151,6 +151,15 @@
</div>
<input type="text" class="form-control" onchange="updateField(this)" onfocus="this.select()">
</div>
<div class="input-group mt-3 entry-expand d-none" data-type="boolean" data-field="expand">
<div class="input-group-prepend">
<span class="input-group-text" data-i18n="expand"></span>
</div>
<div class="btn-group">
<button type="button" value="false" class="btn btn-secondary rounded-0" onclick="updateField(this)" data-i18n="false"></button>
<button type="button" value="true" class="btn btn-secondary" onclick="updateField(this)" data-i18n="true"></button>
</div>
</div>
<div class="input-group mt-3 entry-weight d-none" data-type="int" data-field="weight">
<div class="input-group-prepend">
<span class="input-group-text" data-i18n="$entry.weight"></span>

View File

@@ -86,6 +86,7 @@
"group": "Group",
"dynamic": "Dynamic"
},
"expand": "Expand",
"weight": "Weight",
"quality": "Quality"
},

View File

@@ -86,6 +86,7 @@
"group": "组",
"dynamic": "动态"
},
"expand": "展开",
"weight": "权重",
"quality": "每级幸运对权重的影响"
},

View File

@@ -104,6 +104,13 @@ function generateEntry(entry, i, size) {
}
$entry.find('.entry-name input').val(entry.name);
}
if (entry.type === 'minecraft:tag') {
if (entry.expand === undefined) entry.expand = true;
$entry.find('.entry-expand').removeClass('d-none');
generateRadio($entry.find('.entry-expand'), entry.expand);
} else {
delete entry.expand;
}
if (size > 1) {
$entry.find('.entry-weight').removeClass('d-none');
}
@@ -112,7 +119,7 @@ function generateEntry(entry, i, size) {
} else {
$entry.find('.entry-quality').addClass('d-none');
}
if (entry.weight ) {
if (entry.weight) {
$entry.find('.entry-weight input').val(entry.weight);
}
if (entry.quality) {