'
}
]);
+ // tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on
+ $('.sidebarSearchField').bind('typeahead:selected', function (event, datum, dataset) {
+ console.log(event);
+ if (datum.rtype != "noresult") {
+ var win;
+ if (dataset == "topics") {
+ win=window.open('/topics/' + datum.id, '_blank');
+ }
+ else if (dataset == "maps") {
+ win=window.open('/maps/' + datum.id, '_blank');
+ }
+ else if (dataset == "mappers") {
+ win=window.open('/maps/mappers/' + datum.id, '_blank');
+ }
+ win.focus();
+ closeSearch(0);
+ }
+ });
+
+
+ var checkboxChangeInit = false, minimizeInit = false;
+
+ $('.sidebarSearchField').bind('keyup', function () {
+
+ // when the user selects 'added by me' resend the query with their userid attached
+ if (!checkboxChangeInit) {
+ $('.limitToMe').bind("change", function(e) {
+ // set the value of the search equal to itself to retrigger the autocomplete event
+ searchIsOpen = false;
+ $('.sidebarSearchField').typeahead('setQuery',$('.sidebarSearchField').val());
+ setTimeout(function() { searchIsOpen = true; }, 2000);
+ });
+ checkboxChangeInit = true;
+ }
+
+ // when the user clicks minimize section, hide the results for that section
+ if (!minimizeInit) {
+ $('.minimizeMapperResults').click(function(e) {
+ var s = $('.tt-dataset-mappers .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ $('.tt-dataset-mappers .tt-suggestions').css('height','auto');
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ $('.tt-dataset-mappers .tt-suggestions').css('height','0');
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ $('.minimizeTopicResults').click(function(e) {
+ var s = $('.tt-dataset-topics .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ s.css({'height':'auto','border-top':'none'});
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ s.css({'height':'0','border-top':'1px solid #222'});
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ $('.minimizeMapResults').click(function(e) {
+ var s = $('.tt-dataset-maps .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ s.css({'height':'auto','border-top':'none'});
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ s.css({'height':'0','border-top':'1px solid #222'});
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ minimizeInit = true;
+ }
+ });
+
+ //
+
+ $('.sidebarSearch button.addToMap').click(function(event){
+ event.stopPropagation();
+ });
} // end bindSearchHover
function bindAccountHover() {
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 12c8bf1c..d0e9e340 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -835,12 +835,43 @@ border: 1px solid black;
font-size:20px;
line-height:20px;
margin: 10px 0 3px 10px;
+ float:left;
}
+.sidebarSearch .tt-dropdown-menu .limitToMe {
+ float:left;
+ width: 15px;
+ height: 15px;
+ margin-top: 11px;
+ margin-left: 15px;
+}
+.sidebarSearch .tt-dropdown-menu .limitToMeLabel {
+ float:left;
+ margin-top: 11px;
+}
+.sidebarSearch .tt-dropdown-menu .minimizeResults {
+ float:right;
+ width:35px;
+ height:35px;
+ background: url('/assets/MMCCicon_minimize_arrow.png') no-repeat center center;
+ background-size: 25px 25px;
+ cursor:pointer;
+}
+.sidebarSearch .tt-dropdown-menu .maximizeResults {
+ float:right;
+ width:35px;
+ height:35px;
+ background: url('/assets/MMCCicon_maximize_arrow.png') no-repeat center center;
+ background-size: 25px 25px;
+ cursor:pointer;
+}
+
.sidebarSearch .tt-suggestions {
font-family:'LatoLight', helvetica, sans-serif;
+ overflow:hidden;
}
+
.sidebarSearch .tt-suggestion {
background: rgba(0,0,0,0.5);
border: 1px solid black;
@@ -850,6 +881,10 @@ border: 1px solid black;
background:black;
}
+.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap, .sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic {
+ min-height: 57px;
+}
+
.sidebarSearch .tt-suggestion .icon {
float:left;
width:36px;
@@ -863,7 +898,7 @@ border: 1px solid black;
}
.sidebarSearch .resultText {
- width: 280px;
+ width: 275px;
display: block;
float: left;
}
@@ -888,7 +923,7 @@ border: 1px solid black;
}
.sidebarSearch div.autoOptions {
- width: 117px;
+ width: 122px;
float: left;
position:relative;
display:none;
@@ -896,6 +931,9 @@ border: 1px solid black;
.sidebarSearch .tt-is-under-cursor .autoOptions {
display:block;
}
+.sidebarSearch .tt-suggestion .resultnoresult .autoOptions {
+ display:none;
+}
.sidebarSearch .autoOptions button, .sidebarSearch .autoOptions a, .sidebarSearch .autoOptions div {
position: absolute;
@@ -906,21 +944,22 @@ border: 1px solid black;
}
.sidebarSearch button.addToMap {
- width: 20px;
- height: 20px;
- background: url(/assets/MMCCicon_add.png) no-repeat center center;
- background-size: 15px 15px;
- top: 10px;
- left: 0px;
+width: 20px;
+height: 20px;
+background: url(/assets/MMCCicon_add.png) no-repeat center center;
+background-size: 18px 18px;
+top: 30px;
+left: 84px;
+cursor: pointer;
}
.sidebarSearch a.goTo {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_pop-out.png) no-repeat center center;
-background-size: 15px 15px;
-top: 11px;
-left: 22px;
+background-size: 18px 18px;
+top: 7px;
+left: 84px;
}
.sidebarSearch div.mapCount {
@@ -928,8 +967,8 @@ width: 20px;
height: 20px;
background: url(/assets/MMCCicon_map.png) no-repeat 0px center;
background-size: 14px 14px;
-top: 0px;
-left: 50px;
+top: 7px;
+left: 39px;
padding-left: 18px;
font-size: 12px;
line-height: 20px;
@@ -940,8 +979,8 @@ width: 20px;
height: 20px;
background: url(/assets/MMCCicon_topic.png) no-repeat 0px center;
background-size: 14px 14px;
-top: 0px;
-left: 50px;
+top: 7px;
+left: 39px;
padding-left: 18px;
font-size: 12px;
line-height: 20px;
@@ -951,10 +990,10 @@ line-height: 20px;
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_synapse.png) no-repeat 0px center;
-background-size: 14px 14px;
-top: 0px;
-left: 83px;
-padding-left: 15px;
+background-size: 15px 15px;
+top: 30px;
+left: 38px;
+padding-left: 19px;
font-size: 12px;
line-height: 20px;
}
@@ -963,29 +1002,29 @@ line-height: 20px;
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_mapper.png) no-repeat center center;
- background-size: 16px 16px;
- top: 21px;
- left: 52px;
+ background-size: 17px 17px;
+ top: 7px;
+ left: 13px;
}
.sidebarSearch div.mapContributorsIcon {
- width: 20px;
- height: 20px;
- background: url(/assets/MMCCicon_mapper.png) no-repeat 0px center;
- background-size: 16px 16px;
- top: 21px;
- left: 50px;
- padding-left: 18px;
- font-size: 12px;
- line-height: 20px;
+height: 20px;
+background: url(/assets/MMCCicon_mapper.png) no-repeat 0px center;
+background-size: 17px 17px;
+top: 7px;
+right: 85px;
+padding-left: 19px;
+font-size: 12px;
+line-height: 20px;
+padding-right: 5px;
}
.sidebarSearch div.topicPermission, .sidebarSearch div.mapPermission {
width: 20px;
height: 20px;
-background-size: 20px 20px !important;
-top: 20px;
-left: 84px;
+background-size: 19px 19px !important;
+top: 30px;
+left: 13px;
}
.sidebarSearch div.topicPermission.commons, .sidebarSearch div.mapPermission.commons {
background: url(/assets/MMCCicon_commons.png) no-repeat center center;
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
index 8c40fd51..86aa9431 100644
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -36,6 +36,7 @@ class MainController < ApplicationController
@current = current_user
term = params[:term]
+ user = params[:user] ? params[:user] : false
if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..6] != "mapper:" && term.downcase != "topic:"
@@ -59,13 +60,20 @@ class MainController < ApplicationController
@topics = []
else
search = '%' + term.downcase + '%'
- @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).
- where('metacode_id = ?', filterByMetacode.id).limit(10).order('"name"').visibleToUser(@current,nil)
+
+ if !user
+ @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).where('metacode_id = ?', filterByMetacode.id).order('"name"')
+ elsif user
+ @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).where('metacode_id = ?', filterByMetacode.id).where('user_id = ?', user).order('"name"')
+ end
end
else
search = '%' + term.downcase + '%'
- @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).
- limit(10).order('"name"').visibleToUser(@current,nil)
+ if !user
+ @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).order('"name"')
+ elsif
+ @topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).where('user_id = ?', user).order('"name"')
+ end
end
else
@topics = []
@@ -87,14 +95,19 @@ class MainController < ApplicationController
@current = current_user
term = params[:term]
+ user = params[:user] ? params[:user] : nil
+
if term && !term.empty? && term.downcase[0..5] != "topic:" && term.downcase[0..6] != "mapper:" && term.downcase != "map:"
#remove "map:" if appended at beginning
term = term[4..-1] if term.downcase[0..3] == "map:"
search = '%' + term.downcase + '%'
- @maps = Map.where('LOWER("name") like ? OR LOWER("desc") like ?', search, search).
- limit(10).order('"name"').visibleToUser(@current,nil)
+ if !user
+ @maps = Map.where('LOWER("name") like ? OR LOWER("desc") like ?', search, search).order('"name"')
+ elsif user
+ @maps = Map.where('LOWER("name") like ? OR LOWER("desc") like ?', search, search).where('user_id = ?', user).order('"name"')
+ end
else
@maps = []
end
diff --git a/app/helpers/maps_helper.rb b/app/helpers/maps_helper.rb
index 99a3a752..deedc1e3 100644
--- a/app/helpers/maps_helper.rb
+++ b/app/helpers/maps_helper.rb
@@ -13,6 +13,7 @@ module MapsHelper
map['topicCount'] = m.topics.count
map['synapseCount'] = m.synapses.count
map['contributorCount'] = m.contributors.count
+ map['rtype'] = "map"
contributorList = ''
if m.contributors.count > 0
diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb
index 1c0b1f1f..a97ce8b5 100644
--- a/app/helpers/topics_helper.rb
+++ b/app/helpers/topics_helper.rb
@@ -15,6 +15,7 @@ module TopicsHelper
topic['mapCount'] = t.maps.count
topic['synapseCount'] = t.synapses.count
topic['originator'] = t.user.name
+ topic['rtype'] = "topic"
temp.push topic
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 03bdb2dd..75b06ede 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -9,6 +9,7 @@ module UsersHelper
user['label'] = u.name
user['value'] = u.name
user['mapCount'] = u.maps.count
+ user['rtype'] = "mapper"
temp.push user
end
diff --git a/app/views/layouts/_searchtemplates.html.erb b/app/views/layouts/_searchtemplates.html.erb
index 0362ef01..4d2ddb06 100644
--- a/app/views/layouts/_searchtemplates.html.erb
+++ b/app/views/layouts/_searchtemplates.html.erb
@@ -6,6 +6,7 @@
+
{{type}}
@@ -15,7 +16,7 @@
<% if controller_name == 'maps' && action_name == 'show' && authenticated? && @map.authorize_to_edit(@current) %>
-
+
add to map
<% end %>
@@ -38,8 +39,10 @@
+
+
{{value}}
@@ -67,8 +70,10 @@
+
+
{{value}}
@@ -84,5 +89,6 @@
+
\ No newline at end of file
diff --git a/public/assets/MMCCicon_go-aae580938b3ea29afbe3de759feee359.png b/public/assets/MMCCicon_go-aae580938b3ea29afbe3de759feee359.png
new file mode 100644
index 00000000..e35a0f87
Binary files /dev/null and b/public/assets/MMCCicon_go-aae580938b3ea29afbe3de759feee359.png differ
diff --git a/public/assets/MMCCicon_go.png b/public/assets/MMCCicon_go.png
new file mode 100644
index 00000000..e35a0f87
Binary files /dev/null and b/public/assets/MMCCicon_go.png differ
diff --git a/public/assets/MMCCicon_link-32bc019e1ba44c73c8898de7ca0de1fa.png b/public/assets/MMCCicon_link-32bc019e1ba44c73c8898de7ca0de1fa.png
new file mode 100644
index 00000000..8bd1ee24
Binary files /dev/null and b/public/assets/MMCCicon_link-32bc019e1ba44c73c8898de7ca0de1fa.png differ
diff --git a/public/assets/MMCCicon_link.png b/public/assets/MMCCicon_link.png
new file mode 100644
index 00000000..8bd1ee24
Binary files /dev/null and b/public/assets/MMCCicon_link.png differ
diff --git a/public/assets/MMCCicon_maximize_arrow-d529ebb50a2254187a1d42e7ec496eaa.png b/public/assets/MMCCicon_maximize_arrow-d529ebb50a2254187a1d42e7ec496eaa.png
new file mode 100644
index 00000000..1fe42d26
Binary files /dev/null and b/public/assets/MMCCicon_maximize_arrow-d529ebb50a2254187a1d42e7ec496eaa.png differ
diff --git a/public/assets/MMCCicon_maximize_arrow.png b/public/assets/MMCCicon_maximize_arrow.png
new file mode 100644
index 00000000..1fe42d26
Binary files /dev/null and b/public/assets/MMCCicon_maximize_arrow.png differ
diff --git a/public/assets/MMCCicon_metacode_set-f4e1e0a7c9e66f8d61ded339704f9ef6.png b/public/assets/MMCCicon_metacode_set-f4e1e0a7c9e66f8d61ded339704f9ef6.png
new file mode 100644
index 00000000..98aea34a
Binary files /dev/null and b/public/assets/MMCCicon_metacode_set-f4e1e0a7c9e66f8d61ded339704f9ef6.png differ
diff --git a/public/assets/MMCCicon_metacode_set.png b/public/assets/MMCCicon_metacode_set.png
new file mode 100644
index 00000000..98aea34a
Binary files /dev/null and b/public/assets/MMCCicon_metacode_set.png differ
diff --git a/public/assets/MMCCicon_minimize_arrow-8923745a55d45e84fcd5ce8c0b90d042.png b/public/assets/MMCCicon_minimize_arrow-8923745a55d45e84fcd5ce8c0b90d042.png
new file mode 100644
index 00000000..2aad516c
Binary files /dev/null and b/public/assets/MMCCicon_minimize_arrow-8923745a55d45e84fcd5ce8c0b90d042.png differ
diff --git a/public/assets/MMCCicon_minimize_arrow.png b/public/assets/MMCCicon_minimize_arrow.png
new file mode 100644
index 00000000..2aad516c
Binary files /dev/null and b/public/assets/MMCCicon_minimize_arrow.png differ
diff --git a/public/assets/application-32fff722d967b095a46a0f9aef58d2ac.js b/public/assets/application-32fff722d967b095a46a0f9aef58d2ac.js
deleted file mode 100644
index 7c062836..00000000
--- a/public/assets/application-32fff722d967b095a46a0f9aef58d2ac.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*!
- * 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 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.setData("alpha",.4,"end"),e.eachAdjacency(function(e){e.setData("alpha",.2,"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",.4,"end")})}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function filterTopicsByMap(e){Mconsole.graph.eachNode(function(t){t.getData("inmaps").indexOf(parseInt(e))!==-1?t.setData("alpha",1,"end"):t.setData("alpha",.4,"end"),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:500})})}function filterTopicsByMapper(e){Mconsole.graph.eachNode(function(t){t.getData("userid").toString()==e?t.setData("alpha",1,"end"):t.setData("alpha",.4,"end"),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:500})})}function filterTopicsByName(e){Mconsole.graph.eachNode(function(t){nodeName=t.name.toLowerCase(),nodeName.indexOf(e)!==-1&&e!=""?t.setData("alpha",1,"end"):t.setData("alpha",.4,"end"),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:500})})}function clearCanvas(){Mconsole.graph.eachNode(function(e){Mconsole.graph.removeNode(e.id)}),Mconsole.plot()}function clearCanvasExceptRoot(){var e=new Array;Mconsole.graph.eachNode(function(t){e.push(t.id)});var t=Mconsole.graph.nodes[Mconsole.root];e.forEach(function(e,n){e!=t.id&&Mconsole.graph.removeNode(e)}),fetchRelatives(t)}function selectEdgeOnClickHandler(e,t){if(Mconsole.busy)return;if(synapseWasDoubleClicked()){synapseDoubleClickHandler(e,t);return}var n=MetamapsModel.selectedEdges.indexOf(e);n==-1?n=!1:n!=-1&&(n=!0),n&&t.shiftKey?deselectEdge(e):!n&&t.shiftKey?selectEdge(e):n&&!t.shiftKey?deselectAllEdges():!n&&!t.shiftKey&&(deselectAllEdges(),selectEdge(e)),Mconsole.plot()}function synapseDoubleClickHandler(e,t){editEdge(e,t)}function synapseWasDoubleClicked(){var e=MetamapsModel.lastSynapseClick,t=Date.now();return MetamapsModel.lastSynapseClick=t,t-eDelete'),mapid&&userid!=null&&(r+='
Remove from Map
'),r+='
Hide until refresh
',mapid||(r+='
Center This Topic
'),r+='
Open In New Tab
',r+="",n.innerHTML=r,$(n).css({left:t.clientX,top:t.clientY}),$("#center-container").append(n),$(".rc-delete").click(function(){$(".rightclickmenu").remove();var e=MetamapsModel.selectedNodes.length,t=MetamapsModel.selectedEdges.length,n=e==1?"1 topic":e+" topics",r=t==1?"1 synapse":t+" synapses",i="You have "+n+" and "+r+" selected. ",s=confirm(i+"Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");s==1&&(deleteSelectedEdges(),deleteSelectedNodes())}),$(".rc-remove").click(function(){$(".rightclickmenu").remove(),hideSelectedEdges(),hideSelectedNodes()}),$(".rc-hide").click(function(){$(".rightclickmenu").remove(),hideSelectedEdges(),hideSelectedNodes()}),$(".rc-center").click(function(){$(".rightclickmenu").remove(),centerOn(e.id)}),$(".rc-popout").click(function(){$(".rightclickmenu").remove();var t=window.open("/topics/"+e.id,"_blank");t.focus()})}function canvasDoubleClickHandler(e,t){var n=MetamapsModel.lastCanvasClick,r=Date.now();MetamapsModel.lastCanvasClick=r,r-n=Mconsole.canvas.scaleOffsetX*d&&Mconsole.canvas.scaleOffsetX*d>=1&&Mconsole.canvas.scale(d,d),Mconsole.canvas.scaleOffsetX<.5?Mconsole.canvas.viz.labels.hideLabels(!0):Mconsole.canvas.scaleOffsetX>.5&&Mconsole.canvas.viz.labels.hideLabels(!1),lastDist=p}}function graphSettings(e,t){var n={injectInto:"infovis",Navigation:{enable:!0,panning:"avoid nodes",zooming:28},Node:{overridable:!0,color:"#2D6A5D",type:"customNode",dim:25},Edge:{overridable:!0,color:"#222222",type:"customEdge",lineWidth:2,alpha:.4},Label:{type:"Native",size:20,family:"arial",textBaseline:"hanging",color:"#000"},Tips:{enable:!1,onShow:function(e,t){}},Events:{enable:!0,enableForEdges:!0,onMouseMove:function(e,t,n){onMouseMoveHandler(e,t,n)},onDragMove:function(e,t,n){onDragMoveTopicHandler(e,t,n)},onDragEnd:function(e,t,n){onDragEndTopicHandler(e,t,n,!1)},onDragCancel:function(e,t,n){onDragCancelHandler(e,t,n,!1)},onTouchStart:function(e,t,n){Mconsole.events.touched=!0,touchPos=t.getPos();var r=Mconsole.canvas,i=r.translateOffsetX;oy=r.translateOffsetY,sx=r.scaleOffsetX,sy=r.scaleOffsetY,touchPos.x*=sx,touchPos.y*=sy,touchPos.x+=i,touchPos.y+=oy,touchDragNode=e},onTouchMove:function(e,t,n){touchDragNode?onDragMoveTopicHandler(touchDragNode,t,n):(touchPanZoomHandler(t,n),Mconsole.labels.hideLabel(Mconsole.graph.getNode(MetamapsModel.showcardInUse)))},onTouchEnd:function(e,t,n){},onTouchCancel:function(e,t,n){},onClick:function(e,t,n){if(MetamapsModel.boxStartCoordinates){Mconsole.busy=!1,MetamapsModel.boxEndCoordinates=t.getPos(),selectNodesWithBox();return}if(n.target.id!="infovis-canvas")return!1;e.nodeFrom?selectEdgeOnClickHandler(e,n):e&&!e.nodeFrom?selectNodeOnClickHandler(e,n):(MetamapsModel.didPan||hideCards(),canvasDoubleClickHandler(t.getPos(),n))},onRightClick:function(e,t,n){n.preventDefault(),n.stopPropagation(),e&&!e.nodeFrom?selectNodeOnRightClickHandler(e,n):e&&e.nodeFrom}},iterations:200,levelDistance:200};return t&&(n.Edge.type="customEdgeEmbed"),e=="centered"&&(n.background={CanvasStyles:{strokeStyle:"#333",lineWidth:1.5}},n.levelDistance=400,n.Events.enableForEdges=!0,n.Events.onDragEnd=function(e,t,n){onDragEndTopicHandler(e,t,n,!1)},n.Events.onDragCancel=function(e,t,n){onDragCancelHandler(e,t,n,!0)}),n}function hideCards(){$("#edit_synapse").hide(),MetamapsModel.edgecardInUse=null,hideCurrentCard(),$(".rightclickmenu").remove()}function drawSelectBox(e,t){Mconsole.plot();var n=Mconsole.canvas.getCtx(),r=MetamapsModel.boxStartCoordinates.x,i=MetamapsModel.boxStartCoordinates.y,s=e.getPos().x,o=e.getPos().y;Mconsole.plot(),n.beginPath(),n.moveTo(r,i),n.lineTo(r,o),n.lineTo(s,o),n.lineTo(s,i),n.lineTo(r,i),n.strokeStyle="black",n.stroke()}function selectNodesWithBox(){var e=MetamapsModel.boxStartCoordinates.x,t=MetamapsModel.boxStartCoordinates.y,n=MetamapsModel.boxEndCoordinates.x,r=MetamapsModel.boxEndCoordinates.y;Mconsole.graph.eachNode(function(i){var s=gType=="centered"?i.pos.toComplex().x:i.pos.x,o=gType=="centered"?i.pos.toComplex().y:i.pos.y;if(es&&s>n&&t>o&&o>r||e>s&&s>n&&to&&o>r){var u=MetamapsModel.selectedNodes.indexOf(i);u==-1?selectNode(i):u!=-1&&deselectNode(i)}}),MetamapsModel.boxStartCoordinates=!1,MetamapsModel.boxEndCoordinates=!1,Mconsole.plot()}function onMouseMoveHandler(e,t,n){if(Mconsole.busy)return;var e=t.getNode(),r=t.getEdge();if(e!=0){MetamapsModel.edgeHoveringOver&&onMouseLeave(MetamapsModel.edgeHoveringOver);return}r==0&&MetamapsModel.edgeHoveringOver!=0?onMouseLeave(MetamapsModel.edgeHoveringOver):r!=0&&MetamapsModel.edgeHoveringOver==0?onMouseEnter(r):r!=0&&MetamapsModel.edgeHoveringOver!=r&&(onMouseLeave(MetamapsModel.edgeHoveringOver),onMouseEnter(r)),MetamapsModel.edgeHoveringOver=r}function onMouseEnter(e){$("canvas").css("cursor","pointer");var t=MetamapsModel.selectedEdges.indexOf(e);t==-1&&(e.setData("showDesc",!0,"current"),e.setDataset("end",{lineWidth:4,alpha:1}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100}),Mconsole.plot())}function onMouseLeave(e){$("canvas").css("cursor","default");var t=MetamapsModel.selectedEdges.indexOf(e);t==-1&&(e.setData("showDesc",!1,"current"),e.setDataset("end",{lineWidth:2,alpha:.4}),Mconsole.fx.animate({modes:["edge-property:lineWidth:color:alpha"],duration:100})),Mconsole.plot()}function onDragEndTopicHandler(e,t,n,r){if(tempInit&&tempNode2==null)$("#topic_addSynapse").val("true"),$("#new_topic").fadeIn("fast"),$("#topic_name").focus();else if(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;else if(dragged&&dragged!=0&&goRealtime){saveLayout(dragged);for(var i=0;i$_name_$
'}function replaceVariables(e,t){var n,r,i;authorizeToEdit(t)?(n='[go]',r="",i=""):(n="",t.getData("link")!=""?(r='',i=""):(r="",i=""));var s=new Array;for(var o in imgArray)imgArray.hasOwnProperty(o)&&o!=t.getData("metacode")&&s.push(o);s.sort(),s.unshift(t.getData("metacode"));var u="'[";for(var a in s)u+='["'+s[a]+'","'+s[a]+'"],';u=u.slice(0,-1),u+="]'";var f="Click to add description...",l="Click to add link...",c="";userid==t.getData("userid")&&(c='