mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-30 01:32:44 +00:00
Fix issues with sets and 1.14 functions
This commit is contained in:
3
model.js
3
model.js
@@ -219,7 +219,10 @@ function addToSet(el, array) {
|
||||
|
||||
function removeFromSet(el, array) {
|
||||
let parent = getParent(el);
|
||||
console.warn(parent[array]);
|
||||
console.log($(el).attr('value'));
|
||||
let index = parent[array].indexOf($(el).attr('value'));
|
||||
console.log(parent, index);
|
||||
if (index > -1) {
|
||||
parent[array].splice(index, 1);
|
||||
invalidated();
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
{
|
||||
"id": "function",
|
||||
"type": "enum",
|
||||
"filter": true,
|
||||
"translate": "function.type",
|
||||
"translateValue": "function.type",
|
||||
"default": "minecraft:set_count",
|
||||
|
||||
@@ -168,7 +168,8 @@
|
||||
{
|
||||
"id": "rolls",
|
||||
"type": "random",
|
||||
"translate": "pool.rolls"
|
||||
"translate": "pool.rolls",
|
||||
"help": true
|
||||
},
|
||||
{
|
||||
"id": "bonus_rolls",
|
||||
|
||||
3
view.js
3
view.js
@@ -246,6 +246,7 @@ function generateSet(data, struct) {
|
||||
collection = collections[struct.values];
|
||||
}
|
||||
for (let value of collection) {
|
||||
if (data && (data.includes(value))) continue;
|
||||
let $item = $('<a class="dropdown-item" onclick="addToSet(this, \'' + struct.id + '\')" />');
|
||||
setValueAndName($item, value, struct.translateValue);
|
||||
$el.find('.dropdown-menu').append($item);
|
||||
@@ -254,7 +255,7 @@ function generateSet(data, struct) {
|
||||
let $setContainer = $('<div/>');
|
||||
for (let option of data) {
|
||||
let $item = $('<button type="button" onclick="removeFromSet(this, \'' + struct.id + '\')" />').addClass('btn btn-outline-danger bg-light btn-sm mr-2 mt-2');
|
||||
setValueAndName($item, correctNamespace(option), struct.translateValue);
|
||||
setValueAndName($item, option, struct.translateValue);
|
||||
$setContainer.append($item);
|
||||
}
|
||||
$el.append($setContainer);
|
||||
|
||||
Reference in New Issue
Block a user