1 (
function(a){
if(typeof define===
"function"&&define.amd){define([
"jquery",
"jquery-ui",
"d3",
"JSRootPainter"],a)}
else{
if(typeof jQuery==
"undefined"){
throw new Error(
"jQuery not defined",
"JSRootPainter.jquery.js")}
if(typeof jQuery.ui==
"undefined"){
throw new Error(
"jQuery-ui not defined",
"JSRootPainter.jquery.js")}
if(typeof d3!=
"object"){
throw new Error(
"This extension requires d3.v3.js",
"JSRootPainter.jquery.js")}
if(typeof JSROOT==
"undefined"){
throw new Error(
"JSROOT is not defined",
"JSRootPainter.jquery.js")}
if(typeof JSROOT.Painter!=
"object"){
throw new Error(
"JSROOT.Painter not defined",
"JSRootPainter.jquery.js")}a(jQuery,jQuery.ui,d3,JSROOT)}}(
function(c,d,b,a){
if(typeof define===
"function"&&define.amd){a.loadScript(
"$$$style/jquery-ui.css")}a.Painter.createMenu=
function(e,f){
if(!f||(typeof f!==
"string")){f=
"root_ctx_menu"}var g={element:null,code:
"",cnt:1,funcs:{},separ:
false};g.add=
function(i,h,l){
if(i==
"separator"){this.code+=
"<li>-</li>";this.separ=
true;
return}
if(i.indexOf(
"header:")==0){this.code+=
"<li class='ui-widget-header' style='padding-left:5px'>"+i.substr(7)+
"</li>";
return}
if(i==
"endsub:"){this.code+=
"</ul></li>";
return}var k=
"</li>",j=
"padding-top:2px;padding-bottom:1px";
if(i.indexOf(
"sub:")==0){i=i.substr(4);k=
"<ul>";j+=
";padding-right:2em"}
if(typeof h==
"function"){l=h;h=i}
if(i.indexOf(
"chk:")==0){i=
"<span class='ui-icon ui-icon-check' style='margin:1px'></span>"+i.substr(4)}
else{
if(i.indexOf(
"unk:")==0){i=
"<span class='ui-icon ui-icon-blank' style='margin:1px'></span>"+i.substr(4)}}
if((c.ui.version.indexOf(
"1.10")==0)||(c.ui.version.indexOf(
"1.9")==0)){i=
'<a href="#">'+i+
"</a>"}this.code+=
"<li cnt='"+this.cnt+
"' arg='"+h+
"' style='"+j+
"'>"+i+k;
if(typeof l==
"function"){this.funcs[this.cnt]=l}this.cnt++};g.addchk=
function(i,j,h,k){
return this.add((i?
"chk:":
"unk:")+j,h,k)};g.size=
function(){
return this.cnt-1};g.addDrawMenu=
function(m,k,l){
if(k==null){k=
new Array}
if(k.length==0){k.push(
"")}this.add((k.length>1)?(
"sub:"+m):m,k[0],l);
if(k.length<2){
return}
for(var j=0;j<k.length;++j){var h=k[j];
if(h==
""){h=
"<dflt>"}this.add(h,k[j],l)}this.add(
"endsub:")};g.remove=
function(){
if(this.element!==null){this.element.remove();
if(this.close_callback){this.close_callback()}document.body.removeEventListener(
"click",this.remove_bind)}this.element=null};g.remove_bind=g.remove.bind(g);g.show=
function(j,l){this.
remove();
if(typeof l==
"function"){this.close_callback=l}document.body.addEventListener(
"click",this.remove_bind);var i=document.getElementById(f);
if(i){i.parentNode.removeChild(i)}c(document.body).append(
'<ul class="jsroot_ctxmenu">'+this.code+
"</ul>");this.element=c(
".jsroot_ctxmenu");var h=
this;this.element.attr(
"id",f).css(
"left",j.clientX+window.pageXOffset).css(
"top",j.clientY+window.pageYOffset).css(
"font-size",
"80%").css(
"position",
"absolute").menu({items:
"> :not(.ui-widget-header)",select:
function(q,r){var n=r.item.attr(
"arg");var o=r.item.attr(
"cnt");var p=o?h.funcs[o]:null;h.remove();
if(typeof p==
"function"){
if(
"painter" in g){p.bind(h.painter)(n)}
else{p(n)}}}});var m=null,k=null;
if(j.clientX+
this.element.width()>c(window).width()){m=c(window).width()-this.element.width()-20}
if(j.clientY+
this.element.height()>c(window).height()){k=c(window).height()-this.element.height()-20}
if(m!==null){this.element.css(
"left",(m>0?m:0)+window.pageXOffset)}
if(k!==null){this.element.css(
"top",(k>0?k:0)+window.pageYOffset)}};a.CallBack(e,g);
return g};a.HierarchyPainter.prototype.isLastSibling=
function(f){
if(!f||!f._parent||!f._parent._childs){
return false}var e=f._parent._childs;var g=e.indexOf(f);
if(g<0){
return false}
while(++g<e.length){
if(!(
"_hidden" in e[g])){
return false}}
return true};a.HierarchyPainter.prototype.addItemHtml=
function(e,l,t){var n=!(
"_parent" in e);var g=
"_childs" in e;
if(
"_hidden" in e){
return}var B=a.getDrawHandle(e._kind),F=
"",E=
"",u=
false;
if(B!==null){
if(
"icon" in B){F=B.icon}
if(
"icon2" in B){E=B.icon2}
if((
"func" in B)||(
"execute" in B)||(
"aslink" in B)||((
"expand" in B)&&(e._more!==
false))){u=
true}}
if(
"_icon" in e){F=e._icon}
if(
"_icon2" in e){E=e._icon2}
if((F.length==0)&&(
"_online" in e)){e._icon=F=
"img_globe"}
if((F.length==0)&&n){e._icon=F=
"img_base"}
if(e._more||(
"_expand" in e)||(
"_player" in e)){u=
true}var A=u;
if(!A&&(typeof e._kind==
"string")&&(e._kind.indexOf(
"ROOT.")==0)){A=
true;u=
true}
if(E.length==0){E=F}
if(F.length==0){F=(g||e._more)?
"img_folder":
"img_page"}
if(E.length==0){E=(g||e._more)?
"img_folderopen":
"img_page"}var p=this.itemFullName(e);var y;
if(t){l.selectAll(
"*").remove();y=l}
else{y=l.append(
"div")}y.attr(
"item",p);var v=n?null:e._parent;
while((v!=null)&&(v!=this.h)){y.insert(
"div",
":first-child").attr(
"class",this.isLastSibling(v)?
"img_empty":
"img_line");v=v._parent}var f=
"",m=
false;
if(n){}
else{
if(g){f=e._isopen?
"img_minus":
"img_plus";m=
true}
else{f=
"img_join"}}var x=
this;
if(f.length>0){
if(this.isLastSibling(e)){f+=
"bottom"}var o=y.append(
"div").attr(
"class",f);
if(m){o.style(
"cursor",
"pointer").on(
"click",
function(){x.tree_click(
this,
"plusminus")})}}
if(this.with_icons){var z=e._isopen?E:F;var G=e._kind?e._kind.replace(/</g,
"<").replace(/>/g,
">"):
"";var k=null;
if(z.indexOf(
"img_")==0){k=y.append(
"div").attr(
"class",z).attr(
"title",G)}
else{k=y.append(
"img").attr(
"src",z).attr(
"alt",
"").attr(
"title",G).style(
"vertical-align",
"top").style(
"width",
"18px").style(
"height",
"18px")}
if(
"_icon_click" in e){k.on(
"click",
function(){x.tree_click(
this,
"icon")})}}var r=y.append(
"a");
if(u||g){r.attr(
"class",
"h_item").on(
"click",
function(){x.tree_click(
this)})}
if(
"disp_kind" in x){
if(a.gStyle.DragAndDrop&&u){this.enable_dragging(r.node(),p)}
if(a.gStyle.ContextMenu&&A){r.on(
"contextmenu",
function(){x.tree_contextmenu(
this)})}}var q=e._name;
if(
"_realname" in e){q=e._realname}var s=
"";
if(
"_title" in e){s=e._title}
if(
"_fullname" in e){s+=
" fullname: "+e._fullname}
if(s.length===0){s=q}r.attr(
"title",s).text(q+(
"_value" in e?
":":
""));
if(
"_value" in e){var j=y.append(
"p");
if(
"_vclass" in e){j.attr(
"class",e._vclass)}
if(!e._isopen){j.html(e._value)}}
if(g&&(n||e._isopen)){var D=y.append(
"div").attr(
"class",
"h_childs");
for(var w=0;w<e._childs.length;++w){var C=e._childs[w];C._parent=e;this.addItemHtml(C,D)}}};a.HierarchyPainter.prototype.RefreshHtml=
function(o){
if(this.divid==null){
return a.CallBack(o)}var l=this.select_main();l.html(
"");
if((this.h==null)||l.empty()){
return a.CallBack(o)}var k=
this,m=[],e=null;this.ForEach(
function(h){
if((
"_fastcmd" in h)&&(h._kind==
"Command")){m.push(h)}
if((
"_status" in h)&&(e==null)){e=h}});var f=l.append(
"div").attr(
"class",
"jsroot").style(
"background-color",this.background?this.background:
"").style(
"overflow",
"auto").style(
"width",
"100%").style(
"height",
"100%").style(
"font-size",this.with_icons?
"12px":
"15px");
for(var i=0;i<m.length;++i){var g=f.append(
"button").text(
"").attr(
"class",
"fast_command").attr(
"item",this.itemFullName(m[i])).attr(
"title",m[i]._title).on(
"click",
function(){k.ExecuteCommand(b.select(
this).attr(
"item"),
this)});
if(
"_icon" in m[i]){g.append(
"img").attr(
"src",m[i]._icon)}}d3p=f.append(
"p");d3p.append(
"a").attr(
"href",
"#").text(
"open all").on(
"click",
function(){k.toggle(
true);b.event.preventDefault()});d3p.append(
"text").text(
" | ");d3p.append(
"a").attr(
"href",
"#").text(
"close all").on(
"click",
function(){k.toggle(
false);b.event.preventDefault()});
if(
"_online" in this.h){d3p.append(
"text").text(
" | ");d3p.append(
"a").attr(
"href",
"#").text(
"reload").on(
"click",
function(){k.reload();b.event.preventDefault()})}
if(
"disp_kind" in
this){d3p.append(
"text").text(
" | ");d3p.append(
"a").attr(
"href",
"#").text(
"clear").on(
"click",
function(){k.clear(
false);b.event.preventDefault()})}this.addItemHtml(this.h,f.append(
"div").attr(
"class",
"h_tree"));
if((e!=null)&&(a.GetUrlOption(
"nostatus")==null)){var j=a.findFunction(e._status);var p=(typeof j==
"function")?a.Painter.ConfigureHSeparator(30):null;
if(p!=null){j(p,this.itemFullName(e))}}a.CallBack(o)};a.HierarchyPainter.prototype.UpdateTreeNode=
function(f,g){
if((g===undefined)||g.empty()){var e=this.itemFullName(f);g=this.select_main().select(
"[item='"+e+
"']");
if(g.empty()&&(
"_cycle" in f)){g=this.select_main().select(
"[item='"+e+
";"+f._cycle+
"']")}
if(g.empty()){
return}}this.addItemHtml(f,g,
true)};a.HierarchyPainter.prototype.tree_click=
function(h,e){
if(h===null){
return}var l=b.select(h.parentNode);var k=l.attr(
"item");
if(k==null){
return}var f=this.Find(k);
if(f==null){
return}var g=f,j=undefined;
while(g){
if((j=g._click_action)!==undefined){
break}g=g._parent}
if(!e||(e==
"")){e=
"item"}
if(e==
"icon"){
if((
"_icon_click" in f)&&(typeof f._icon_click==
"function")){
if(f._icon_click(f)){this.UpdateTreeNode(f,l)}}
return}
if((e==
"item")&&(
"_expand" in f)){e=
"plusminus"}
if(((e==
"plusminus")&&!(
"_childs" in f)&&f._more)||((e==
"item")&&(j===
"expand"))){
return this.expand(k,null,l)}
if(e==
"item"){
if(
"_player" in f){
return this.player(k)}var i=a.getDrawHandle(f._kind);
if(i!=null){
if(
"aslink" in i){
return window.open(k+
"/")}
if(
"func" in i){
return this.display(k)}
if(
"execute" in i){
return this.ExecuteCommand(k,h.parentNode)}
if((
"expand" in i)&&(f._childs==null)){
return this.expand(k,null,l)}}
if(!f._childs&&(
this.default_by_click===
"expand")){
return this.expand(k,null,l)}
if((typeof f._kind===
"string")&&(f._kind.indexOf(
"ROOT.")===0)){
return this.display(k,
"inspect")}
if(!f._childs||(f===
this.h)){
return}}
if(f._isopen){
delete f._isopen}
else{f._isopen=
true}this.UpdateTreeNode(f,l)};a.HierarchyPainter.prototype.tree_contextmenu=
function(g){b.event.preventDefault();var k=b.select(g.parentNode).attr(
"item");var f=this.Find(k);
if(f==null){
return}var e=
this;var j=e.GetOnlineProp(k);var i=e.GetFileProp(k);
function h(l){
function n(o){
return o.split(
"&").join(
"&").split(
"<").join(
"<").split(
'"').join(
""")}var m=document.createElement(
"div");m.innerHTML=
'<a href="'+n(l)+
'">x</a>';
return m.firstChild.href}a.Painter.createMenu(
function(r){r.painter=e;
if((k==
"")&&!(
"_jsonfile" in f)){var s=
"",m=0;
function q(){
return m++>0?
"&":
"?"}var o=[];e.ForEachRootFile(
function(t){o.push(t._file.fFullURL)});
if(e.GetTopOnlineItem()==null){s=a.source_dir+
"index.htm"}
if(e.IsMonitoring()){s+=q()+
"monitoring="+e.MonitoringInterval()}
if(o.length==1){s+=q()+
"file="+o[0]}
else{
if(o.length>1){s+=q()+
"files="+JSON.stringify(o)}}
if(e.disp_kind){s+=q()+
"layout="+e.disp_kind.replace(/ /g,
"")}var l=[];
if(e.disp!=null){e.disp.ForEachPainter(
function(t){
if(t.GetItemName()!=null){l.push(t.GetItemName())}})}
if(l.length==1){s+=q()+
"item="+l[0]}
else{
if(l.length>1){s+=q()+
"items="+JSON.stringify(l)}}r.add(
"Direct link",
function(){window.open(s)});r.add(
"Only items",
function(){window.open(s+
"&nobrowser")})}
else{
if(j!=null){e.FillOnlineMenu(r,j,k)}
else{var n=a.getDrawOptions(f._kind,
"nosame");
if(n!=null){r.addDrawMenu(
"Draw",n,
function(t){this.display(k,t)})}
if((i!=null)&&(n!=null)){var p=h(i.fileurl);
if(p.indexOf(a.source_dir)==0){p=p.slice(a.source_dir.length)}r.addDrawMenu(
"Draw in new window",n,
function(t){window.open(a.source_dir+
"index.htm?nobrowser&file="+p+
"&item="+i.itemname+
"&opt="+t)})}
if(!(
"_childs" in f)&&(f._more||!(
"_more" in f))){r.add(
"Expand",
function(){e.expand(k)})}}}
if((
"_menu" in f)&&(typeof f._menu==
"function")){f._menu(r,f,e)}
if(r.size()>0){r.tree_node=g.parentNode;
if(r.separ){r.add(
"separator")}r.add(
"Close");r.show(b.event)}});
return false};a.HierarchyPainter.prototype.CreateDisplay=
function(e){
if(
"disp" in
this){
if(this.disp.NumDraw()>0){
return a.CallBack(e,this.disp)}this.disp.Reset();
delete this.disp}
if(document.getElementById(
this.disp_frameid)==null){
return a.CallBack(e,null)}
if(this.disp_kind==
"tabs"){this.disp=
new a.TabsDisplay(this.disp_frameid)}
else{
if((this.disp_kind==
"flex")||(this.disp_kind==
"flexible")){this.disp=
new a.FlexibleDisplay(this.disp_frameid)}
else{
if(this.disp_kind.search(
"grid")==0){this.disp=
new a.GridDisplay(this.disp_frameid,this.disp_kind)}
else{
if(this.disp_kind==
"simple"){this.disp=
new a.SimpleDisplay(this.disp_frameid)}
else{this.disp=
new a.CollapsibleDisplay(this.disp_frameid)}}}}a.CallBack(e,this.disp)};a.HierarchyPainter.prototype.enable_dragging=
function(e,f){c(e).draggable({revert:
"invalid",appendTo:
"body",helper:
"clone"})};a.HierarchyPainter.prototype.enable_dropping=
function(f,g){var e=
this;c(f).droppable({hoverClass:
"ui-state-active",accept:
function(j){var i=j.parent().attr(
"item");
if((i==g)||(i==null)){
return false}var h=e.Find(i);
if((h==null)||(!(
"_kind" in h))){
return false}
return h._kind.indexOf(
"ROOT.")==0},drop:
function(i,j){var h=j.draggable.parent().attr(
"item");
if(h==null){
return false}
return e.dropitem(h,c(
this).attr(
"id"))}})};a.CollapsibleDisplay=
function(e){a.MDIDisplay.call(
this,e);this.cnt=0};a.CollapsibleDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.CollapsibleDisplay.prototype.ForEachFrame=
function(f,g){var e=this.frameid+
"_collapsible";
if(document.getElementById(e)==null){
return}
if(typeof f!=
"function"){
return}c(
"#"+e+
" .collapsible_draw").each(
function(){
if(g&&c(
this).is(
":hidden")){
return}f(c(
this).
get(0))})};a.CollapsibleDisplay.prototype.ActivateFrame=
function(e){
if(c(e).is(
":hidden")){c(e).prev().toggleClass(
"ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find(
"> .ui-icon").toggleClass(
"ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass(
"ui-accordion-content-active").slideDown(0)}c(e).prev()[0].scrollIntoView()};a.CollapsibleDisplay.prototype.CreateFrame=
function(i){var g=this.frameid+
"_collapsible";
if(document.getElementById(g)==null){c(
"#"+this.frameid).append(
'<div id="'+g+
'" class="jsroot ui-accordion ui-accordion-icons ui-widget ui-helper-reset" style="overflow:auto; overflow-y:scroll; height:100%; padding-left: 2px; padding-right: 2px"></div>')}var f=g+
"_sub"+this.cnt++;var h=f+
"h";var e=
'<h5 id="'+h+
"\"><span class='ui-icon ui-icon-triangle-1-e'></span><a> "+i+
"</a> <button type='button' class='jsroot_collaps_closebtn' style='float:right; width:1.4em' title='close canvas'/> </h5>\n";e+=
"<div class='collapsible_draw' id='"+f+
"'></div>\n";c(
"#"+g).append(e);c(
"#"+h).addClass(
"ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom").hover(
function(){c(
this).toggleClass(
"ui-state-hover")}).click(
function(){c(
this).toggleClass(
"ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find(
"> .ui-icon").toggleClass(
"ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass(
"ui-accordion-content-active").slideToggle(0);a.resize(c(
this).next().attr(
"id"));
return false}).next().addClass(
"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();c(
"#"+h).find(
" .jsroot_collaps_closebtn").button({icons:{primary:
"ui-icon-close"},text:
false}).click(
function(){a.cleanup(c(
this).parent().next().attr(
"id"));c(
this).parent().next().andSelf().remove()});c(
"#"+h).toggleClass(
"ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find(
"> .ui-icon").toggleClass(
"ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass(
"ui-accordion-content-active").slideToggle(0);
return c(
"#"+f).attr(
"frame_title",i).css(
"overflow",
"hidden").get(0)};a.TabsDisplay=
function(e){a.MDIDisplay.call(
this,e);this.cnt=0};a.TabsDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.TabsDisplay.prototype.ForEachFrame=
function(f,i){var e=this.frameid+
"_tabs";
if(document.getElementById(e)==null){
return}
if(typeof f!=
"function"){
return}var g=-1;var h=c(
"#"+e).tabs(
"option",
"active");c(
"#"+e+
"> .tabs_draw").each(
function(){g++;
if(!i||(g==h)){f(c(
this).
get(0))}})};a.TabsDisplay.prototype.ActivateFrame=
function(f){var e=0,g=-1;this.ForEachFrame(
function(h){
if(c(h).attr(
"id")==c(f).attr(
"id")){g=e}e++});c(
"#"+this.frameid+
"_tabs").tabs(
"option",
"active",g)};a.TabsDisplay.prototype.CreateFrame=
function(j){var h=this.frameid+
"_tabs";var g=h+
"_sub"+this.cnt++;var f=
'<li><a href="#'+g+
'">'+j+
'</a><span class="ui-icon ui-icon-close" style="float: left; margin: 0.4em 0.2em 0 0; cursor: pointer;" role="presentation">Remove Tab</span></li>';var e=
'<div class="tabs_draw" id="'+g+
'"></div>';
if(document.getElementById(h)==null){c(
"#"+this.frameid).append(
'<div id="'+h+
'" class="jsroot"> <ul>'+f+
" </ul>"+e+
"</div>");var i=c(
"#"+h).css(
"overflow",
"hidden").tabs({heightStyle:
"fill",activate:
function(k,l){c(l.newPanel).css(
"overflow",
"hidden");a.resize(c(l.newPanel).attr(
"id"))}});i.delegate(
"span.ui-icon-close",
"click",
function(){var k=c(
this).closest(
"li").remove().attr(
"aria-controls");a.cleanup(k);c(
"#"+k).remove();i.tabs(
"refresh");
if(c(
"#"+h+
"> .tabs_draw").length==0){c(
"#"+h).remove()}})}
else{c(
"#"+h).find(
"> .ui-tabs-nav").append(f);c(
"#"+h).append(e);c(
"#"+h).tabs(
"refresh");c(
"#"+h).tabs(
"option",
"active",-1)}c(
"#"+g).empty().css(
"overflow",
"hidden").attr(
"frame_title",j);
return c(
"#"+g).get(0)};a.FlexibleDisplay=
function(e){a.MDIDisplay.call(
this,e);this.cnt=0};a.FlexibleDisplay.prototype=Object.create(a.MDIDisplay.prototype);a.FlexibleDisplay.prototype.ForEachFrame=
function(f,g){var e=this.frameid+
"_flex";
if(document.getElementById(e)==null){
return}
if(typeof f!=
"function"){
return}c(
"#"+e+
" .flex_draw").each(
function(){f(c(
this).
get(0))})};a.FlexibleDisplay.prototype.ActivateFrame=
function(e){};a.FlexibleDisplay.prototype.CreateFrame=
function(m){var g=this.frameid+
"_flex";
if(document.getElementById(g)==null){c(
"#"+this.frameid).append(
'<div id="'+g+
'" class="jsroot" style="overflow:none; height:100%; width:100%"></div>')}var k=c(
"#"+g);var f=k.width(),i=k.height();var e=g+
"_frame"+this.cnt;var j=
'<div id="'+e+
'" class="flex_frame" style="position:absolute"><div class="ui-widget-header flex_header"><p>'+m+
'</p><button type="button" style="float:right; width:1.4em"/><button type="button" style="float:right; width:1.4em"/><button type="button" style="float:right; width:1.4em"/></div><div id="'+e+
'_cont" class="flex_draw"></div></div>';k.append(j);
function l(h,n){var o=h.prop(
"state");
if(!o){o=
"normal"}h.prop(
"state",n);
if(n==o){
return}
if(o==
"normal"){h.prop(
"original_height",h.height());h.prop(
"original_width",h.width());h.prop(
"original_top",h.css(
"top"));h.prop(
"original_left",h.css(
"left"))}h.find(
".jsroot_minbutton").find(
".ui-icon").toggleClass(
"ui-icon-carat-1-s",n!=
"minimal").toggleClass(
"ui-icon-carat-2-n-s",n==
"minimal");h.find(
".jsroot_maxbutton").find(
".ui-icon").toggleClass(
"ui-icon-carat-1-n",n!=
"maximal").toggleClass(
"ui-icon-carat-2-n-s",n==
"maximal");
switch(n){
case"minimal":h.height(h.find(
".flex_header").height()).width(
"auto");h.find(
".flex_draw").css(
"display",
"none");h.find(
".ui-resizable-handle").css(
"display",
"none");
break;
case"maximal":h.height(
"100%").width(
"100%").css(
"left",
"").css(
"top",
"");h.find(
".flex_draw").css(
"display",
"");h.find(
".ui-resizable-handle").css(
"display",
"none");
break;
default:h.find(
".flex_draw").css(
"display",
"");h.find(
".ui-resizable-handle").css(
"display",
"");h.height(h.prop(
"original_height")).width(h.prop(
"original_width"));
if(o!=
"minimal"){h.css(
"left",h.prop(
"original_left")).css(
"top",h.prop(
"original_top"))}}
if(n!==
"minimal"){a.resize(h.find(
".flex_draw").get(0))}}c(
"#"+e).css(
"left",parseInt(f*(this.cnt%5)/10)).css(
"top",parseInt(i*(this.cnt%5)/10)).width(Math.round(f*0.58)).height(Math.round(i*0.58)).resizable({helper:
"jsroot-flex-resizable-helper",start:
function(h,n){c(
this).appendTo(c(
this).parent())},stop:
function(n,o){var h={width:o.size.width-1,height:o.size.height-c(
this).find(
".flex_header").height()-1};a.resize(c(
this).find(
".flex_draw").
get(0),h)}}).draggable({containment:
"parent",start:
function(n,p){c(
this).appendTo(c(
this).parent());var o=c(
this).find(
".flex_draw");
if(o.prop(
"flex_block_drag")===
true){var q=document.elementFromPoint(n.clientX,n.clientY);var h=
false;c(q).parents().map(
function(){
if(c(
this).
get(0)===o.get(0)){h=
true}});
if(h){
return false}}}}).find(
".flex_header").click(
function(){var h=c(
this).parent();h.appendTo(h.parent())}).find(
"button").first().attr(
"title",
"close canvas").button({icons:{primary:
"ui-icon-close"},text:
false}).click(
function(){var h=c(
this).parent().parent();a.cleanup(h.find(
".flex_draw").get(0));h.remove()}).next().attr(
"title",
"maximize canvas").addClass(
"jsroot_maxbutton").button({icons:{primary:
"ui-icon-carat-1-n"},text:
false}).click(
function(){var h=c(
this).parent().parent();var n=c(
this).find(
".ui-icon").hasClass(
"ui-icon-carat-1-n");l(h,n?
"maximal":
"normal")}).next().attr(
"title",
"minimize canvas").addClass(
"jsroot_minbutton").button({icons:{primary:
"ui-icon-carat-1-s"},text:
false}).click(
function(){var h=c(
this).parent().parent();var n=c(
this).find(
".ui-icon").hasClass(
"ui-icon-carat-1-s");l(h,n?
"minimal":
"normal")});c(
"#"+e).find(
".ui-resizable-handle").css(
"z-index",
"");this.cnt++;
return c(
"#"+e+
"_cont").attr(
"frame_title",m).get(0)};a.TTreePlayer=
function(h,f,g,e){a.TBasePainter.call(
this);this.SetItemName(h);this.url=f;this.root_version=e;this.hist_painter=null;this.askey=g;
return this};a.TTreePlayer.prototype=Object.create(a.TBasePainter.prototype);a.TTreePlayer.prototype.Show=
function(f){this.drawid=f+
"_draw";c(
"#"+f).html(
"<div class='treedraw_buttons' style='padding-left:0.5em'><button class='treedraw_exe'>Draw</button> Expr:<input class='treedraw_varexp' style='width:12em'></input> <button class='treedraw_more'>More</button></div><div id='"+this.drawid+
"' style='width:100%'></div>");var e=
this;c(
"#"+f).find(
".treedraw_exe").click(
function(){e.PerformDraw()});c(
"#"+f).find(
".treedraw_varexp").val(
"px:py").keyup(
function(g){
if(g.keyCode==13){e.PerformDraw()}});c(
"#"+f).find(
".treedraw_more").click(
function(){c(
this).remove();c(
"#"+f).find(
".treedraw_buttons").append(
" Cut:<input class='treedraw_cut' style='width:8em'></input> Opt:<input class='treedraw_opt' style='width:5em'></input> Num:<input class='treedraw_number' style='width:7em'></input> First:<input class='treedraw_first' style='width:7em'></input>");c(
"#"+f+
" .treedraw_opt").val(
"");c(
"#"+f+
" .treedraw_number").val(
"").spinner({numberFormat:
"n",min:0,page:1000});c(
"#"+f+
" .treedraw_first").val(
"").spinner({numberFormat:
"n",min:0,page:1000})});this.CheckResize();this.SetDivId(f)};a.TTreePlayer.prototype.PerformDraw=
function(){var g=c(this.select_main().node());var f=this.url+
"/exe.json.gz?compact=3&method=Draw";var o=g.find(
".treedraw_varexp").val();var e=
"h_tree_draw";var l=o.indexOf(
">>");
if(l<0){o+=
">>"+e}
else{e=o.substr(l+2);
if(e[0]==
"+"){e=e.substr(1)}var m=e.indexOf(
"(");
if(m>0){e=e.substr(0,m)}}
if(g.find(
".treedraw_more").length==0){var n=g.find(
".treedraw_cut").val();var h=g.find(
".treedraw_opt").val();var k=g.find(
".treedraw_number").val();var j=g.find(
".treedraw_first").val();f+=
'&prototype="const char*,const char*,Option_t*,Long64_t,Long64_t"&varexp="'+o+
'"&selection="'+n+
'"';
if((h!=
"")||(k!=
"")||(j!=
"")){
if(k==
""){k=(this.root_version>=394499)?
"TTree::kMaxEntries":
"1000000000"}
if(j==
""){j=
"0"}f+=
'&option="'+h+
'"&nentries='+k+
"&firstentry="+j}}
else{f+=
'&prototype="Option_t*"&opt="'+o+
'"'}f+=
"&_ret_object_="+e;var p=
this;
function i(){a.NewHttpRequest(f,
"object",
function(q){
if(q==null){
return}c(
"#"+p.drawid).empty();p.hist_painter=a.draw(p.drawid,q)}).send()}
if(this.askey){this.askey=
false;a.NewHttpRequest(this.url+
"/root.json",
"text",i).send()}
else{i()}};a.TTreePlayer.prototype.CheckResize=
function(i){var e=c(this.select_main().node());c(
"#"+this.drawid).width(e.width());var g=e.height();var f=e.find(
".treedraw_buttons").height();
if(g>f+30){c(
"#"+this.drawid).height(g-1-f)}
if(this.hist_painter){this.hist_painter.CheckResize(i)}};a.drawTreePlayer=
function(h,k,j){var e=h.GetOnlineItemUrl(k);
if(e==null){
return null}var m=h.GetTopOnlineItem(h.Find(k));
if(m==null){
return null}var f=(
"_root_version" in m)?m._root_version:336417;var i=h.GetDisplay();
if(i==null){
return null}var g=i.FindFrame(k,
true);
if(g==null){
return null}var l=b.select(g).attr(
"id");var n=
new a.TTreePlayer(k,e,j,f);n.Show(l);
return n};a.drawTreePlayerKey=
function(e,f){
return a.drawTreePlayer(e,f,
true)};a.Painter.separ=null;a.Painter.AdjustLayout=
function(e,n,k){
if(this.separ==null){
return}
if(e!=null){var g=c(
"#"+this.separ.left).outerWidth()-c(
"#"+this.separ.left).width();var m=5;c(
"#"+this.separ.vertical).css(
"left",e+
"px").width(m).css(
"top",
"1px");c(
"#"+this.separ.left).width(e-g-1).css(
"top",
"1px");c(
"#"+this.separ.right).css(
"left",e+m+
"px").css(
"top",
"1px");
if(!this.separ.horizontal){c(
"#"+this.separ.vertical).css(
"bottom",
"1px");c(
"#"+this.separ.left).css(
"bottom",
"1px");c(
"#"+this.separ.right).css(
"bottom",
"1px")}}
if((n!=null)&&this.separ.horizontal){var l=c(
"#"+this.separ.bottom).outerHeight()-c(
"#"+this.separ.bottom).height();n-=2*l;
if(n<5){n=5}var j=n+l;c(
"#"+this.separ.bottom).height(n);var i=5;c(
"#"+this.separ.horizontal).css(
"bottom",j+
"px").height(i);j+=i;c(
"#"+this.separ.left).css(
"bottom",j+
"px")}
if(this.separ.horizontal){
if(this.separ.hpart){var f=c(
"#"+this.separ.left).outerWidth()-2;c(
"#"+this.separ.bottom).width(f);c(
"#"+this.separ.horizontal).width(f)}
else{var j=c(
"#"+this.separ.left).css(
"bottom");c(
"#"+this.separ.vertical).css(
"bottom",j);c(
"#"+this.separ.right).css(
"bottom",j)}}
if(k||(this.separ.handle==null)){
return}
if(typeof this.separ.handle==
"function"){this.separ.handle()}
else{
if((typeof this.separ.handle==
"object")&&(typeof
this.separ.handle.CheckResize==
"function")){this.separ.handle.CheckResize()}}};a.Painter.ConfigureVSeparator=
function(f){a.Painter.separ={handle:f,left:
"left-div",right:
"right-div",vertical:
"separator-div",horizontal:null,bottom:null,hpart:
true};c(
"#separator-div").addClass(
"separator").draggable({axis:
"x",zIndex:100,cursor:
"ew-resize",helper:
function(){
return c(
"#separator-div").clone().attr(
"id",
"separator-clone").css(
"background-color",
"grey")},stop:
function(g,h){g.stopPropagation();var i=h.position.left;c(
"#separator-clone").remove();a.Painter.AdjustLayout(i,null,
false)}});var e=Math.round(c(window).width()*0.2);
if(e<300){e=Math.min(300,Math.round(c(window).width()*0.5))}a.Painter.AdjustLayout(e,null,
true)};a.Painter.ConfigureHSeparator=
function(e,g){
if((a.Painter.separ==null)||(a.Painter.separ.horizontal!=null)){
return null}a.Painter.separ.horizontal=
"horizontal-separator-div";a.Painter.separ.bottom=
"bottom-div";a.Painter.separ.hpart=(g===
true);var f=c(
"#"+this.separ.left).parent();f.append(
'<div id="horizontal-separator-div" class="separator" style="left:1px; right:1px; height:4px; bottom:16px; cursor: ns-resize"></div>');f.append(
'<div id="bottom-div" class="column" style="left:1px; right:1px; height:15px; bottom:1px"></div>');c(
"#horizontal-separator-div").addClass(
"separator").draggable({axis:
"y",zIndex:100,cursor:
"ns-resize",helper:
function(){
return c(
"#horizontal-separator-div").clone().attr(
"id",
"horizontal-separator-clone").css(
"background-color",
"grey")},stop:
function(h,i){h.stopPropagation();var j=c(window).height()-i.position.top;c(
"#horizontal-separator-clone").remove();a.Painter.AdjustLayout(null,j,
false)}});a.Painter.AdjustLayout(null,e,
false);
return a.Painter.separ.bottom};
return a.Painter}));