2014-07-29 17:34:10 +00:00
|
|
|
function fetchRelatives(node) {
|
|
|
|
var myA = $.ajax({
|
|
|
|
type: "Get",
|
|
|
|
url: "/topics/" + node.id + "?format=json",
|
|
|
|
success: function (data) {
|
|
|
|
if (gType == "centered") {
|
|
|
|
Mconsole.busy = true;
|
|
|
|
Mconsole.op.sum(data, {
|
|
|
|
type: 'fade',
|
|
|
|
duration: 500,
|
|
|
|
hideLabels: false
|
|
|
|
});
|
|
|
|
Mconsole.graph.eachNode(function (n) {
|
|
|
|
n.eachAdjacency(function (a) {
|
|
|
|
if (!a.getData('showDesc')) {
|
|
|
|
a.setData('alpha', 0.4, 'start');
|
|
|
|
a.setData('alpha', 0.4, 'current');
|
|
|
|
a.setData('alpha', 0.4, 'end');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Mconsole.busy = false;
|
|
|
|
} else {
|
|
|
|
Mconsole.op.sum(data, {
|
|
|
|
type: 'nothing',
|
|
|
|
});
|
|
|
|
Mconsole.plot();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function () {
|
|
|
|
alert('failure');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function centerOn(nodeid) {
|
|
|
|
if (!Mconsole.busy) {
|
|
|
|
var node = Mconsole.graph.getNode(nodeid);
|
|
|
|
$('div.index img').attr('src', imgArray[node.getData('metacode')].src);
|
|
|
|
$('div.index .mapName').html(node.name);
|
|
|
|
$(document).attr('title', node.name + ' | Metamaps');
|
|
|
|
window.history.pushState(node.name, "Metamaps", "/topics/" + node.id);
|
|
|
|
Mconsole.onClick(node.id, {
|
|
|
|
hideLabels: false,
|
|
|
|
duration: 1000,
|
|
|
|
onComplete: function () {
|
|
|
|
fetchRelatives(node);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function MconsoleReset() {
|
|
|
|
|
|
|
|
var tX = Mconsole.canvas.translateOffsetX;
|
|
|
|
var tY = Mconsole.canvas.translateOffsetY;
|
|
|
|
Mconsole.canvas.translate(-tX, -tY);
|
|
|
|
|
|
|
|
var mX = Mconsole.canvas.scaleOffsetX;
|
|
|
|
var mY = Mconsole.canvas.scaleOffsetY;
|
|
|
|
Mconsole.canvas.scale((1 / mX), (1 / mY));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-01 08:57:19 +00:00
|
|
|
// create filters for maps
|
2012-10-22 01:10:43 +00:00
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function switchVisible(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (categoryVisible[category] == true) {
|
2012-12-14 18:31:39 +00:00
|
|
|
hideCategory(category, duration);
|
2012-10-22 01:10:43 +00:00
|
|
|
}
|
|
|
|
else if (categoryVisible[category] == false) {
|
2012-12-14 18:31:39 +00:00
|
|
|
showCategory(category, duration);
|
2012-10-22 01:10:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function hideCategory(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2013-01-01 22:45:35 +00:00
|
|
|
if (n.getData('metacode') == category) {
|
2012-12-22 08:32:12 +00:00
|
|
|
n.setData('alpha', 0.4, 'end');
|
2012-10-22 01:10:43 +00:00
|
|
|
n.eachAdjacency(function(adj) {
|
2012-12-22 08:32:12 +00:00
|
|
|
adj.setData('alpha', 0.4, 'end');
|
2012-10-22 01:10:43 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-10-22 01:10:43 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
function showCategory(category, duration) {
|
2012-10-22 01:10:43 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2013-01-01 22:45:35 +00:00
|
|
|
if (n.getData('metacode') == category) {
|
2012-10-22 01:10:43 +00:00
|
|
|
n.setData('alpha', 1, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 1, 'end');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-10-22 01:10:43 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-11-23 19:00:00 +00:00
|
|
|
|
2012-12-22 08:32:12 +00:00
|
|
|
// These functions toggle ALL nodes and synapses on the page
|
2012-12-14 18:31:39 +00:00
|
|
|
function hideAll(duration) {
|
2012-11-23 19:00:00 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2014-02-01 08:57:19 +00:00
|
|
|
n.setData('alpha', 0.4, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 0.2, 'end');
|
|
|
|
});
|
2012-11-23 19:00:00 +00:00
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-11-23 19:00:00 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-12-14 18:31:39 +00:00
|
|
|
function showAll(duration) {
|
2012-11-23 19:00:00 +00:00
|
|
|
if (duration == null) duration = 500;
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.graph.eachNode( function (n) {
|
2012-11-23 19:00:00 +00:00
|
|
|
n.setData('alpha', 1, 'end');
|
|
|
|
n.eachAdjacency(function(adj) {
|
2014-02-01 08:57:19 +00:00
|
|
|
adj.setData('alpha', 0.4, 'end');
|
2012-11-23 19:00:00 +00:00
|
|
|
});
|
|
|
|
});
|
2012-12-15 07:39:14 +00:00
|
|
|
Mconsole.fx.animate({
|
2012-11-23 19:00:00 +00:00
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: duration
|
|
|
|
});
|
|
|
|
}
|
2012-12-16 20:00:43 +00:00
|
|
|
|
2014-02-01 08:57:19 +00:00
|
|
|
function filterTopicsByMap(mapID) {
|
2013-02-22 00:59:59 +00:00
|
|
|
Mconsole.graph.eachNode(function (n) {
|
2014-02-01 08:57:19 +00:00
|
|
|
if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) {
|
|
|
|
n.setData('alpha', 1, 'end');
|
2013-02-22 00:59:59 +00:00
|
|
|
}
|
2014-02-01 08:57:19 +00:00
|
|
|
else {
|
|
|
|
n.setData('alpha', 0.4, 'end');
|
2013-02-22 00:59:59 +00:00
|
|
|
}
|
2014-02-01 08:57:19 +00:00
|
|
|
Mconsole.fx.animate({
|
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: 500
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} // filterTopicsByName
|
|
|
|
|
|
|
|
function filterTopicsByMapper(mapperID) {
|
|
|
|
Mconsole.graph.eachNode(function (n) {
|
|
|
|
if (n.getData('userid').toString() == mapperID) {
|
|
|
|
n.setData('alpha', 1, 'end');
|
2013-02-22 00:59:59 +00:00
|
|
|
}
|
2014-02-01 08:57:19 +00:00
|
|
|
else {
|
|
|
|
n.setData('alpha', 0.4, 'end');
|
|
|
|
}
|
|
|
|
Mconsole.fx.animate({
|
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: 500
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} // filterTopicsByName
|
|
|
|
|
|
|
|
function filterTopicsByName(searchQuery) {
|
|
|
|
Mconsole.graph.eachNode(function (n) {
|
|
|
|
nodeName = n.name.toLowerCase();
|
|
|
|
if (nodeName.indexOf(searchQuery) !== -1 && searchQuery != "") {
|
|
|
|
n.setData('alpha', 1, 'end');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
n.setData('alpha', 0.4, 'end');
|
|
|
|
}
|
|
|
|
Mconsole.fx.animate({
|
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: 500
|
|
|
|
});
|
|
|
|
});
|
2014-07-29 17:34:10 +00:00
|
|
|
} // filterTopicsByName
|