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 61: Line 62:
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>');
});
// draw lines
items.forEach(function (item) {
if (item.parent === undefined) {
return;
}
var childPos = item.el.position();
var parent = item.parent;
var parentPos = parent.el.position();
var height = childPos.top - parentPos.top;
var width = item.left - parent.left - parent.width/2;
var left = parent.left - item.left + (parent.width / 2);
var $tail = $('<div class="tail"></div>').css({
height: height,
width: width,
left: left
});
item = $tail;
item.el.prepend($tail);
});
});


Line 76: Line 102:
{
{
children[0].el.closest("tr").addClass(className);
children[0].el.closest("tr").addClass(className);
children[0].tail.addClass(className);
if(children[0].children.length > 0)
if(children[0].children.length > 0)
children.push.apply(children[0], children[0].children);
children.push.apply(children[0], children[0].children);
Line 84: Line 111:
//$("." + className).wrapAll("<span id='children_group_" + item.el.attr("data-tt-id") + "'></col>");
//$("." + className).wrapAll("<span id='children_group_" + item.el.attr("data-tt-id") + "'></col>");
}
}
});
// draw lines
items.forEach(function (item) {
if (item.parent === undefined) {
return;
}
var childPos = item.el.position();
var parent = item.parent;
var parentPos = parent.el.position();
var height = childPos.top - parentPos.top;
var width = item.left - parent.left - parent.width/2;
var left = parent.left - item.left + (parent.width / 2);
var $tail = $('<div class="tail"></div>').css({
height: height,
width: width,
left: left
});
item.el.prepend($tail);
});
});


Confirmedusers, editor, Administrators
886

edits