mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-02 13:42:55 +00:00
Add help to other field types
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
.btn-circle {
|
.help-tooltip {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
padding: 6px 0px;
|
padding: 6px 0px;
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
"group": "Executes all child entries when own conditions pass",
|
"group": "Executes all child entries when own conditions pass",
|
||||||
"dynamic": "Gets block specific drops"
|
"dynamic": "Gets block specific drops"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"$pool": {
|
||||||
|
"rolls": "The amount of entries that are randomly chosen"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$condition": {
|
"$condition": {
|
||||||
|
|||||||
+2
-1
@@ -33,7 +33,8 @@
|
|||||||
{
|
{
|
||||||
"id": "rolls",
|
"id": "rolls",
|
||||||
"type": "random",
|
"type": "random",
|
||||||
"translate": "$pool.rolls"
|
"translate": "$pool.rolls",
|
||||||
|
"help": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bonus_rolls",
|
"id": "bonus_rolls",
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ let structure;
|
|||||||
let components;
|
let components;
|
||||||
let collections;
|
let collections;
|
||||||
|
|
||||||
|
i18next.on('initialized', () => {
|
||||||
|
$('[data-help]').each(function() {
|
||||||
|
console.log('ahhh');
|
||||||
|
$(this).tooltip({title: i18next.t('$help.' + $(this).attr('data-help'))});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
changeVersion('1.14');
|
changeVersion('1.14');
|
||||||
function changeVersion(version) {
|
function changeVersion(version) {
|
||||||
$.getJSON('schemas/' + version + '.json', json => {
|
$.getJSON('schemas/' + version + '.json', json => {
|
||||||
@@ -95,6 +102,9 @@ function generateString(data, struct) {
|
|||||||
$el.attr('data-index', struct.id);
|
$el.attr('data-index', struct.id);
|
||||||
$el.find('[data-name]').attr('data-i18n', struct.translate);
|
$el.find('[data-name]').attr('data-i18n', struct.translate);
|
||||||
$el.find('input').val(data);
|
$el.find('input').val(data);
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +117,9 @@ function generateBoolean(data, struct) {
|
|||||||
} else if (data === false) {
|
} else if (data === false) {
|
||||||
$el.find('[value="false"]').addClass('active');
|
$el.find('[value="false"]').addClass('active');
|
||||||
}
|
}
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +141,9 @@ function generateRandom(data, struct) {
|
|||||||
$el.find('.exact').removeClass('d-none');
|
$el.find('.exact').removeClass('d-none');
|
||||||
$el.find('.exact').val(data);
|
$el.find('.exact').val(data);
|
||||||
}
|
}
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +159,9 @@ function generateRange(data, struct) {
|
|||||||
$el.find('.exact').removeClass('d-none');
|
$el.find('.exact').removeClass('d-none');
|
||||||
$el.find('.exact').val(data);
|
$el.find('.exact').val(data);
|
||||||
}
|
}
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +173,9 @@ function generateBoundary(data, struct) {
|
|||||||
$el.find('.range.min').val(data.min);
|
$el.find('.range.min').val(data.min);
|
||||||
$el.find('.range.max').val(data.max);
|
$el.find('.range.max').val(data.max);
|
||||||
}
|
}
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +280,9 @@ function generateJson(data, struct) {
|
|||||||
data = JSON.stringify(data);
|
data = JSON.stringify(data);
|
||||||
}
|
}
|
||||||
$el.find('textarea').val(data).keydown(e => preventNewline(e));
|
$el.find('textarea').val(data).keydown(e => preventNewline(e));
|
||||||
|
if (struct.help) {
|
||||||
|
$el.append(generateTooltip(struct.translate));
|
||||||
|
}
|
||||||
return {out: data, component: $el};
|
return {out: data, component: $el};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +461,7 @@ function generateField(data, field, parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateTooltip(str) {
|
function generateTooltip(str) {
|
||||||
let $el = $('<button type="button" class="btn btn-circle ml-2" data-toggle="tooltip">?</button>');
|
let $el = $('<button type="button" class="btn help-tooltip ml-2" data-toggle="tooltip" data-help="' + str + '">?</button>');
|
||||||
$el.tooltip({title: i18next.t('$help.' + str)});
|
$el.tooltip({title: i18next.t('$help.' + str)});
|
||||||
return $el;
|
return $el;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user