/*! * jQuery JavaScript Library v1.8.1 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Thu Aug 30 2012 17:17:22 GMT-0400 (Eastern Daylight Time) */ function BestInPlaceEditor(e){this.element=e,this.initOptions(),this.bindForm(),this.initNil(),jQuery(this.activator).bind("click",{editor:this},this.clickHandler)}function openAnalyze(){analyzeOpen=!0,findOpen&&closeFind(),organizeOpen&&closeOrganize(),$("#sideOptionFind").css("z-index","8"),$("#sideOptionAnalyze, #closeAnalyze").css("z-index","10"),$("#sideOptionOrganize").css("z-index","8"),$("#sideOptionAnalyze").animate({width:"100px",height:"76px"},100),$("#closeAnalyze").css("display","block"),$("#sideOptionAnalyze").css("cursor","default");var e=Object.keys(Mconsole.graph.nodes).length,t=0;Mconsole.graph.eachNode(function(e){e.eachAdjacency(function(){t++})}),t/=2,$(".analysis").html("
"+e+" topics
"+t+" synapses
")}function closeAnalyze(){analyzeOpen=!1,$("#closeAnalyze").css("display","none"),$("#sideOptionAnalyze").css("cursor","pointer"),$("#sideOptionAnalyze").animate({width:"64px",height:"32px"},100)}function switchVisible(e,t){categoryVisible[e]==1?hideCategory(e,t):categoryVisible[e]==0&&showCategory(e,t)}function hideCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",.4,"end"),t.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function showCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",1,"end"),t.eachAdjacency(function(e){e.setData("alpha",1,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function hideAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){!e.getData("inCommons")&&!e.getData("onCanvas")&&(e.setData("alpha",.4,"end"),e.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function showAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){e.setData("alpha",1,"end"),e.eachAdjacency(function(e){e.setData("alpha",1,"end")})}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function onCanvasSearch(e,t,n){Mconsole.graph.eachNode(function(r){e!=null?r.name.indexOf(e)!==-1&&e!=""?r.setData("onCanvas",!0):r.setData("onCanvas",!1):t!=null?r.getData("inmaps").indexOf(parseInt(t))!==-1?r.setData("onCanvas",!0):r.setData("onCanvas",!1):n!=null&&(r.getData("userid").toString()==n?r.setData("onCanvas",!0):r.setData("onCanvas",!1)),Mconsole.plot()})}function clearCanvas(){Mconsole.graph.eachNode(function(e){Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id)}),Mconsole.plot()}function clearFoundData(){Mconsole.graph.eachNode(function(e){e.getData("inCommons")===!0&&(Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id))}),Mconsole.plot()}function openFind(){findOpen=!0,analyzeOpen&&closeAnalyze(),organizeOpen&&closeOrganize(),$("#sideOptionFind, #closeFind").css("z-index","10"),$("#sideOptionAnalyze").css("z-index","9"),$("#sideOptionOrganize").css("z-index","8"),firstVal=$('#sideOptionFind option[value="name"]').attr("selected"),secondVal=$('#sideOptionFind option[value="metacode"]').attr("selected"),thirdVal=$('#sideOptionFind option[value="map (by name)"]').attr("selected"),fourthVal=$('#sideOptionFind option[value="mapper (by name)"]').attr("selected"),firstVal==="selected"||thirdVal==="selected"||fourthVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#topic_by_name_input").focus()}):secondVal==="selected"?$("#sideOptionFind").animate({width:"380px",height:"463px"},100,function(){}):thirdVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#map_by_name_input").focus()}):fourthVal==="selected"&&$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#mapper_by_name_input").focus()}),$("#closeFind, #findWhere").css("display","block"),$("#sideOptionFind").css("cursor","default")}function closeFind(){findOpen=!1,Mconsole.graph.eachNode(function(e){e.setData("inCommons",!1),e.setData("onCanvas",!1)}),Mconsole.plot(),$("#closeFind, #findWhere").css("display","none"),$("#sideOptionFind").css("cursor","pointer"),$("#sideOptionFind").animate({width:"45px",height:"32px"},100)}function graphSettings(e){var t;if(e=="arranged"||e=="chaotic")t={injectInto:"infovis",Navigation:{enable:!0,type:"HTML",panning:"avoid nodes",zooming:15},Node:{overridable:!0,color:"#2D6A5D",type:"customNode",dim:25},Edge:{overridable:!0,color:"#222222",type:"customEdge",lineWidth:2},Label:{type:"HTML",size:20},Tips:{enable:!1,onShow:function(e,t){}},Events:{enable:!0,enableForEdges:!0,type:"HTML",onMouseMove:function(e,t,n){onMouseMoveHandler(e,t,n)},onDragMove:function(e,t,n){clickDragOnTopic(e,t,n)},onDragEnd:function(){tempInit&&tempNode2==null?($("#topic_addSynapse").val("true"),$("#new_topic").fadeIn("fast"),addMetacode(),$("#topic_name").focus()):tempInit&&tempNode2!=null?($("#topic_addSynapse").val("false"),$("#synapse_topic1id").val(tempNode.id),$("#synapse_topic2id").val(tempNode2.id),$("#new_synapse").fadeIn("fast"),$("#synapse_desc").focus(),tempNode=null,tempNode2=null,tempInit=!1):dragged!=0&&goRealtime&&saveLayout(dragged)},onDragCancel:function(){tempNode=null,tempNode2=null,tempInit=!1,$("#topic_addSynapse").val("false"),$("#topic_topic1id").val(0),$("#topic_topic2id").val(0),Mconsole.plot()},onTouchMove:function(e,t,n){$jit.util.event.stop(n),this.onDragMove(e,t,n)},onClick:function(e,t,n){if(n.target.id!="infovis-canvas")return!1;e.nodeFrom?selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?selectNodeOnClickHandler(e,n):canvasDoubleClickHandler(t.getPos(),n)}},iterations:200,levelDistance:200,onCreateLabel:function(e,t){onCreateLabelHandler(e,t)},onPlaceLabel:function(e,t){var n=e.style,r=parseInt(n.left),i=parseInt(n.top),s=e.offsetWidth;n.left=r-s/2+107+"px",n.top=i-165+"px",n.display="";var o=document.getElementById("topic_"+t.id+"_label");s=o.offsetWidth,n=o.style,n.left=-(s/2+106)+"px"}};else if(e="centered")t={injectInto:"infovis",background:{CanvasStyles:{strokeStyle:"#333",lineWidth:1.5}},Navigation:{enable:!0,type:"HTML",panning:"avoid nodes",zooming:15},Node:{overridable:!0,color:"#2D6A5D",type:"customNode",dim:25},Edge:{overridable:!0,color:"#222222",type:"customEdge",lineWidth:2},Label:{type:"HTML",size:20},Tips:{enable:!1,onShow:function(e,t){}},Events:{enable:!0,type:"HTML",onMouseMove:function(e,t,n){onMouseMoveHandler(e,t,n)},onDragMove:function(e,t,n){clickDragOnTopic(e,t,n)},onDragEnd:function(){tempInit&&tempNode2==null?($("#topic_addSynapse").val("true"),$("#new_topic").fadeIn("fast"),addMetacode(),$("#topic_name").focus()):tempInit&&tempNode2!=null&&($("#topic_addSynapse").val("false"),$("#synapse_topic1id").val(tempNode.id),$("#synapse_topic2id").val(tempNode2.id),$("#new_synapse").fadeIn("fast"),$("#synapse_desc").focus(),tempNode=null,tempNode2=null,tempInit=!1)},onDragCancel:function(){tempNode=null,tempNode2=null,tempInit=!1,Mconsole.plot()},onTouchMove:function(e,t,n){$jit.util.event.stop(n),this.onDragMove(e,t,n)},onClick:function(e,t,n){if(n.target.id!="infovis-canvas")return!1;t.getNode()==0?t.getEdge()!=0?selectEdgeOnClickHandler(t.getEdge(),n):e.nodeFrom&&selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?Mconsole.busy||(selectNodeOnClickHandler(e,n),Mconsole.onClick(e.id,{hideLabels:!1})):canvasDoubleClickHandler(t.getPos(),n)}},iterations:200,levelDistance:200,onCreateLabel:function(e,t){onCreateLabelHandler(e,t)},onPlaceLabel:function(e,t){var n=e.style,r=parseInt(n.left),i=parseInt(n.top),s=e.offsetWidth;n.left=r-s/2+107+"px",n.top=i-165+"px",n.display="";var o=document.getElementById("topic_"+t.id+"_label");s=o.offsetWidth,n=o.style,n.left=-(s/2+106)+"px"}};return t}function editEdge(e,t){$("#edit_synapse").remove(),deselectEdge(e);var n=document.createElement("div");n.setAttribute("id","edit_synapse"),$(".main .wrapper").append(n),$("#edit_synapse").attr("class","best_in_place best_in_place_desc"),$("#edit_synapse").attr("data-object","synapse"),$("#edit_synapse").attr("data-attribute","desc"),$("#edit_synapse").attr("data-type","input"),$("#edit_synapse").attr("data-nil"," "),$("#edit_synapse").attr("data-url","/synapses/"+e.getData("id")),$("#edit_synapse").html(e.getData("desc")),$("#edit_synapse").css("position","absolute"),$("#edit_synapse").css("left",t.clientX),$("#edit_synapse").css("top",t.clientY),$("#edit_synapse").bind("ajax:success",function(){var t=$(this).html();e.setData("desc",t),selectEdge(e),Mconsole.plot(),$("#edit_synapse").remove()}),$("#edit_synapse").focusout(function(){$("#edit_synapse").hide()}),$("#edit_synapse").click(),$("#edit_synapse form").submit(function(){$("#edit_synapse").hide()}),$("#edit_synapse input").focus(),$("#edit_synapse").show()}function selectEdgeOnClickHandler(e,t){if(t.altKey){editEdge(e,t);return}var n=e.getData("showDesc");n&&t.shiftKey?deselectEdge(e):!n&&t.shiftKey?selectEdge(e):n&&!t.shiftKey?deselectAllEdges():!n&&!t.shiftKey&&(deselectAllEdges(),selectEdge(e)),Mconsole.plot()}function deselectAllEdges(){for(var e=0;et |