semantic_connector-8.x-1.1/js/visual_mapper/visual_mapper.min.js

js/visual_mapper/visual_mapper.min.js
/*! Visual Mapper v1.7.1 | (c) 2018 Semantic Web Company */
!function(f){f.fn.initVisualMapper=function(t,e){return new f.VisualMapper(this[0],t,e)},f.VisualMapper=function(t,e,n){var I=this;for(var r in this.settings=f.extend(!0,{width:800,height:800,startUri:"",loadParams:{},spiderChart:{chartShiftHorizontal:0,chartShiftVertical:0,rootInnerRadius:75,rootOuterRadius:360,rootFontSize:15,rootCharactersPerLine:18,conceptMaxRadius:30,conceptMinRadius:15,conceptFontSize:12,conceptCharactersPerLine:18,sectorMinArc:.5,paginationAngle:.5,rectHeight:90,rectWidth:90,showConceptSchemeSelection:!0,legendSize:12,legendPositionX:"left",legendPositionY:"top",legendStyle:"list",legendShiftHorizontal:0,legendShiftVertical:0},treeView:{barHeight:20,collapseCircleRadius:8,conceptFontSize:11},export:{enabled:!0,exportButtonRadius:20,exportButtonPositionX:"right",exportButtonPositionY:"top",exportButtonShiftHorizontal:0,exportButtonShiftVertical:0,exportButtonColor:"#aaa",exportFileName:"visual_mapper"},relations:{},backColor:"#FFFFFF",backColorItems:"#ffffff",headerColor:"#eef0eb",inactiveColor:"#dadada",selectedColor:"#ff7f00",chartTypes:["spider"],wording:{glossaryRoot:"Glossary Root",homeButton:"Glossary Root",currentConcept:"Current Concept",exportText:"Export as PNG"},fontMultiplier:1.2,transitionDuration:500},e||{}),this.settings.relations)this.settings.relations[r]=f.extend(!0,{colors:{bright:"#ccc",dark:"#888"},wording:{legend:"Legend item"}},this.settings.relations[r]);this.listeners=f.extend({conceptLoaded:[],visibleConceptsChanged:[]},n||{}),this.uniqueId=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),this.element=t,this.browser=null,this.chart_data=null,this.concepts=null,this.root_concept=null,this.concept_scheme_selection=null,this.cleanedConcepts=!0,this.tree=d3.layout.tree().nodeSize([0,20]),this.diagonal=d3.svg.diagonal().projection(function(t){return[t.y,t.x]}),this.xScale=d3.scale.linear().range([0,this.settings.width]),this.yScale=d3.scale.linear().range([0,this.settings.height]),this.rawJsonData=null,this.UriHistory=[],this.chartType=this.settings.chartTypes[0],this.loadUrl="",this.language="",this.currentUri="",this.loading=!0,f.extend(this,{init:function(){d3.select(I.element).append("div").attr("class","chart-header collapsed").style("background-color",I.settings.headerColor).style("display","none").attr("width",I.settings.width-2*f(I.element).children(".chart-header").css("padding-top").replace("px",""));if(1<I.settings.chartTypes.length){var e=d3.select(I.element).insert("div",".chart-header").attr("class","chart-type-selection").append("ul"),n={spider:"Visual Mapper",tree:"Tree View",treemap:"Tree Map"};I.settings.chartTypes.forEach(function(t){e.append("li").text(n[t]).attr("data-type",t).attr("class",t===I.chartType?"active":"").on("click",function(){f(this).hasClass("active")||(f(this).siblings().removeClass("active"),f(this).addClass("active"),d3.selectAll(I.browser.node().childNodes).remove(),d3.selectAll(d3.select(I.element).select(".chart-header").node().childNodes).remove(),I.chartType=f(this).attr("data-type"),I.load(I.loadUrl,I.currentUri,I.language),I.browser.attr("class","visual-mapper-svg visual-mapper-"+I.chartType),I.settings.export.enabled&&d3.select(I.element).select(".export-svg").attr("class","visual-mapper-svg visual-mapper-"+I.chartType+" export-svg"),f(I.element).children(".chart-header").hide())})})}I.browser=d3.select(I.element).append("svg").attr("width",I.settings.width).attr("height",I.settings.height).attr("id","visual-mapper-svg-"+I.uniqueId).attr("class","visual-mapper-svg visual-mapper-"+I.chartType).style("background",I.settings.backColor),I.settings.export.enabled&&(d3.select(I.element).append("svg").attr("id","export-svg-"+I.uniqueId).attr("width",I.settings.width).attr("height",I.settings.height).attr("class","visual-mapper-svg visual-mapper-"+I.chartType+" export-svg").style("background",I.settings.backColor),d3.select(I.element).append("canvas").attr("id","export-canvas-"+I.uniqueId).attr("class","export-canvas").attr("width",I.settings.width).attr("height",I.settings.height).style("background",I.settings.backColor))},load:function(o,t,e){I.loadUrl=o,I.language=void 0!==e?e:"";var l=!t||0==t.length;f.ajax({dataType:"json",url:o,data:f.extend({uri:t||I.settings.startUri||"",lang:I.language,parent_info:"tree"===I.chartType},I.settings.loadParams),success:function(t){switch(null===t.id&&(t.id=""),I.currentUri=t.id,void 0!==(I.rawJsonData=t).settings&&I.updateSettings(t.settings),I.chartType){case"spider":d3.select(I.element).select(".pattern-definition-svg").empty()&&d3.select(I.element).append("svg").attr("height",1).attr("width",1).attr("class","pattern-definition-svg").append("defs").attr("class","pattern-definitions").append("pattern").attr("height",1).attr("width",1).attr("id","concept-image-pattern-"+I.uniqueId).append("image").attr("x",0).attr("y",0).attr("width",2*I.settings.spiderChart.rootInnerRadius-0).attr("height",2*I.settings.spiderChart.rootInnerRadius-0).attr("class","concept-image"),I.browser.select(".concepts").empty()&&(I.concepts=I.browser.append("g").attr("class","concepts")),I.browser.select(".root-concept").empty()&&(I.root_concept=I.concepts.append("g").attr("class","concept root-concept")),I.browser.select(".concept-scheme-selection").empty()&&(I.concept_scheme_selection=I.browser.append("g").attr("class","concept-scheme-selection").attr("transform","scale(1, 0)").style("display","none")),I.settings.spiderChart.showConceptSchemeSelection&&0==f(I.concept_scheme_selection.node()).children().length&&(l?I.drawConceptSchemeSelection(t,l):f.ajax({dataType:"json",url:o,data:f.extend({lang:I.language},I.settings.loadParams),success:function(t){I.drawConceptSchemeSelection(t,l)}}));for(var e=0;e<I.listeners.conceptLoaded.length;e++)I.listeners.conceptLoaded[e](I,t);I.drawBrowser(t);break;case"tree":f(I.element).children(".chart-header").show(),d3.select(I.element).select(".chart-header").append("div").attr("class","chart-navigation"),d3.select(I.element).select(".chart-navigation").append("span").attr("class","current-concept-info").text("project"!==t.type?I.settings.wording.currentConcept+": "+(t.name.length<=30?t.name:t.name.substr(0,30)+"..."):"");var n=0;I.settings.export.enabled&&"left"===I.settings.export.exportButtonPositionX&&(n=2*I.settings.export.exportButtonRadius+10),I.browser.select(".links").empty()&&(I.links=I.browser.append("g").attr("class","links").attr("transform","translate("+(I.settings.treeView.barHeight+5+n)+", "+I.settings.treeView.barHeight+")")),I.browser.select(".concepts").empty()&&(I.concepts=I.browser.append("g").attr("class","concepts").attr("transform","translate("+(I.settings.treeView.barHeight+5+n)+", "+I.settings.treeView.barHeight+")"));for(e=0;e<I.listeners.conceptLoaded.length;e++)I.listeners.conceptLoaded[e](I,t);var r=c(t);r.x0=0,r.y0=0,I.chart_data=r,I.drawTree(r);break;case"treemap":f(I.element).children(".chart-header").empty().append('<div class="chart-breadcrumb"><ul><li><a href="" class="active">Glossary</a></li></ul></div>').show(),t.children&&f(t.children).each(function(){this.children?(this.hasChildren=!0,delete this.children):this.hasChildren=!1});var a=d3.layout.treemap().round(!0).size([I.settings.width,I.settings.height]).value(function(t){return t.size}).sort(function(t,e){return t.size-e.size});I.chart_data=t;var i=a.nodes(t).filter(function(t){return!t.children}),s=I.browser.datum(t).selectAll("g").data(i);s.enter().append("svg:g").attr("class",function(t){return t.hasChildren?"cell has-children":"cell"}).attr("id",function(t){return I.friendly_url(t.id)}).call(I.position).attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).on("click",function(t){return I.treemap_cell_clicked(t)}),I.update_breadcrumbs(),s.append("svg:rect").attr("width",function(t){return t.dx-1}).attr("height",function(t){return t.dy-1}).style("fill",function(t){var e=I.rawJsonData.children&&!I.rawJsonData.children[0].parents?"conceptScheme":"children";return t.hasChildren?I.settings.relations[e].colors.bright:I.settings.relations[e].colors.dark}).append("title").text(function(t){return t.name}),s.append("svg:text").attr("x",function(t){return t.dx/2}).attr("y",function(t){return t.dy/2}).attr("dy",".35em").attr("text-anchor","middle").text(function(t){return t.name}).style("display",function(t){return t.w=this.getComputedTextLength(),t.dx>t.w?"block":"none"})}for(e=0;e<I.listeners.visibleConceptsChanged.length;e++)I.listeners.visibleConceptsChanged[e](I,I.getVisibleData())}})},addListener:function(t,e){return!!this.listeners.hasOwnProperty(t)&&(this.listeners[t].push(e),!0)},getDOMElement:function(){return I.element},drawBrowser:function(t){I.browser.transition().duration(I.settings.transitionDuration).attr("height",I.settings.height),I.settings.export.enabled&&d3.select(I.element).selectAll(".export-svg, .export-canvas").attr("height",I.settings.height),I.root_concept.attr("transform","translate("+(I.settings.width/2+I.settings.spiderChart.chartShiftHorizontal)+","+(I.settings.height/2+I.settings.spiderChart.chartShiftVertical)+")").datum(t).call(i),this.addExportButton(),this.updateLegend(t)},addExportButton:function(){if(I.settings.export.enabled){var t=10,e=10,n=I.settings.export.exportButtonRadius;"right"===I.settings.export.exportButtonPositionX&&(t=I.settings.width-10-2*n),"bottom"===I.settings.export.exportButtonPositionY&&(e=I.settings.height-10-2*n),t+=I.settings.export.exportButtonShiftHorizontal,e+=I.settings.export.exportButtonShiftVertical,export_element=I.browser.append("g").attr("transform","translate("+t+", "+e+")").attr("class","export-button"),export_element.append("circle").attr("r",n).attr("cx",n).attr("cy",n).attr("fill",I.settings.backColorItems).attr("stroke",I.settings.export.exportButtonColor).attr("stroke-width",3),export_element.append("path").attr("d","M"+n+" "+n/3+" L"+n+" "+(2*n-(n/3+2))+" M"+n+" "+(2*n-n/3)+" L"+.6*n+" "+1.2*n+" L"+n+" "+(2*n-n/3)+" L"+1.4*n+" "+1.2*n).attr("fill",I.settings.backColorItems).attr("stroke",I.settings.export.exportButtonColor).attr("stroke-width",3),export_element.append("text").text(I.settings.wording.exportText).attr("text-anchor","right"===I.settings.export.exportButtonPositionX?"end":"start").attr("dominant-baseline","middle").attr("class","export-button-text").attr("transform","translate("+("right"===I.settings.export.exportButtonPositionX?"-"+n:3*n)+", "+n+")").style("font-size",n+"px").style("fill",I.settings.export.exportButtonColor).style("opacity",0),export_element.append("circle").attr("r",n+2).attr("cx",n).attr("cy",n).attr("class","invisibleExportCircle").on("mouseover",function(t){d3.select(this.parentNode).selectAll(".export-button-text").transition().duration(I.settings.transitionDuration).style("opacity",1)}).on("mouseout",function(t){d3.select(this.parentNode).selectAll(".export-button-text").transition().duration(I.settings.transitionDuration).style("opacity",0)}).on("click",function(t){if(!I.loading){var e=f(I.concepts.node()).clone(!0);e.find(".invisibleConceptCircle, .page-container:not(.active)").remove();var n=f("#export-svg-"+I.uniqueId);n.append(e);var r=f('<svg id="empty-export-svg" xmlns="http://www.w3.org/2000/svg" version="1.1" height="2"/>').insertAfter("body"),a=getComputedStyle(r[0]);n.find("*").each(function(){!function(t,e){var n,r,a,i,s=getComputedStyle(t),o="";for(n=0,r=s.length;n<r;n++)a=s[n],(i=s.getPropertyValue(a))!==e.getPropertyValue(a)&&(o+=a+":"+i+";");t.setAttribute("style",o)}(this,a)}),r.remove();var i=document.getElementById("export-svg-"+I.uniqueId),s=document.getElementById("export-canvas-"+I.uniqueId),o=s.getContext("2d"),l=(new XMLSerializer).serializeToString(i),c=window.URL||window.webkitURL||window;n.empty();var d=new Image,p=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),g=c.createObjectURL(p);d.onload=function(){o.drawImage(d,0,0),c.revokeObjectURL(g);var t=s.toDataURL("image/png").replace("image/png","image/octet-stream"),e=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),n=document.createElement("a");n.setAttribute("download",I.settings.export.exportFileName+".png"),n.setAttribute("href",t),n.setAttribute("target","_blank"),n.dispatchEvent(e)},d.src=g}})}},updateLegend:function(t){var n=[];for(var e in t.relations)0<t.relations[e].length&&(-1===f.inArray(e,n)&&n.push(e),t.relations[e].forEach(function(t){for(var e in t.relations)-1===f.inArray(e,n)&&n.push(e)}));"project"===t.type&&-1===f.inArray(Object.keys(I.settings.relations)[0],n)&&n.push(Object.keys(I.settings.relations)[0]);var r=[],a=[];for(var e in I.settings.relations)if(-1!==f.inArray(e,n)){var i=I.settings.relations[e].wording.legend;-1===f.inArray(i,r)&&(a.push(e),r.push(i))}var s=d3.select(I.element).select(".chart-legend");if(s.empty()){var o=10+("circle"===I.settings.spiderChart.legendStyle?40:0),l=10,c=!1;I.settings.export.enabled&&I.settings.spiderChart.legendPositionX===I.settings.export.exportButtonPositionX&&I.settings.spiderChart.legendPositionY===I.settings.export.exportButtonPositionY&&(c=!0),"right"===I.settings.spiderChart.legendPositionX&&(o=I.settings.width-5*I.settings.spiderChart.legendSize-60),"bottom"===I.settings.spiderChart.legendPositionY?(l=I.settings.height-(I.settings.spiderChart.legendSize*(a.length+1)*1.5+15),c&&(l-=2*I.settings.export.exportButtonRadius+10)):c&&(l+=2*I.settings.export.exportButtonRadius+("circle"===I.settings.spiderChart.legendStyle?10:0)),o+=I.settings.spiderChart.legendShiftHorizontal,l+=I.settings.spiderChart.legendShiftVertical,s=I.concepts.append("g").attr("transform","translate("+o+", "+l+")").attr("class","chart-legend")}else s.selectAll("*").remove();var d=0;a.forEach(function(t){if("list"===I.settings.spiderChart.legendStyle)s.append("rect").attr("width",I.settings.spiderChart.legendSize).attr("height",I.settings.spiderChart.legendSize).style("fill",I.settings.relations[t].colors.dark).attr("transform","translate(0,"+(I.settings.spiderChart.legendSize*d*1.5+25)+")"),s.append("text").text(I.settings.relations[t].wording.legend).attr("transform","translate("+1.5*I.settings.spiderChart.legendSize+","+(I.settings.spiderChart.legendSize*d*1.5+I.settings.spiderChart.legendSize-2+25)+")").style("font-size",I.settings.spiderChart.legendSize+"px");else if("circle"===I.settings.spiderChart.legendStyle){var e=d3.svg.arc().innerRadius(10).outerRadius(30).startAngle(2*Math.PI/a.length*d).endAngle(2*Math.PI/a.length*(d+1));s.append("path").attr("d",e).attr("stroke",I.settings.backColorItems).attr("stroke-width",1).attr("fill",I.settings.relations[t].colors.dark).attr("class","legend-circle-part").attr("transform","translate("+-1.5*I.settings.spiderChart.legendSize+","+(I.settings.spiderChart.legendSize*a.length*.5+I.settings.spiderChart.legendSize+9)+")"),s.append("text").text(I.settings.relations[t].wording.legend).attr("transform","translate("+1.5*I.settings.spiderChart.legendSize+","+(I.settings.spiderChart.legendSize*d*1.5+I.settings.spiderChart.legendSize-2+15)+")").style("font-size",I.settings.spiderChart.legendSize+"px").style("fill",I.settings.relations[t].colors.dark)}d++})},drawConceptSchemeSelection:function(t){f(I.element).children(".chart-header").show(),d3.select(I.element).select(".chart-header").append("div").attr("class","chart-navigation").append("span").attr("class","glossary-root-button").text(I.settings.wording.homeButton).on("click",function(){var t=f(this).closest(".chart-header");t.hasClass("collapsed")?(t.removeClass("collapsed"),I.concept_scheme_selection.style("display","").transition().duration(I.settings.transitionDuration).attr("transform","scale(1 1)").call(I.endAll,function(){d3.select(this).attr("transform",null)})):I.concept_scheme_selection.transition().duration(I.settings.transitionDuration).attr("transform","scale(1 0)").call(I.endAll,function(){d3.select(this).style("display","none"),f(I.element).children(".chart-header").addClass("collapsed")})}),d3.select(I.element).select(".chart-navigation").append("span").attr("class","current-concept-info").text("project"!==I.rawJsonData.type?I.settings.wording.currentConcept+": "+(I.rawJsonData.name.length<=30?I.rawJsonData.name:I.rawJsonData.name.substr(0,30)+"..."):"");var e=[],n=0,r=0;for(var a in I.settings.relations)if(void 0!==t.relations[a]&&t.relations[a].length){var i=t.relations[a];for(var s in i)e.push(i[s]);i[0].size>n&&(n=i[0].size),(i[i.length-1].size<r||0==r)&&(r=i[i.length-1].size)}var o=n-r,l=I.settings.spiderChart.conceptMaxRadius-I.settings.spiderChart.conceptMinRadius,c=e.length,d=(I.settings.height-20)/(2*I.settings.spiderChart.conceptMaxRadius+5);d=(d=(I.settings.height-20)/(2*I.settings.spiderChart.conceptMaxRadius+5))<c?Math.ceil(c/2):c,I.concept_scheme_selection.append("svg:rect").attr("width",I.settings.width-2).attr("height",d*I.settings.spiderChart.conceptMaxRadius*2+20+5*(d-1)).attr("rx",5).attr("ry",5).style("fill",I.settings.backColorItems).attr("transform","translate(1, -5)").style("opacity",.9).style("stroke-width",2).style("stroke",I.settings.headerColor);var p,g=0,h=0;for(var s in e){(t=e[s]).radius=(p=t,0<o?(p.size-r)/o*l+I.settings.spiderChart.conceptMinRadius:I.settings.spiderChart.conceptMaxRadius);var u=I.concept_scheme_selection.append("g");u.selectAll("g").data([t]).enter().append("g").attr("class","concept concept-scheme").attr("transform","translate("+(I.settings.spiderChart.conceptMaxRadius+10+400*g)+","+((h+.5)*I.settings.spiderChart.conceptMaxRadius*2+10+5*h)+")").call(D),f(u.node()).find("tspan").remove(),u.select("text").text(t.name).attr("text-anchor","start").attr("transform","translate("+(I.settings.spiderChart.conceptMaxRadius+5)+", "+(I.settings.spiderChart.conceptFontSize/2-2)+")"),u.select("circle.invisibleConceptCircle").on("click",function(t){return f(I.element).find(".glossary-root-button").d3Click(),I.updateConcept(t)}),d<=++h&&(g++,h=0)}},updateConcept:function(a){I.loading||(I.loading=!0,"spider"===I.chartType&&(I.cleanedConcepts=!1,d3.select(I.element).selectAll("text.rootConceptText, g.pagination-container").transition().duration(I.settings.transitionDuration).style("opacity",0).remove(),d3.select(I.element).selectAll("g.concept:not(.root-concept):not(.concept-scheme)").transition().duration(I.settings.transitionDuration).attr("transform","translate(0,0)").style("opacity",0).call(I.endAll,function(){I.cleanedConcepts=!0}).remove()),f.ajax({dataType:"json",url:I.loadUrl,data:f.extend({uri:a.id,lang:this.language,parent_info:"tree"===I.chartType},I.settings.loadParams),success:function(e){switch(void 0!==a.noHistory&&a.noHistory||I.UriHistory.push(I.rawJsonData.id),void 0!==(I.rawJsonData=e).settings&&I.updateSettings(e.settings),I.chartType){case"spider":if(I.currentUri!==e.id){I.currentUri=e.id;for(var t=0;t<I.listeners.conceptLoaded.length;t++)I.listeners.conceptLoaded[t](I,e);var n=setInterval(function(){if(I.cleanedConcepts){clearInterval(n),d3.select(I.element).select(".current-concept-info").text(I.settings.wording.currentConcept+": "+(e.name.length<=30?e.name:e.name.substr(0,30)+"...")),I.concepts.select("g").datum(e).call(i);for(var t=0;t<I.listeners.visibleConceptsChanged.length;t++)I.listeners.visibleConceptsChanged[t](I,I.getVisibleData())}},10);I.updateLegend(e)}break;case"tree":if(I.currentUri!==e.id){I.currentUri=e.id;for(t=0;t<I.listeners.conceptLoaded.length;t++)I.listeners.conceptLoaded[t](I,e);d3.select(I.element).select(".current-concept-info").text(I.settings.wording.currentConcept+": "+(e.name.length<=30?e.name:e.name.substr(0,30)+"..."));var r=c(e);for(r.x0=0,r.y0=0,I.chart_data=d(r,I.chart_data),I.drawTree(r),t=0;t<I.listeners.visibleConceptsChanged.length;t++)I.listeners.visibleConceptsChanged[t](I,I.getVisibleData())}}}}))},back:function(){if(0<this.UriHistory.length){var t=this.UriHistory.pop();return this.updateConcept({id:t,noHistory:!0}),!0}return!1},getVisibleData:function(){var t=[],e=null;switch(I.chartType){case"spider":e=d3.select(I.element).selectAll(".page-container.active  g.concept");break;case"tree":e=d3.select(I.element).selectAll("g.concept:not(.concept-removed)")}if(null!==e)for(var n=0;n<e[0].length;n++)t.push(e[0][n].__data__);return t},updateSettings:function(t){if(void 0!==t.relations)for(var e in I.settings.relations=jQuery.extend(!0,{},t.relations),delete t.relations,I.settings.relations)I.settings.relations[e]=f.extend(!0,{colors:{bright:"#ccc",dark:"#888"},wording:{legend:"Legend item"}},I.settings.relations[e]);I.settings=f.extend(!0,I.settings,t||{})},drawTree:function(n){var t=.8*I.settings.width,e=I.tree.nodes(I.chart_data),r=e.length*I.settings.treeView.barHeight+I.settings.treeView.barHeight;I.browser.transition().duration(I.settings.transitionDuration).attr("height",r),I.settings.export.enabled&&d3.select(I.element).selectAll(".export-svg, .export-canvas").attr("height",r),e.forEach(function(t,e){t.x=e*I.settings.treeView.barHeight});var a=I.concepts.selectAll("g.concept").data(e,function(t){return t.id}),i=a.enter().append("g").attr("class","concept").attr("transform",function(t){return"translate("+n.y0+","+n.x0+")"}).style("opacity",1e-6),s=function(t){if(!I.loading)if(t.children){t._children=t.children,t.children=null,I.drawTree(t);for(var e=0;e<I.listeners.visibleConceptsChanged.length;e++)I.listeners.visibleConceptsChanged[e](I,I.getVisibleData())}else if(t.children=t._children,t._children=null,t.loadRequired)I.updateConcept(t),t.loadRequired=!1;else{I.drawTree(t);for(e=0;e<I.listeners.visibleConceptsChanged.length;e++)I.listeners.visibleConceptsChanged[e](I,I.getVisibleData())}},o=i.append("g").attr("class","collapse-toggle").attr("transform","translate(-"+(I.settings.treeView.barHeight/2+2)+", 0)").style("opacity",function(t){return t._children||t.children?1:1e-6}).on("click",function(t){s(t)});o.append("circle").attr("r",I.settings.treeView.collapseCircleRadius).attr("fill",I.settings.backColorItems).attr("stroke",I.settings.export.exportButtonColor).attr("stroke-width",1),o.append("text").style("font-size",(I.settings.treeView.conceptFontSize%2==0?I.settings.treeView.conceptFontSize:I.settings.treeView.conceptFontSize+1)+"px").style("text-anchor","middle").attr("dy",4).text(function(t){return t._children?"+":t.children?"-":""}),i.append("rect").attr("y",-I.settings.treeView.barHeight/2).attr("height",I.settings.treeView.barHeight).attr("width",t).style("fill",function(t){return t.id===I.currentUri?I.settings.selectedColor:t._children?I.settings.relations.children.colors.bright:t.children?I.settings.relations.children.colors.dark:I.settings.relations.children.colors.bright}).style("fill-opacity",function(t){if(t.id===I.currentUri)return"0.5"}).attr("class",function(t){return t._children?"concept-collapsed":t.children?"concept-open":"concept-no-child"}).on("click",function(t){if(!I.loading&&I.currentUri!==t.id){I.currentUri=t.id;for(var e=0;e<I.listeners.conceptLoaded.length;e++)I.listeners.conceptLoaded[e](I,t);I.drawTree(t)}}).on("dblclick",function(t){s(t)}),i.append("text").attr("dy",4).attr("dx",5.5).style("font-size",I.settings.treeView.conceptFontSize+"px").text(function(t){return t.name}),i.transition().duration(I.settings.transitionDuration).attr("transform",function(t){return"translate("+t.y+","+t.x+")"}).style("opacity",1);var l=a.transition().duration(I.settings.transitionDuration).attr("transform",function(t){return"translate("+t.y+","+t.x+")"}).style("opacity",1);l.select("rect").style("fill",function(t){return t.id===I.currentUri?I.settings.selectedColor:t._children?I.settings.relations.children.colors.bright:t.children?I.settings.relations.children.colors.dark:I.settings.relations.children.colors.bright}).style("fill-opacity",function(t){if(t.id===I.currentUri)return"0.5"}).attr("class",function(t){return t._children?"concept-collapsed":t.children?"concept-open":"concept-no-child"}),l.select(".collapse-toggle").style("opacity",function(t){return t._children||t.children?1:1e-6}).select("text").text(function(t){return t._children?"+":t.children?"-":""});var c=a.exit();c.attr("class","concept-removed"),c.transition().duration(I.settings.transitionDuration).attr("transform",function(t){return"translate("+n.y+","+n.x+")"}).style("opacity",1e-6).remove();var d=I.links.selectAll("path.link").data(I.tree.links(e),function(t){return t.target.id});d.enter().insert("path","g").attr("class","link").attr("d",function(t){var e={x:n.x0,y:n.y0};return I.diagonal({source:e,target:e})}).transition().duration(I.settings.transitionDuration).attr("d",I.diagonal),d.transition().duration(I.settings.transitionDuration).attr("d",I.diagonal).call(I.endAll,function(){I.loading=!1}),d.exit().transition().duration(I.settings.transitionDuration).attr("d",function(t){var e={x:n.x,y:n.y};return I.diagonal({source:e,target:e})}).remove(),e.forEach(function(t){t.x0=t.x,t.y0=t.y}),this.addExportButton()},treemap_cell_clicked:function(t){!I.loading&&t.hasChildren&&(I.loading=!0,f(".chart-breadcrumb ul a").removeClass("active"),f(".chart-breadcrumb ul").append('<li><span> -> </span><a href="'+t.id+'" class="active">'+t.name+"</a></li>"),this.update_breadcrumbs(),this.update_treemap(t))},update_treemap:function(o){f.ajax({dataType:"json",url:I.loadUrl,data:f.extend({uri:o.id,lang:this.language},I.settings.loadParams),success:function(t){(I.rawJsonData=t).relations.children&&f(t.relations.children).each(function(){this.children?(this.hasChildren=!0,delete this.children):this.hasChildren=!1});for(var e=0;e<I.chart_data.relations.children.length;e++)I.chart_data.relations.children[e].id==t.id&&(I.chart_data.relations.children[e].children=t.relations.children);var n=o;n.children=t.relations.children;var r=d3.layout.treemap().round(!0).size([n.dx,n.dy]).value(function(t){return t.size}).sort(function(t,e){return t.size-e.size}),a=d3.select("body").append("div").attr("class","sub-chart").style("width",n.dx-1+"px").style("height",n.dy-1+"px").append("svg:svg").attr("width",n.dx-1).attr("height",n.dy-1).style("left",n.x).style("top",n.y),i=r.nodes(t).filter(function(t){return!t.children}),s=a.datum(t).selectAll("g").data(i);s.exit().remove(),s.enter().append("svg:g").attr("class",function(t){return t.hasChildren?"cell has-children":"cell"}).attr("id",function(t){return I.friendly_url(t.id)}).call(I.position).attr("transform",function(t){return t.x+=n.x,t.y+=n.y,"translate("+t.x+","+t.y+")"}).on("click",function(t){return I.treemap_cell_clicked(t)}),s.text(function(t){return t.children?null:t.name}),s.append("svg:rect").attr("width",function(t){return t.dx-1}).attr("height",function(t){return t.dy-1}).style("fill",function(t){return t.hasChildren?I.settings.relations.children.colors.bright:I.settings.relations.children.colors.dark}).append("title").text(function(t){return t.name}),s.append("svg:text").attr("x",function(t){return t.dx/2}).attr("y",function(t){return t.dy/2}).attr("dy",".35em").attr("text-anchor","middle").text(function(t){return t.name}).style("display",function(t){return t.w=this.getComputedTextLength(),t.dx>t.w?"block":"none"}),f("#"+I.friendly_url(o.id)).children("rect, text").css("opacity",0),f("#"+I.friendly_url(o.id)).parent().append(f(".sub-chart").find("g.cell")),f(".sub-chart").remove(),I.zoom(n)}})},update_breadcrumbs:function(){f(".chart-breadcrumb a").unbind("click"),f(".chart-breadcrumb a").click(function(t){t.preventDefault(),I.loading||(I.loading=!0,cell_data=0<f(this).attr("href").length?f("#"+I.friendly_url(f(this).attr("href")))[0].__data__:I.chart_data,f(f(this).parent("li").nextAll().children("a").get().reverse()).each(function(){var t=f("#"+I.friendly_url(f(this).attr("href")))[0].__data__;f("#"+I.friendly_url(f(this).attr("href"))).find("rect, text").css("opacity","");for(var e=0;e<t.relations.children.length;e++)f("#"+I.friendly_url(t.relations.children[e].id)).remove();delete t.relations.children}),f(this).parent("li").nextAll().remove(),f(this).addClass("active"),I.zoom(cell_data))})},zoom:function(t){var e=this.settings.width/t.dx,n=this.settings.height/t.dy;this.xScale.domain([t.x,t.x+t.dx]),this.yScale.domain([t.y,t.y+t.dy]);var r=this.browser.selectAll("g.cell").transition().duration(1.5*I.settings.transitionDuration).attr("transform",function(t){return"translate("+I.xScale(t.x)+","+I.yScale(t.y)+")"}).call(I.endAll,function(){I.loading=!1});r.select("rect").attr("width",function(t){return e*t.dx-1}).attr("height",function(t){return n*t.dy-1}),r.select("text").attr("x",function(t){return e*t.dx/2}).attr("y",function(t){return n*t.dy/2}).style("display",function(t){return!t.children&&e*t.dx>t.w?"block":"none"})},position:function(){this.style("left",function(t){return t.x+"px"}).style("top",function(t){return t.y+"px"}).style("width",function(t){return Math.max(0,t.dx-1)+"px"}).style("height",function(t){return Math.max(0,t.dy-1)+"px"})},endAll:function(t,e){var n=0;t.each(function(){++n}).each("end",function(){--n||e.apply(this,arguments)})},arcTween:function(t,i,e,n,s,o){t.attrTween("d",function(){var r=d3.interpolate(e,n),a=d3.interpolate(s,o);return function(t){var e=r(t),n=a(t);return i.startAngle(e),i.endAngle(n),i()}})},friendly_url:function(t){for(var e=new Array(new Array("a",/[áàâãªÁÀÂÃ]/g),new Array("e",/[éèêÉÈÊ]/g),new Array("i",/[íìîÍÌÎ]/g),new Array("o",/[òóôõºÓÒÔÕ]/g),new Array("u",/[úùûÚÙÛ]/g),new Array("c",/[çÇ]/g),new Array("n",/[Ññ]/g)),n=0;n<e.length;n++)t=t.replace(e[n][1],e[n][0]);return t.replace(/\s+/g,"-").toLowerCase().replace(/[^a-z0-9\-]/g,"-")}}),this.init();var i=function(t){var e=t.datum();e.hasOwnProperty("image")&&d3.select(I.element).select(".pattern-definitions .concept-image").attr("xlink:href",e.image),t.select("circle").empty()?t.append("circle").style("fill",e.hasOwnProperty("image")?"url(#concept-image-pattern-"+I.uniqueId+")":I.settings.backColorItems).attr("r",I.settings.spiderChart.rootInnerRadius).attr("stroke-width","0").call(s,"project"!=e.type?e.name:I.settings.wording.glossaryRoot):(f(t.node()).children("text").remove(),t.select("circle").call(s,"project"!=e.type?e.name:I.settings.wording.glossaryRoot),t.select("circle").style("fill",e.hasOwnProperty("image")?"url(#concept-image-pattern-"+I.uniqueId+")":I.settings.backColorItems)),t.call(a,e)},a=function(t,e){d3.select(I.element).select("text.rootConceptText").transition().duration(I.settings.transitionDuration).style("opacity",1).call(I.endAll,function(){jQuery.isEmptyObject(I.rawJsonData.relations)&&(I.loading=!1)});var f=[],n=0,y=0;for(var r in I.settings.relations){var m=e.relations[r]?e.relations[r]:[];f.push({type:r,elements:m,angle:0}),m.length&&(m[0].size>n&&(n=m[0].size),(m[m.length-1].size<y||0==y)&&(y=m[m.length-1].size))}var a=0,i=0;!function(){var t=0,e=[],n=0,r=0;for(var a in sum=0,f)t+=f[a].elements.length;if(0<t){for(var a in f)0<(n=f[a].elements.length/t*2*Math.PI)&&(e.push({id:a,angle:n}),n>=I.settings.spiderChart.sectorMinArc&&(sum+=n));for(var a in e.sort(function(t,e){return t.angle>e.angle?1:t.angle<e.angle?-1:0}),e)e[a].angle<I.settings.spiderChart.sectorMinArc?(r+=I.settings.spiderChart.sectorMinArc-e[a].angle,e[a].angle=I.settings.spiderChart.sectorMinArc,0):(n=e[a].angle*r/sum,e[a].angle-n<I.settings.spiderChart.sectorMinArc?sum-=e[a].angle:e[a].angle-=n);for(var a in e)f[e[a].id].angle=e[a].angle}}(),I.root_concept.select("g.root-arcs").empty()?I.root_concept.append("g").attr("class","root-arcs"):d3.select(I.element).selectAll("g.root-arc-circles").each(function(){var t=this.dataset.relationType;I.settings.relations.hasOwnProperty(t)||(d3.select(I.element).select(".container."+t).remove(),d3.select(this).remove())});for(var x=0,v=0;v<f.length;v++){var s;if(angle=f[v].angle,i=a+angle,0==a&&a!=i&&i<2*Math.PI&&(i=(a=(a-angle)/2)+angle),d3.select(I.element).select("g.container."+f[v].type).empty()?s=t.append("g").attr("class",f[v].type+" container"):(s=t.select("g.container."+f[v].type)).selectAll("g.pagination-container, g.page-container").remove(),P(f[v].type,a,i),0<angle){for(var o=0,l=0,C=(m=f[v].elements,180*a/Math.PI),w=180*i/Math.PI,b=(n=m[0].size)-(y=m[m.length-1].size),k=I.settings.spiderChart.conceptMaxRadius-I.settings.spiderChart.conceptMinRadius;l<m.length;){var A=s.append("g").attr("class","page-container page-"+(o+1)+(0<o?"":" active"));l=T(l)+1,o++}if(1<o){var c,d,p="Page ";clockwisePagination=!1,prefixSpaceToAdd=p.length*I.settings.fontMultiplier/(I.settings.spiderChart.rootOuterRadius/Math.PI),pagTextRadius=I.settings.spiderChart.rootOuterRadius+18,I.settings.spiderChart.paginationAngle*o>angle?(c=angle/o,d=i):(c=I.settings.spiderChart.paginationAngle,d=a+angle/2+I.settings.spiderChart.paginationAngle*o/2);var g=i-(i-a)/2;(g<Math.PI/2||g>=1.5*Math.PI)&&(clockwisePagination=!0,d-=2*(d-g),c*=-1,pagTextRadius-=10);for(var h=s.append("g").attr("class","pagination-container").attr("data-relation-type",f[v].type).style("opacity",0),u=1;u<=o;u++){var _=h.append("g").attr("class","pagination-page-container"+(1==u?" active":"")).attr("data-page",u).on("click",function(){if(-1==d3.select(this).attr("class").indexOf("active")){var t=this.parentNode.dataset.relationType;d3.select(d3.select(this).node().parentNode).selectAll(".pagination-page-container").attr("class","pagination-page-container"),d3.select(this).attr("class","pagination-page-container active");var e=this.dataset.page;d3.select(this.parentNode).selectAll("path.concept-pagination").attr("fill",I.settings.inactiveColor),d3.select(this.parentNode.parentNode).selectAll(".page-container").each(function(){d3.select(this).attr("class",d3.select(this).attr("class").replace(" active","")),d3.select(this).selectAll(".concept").attr("transform","translate(0,0)")}),d3.select(d3.select(this).node().parentNode.parentNode).select(".page-container.page-"+e).selectAll(".concept").attr("transform",function(){return"translate("+d3.select(this).attr("data-x")+","+d3.select(this).attr("data-y")+")"}),d3.select(d3.select(this).node().parentNode.parentNode).select(".page-container.page-"+e).attr("class","page-container page-"+e+" active"),d3.select(this).select("path.concept-pagination").attr("fill",I.settings.relations[t].colors.dark);for(var n=0;n<I.listeners.visibleConceptsChanged.length;n++)I.listeners.visibleConceptsChanged[n](I,I.getVisibleData())}}).on("mouseover",function(){if(-1==d3.select(this).attr("class").indexOf("active")){var t=this.parentNode.dataset.relationType;d3.select(this).select("path.concept-pagination").attr("fill",I.settings.relations[t].colors.bright)}}).on("mouseout",function(){if(-1==d3.select(this).attr("class").indexOf("active")){this.parentNode.dataset.relationType;d3.select(this).select("path.concept-pagination").attr("fill",I.settings.inactiveColor)}}),R=d3.svg.arc().innerRadius(I.settings.spiderChart.rootOuterRadius+2).outerRadius(I.settings.spiderChart.rootOuterRadius+24).startAngle(d-c*(u-1)).endAngle(d-c*u);_.append("path").attr("d",R).attr("stroke-width",1).attr("stroke",I.settings.backColorItems).attr("class","concept-pagination").attr("fill",1==u?I.settings.relations[f[v].type].colors.dark:I.settings.inactiveColor);var S=d-Math.PI/2,z=u.toString().length*I.settings.fontMultiplier/(I.settings.spiderChart.rootOuterRadius/Math.PI),M=(prefixSpaceToAdd+z)*(clockwisePagination?-1:1);Math.abs(c)<=Math.abs(2*M)&&(p="",M=z*(clockwisePagination?-1:1)),_.append("path").attr("d","M "+Math.cos(S-c*(u-.5)+M).toFixed(10)*pagTextRadius+","+Math.sin(S-c*(u-.5)+M).toFixed(10)*pagTextRadius+" Q "+Math.cos(S-c*(u-.5)).toFixed(10)*(pagTextRadius+2)+","+Math.sin(S-c*(u-.5)).toFixed(10)*(pagTextRadius+2)+" "+Math.cos(S-c*(u-.5)-M).toFixed(10)*pagTextRadius+","+Math.sin(S-c*(u-.5)-M).toFixed(10)*pagTextRadius).attr("id","concept-pagination-text-path-"+I.uniqueId+"-"+f[v].type+"-"+u).attr("class","concept-pagination-text-path").style("opacity",0),_.append("text").style("font-size","14px").attr("class","concept-pagination-text").append("textPath").attr("xlink:href","#concept-pagination-text-path-"+I.uniqueId+"-"+f[v].type+"-"+u).text(p+u)}}}a=i}function P(t,e,n){var r="project"==I.rawJsonData.type?Object.keys(I.settings.relations)[0]:t,a=n-e,i=d3.select(I.element).select("g.root-arcs"),s=i.select("g.root-arcs-"+t),o=s.empty(),l=18<=I.settings.spiderChart.rootOuterRadius?100<=I.settings.spiderChart.rootOuterRadius?5:2:1,c=d3.svg.arc().innerRadius(I.settings.spiderChart.rootInnerRadius).outerRadius(I.settings.spiderChart.rootOuterRadius).startAngle(0).endAngle(0);o&&(s=i.append("g").attr("class","root-arc-circles root-arcs-"+t).attr("data-relation-type",t)).append("path").attr("d",c).attr("stroke",I.settings.backColorItems).attr("stroke-width",l).attr("data-startangle",0).attr("data-endangle",0).attr("fill",I.settings.relations[r].colors.bright).attr("class","main-circle-part"),s.style("opacity",+(0<a));var d,p,g=s.select(".main-circle-part"),h=(s.select(".main-circle-part").transition().duration(I.settings.transitionDuration).call(I.arcTween,c,g.attr("data-startangle"),e,g.attr("data-endangle"),n).attr("data-startangle",e).attr("data-endangle",n).attr("fill",I.settings.relations[r].colors.bright).call(I.endAll,function(){++x==s.select(".main-circle-part").length&&(d3.select(I.element).selectAll(".page-1 g.concept").transition().duration(I.settings.transitionDuration).attr("transform",function(){return"translate("+d3.select(this).attr("data-x")+","+d3.select(this).attr("data-y")+")"}).style("opacity",1).call(I.endAll,function(){d3.select(I.element).selectAll(".page-container g.concept").style("opacity",1),I.loading=!1}),d3.select(I.element).selectAll("g.pagination-container").transition().duration(I.settings.transitionDuration).style("opacity",1))}),d3.svg.arc().innerRadius(I.settings.spiderChart.rootOuterRadius).outerRadius(I.settings.spiderChart.rootOuterRadius+20).startAngle(0).endAngle(0)),u=d3.svg.arc().innerRadius(I.settings.spiderChart.rootInnerRadius-10).outerRadius(I.settings.spiderChart.rootInnerRadius).startAngle(0).endAngle(0);o?(d=s.append("path").attr("d",h).attr("class","outer-circle").attr("stroke",I.settings.backColorItems).attr("stroke-width",l).attr("data-startangle",0).attr("data-endangle",0).attr("fill",I.settings.relations[r].colors.dark),p=s.append("path").attr("d",u).attr("class","inner-circle").attr("stroke",I.settings.backColorItems).attr("stroke-width",l).attr("data-startangle",0).attr("data-endangle",0).attr("fill",I.settings.inactiveColor)):(d=s.select("path.outer-circle"),p=s.select("path.inner-circle"));d.transition().duration(I.settings.transitionDuration).call(I.arcTween,h,d.attr("data-startangle"),e,d.attr("data-endangle"),n).attr("data-startangle",e).attr("data-endangle",n).attr("fill",I.settings.relations[r].colors.dark);p.transition().duration(I.settings.transitionDuration).call(I.arcTween,u,p.attr("data-startangle"),e,p.attr("data-endangle"),n).attr("data-startangle",e).attr("data-endangle",n)}function T(t){var e=0,n=18,r=1,a=!1,i=Math.floor((w-C)/(2*n));i>m.length-t&&(i=m.length-t);for(var s=(w-C)/(i||1),o=t;o<m.length;o++){if(i+1<=r){if(e++,r=1,I.settings.spiderChart.rootOuterRadius-I.settings.spiderChart.rootInnerRadius<Math.sqrt(Math.pow(I.settings.spiderChart.rectWidth,2)+Math.pow(I.settings.spiderChart.rectHeight,2))*(e+1)+25*e-Math.ceil(12.5)*(e-1)){if(0<i||a){o--;break}e--,i=1,a=!0}n-=7/e,(i=Math.floor((w-C)/(2*n)))>m.length-o&&(i=m.length-o),s=(w-C)/(i||1)}var l=(C-90+(r-.5)*s)*Math.PI/180,c=Math.cos(l).toFixed(10),d=Math.sin(l).toFixed(10),p=I.settings.spiderChart.rootInnerRadius*c;p+=e*(I.settings.spiderChart.rectWidth+25)*c,p+=c*I.settings.spiderChart.rectWidth;var g=I.settings.spiderChart.rootInnerRadius*d;g+=e*(I.settings.spiderChart.rectHeight+25)*d,g+=d*I.settings.spiderChart.rectHeight;var h=f[v].elements[o];h.radius=u(h),A.append("g").selectAll("g").data([h]).enter().append("g").attr("class","concept "+f[v].type).attr("data-x",p).attr("data-y",g).style("opacity",0).call(D),r++}function u(t){return 0<b?(t.size-y)/b*k+I.settings.spiderChart.conceptMinRadius:I.settings.spiderChart.conceptMaxRadius}return o}return t},s=function(t,e){return function(t,e){var n=t.node().parentNode,r=d3.select(n);textArray=p(e,I.settings.spiderChart.rootCharactersPerLine),paragraph=r.append("text").attr("class","rootConceptText").attr("transform","translate(0,"+(-(textArray.length-1)*(I.settings.spiderChart.rootFontSize/2+1)+(I.settings.spiderChart.rootFontSize/2-3))+")").style("opacity",0).attr("text-anchor","middle");for(var a=0;a<textArray.length;a++)paragraph.append("svg:tspan").attr("x","0").attr("y",a*(I.settings.spiderChart.rootFontSize+2)).text(textArray[a]).attr("font-size",I.settings.spiderChart.rootFontSize).style("stroke","#fff").style("stroke-width",4).style("stroke-linecap","butt").style("stroke-linejoin","miter"),paragraph.append("svg:tspan").attr("x","0").attr("y",a*(I.settings.spiderChart.rootFontSize+2)).text(textArray[a]).attr("font-size",I.settings.spiderChart.rootFontSize)}(t,e),t},D=function(t){t.each(function(t){var e=d3.select(this),n=t.radius,r=n/2.5;e.append("rect").attr("width",I.settings.spiderChart.rectWidth).attr("height",I.settings.spiderChart.rectHeight).attr("transform","translate(-"+I.settings.spiderChart.rectWidth/2+",-"+I.settings.spiderChart.conceptMaxRadius+")").style("fill","none"),e.append("circle").style("fill",I.settings.backColorItems).attr("r",n).attr("stroke-width","0").call(l),e.call(o,t,r,n),e.append("circle").attr("r",n).attr("class","invisibleConceptCircle").on("click",function(t){return I.updateConcept(t)})})},o=function(t,e,n,r){var a=[],i=0;for(var s in I.settings.relations){var o=e.relations&&e.relations[s]?e.relations[s]:[];a.push({type:s,elements:o,angle:0}),i+=o.length}var l=0,c=0;for(var d in a){var p=a[d].elements.length/i*2*Math.PI;if(0<p){var g=t.append("g").attr("class",a[d].type);c=l+p,0==l&&(c=(l=(l-c)/2)+c);var h=d3.svg.arc().innerRadius(n).outerRadius(r).startAngle(l).endAngle(c),u=18<=r?100<=r?5:2:1;g.append("path").attr("d",h).attr("stroke",I.settings.backColorItems).attr("stroke-width",u).attr("stroke-miterlimit","10").attr("fill",I.settings.relations[a[d].type].colors.dark),l=c}}return t},l=function(t){return t.each(function(t){!function(t,e){var n=d3.select(t),r=t.parentNode,a=d3.select(r);textArray=p(e,I.settings.spiderChart.conceptCharactersPerLine),paragraph=a.append("text").attr("class","conceptText").attr("transform","translate(0,"+(+n.attr("r")+2+I.settings.spiderChart.conceptFontSize)+")").attr("text-anchor","middle");for(var i=0;i<textArray.length;i++)paragraph.append("svg:tspan").attr("x","0").attr("y",i*(I.settings.spiderChart.conceptFontSize+2)).text(textArray[i]).attr("font-size",I.settings.spiderChart.conceptFontSize)}(this,t.name)}),t},c=function(e,n){var r={};if(e.hasOwnProperty("parent_info")){r={id:"",name:I.settings.wording.glossaryRoot,children:[]};var t=e.parent_info;delete e.parent_info,t.forEach(function(t){r.children.push(c(t,e))}),r.children.sort(function(t,e){var n=t.name.toUpperCase(),r=e.name.toUpperCase();return n<r?-1:r<n?1:0})}else if(void 0!==n&&n.id===e.id&&(e=n),r={id:null!==e.id?e.id:"",name:e.hasOwnProperty("name")?0<e.name.length?e.name:I.settings.wording.glossaryRoot:""},e.hasOwnProperty("relations")&&e.relations.hasOwnProperty("children")&&0<e.relations.children.length){r.children=[],e.relations.children.forEach(function(t){r.children.push(c(t,n))}),r.children.sort(function(t,e){var n=t.name.toUpperCase(),r=e.name.toUpperCase();return n<r?-1:r<n?1:0});var a=!e.relations.children[0].hasOwnProperty("relations");(r.loadRequired=a)&&(r._children=r.children,r.children=null)}return r},d=function(t,e){var n=e.id===t.id;if(n&&0<t.name.length&&(e.name=t.name),e.hasOwnProperty("children")){var r=e.children;null!==r&&0!==r.length||!e.hasOwnProperty("_children")||(r=e._children);for(var a=0;a<r.length;a++)if(n&&t.hasOwnProperty("children")){var i=t.children;null!==i&&0!==i.length||!t.hasOwnProperty("_children")||(i=t._children);for(var s=0;s<i.length;s++)r[a]=d(i[s],r[a])}else r[a]=d(t,r[a]);r.sort(function(t,e){var n=t.name.toUpperCase(),r=e.name.toUpperCase();return n<r?-1:r<n?1:0})}else n&&t.hasOwnProperty("children")&&(e=t);return e};function p(t,e){null===t&&(t="");for(var n=t.split(/\s+/),r=[],a=[],i=0,s=0;s<n.length;s++)i+a.length+n[s].length>e&&0!=i&&(r.push(a.join(" ")),a=[],i=0),a.push(n[s]),i+=n[s].length,s==n.length-1&&r.push(a.join(" "));return r}},f.fn.d3Click=function(){this.each(function(t,e){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(n)})}}(jQuery);

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc