2012-10-09 03:18:00 +00:00
|
|
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
|
|
// listed below.
|
|
|
|
//
|
|
|
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
|
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
|
|
//
|
|
|
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
|
|
// the compiled file.
|
|
|
|
//
|
|
|
|
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
|
|
// GO AFTER THE REQUIRES BELOW.
|
|
|
|
//
|
|
|
|
//= require jquery
|
2012-12-14 07:16:17 +00:00
|
|
|
//= require jquery-ui
|
2012-12-31 03:56:05 +00:00
|
|
|
//= require jquery.purr
|
|
|
|
//= require best_in_place
|
2012-12-14 07:16:17 +00:00
|
|
|
//= require autocomplete-rails-uncompressed
|
2012-10-09 03:18:00 +00:00
|
|
|
//= require jquery_ujs
|
|
|
|
//= require_tree .
|
2012-11-23 16:56:22 +00:00
|
|
|
|
2012-12-15 07:39:14 +00:00
|
|
|
// other options are 'graph'
|
|
|
|
var viewMode = "list";
|
2012-10-22 01:10:43 +00:00
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false, mapid = null;
|
2012-12-21 04:45:44 +00:00
|
|
|
|
2012-10-09 03:18:00 +00:00
|
|
|
$(document).ready(function() {
|
2012-12-16 20:00:43 +00:00
|
|
|
|
2013-01-01 22:45:35 +00:00
|
|
|
$('#new_topic, #new_synapse').bind('contextmenu', function(e){
|
2012-12-21 00:24:27 +00:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
/// this is for the topic creation autocomplete field
|
2013-01-01 22:45:35 +00:00
|
|
|
$('#topic_name').bind('railsAutocomplete.select', function(event, data){
|
2012-12-16 20:00:43 +00:00
|
|
|
if (data.item.id != undefined) {
|
2013-01-01 22:45:35 +00:00
|
|
|
$('#topic_grabTopic').val(data.item.id);
|
2013-01-05 21:21:11 +00:00
|
|
|
$('.new_topic').submit();
|
2012-12-14 07:16:17 +00:00
|
|
|
}
|
|
|
|
});
|
2012-12-16 20:00:43 +00:00
|
|
|
|
2012-12-27 04:00:05 +00:00
|
|
|
$('.new_topic').bind('submit', function(event, data){
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2013-01-06 23:40:48 +00:00
|
|
|
//$("#cards").mCustomScrollbar();
|
2012-10-31 22:53:11 +00:00
|
|
|
$(".scroll").mCustomScrollbar();
|
|
|
|
|
2013-01-06 23:40:48 +00:00
|
|
|
//$('.nodemargin').css('padding-top',$('.focus').css('height'));
|
2012-10-28 18:37:46 +00:00
|
|
|
|
2012-12-16 20:00:43 +00:00
|
|
|
// controls the sliding hover of the menus at the top
|
2012-12-25 23:29:20 +00:00
|
|
|
var sliding1 = false;
|
|
|
|
var lT;
|
|
|
|
$(".logo").hover(
|
2012-10-28 18:37:46 +00:00
|
|
|
function () {
|
2012-12-25 23:29:20 +00:00
|
|
|
clearTimeout(lT);
|
2012-10-28 18:37:46 +00:00
|
|
|
if (! sliding1) {
|
|
|
|
sliding1 = true;
|
2012-12-25 23:29:20 +00:00
|
|
|
if (userid != null) {
|
|
|
|
$('.footer .menu').animate({
|
2013-01-08 05:03:40 +00:00
|
|
|
height: '282px'
|
2012-12-25 23:29:20 +00:00
|
|
|
}, 300, function() {
|
|
|
|
sliding1 = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('.footer .menu').animate({
|
2012-12-27 01:57:06 +00:00
|
|
|
height: '140px'
|
2012-12-25 23:29:20 +00:00
|
|
|
}, 300, function() {
|
|
|
|
sliding1 = false;
|
|
|
|
});
|
|
|
|
}
|
2012-10-28 18:37:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
function () {
|
2012-12-25 23:29:20 +00:00
|
|
|
lT = setTimeout(function() {
|
|
|
|
if (! sliding1) {
|
|
|
|
sliding1 = true;
|
|
|
|
$('.footer .menu').animate({
|
|
|
|
height: '0px'
|
|
|
|
}, 300, function() {
|
|
|
|
sliding1 = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},800);
|
2012-10-28 18:37:46 +00:00
|
|
|
}
|
|
|
|
);
|
2012-12-03 23:40:14 +00:00
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
// this is to save the layout of maps when you're on a map page
|
2012-12-03 23:40:14 +00:00
|
|
|
$("#saveLayout").click(function(event) {
|
|
|
|
event.preventDefault();
|
2013-01-04 21:51:37 +00:00
|
|
|
saveLayoutAll();
|
2012-12-03 23:40:14 +00:00
|
|
|
});
|
2012-12-25 23:29:20 +00:00
|
|
|
|
2012-10-22 01:10:43 +00:00
|
|
|
});
|
2012-12-25 23:29:20 +00:00
|
|
|
|
2013-01-04 21:51:37 +00:00
|
|
|
// this is to save the layout of a map
|
|
|
|
function saveLayoutAll() {
|
|
|
|
var coor = "";
|
|
|
|
if (gType == "arranged" || gType == "chaotic") {
|
|
|
|
Mconsole.graph.eachNode(function(n) {
|
|
|
|
coor = coor + n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y + ',';
|
|
|
|
});
|
|
|
|
coor = coor.slice(0, -1);
|
|
|
|
$('#map_coordinates').val(coor);
|
|
|
|
$('#saveMapLayout').submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// this is to update the location coordinate of a single node on a map
|
|
|
|
function saveLayout(id) {
|
|
|
|
var n = Mconsole.graph.getNode(id);
|
|
|
|
$('#map_coordinates').val(n.data.$mappingid + '/' + n.pos.x + '/' + n.pos.y);
|
|
|
|
$('#saveMapLayout').submit();
|
|
|
|
dragged = 0;
|
|
|
|
}
|
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
// this is to save your console to a map
|
|
|
|
function saveToMap() {
|
2013-01-08 04:03:29 +00:00
|
|
|
var nodes_data = "", synapses_data = "";
|
|
|
|
var synapses_array = new Array();
|
2012-12-25 23:29:20 +00:00
|
|
|
Mconsole.graph.eachNode(function(n) {
|
2013-01-08 03:05:59 +00:00
|
|
|
nodes_data += n.id + '/' + n.pos.x + '/' + n.pos.y + ',';
|
2013-01-08 04:03:29 +00:00
|
|
|
n.eachAdjacency(function(adj) {
|
|
|
|
synapses_array.push(adj.getData("id"));
|
|
|
|
});
|
2012-12-25 23:29:20 +00:00
|
|
|
});
|
2013-01-08 04:03:29 +00:00
|
|
|
|
|
|
|
//get unique values only
|
|
|
|
synapses_array = $.grep(synapses_array, function(value, key){
|
|
|
|
return $.inArray(value, synapses_array) === key;
|
2012-12-25 23:29:20 +00:00
|
|
|
});
|
2013-01-08 04:03:29 +00:00
|
|
|
|
|
|
|
synapses_data = synapses_array.join();
|
|
|
|
console.log(synapses_data);
|
2013-01-08 03:05:59 +00:00
|
|
|
nodes_data = nodes_data.slice(0, -1);
|
2013-01-08 04:03:29 +00:00
|
|
|
|
2013-01-08 03:05:59 +00:00
|
|
|
$('#map_topicsToMap').val(nodes_data);
|
|
|
|
$('#map_synapsesToMap').val(synapses_data);
|
2012-12-25 23:29:20 +00:00
|
|
|
$('#new_map').fadeIn('fast');
|
|
|
|
}
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
// this is for hiding one topic from your canvas
|
|
|
|
function removeFromCanvas(topic_id) {
|
|
|
|
var node = Mconsole.graph.getNode(topic_id);
|
|
|
|
node.setData('alpha', 0, 'end');
|
|
|
|
node.eachAdjacency(function(adj) {
|
|
|
|
adj.setData('alpha', 0, 'end');
|
|
|
|
});
|
|
|
|
Mconsole.fx.animate({
|
|
|
|
modes: ['node-property:alpha',
|
|
|
|
'edge-property:alpha'],
|
|
|
|
duration: 1000
|
|
|
|
});
|
|
|
|
Mconsole.graph.removeNode(topic_id);
|
|
|
|
Mconsole.labels.disposeLabel(topic_id);
|
|
|
|
}
|
|
|
|
|
2012-12-25 23:29:20 +00:00
|
|
|
function addMetacode() {
|
|
|
|
// code from http://www.professorcloud.com/mainsite/carousel-integration.htm
|
2013-01-03 23:21:46 +00:00
|
|
|
//mouseWheel:true,
|
2012-12-25 23:29:20 +00:00
|
|
|
if (!metacodeIMGinit) {
|
2013-01-03 23:21:46 +00:00
|
|
|
$("#metacodeImg").CloudCarousel( {
|
2012-12-25 23:29:20 +00:00
|
|
|
titleBox: $('#metacodeImgTitle'),
|
|
|
|
yRadius:40,
|
|
|
|
xPos: 150,
|
|
|
|
yPos: 40,
|
2013-01-05 19:07:46 +00:00
|
|
|
speed:0.15,
|
|
|
|
mouseWheel:true,
|
2012-12-25 23:29:20 +00:00
|
|
|
bringToFront: true
|
|
|
|
});
|
|
|
|
metacodeIMGinit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-06 04:03:05 +00:00
|
|
|
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));
|
|
|
|
|
2013-01-08 03:05:59 +00:00
|
|
|
}
|