Confirmedusers, editor, Administrators
886
edits
CreativeMD (talk | contribs) No edit summary |
CreativeMD (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
defaults: { | defaults: { | ||
slideSpeed: 400, | slideSpeed: 400, | ||
Line 73: | Line 70: | ||
} | } | ||
}, | }, | ||
}); | }); | ||
/*var wait = setInterval(function () { | |||
if($cellContentWrappers.is(':animated') === false) { | |||
clearInterval(wait); | |||
if(typeof sR.thisCallArgs.callback == 'function') { | |||
sR.thisCallArgs.callback.call(this); | |||
} | |||
} | |||
}, 100);*/ | |||
return $(this); | return $(this); | ||
}, | }, | ||
Line 127: | Line 132: | ||
} | } | ||
}); | }); | ||
/*var wait = setInterval(function () { | |||
if($cellContentWrappers.is(':animated') === false) { | |||
clearInterval(wait); | |||
if(typeof sR.thisCallArgs.callback == 'function') { | |||
sR.thisCallArgs.callback.call(this); | |||
} | |||
} | |||
}, 100);*/ | |||
return $(this); | return $(this); | ||
} | } | ||
Line 162: | Line 176: | ||
var item = { | var item = { | ||
id: id, | |||
level: 0, | level: 0, | ||
parent: parent, | parent: parent, | ||
Line 169: | Line 182: | ||
el: $el, | el: $el, | ||
left: 0, | left: 0, | ||
width: $el.width() + 12 | |||
}; | }; | ||
Line 236: | Line 203: | ||
item.left = 0; | item.left = 0; | ||
if (item.parent !== undefined) { | if (item.parent !== undefined) { | ||
item.left = item.parent.left + Math.min(item.parent.width, 40); | |||
} | } | ||
}); | }); | ||
Line 255: | Line 222: | ||
item.el.closest("tr").addClass("level" + item.level); | item.el.closest("tr").addClass("level" + item.level); | ||
if(item.parent == undefined) | |||
item.el.closest("tr").addClass("odd"); | |||
var odd = true; | |||
if (item.children.length > 0) { | if (item.children.length > 0) { | ||
item.children.forEach(function (child) { | |||
if(odd) | |||
child.el.closest("tr").addClass("odd"); | |||
else | |||
child.el.closest("tr").addClass("even"); | |||
odd = !odd; | |||
}); | |||
item.el.addClass("tt-parent"); | item.el.addClass("tt-parent"); | ||
item.showChildren = true; | |||
var className = item.el.attr("data-tt-id"); | var className = item.el.attr("data-tt-id"); | ||
//item.el.closest("tr").addClass(className); | |||
while(children.length > 0) { | var children = item.children.slice(); | ||
while(children.length > 0) | |||
{ | |||
children[0].el.closest("tr").addClass(className); | children[0].el.closest("tr").addClass(className); | ||
if(children[0].children.length > 0) | if(children[0].children.length > 0) | ||
Line 273: | Line 252: | ||
children.shift(); | children.shift(); | ||
} | } | ||
//$("." + className).wrapAll("<span id='children_group_" + item.el.attr("data-tt-id") + "'></col>"); | |||
} | } | ||
}); | }); | ||
Line 283: | Line 264: | ||
} | } | ||
if(item.el.attr("data-invisible") == "true") { | if(item.el.attr("data-invisible") == "true") | ||
{ | |||
item.el.hide(); | |||
return ; | return ; | ||
} | } | ||
Line 305: | Line 287: | ||
}); | }); | ||
function updateLines(limited) { | function updateLines(limited) | ||
{ | |||
//Update height of all items | //Update height of all items | ||
items.forEach(function (item) { | items.forEach(function (item) { | ||
Line 331: | Line 314: | ||
$table.on("click", "div.tt div.content", function (e) { | $table.on("click", "div.tt div.content", function (e) { | ||
var $el = $(e.currentTarget).closest(".tt"); | |||
var $tr = $el.closest("tr"); | |||
var id = $el.data('tt-id'); | var id = $el.data('tt-id'); | ||
var item = index[id]; | var item = index[id]; | ||
if (item.showChildren === true) { | |||
// hide all children | |||
item.showChildren = false; | |||
/*function hide(parentId) { | |||
var item = index[parentId]; | |||
item.children.forEach(function (child) { | |||
if (child.showChildren !== undefined) { | |||
child.showChildren = false; | |||
} | |||
$(child.el).closest("tr").addClass("tt-hide"); | |||
hide(child.id); | |||
}); | |||
} | |||
window.location.hash = '#' + $el.attr("data-tt-id"); | hide(id);*/ | ||
var lineUpdateUp = setInterval(function () { | |||
updateLines(item); | |||
}, 1); | |||
$("." + $el.attr("data-tt-id")).slideRow("up", 400, function(){clearInterval(lineUpdateUp); updateLines();}); | |||
} | |||
else { | |||
// show direct children | |||
item.showChildren = true; | |||
/*item.children.forEach(function (child) { | |||
$(child.el).closest("tr").removeClass("tt-hide"); | |||
});*/ | |||
window.location.hash = '#' + $el.attr("data-tt-id"); | |||
var lineUpdateDown = setInterval(function () { | |||
updateLines(item); | |||
}, 1); | |||
$("." + $el.attr("data-tt-id")).slideRow("down", 400, function(){clearInterval(lineUpdateDown); updateLines();}); | |||
} | |||
updateLines(); | updateLines(); | ||
}); | }); | ||
Line 355: | Line 364: | ||
if(item.children.length > 0) { | if(item.children.length > 0) { | ||
if (item.el.attr("data-hide") == "true" || (item.parent != undefined && item.el.attr("data-hide") != "false")) { | if (item.el.attr("data-hide") == "true" || (item.parent != undefined && item.el.attr("data-hide") != "false")) { | ||
//item.el.find(".content").click(); | |||
item. | if(window.location.hash != "#" + item.el.attr("data-tt-id")) | ||
item.el.hide(); | { | ||
item.showChildren = false; | |||
$("." + item.el.attr("data-tt-id")).hide(); | |||
item.el. | }else{ | ||
item.showChildren = true; | |||
$('html, body').animate({ | |||
scrollTop: item.el.offset().top-100 | |||
}, 200); | |||
} | |||
} | } | ||
} | } |