MediaWiki:Common.js: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 28: Line 28:
el: $el,
el: $el,
left: 0,
left: 0,
width: $el.width() + 12,
width: $el.width() + 12
tail: undefined
};
};


Line 62: Line 61:
items.forEach(function (item) {
items.forEach(function (item) {
item.el.html('<div class="content">' + item.el.html() + '</div>');
item.el.html('<div class="content">' + item.el.html() + '</div>');
});
// add parent classes
items.forEach(function (item) {
if (item.children.length > 0) {
item.el.addClass("tt-parent");
item.showChildren = true;
var className = item.el.attr("data-tt-id");
//item.el.closest("tr").addClass(className);
var children = item.children.slice();
while(children.length > 0)
{
children[0].el.closest("tr").addClass(className);
if(children[0].children.length > 0)
children.push.apply(children[0], children[0].children);
children.shift();
}
//$("." + className).wrapAll("<span id='children_group_" + item.el.attr("data-tt-id") + "'></col>");
}
});
});
Line 85: Line 107:
});
});
item.tail = $tail;
item.el.prepend($tail);
item.el.prepend($tail);
});
// add parent classes
items.forEach(function (item) {
if (item.children.length > 0) {
item.el.addClass("tt-parent");
item.showChildren = true;
var className = item.el.attr("data-tt-id");
//item.el.closest("tr").addClass(className);
var children = item.children.slice();
while(children.length > 0)
{
children[0].el.closest("tr").addClass(className);
children[0].tail.addClass(className);
if(children[0].children.length > 0)
children.push.apply(children[0], children[0].children);
children.shift();
}
//$("." + className).wrapAll("<span id='children_group_" + item.el.attr("data-tt-id") + "'></col>");
}
});
});


Line 138: Line 135:


hide(id);*/
hide(id);*/
$("." + $el.attr("data-tt-id")).fadeOut();
$("." + $el.attr("data-tt-id")).hide();
}
}
else {
else {
Line 146: Line 143:
$(child.el).closest("tr").removeClass("tt-hide");
$(child.el).closest("tr").removeClass("tt-hide");
});*/
});*/
$("." + $el.attr("data-tt-id")).fadeIn();
$("." + $el.attr("data-tt-id")).show();
}
}


Confirmedusers, editor, Administrators
886

edits