ability to switch metacode sets from mapping page
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 101 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 263 KiB |
Before Width: | Height: | Size: 4.3 KiB |
|
@ -9,6 +9,18 @@ var MetamapsModel = new Object();
|
|||
|
||||
MetamapsModel.embed = false;
|
||||
|
||||
|
||||
MetamapsModel.metacodeScrollerInit = false; // indicates whether the scrollbar in the custom metacode set space has been init
|
||||
|
||||
MetamapsModel.selectedMetacodeSet = null;
|
||||
MetamapsModel.selectedMetacodeSetIndex = null;
|
||||
|
||||
MetamapsModel.selectedMetacodeNames = new Array();
|
||||
MetamapsModel.newSelectedMetacodeNames = new Array();
|
||||
|
||||
MetamapsModel.selectedMetacodes = new Array();
|
||||
MetamapsModel.newSelectedMetacodes = new Array();
|
||||
|
||||
//array of all selected edges, same for nodes
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
MetamapsModel.selectedNodes = new Array();
|
||||
|
|
|
@ -1,302 +0,0 @@
|
|||
/*
|
||||
* @file
|
||||
* There is a lot of code that goes into creating the "label" of a node
|
||||
* This includes editable cards with all node details, and some controls
|
||||
* onCreateLabelHandler is the main function of this file, and the file
|
||||
* also contains a bunch of helper functions
|
||||
*
|
||||
* html and littleHTML are potentially confusing variables
|
||||
* html is the contents of the card shown when you click on a node's label.
|
||||
* littleHTML creates little controls for removing/hiding nodes from the canvas
|
||||
*
|
||||
* This function features PHP-style variable substitution because the strings
|
||||
* are so damn long. Values are identified by $_id_$, and then a regular
|
||||
* expression is substituted in later (for html, in a separate function).
|
||||
*/
|
||||
|
||||
function generateShowcardHTML() {
|
||||
return ' \
|
||||
<div class="CardOnGraph" \
|
||||
id="topic_$_id_$"> \
|
||||
<span class="title"> \
|
||||
<span class="best_in_place best_in_place_name" \
|
||||
data-url="/topics/$_id_$" \
|
||||
data-object="topic" \
|
||||
data-attribute="name" \
|
||||
data-type="input">$_name_$</span> \
|
||||
</span> \
|
||||
<div class="links"> \
|
||||
<div \
|
||||
class="linkItem icon"> \
|
||||
<div class="metacodeTitle">$_metacode_$</div> \
|
||||
<div class="metacodeImage" \
|
||||
style="background-image:url($_imgsrc_$);" \
|
||||
title="click and drag to move card"></div> \
|
||||
</div> \
|
||||
<div class="linkItem contributor hoverForTip"> \
|
||||
<div class="tip">Created by $_username_$ on $_date_$</div> \
|
||||
</div> \
|
||||
<a href="/maps/topics/$_id_$" class="linkItem mapCount hoverForTip" \
|
||||
title="Click to see which maps topic appears on" target="_blank"> \
|
||||
$_map_count_$ \
|
||||
</a> \
|
||||
<div class="linkItem synapseCount">$_synapse_count_$</div> \
|
||||
<div class="linkItem mapPerm $_mk_permission_$"></div> \
|
||||
<a href="/topics/$_id_$" class="linkItem topicPopout" title="Open topic in new tab" target="_blank"></a>\
|
||||
<div class="clearfloat"></div> \
|
||||
</div> \
|
||||
<div class="metacodeSelect">$_metacode_select_$</div> \
|
||||
<div class="scroll"> \
|
||||
<div class="desc"> \
|
||||
<span class="best_in_place best_in_place_desc" \
|
||||
data-url="/topics/$_id_$" \
|
||||
data-object="topic" \
|
||||
data-nil="$_desc_nil_$" \
|
||||
data-attribute="desc" \
|
||||
data-type="textarea">$_desc_$</span> \
|
||||
<div class="clearfloat"></div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div class="link"> \
|
||||
$_a_tag_$<span class="best_in_place best_in_place_link" \
|
||||
data-url="/topics/$_id_$" \
|
||||
data-object="topic" \
|
||||
data-nil="$_link_nil_$" \
|
||||
data-attribute="link" \
|
||||
data-type="input">$_link_$</span>$_close_a_tag_$ \
|
||||
$_go_link_$ \
|
||||
</div> \
|
||||
<div class="clearfloat"></div> \
|
||||
</div>';
|
||||
}//generateShowcardHTML
|
||||
|
||||
function replaceVariables(html, node) {
|
||||
//link is rendered differently if user is logged out or in
|
||||
var go_link, a_tag, close_a_tag;
|
||||
if (! authorizeToEdit(node)) {
|
||||
go_link = '';
|
||||
if (node.getData("link") != "") {
|
||||
a_tag = '<a href="' + node.getData("link") + '" target="_blank">';
|
||||
close_a_tag = '</a>';
|
||||
}
|
||||
else {
|
||||
a_tag = '';
|
||||
close_a_tag = '';
|
||||
}
|
||||
} else {
|
||||
go_link = '<a href="' + node.getData("link") + '" ' +
|
||||
' class="go-link" target="_blank"></a>';
|
||||
a_tag = '';
|
||||
close_a_tag = '';
|
||||
}
|
||||
|
||||
var desc_nil = "<span class='gray'>Click to add description...</span>";
|
||||
var link_nil = "<span class='gray'>Click to add link...</span>";
|
||||
|
||||
var edit_perm = '';
|
||||
if (userid == node.getData("userid")) {
|
||||
edit_perm = ' \
|
||||
<div class="permActivator"> \
|
||||
<div class="editSettings"> \
|
||||
<span>Permissions: </span> \
|
||||
<span title="Click to Edit"> \
|
||||
<span class="best_in_place best_in_place_permission" \
|
||||
id="best_in_place_topic_$_id_$_permission" \
|
||||
data-url="/topics/$_id_$" \
|
||||
data-object="topic" \
|
||||
data-collection=$_permission_choices_$ \
|
||||
data-attribute="permission" \
|
||||
data-type="select" \
|
||||
data-value="$_permission_$"> \
|
||||
$_permission_$ \
|
||||
</span> \
|
||||
</span> \
|
||||
<div class="clearfloat"></div> \
|
||||
</div> \
|
||||
</div>';
|
||||
}
|
||||
var permissions = ['commons','public','private'];
|
||||
var permission_choices = "'[";
|
||||
for (var i in permissions) {
|
||||
permission_choices += '["' + permissions[i] + '","' + permissions[i] + '"],';
|
||||
}
|
||||
//remove trailing comma and add ]
|
||||
permission_choices = permission_choices.slice(0, -1);
|
||||
permission_choices += "]'";
|
||||
edit_perm = edit_perm.replace(/\$_permission_choices_\$/g, permission_choices);
|
||||
|
||||
html = html.replace(/\$_edit_permission_\$/g, edit_perm);
|
||||
html = html.replace(/\$_permission_\$/g, node.getData("permission"));
|
||||
html = html.replace(/\$_mk_permission_\$/g, mk_permission(node));
|
||||
html = html.replace(/\$_map_count_\$/g, node.getData("inmaps").length);
|
||||
html = html.replace(/\$_synapse_count_\$/g, node.getData("synapseCount"));
|
||||
html = html.replace(/\$_id_\$/g, node.id);
|
||||
html = html.replace(/\$_metacode_\$/g, node.getData("metacode"));
|
||||
html = html.replace(/\$_imgsrc_\$/g, imgArray[node.getData("metacode")].src);
|
||||
html = html.replace(/\$_name_\$/g, node.name);
|
||||
html = html.replace(/\$_userid_\$/g, node.getData("userid"));
|
||||
html = html.replace(/\$_username_\$/g, node.getData("username"));
|
||||
html = html.replace(/\$_date_\$/g, node.getData("date"));
|
||||
html = html.replace(/\$_metacode_select_\$/g, $('#metacodeOptions').html());
|
||||
html = html.replace(/\$_go_link_\$/g, go_link);
|
||||
html = html.replace(/\$_a_tag_\$/g, a_tag);
|
||||
html = html.replace(/\$_close_a_tag_\$/g, close_a_tag);
|
||||
|
||||
html = html.replace(/\$_link_nil_\$/g, link_nil);
|
||||
if (node.getData("link") == "" && authorizeToEdit(node)) {
|
||||
html = html.replace(/\$_link_\$/g, link_nil);
|
||||
} else {
|
||||
html = html.replace(/\$_link_\$/g, node.getData("link"));
|
||||
}
|
||||
|
||||
html = html.replace(/\$_desc_nil_\$/g, desc_nil);
|
||||
if (node.getData("desc") == "" && authorizeToEdit(node)) {
|
||||
//logged in but desc isn't there so it's invisible
|
||||
html = html.replace(/\$_desc_\$/g, desc_nil);
|
||||
} else {
|
||||
//html = html.replace(/\$_desc_\$/g, node.getData("desc").replace(/\n/g, '<br />'));
|
||||
html = html.replace(/\$_desc_\$/g, node.getData("desc"));
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
function hideCurrentCard() {
|
||||
if (MetamapsModel.showcardInUse) {
|
||||
var node = Mconsole.graph.getNode(MetamapsModel.showcardInUse);
|
||||
hideCard(node);
|
||||
}
|
||||
}
|
||||
|
||||
function hideCard(node) {
|
||||
var card = '.showcard';
|
||||
|
||||
$(card).fadeOut('fast', function(){
|
||||
//node.setData('dim', 25, 'current');
|
||||
Mconsole.plot();
|
||||
});
|
||||
|
||||
MetamapsModel.showcardInUse = null;
|
||||
}
|
||||
|
||||
function populateShowCard(node) {
|
||||
var showCard = document.getElementById('showcard');
|
||||
|
||||
$(showCard).find('.permission').remove();
|
||||
|
||||
var html = generateShowcardHTML();
|
||||
html = replaceVariables(html, node);
|
||||
|
||||
if (authorizeToEdit(node)) {
|
||||
var perm = document.createElement('div');
|
||||
|
||||
var string = 'permission canEdit';
|
||||
if (userid == node.data.$userid) string += ' yourTopic';
|
||||
perm.className = string;
|
||||
perm.innerHTML = html;
|
||||
showCard.appendChild(perm);
|
||||
} else {
|
||||
var perm = document.createElement('div');
|
||||
perm.className = 'permission cannotEdit';
|
||||
perm.innerHTML = html;
|
||||
showCard.appendChild(perm);
|
||||
}
|
||||
|
||||
var selectingMetacode = false;
|
||||
// attach the listener that shows the metacode title when you hover over the image
|
||||
$('.showcard .metacodeImage').mouseenter(function(){
|
||||
$('.showcard .icon').css('z-index','4');
|
||||
$('.showcard .metacodeTitle').show();
|
||||
});
|
||||
$('.showcard .linkItem.icon').mouseleave(function() {
|
||||
if ( !selectingMetacode ) {
|
||||
$('.showcard .metacodeTitle').hide();
|
||||
$('.showcard .icon').css('z-index','1');
|
||||
}
|
||||
});
|
||||
|
||||
$('.showcard .metacodeTitle').click(function() {
|
||||
if (!selectingMetacode) {
|
||||
selectingMetacode = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
$('.metacodeSelect').show();
|
||||
// add the scroll bar to the list of metacode select options if it isn't already there
|
||||
if ( !$('.metacodeSelect ul').hasClass('mCustomScrollbar') ) {
|
||||
$('.metacodeSelect ul').mCustomScrollbar();
|
||||
|
||||
$('.metacodeSelect li').click(function() {
|
||||
selectingMetacode = false;
|
||||
var metacodeName = $(this).find('.mSelectName').text();
|
||||
updateMetacode(node, metacodeName);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
selectingMetacode = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.metacodeSelect').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ability to change permission
|
||||
var selectingPermission = false;
|
||||
if (userid == node.data.$userid ) {
|
||||
$('.showcard .yourTopic .mapPerm').click(function() {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ( $(this).hasClass('co') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('pu') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('pr') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('.permissionSelect li').click(function(event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateTopicPermission(node, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.permissionSelect').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// when you're typing a description, resize the scroll box to have space
|
||||
$('.best_in_place_desc textarea').bind('keyup', function() {
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height( s.height() ).mCustomScrollbar('update');
|
||||
console.log('working');
|
||||
});
|
||||
|
||||
//bind best_in_place ajax callbacks
|
||||
$(showCard).find('.best_in_place_name').bind("ajax:success", function() {
|
||||
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height( s.height() ).mCustomScrollbar('update');
|
||||
|
||||
var name = $(this).html();
|
||||
node.name = decodeEntities(name);
|
||||
Mconsole.plot();
|
||||
});
|
||||
|
||||
$(showCard).find('.best_in_place_desc').bind("ajax:success", function() {
|
||||
this.innerHTML = this.innerHTML.replace(/\r/g, '')
|
||||
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height( s.height() ).mCustomScrollbar('update');
|
||||
|
||||
var desc = $(this).html();
|
||||
node.setData("desc", desc);
|
||||
});
|
||||
|
||||
$(showCard).find('.best_in_place_link').bind("ajax:success", function() {
|
||||
var link = $(this).html();
|
||||
$(showCard).find('.go-link').attr('href', link);
|
||||
node.setData("link", link);
|
||||
});
|
||||
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
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, {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
onComplete: function () {
|
||||
fetchRelatives(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function editEdge(edge, e) {
|
||||
|
@ -29,10 +29,10 @@ function editEdge(edge, e) {
|
|||
var edit_div = document.createElement('div');
|
||||
edit_div.setAttribute('id', 'edit_synapse');
|
||||
if (authorizeToEdit(edge)) {
|
||||
edit_div.className = 'permission canEdit';
|
||||
edit_div.className += edge.getData('userid') === userid ? ' yourEdge' : '';
|
||||
edit_div.className = 'permission canEdit';
|
||||
edit_div.className += edge.getData('userid') === userid ? ' yourEdge' : '';
|
||||
} else {
|
||||
edit_div.className = 'permission cannotEdit';
|
||||
edit_div.className = 'permission cannotEdit';
|
||||
}
|
||||
$('.main .wrapper').append(edit_div);
|
||||
|
||||
|
@ -41,422 +41,399 @@ function editEdge(edge, e) {
|
|||
//drop it in the right spot, activate it
|
||||
$('#edit_synapse').css('position', 'absolute');
|
||||
if (e) {
|
||||
$('#edit_synapse').css('left', e.clientX);
|
||||
$('#edit_synapse').css('top', e.clientY);
|
||||
}
|
||||
else {
|
||||
$('#edit_synapse').css('left', myX);
|
||||
$('#edit_synapse').css('top', myY);
|
||||
$('#edit_synapse').css('left', e.clientX);
|
||||
$('#edit_synapse').css('top', e.clientY);
|
||||
} else {
|
||||
$('#edit_synapse').css('left', myX);
|
||||
$('#edit_synapse').css('top', myY);
|
||||
}
|
||||
//$('#edit_synapse_name').click(); //required in case name is empty
|
||||
//$('#edit_synapse_name input').focus();
|
||||
$('#edit_synapse').show();
|
||||
|
||||
|
||||
MetamapsModel.edgecardInUse = edge.data.$id;
|
||||
}
|
||||
|
||||
function populateEditEdgeForm(edge) {
|
||||
add_name_form(edge);
|
||||
add_user_info(edge);
|
||||
add_perms_form(edge);
|
||||
if (authorizeToEdit(edge)) {
|
||||
add_direction_form(edge);
|
||||
}
|
||||
add_name_form(edge);
|
||||
add_user_info(edge);
|
||||
add_perms_form(edge);
|
||||
if (authorizeToEdit(edge)) {
|
||||
add_direction_form(edge);
|
||||
}
|
||||
}
|
||||
|
||||
function add_name_form(edge) {
|
||||
var data_nil = '<span class="gray">Click to add description.</span>';
|
||||
//name editing form
|
||||
$('#edit_synapse').append('<div id="edit_synapse_name"></div>');
|
||||
$('#edit_synapse_name').attr('class', 'best_in_place best_in_place_desc');
|
||||
$('#edit_synapse_name').attr('data-object', 'synapse');
|
||||
$('#edit_synapse_name').attr('data-attribute', 'desc');
|
||||
$('#edit_synapse_name').attr('data-type', 'textarea');
|
||||
$('#edit_synapse_name').attr('data-nil', data_nil);
|
||||
$('#edit_synapse_name').attr('data-url', '/synapses/' + edge.getData("id"));
|
||||
$('#edit_synapse_name').html(edge.getData("desc"));
|
||||
var data_nil = '<span class="gray">Click to add description.</span>';
|
||||
//name editing form
|
||||
$('#edit_synapse').append('<div id="edit_synapse_name"></div>');
|
||||
$('#edit_synapse_name').attr('class', 'best_in_place best_in_place_desc');
|
||||
$('#edit_synapse_name').attr('data-object', 'synapse');
|
||||
$('#edit_synapse_name').attr('data-attribute', 'desc');
|
||||
$('#edit_synapse_name').attr('data-type', 'textarea');
|
||||
$('#edit_synapse_name').attr('data-nil', data_nil);
|
||||
$('#edit_synapse_name').attr('data-url', '/synapses/' + edge.getData("id"));
|
||||
$('#edit_synapse_name').html(edge.getData("desc"));
|
||||
|
||||
//if edge data is blank or just whitespace, populate it with data_nil
|
||||
if ($('#edit_synapse_name').html().trim() == '') {
|
||||
$('#edit_synapse_name').html(data_nil);
|
||||
}
|
||||
|
||||
$('#edit_synapse_name').bind("ajax:success", function() {
|
||||
var desc = $(this).html();
|
||||
if (desc == data_nil) {
|
||||
edge.setData("desc", '');
|
||||
} else {
|
||||
edge.setData("desc", desc);
|
||||
//if edge data is blank or just whitespace, populate it with data_nil
|
||||
if ($('#edit_synapse_name').html().trim() == '') {
|
||||
$('#edit_synapse_name').html(data_nil);
|
||||
}
|
||||
selectEdge(edge);
|
||||
Mconsole.plot();
|
||||
});
|
||||
|
||||
$('#edit_synapse_name').bind("ajax:success", function () {
|
||||
var desc = $(this).html();
|
||||
if (desc == data_nil) {
|
||||
edge.setData("desc", '');
|
||||
} else {
|
||||
edge.setData("desc", desc);
|
||||
}
|
||||
selectEdge(edge);
|
||||
Mconsole.plot();
|
||||
});
|
||||
}
|
||||
|
||||
function add_user_info(edge) {
|
||||
$('#edit_synapse').append('<div id="edgeUser" class="hoverForTip"><div class="tip">Created by ' + edge.getData("username") + '</div></div>');
|
||||
$('#edit_synapse').append('<div id="edgeUser" class="hoverForTip"><div class="tip">Created by ' + edge.getData("username") + '</div></div>');
|
||||
}
|
||||
|
||||
function add_perms_form(edge) {
|
||||
//permissions - if owner, also allow permission editing
|
||||
$('#edit_synapse').append('<div class="mapPerm ' + mk_permission(edge) + '"></div>');
|
||||
|
||||
// ability to change permission
|
||||
var selectingPermission = false;
|
||||
if (userid == edge.getData('userid')) {
|
||||
$('#edit_synapse.yourEdge .mapPerm').click(function() {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ( $(this).hasClass('co') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('pu') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('pr') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('#edit_synapse .permissionSelect li').click(function(event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateSynapsePermission(edge, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('#edit_synapse .permissionSelect').remove();
|
||||
//permissions - if owner, also allow permission editing
|
||||
$('#edit_synapse').append('<div class="mapPerm ' + mk_permission(edge) + '"></div>');
|
||||
|
||||
// ability to change permission
|
||||
var selectingPermission = false;
|
||||
if (userid == edge.getData('userid')) {
|
||||
$('#edit_synapse.yourEdge .mapPerm').click(function () {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ($(this).hasClass('co')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('pu')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('pr')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('#edit_synapse .permissionSelect li').click(function (event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateSynapsePermission(edge, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('#edit_synapse .permissionSelect').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}//add_perms_form
|
||||
} //add_perms_form
|
||||
|
||||
function add_direction_form(edge) {
|
||||
//directionality checkboxes
|
||||
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_left">');
|
||||
$('#edit_synapse').append('<label class="left"><</label>');
|
||||
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_right">');
|
||||
$('#edit_synapse').append('<label class="right">></label>');
|
||||
//directionality checkboxes
|
||||
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_left">');
|
||||
$('#edit_synapse').append('<label class="left"><</label>');
|
||||
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_right">');
|
||||
$('#edit_synapse').append('<label class="right">></label>');
|
||||
|
||||
//determine which node is to the left and the right
|
||||
//if directly in a line, top is left
|
||||
if (edge.nodeFrom.pos.x < edge.nodeTo.pos.x ||
|
||||
edge.nodeFrom.pos.x == edge.nodeTo.pos.x &&
|
||||
edge.nodeFrom.pos.y < edge.nodeTo.pos.y) {
|
||||
var left = edge.nodeTo;
|
||||
var right = edge.nodeFrom;
|
||||
} else {
|
||||
var left = edge.nodeFrom;
|
||||
var right = edge.nodeTo;
|
||||
}
|
||||
|
||||
/*
|
||||
* One node is actually on the left onscreen. Call it left, & the other right.
|
||||
* If category is from-to, and that node is first, check the 'right' checkbox.
|
||||
* Else check the 'left' checkbox since the arrow is incoming.
|
||||
*/
|
||||
|
||||
var directionCat = edge.getData('category'); //both, none, from-to
|
||||
if (directionCat == 'from-to') {
|
||||
var from_to = edge.getData('direction');
|
||||
if (from_to[0] == left.id) {
|
||||
//check left checkbox
|
||||
$('#edit_synapse_left').prop('checked', true);
|
||||
//determine which node is to the left and the right
|
||||
//if directly in a line, top is left
|
||||
if (edge.nodeFrom.pos.x < edge.nodeTo.pos.x ||
|
||||
edge.nodeFrom.pos.x == edge.nodeTo.pos.x &&
|
||||
edge.nodeFrom.pos.y < edge.nodeTo.pos.y) {
|
||||
var left = edge.nodeTo;
|
||||
var right = edge.nodeFrom;
|
||||
} else {
|
||||
//check right checkbox
|
||||
$('#edit_synapse_right').prop('checked', true);
|
||||
var left = edge.nodeFrom;
|
||||
var right = edge.nodeTo;
|
||||
}
|
||||
} else if (directionCat == 'both') {
|
||||
//check both checkboxes
|
||||
$('#edit_synapse_left').prop('checked', true);
|
||||
$('#edit_synapse_right').prop('checked', true);
|
||||
}
|
||||
$('#edit_synapse_left, #edit_synapse_right').click(function() {
|
||||
var leftChecked = $('#edit_synapse_left').is(':checked');
|
||||
var rightChecked = $('#edit_synapse_right').is(':checked');
|
||||
|
||||
var dir = edge.getData('direction');
|
||||
var dirCat = 'none';
|
||||
if (leftChecked && rightChecked) {
|
||||
dirCat = 'both';
|
||||
} else if (!leftChecked && rightChecked) {
|
||||
dirCat = 'from-to';
|
||||
dir = [right.id, left.id];
|
||||
} else if (leftChecked && !rightChecked) {
|
||||
dirCat = 'from-to';
|
||||
dir = [left.id, right.id];
|
||||
}
|
||||
$.ajax({
|
||||
'type': 'PUT',
|
||||
'url': '/synapses/' + edge.getData('id'),
|
||||
'data': {
|
||||
synapse: {
|
||||
category:dirCat
|
||||
},
|
||||
node1_id: {
|
||||
node1: dir[0]
|
||||
},
|
||||
node2_id: {
|
||||
node2: dir[1]
|
||||
/*
|
||||
* One node is actually on the left onscreen. Call it left, & the other right.
|
||||
* If category is from-to, and that node is first, check the 'right' checkbox.
|
||||
* Else check the 'left' checkbox since the arrow is incoming.
|
||||
*/
|
||||
|
||||
var directionCat = edge.getData('category'); //both, none, from-to
|
||||
if (directionCat == 'from-to') {
|
||||
var from_to = edge.getData('direction');
|
||||
if (from_to[0] == left.id) {
|
||||
//check left checkbox
|
||||
$('#edit_synapse_left').prop('checked', true);
|
||||
} else {
|
||||
//check right checkbox
|
||||
$('#edit_synapse_right').prop('checked', true);
|
||||
}
|
||||
},
|
||||
'success': function(data) {
|
||||
updateEdgeDisplay(edge, dir, dirCat);
|
||||
}
|
||||
} else if (directionCat == 'both') {
|
||||
//check both checkboxes
|
||||
$('#edit_synapse_left').prop('checked', true);
|
||||
$('#edit_synapse_right').prop('checked', true);
|
||||
}
|
||||
$('#edit_synapse_left, #edit_synapse_right').click(function () {
|
||||
var leftChecked = $('#edit_synapse_left').is(':checked');
|
||||
var rightChecked = $('#edit_synapse_right').is(':checked');
|
||||
|
||||
var dir = edge.getData('direction');
|
||||
var dirCat = 'none';
|
||||
if (leftChecked && rightChecked) {
|
||||
dirCat = 'both';
|
||||
} else if (!leftChecked && rightChecked) {
|
||||
dirCat = 'from-to';
|
||||
dir = [right.id, left.id];
|
||||
} else if (leftChecked && !rightChecked) {
|
||||
dirCat = 'from-to';
|
||||
dir = [left.id, right.id];
|
||||
}
|
||||
$.ajax({
|
||||
'type': 'PUT',
|
||||
'url': '/synapses/' + edge.getData('id'),
|
||||
'data': {
|
||||
synapse: {
|
||||
category: dirCat
|
||||
},
|
||||
node1_id: {
|
||||
node1: dir[0]
|
||||
},
|
||||
node2_id: {
|
||||
node2: dir[1]
|
||||
}
|
||||
},
|
||||
'success': function (data) {
|
||||
updateEdgeDisplay(edge, dir, dirCat);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}//add_direction_form
|
||||
} //add_direction_form
|
||||
|
||||
function updateEdgeDisplay(edge, dir, dirCat) {
|
||||
edge.setData('category', dirCat);
|
||||
edge.setData('direction', dir);
|
||||
edge.setData('category', dirCat);
|
||||
edge.setData('direction', dir);
|
||||
|
||||
//render mid arrow
|
||||
//renderEdgeArrows(Mconsole.fx.edgeHelper, edge);
|
||||
Mconsole.plot();
|
||||
//render mid arrow
|
||||
//renderEdgeArrows(Mconsole.fx.edgeHelper, edge);
|
||||
Mconsole.plot();
|
||||
}
|
||||
|
||||
function best_in_place_perms(edge) {
|
||||
var output =
|
||||
'<span class="best_in_place best_in_place_permission" \
|
||||
id="best_in_place_topic_$_id_$_permission" \
|
||||
data-url="/synapses/$_id_$" \
|
||||
data-object="synapse" \
|
||||
data-collection=$_permission_choices_$ \
|
||||
data-attribute="permission" \
|
||||
data-type="select" \
|
||||
data-value="$_current_$">$_perm_$</span>';
|
||||
|
||||
var permission_choices = "'[";
|
||||
permission_choices += '["commons","commons"],';
|
||||
permission_choices += '["public","public"],';
|
||||
permission_choices += '["private","private"]';
|
||||
permission_choices += "]'";
|
||||
|
||||
output = output.replace(/\$_permission_choices_\$/g, permission_choices);
|
||||
output = output.replace(/\$_id_\$/g, edge.getData('id'));
|
||||
output = output.replace(/\$_current_$\$/g, edge.getData('permission'));
|
||||
output = output.replace(/\$_perm_\$/g, edge.getData('permission'));
|
||||
return output;
|
||||
}//best_in_place_perms
|
||||
|
||||
function deselectAllEdges() {
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
deselectEdge(edge);
|
||||
}
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
deselectEdge(edge);
|
||||
}
|
||||
}
|
||||
|
||||
function deselectAllNodes() {
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
deselectNode(node);
|
||||
}
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
deselectNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
// this is for hiding one topic from your canvas
|
||||
function removeEdge(edge) {
|
||||
var id = edge.getData("id");
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/synapses/" + id,
|
||||
success: function(){
|
||||
hideEdge(edge);
|
||||
},
|
||||
});
|
||||
var id = edge.getData("id");
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/synapses/" + id,
|
||||
success: function () {
|
||||
hideEdge(edge);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function hideEdge(edge) {
|
||||
var from = edge.nodeFrom.id;
|
||||
var to = edge.nodeTo.id;
|
||||
edge.setData('alpha', 0, 'end');
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:alpha'],
|
||||
duration: 1000
|
||||
});
|
||||
Mconsole.graph.removeAdjacence(from, to);
|
||||
Mconsole.plot();
|
||||
var from = edge.nodeFrom.id;
|
||||
var to = edge.nodeTo.id;
|
||||
edge.setData('alpha', 0, 'end');
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:alpha'],
|
||||
duration: 1000
|
||||
});
|
||||
Mconsole.graph.removeAdjacence(from, to);
|
||||
Mconsole.plot();
|
||||
}
|
||||
|
||||
function hideSelectedEdges() {
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
hideEdge(edge);
|
||||
}
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
hideEdge(edge);
|
||||
}
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
}
|
||||
|
||||
function removeSelectedEdges() {
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
if (mapid != null) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
var id = edge.getData("id");
|
||||
//delete mapping of id mapid
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/synapses/" + mapid + "/" + id + "/removefrommap",
|
||||
});
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
if (mapid != null) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
var id = edge.getData("id");
|
||||
//delete mapping of id mapid
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/synapses/" + mapid + "/" + id + "/removefrommap",
|
||||
});
|
||||
}
|
||||
hideEdge(edge);
|
||||
}
|
||||
hideEdge(edge);
|
||||
}
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
}
|
||||
|
||||
function deleteSelectedEdges() {
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
var id = edge.getData("id");
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/synapses/" + id,
|
||||
});
|
||||
hideEdge(edge);
|
||||
}
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
var l = MetamapsModel.selectedEdges.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var edge = MetamapsModel.selectedEdges[i];
|
||||
var id = edge.getData("id");
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/synapses/" + id,
|
||||
});
|
||||
hideEdge(edge);
|
||||
}
|
||||
MetamapsModel.selectedEdges = new Array();
|
||||
}
|
||||
|
||||
function selectNode(node) {
|
||||
if (MetamapsModel.selectedNodes.indexOf(node) != -1) return;
|
||||
node.selected = true;
|
||||
node.setData('dim', 30, 'current');
|
||||
node.setData('whiteCircle',true);
|
||||
node.eachAdjacency(function (adj) {
|
||||
selectEdge(adj);
|
||||
});
|
||||
MetamapsModel.selectedNodes.push(node);
|
||||
if (MetamapsModel.selectedNodes.indexOf(node) != -1) return;
|
||||
node.selected = true;
|
||||
node.setData('dim', 30, 'current');
|
||||
node.setData('whiteCircle', true);
|
||||
node.eachAdjacency(function (adj) {
|
||||
selectEdge(adj);
|
||||
});
|
||||
MetamapsModel.selectedNodes.push(node);
|
||||
}
|
||||
|
||||
function deselectNode(node) {
|
||||
delete node.selected;
|
||||
node.setData('whiteCircle', false);
|
||||
node.eachAdjacency(function(adj) {
|
||||
deselectEdge(adj);
|
||||
});
|
||||
node.setData('dim', 25, 'current');
|
||||
delete node.selected;
|
||||
node.setData('whiteCircle', false);
|
||||
node.eachAdjacency(function (adj) {
|
||||
deselectEdge(adj);
|
||||
});
|
||||
node.setData('dim', 25, 'current');
|
||||
|
||||
//remove the node
|
||||
MetamapsModel.selectedNodes.splice(
|
||||
MetamapsModel.selectedNodes.indexOf(node), 1);
|
||||
//remove the node
|
||||
MetamapsModel.selectedNodes.splice(
|
||||
MetamapsModel.selectedNodes.indexOf(node), 1);
|
||||
}
|
||||
|
||||
function selectEdge(edge) {
|
||||
if (MetamapsModel.selectedEdges.indexOf(edge) != -1) return;
|
||||
edge.setData('showDesc', true, 'current');
|
||||
if ( ! MetamapsModel.embed) {
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#FFFFFF',
|
||||
alpha: 1
|
||||
if (MetamapsModel.selectedEdges.indexOf(edge) != -1) return;
|
||||
edge.setData('showDesc', true, 'current');
|
||||
if (!MetamapsModel.embed) {
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#FFFFFF',
|
||||
alpha: 1
|
||||
});
|
||||
} else if (MetamapsModel.embed) {
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#999',
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:lineWidth:color:alpha'],
|
||||
duration: 100
|
||||
});
|
||||
} else if (MetamapsModel.embed) {
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#999',
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:lineWidth:color:alpha'],
|
||||
duration: 100
|
||||
});
|
||||
MetamapsModel.selectedEdges.push(edge);
|
||||
MetamapsModel.selectedEdges.push(edge);
|
||||
}
|
||||
|
||||
function deselectEdge(edge) {
|
||||
edge.setData('showDesc', false, 'current');
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 2,
|
||||
color: '#222222',
|
||||
alpha: 0.4
|
||||
});
|
||||
|
||||
if (MetamapsModel.edgeHoveringOver == edge) {
|
||||
edge.setData('showDesc', true, 'current');
|
||||
edge.setData('showDesc', false, 'current');
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#222222',
|
||||
alpha: 1
|
||||
lineWidth: 2,
|
||||
color: '#222222',
|
||||
alpha: 0.4
|
||||
});
|
||||
}
|
||||
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:lineWidth:color:alpha'],
|
||||
duration: 100
|
||||
});
|
||||
if (MetamapsModel.edgeHoveringOver == edge) {
|
||||
edge.setData('showDesc', true, 'current');
|
||||
edge.setDataset('end', {
|
||||
lineWidth: 4,
|
||||
color: '#222222',
|
||||
alpha: 1
|
||||
});
|
||||
}
|
||||
|
||||
//remove the edge
|
||||
MetamapsModel.selectedEdges.splice(
|
||||
MetamapsModel.selectedEdges.indexOf(edge), 1);
|
||||
Mconsole.fx.animate({
|
||||
modes: ['edge-property:lineWidth:color:alpha'],
|
||||
duration: 100
|
||||
});
|
||||
|
||||
//remove the edge
|
||||
MetamapsModel.selectedEdges.splice(
|
||||
MetamapsModel.selectedEdges.indexOf(edge), 1);
|
||||
}
|
||||
|
||||
// this is for hiding one topic from your canvas
|
||||
function hideNode(nodeid) {
|
||||
var node = Mconsole.graph.getNode(nodeid);
|
||||
if (nodeid == Mconsole.root && gType == "centered") {
|
||||
alert("You can't hide this topic, it is the root of your graph.");
|
||||
return;
|
||||
}
|
||||
var node = Mconsole.graph.getNode(nodeid);
|
||||
if (nodeid == Mconsole.root && gType == "centered") {
|
||||
alert("You can't hide this topic, it is the root of your graph.");
|
||||
return;
|
||||
}
|
||||
|
||||
deselectNode(node);
|
||||
|
||||
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(nodeid);
|
||||
deselectNode(node);
|
||||
|
||||
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(nodeid);
|
||||
}
|
||||
|
||||
function hideSelectedNodes() {
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
hideNode(node.id);
|
||||
}
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
hideNode(node.id);
|
||||
}
|
||||
}
|
||||
|
||||
function removeNode(nodeid) {
|
||||
var node = Mconsole.graph.getNode(nodeid);
|
||||
deselectNode(node);
|
||||
if (mapperm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/topics/" + mapid + "/" + nodeid + "/removefrommap",
|
||||
});
|
||||
}
|
||||
}
|
||||
function removeSelectedNodes() {
|
||||
if (mapperm) {
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
removeNode(node.id);
|
||||
var node = Mconsole.graph.getNode(nodeid);
|
||||
deselectNode(node);
|
||||
if (mapperm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/topics/" + mapid + "/" + nodeid + "/removefrommap",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function removeSelectedNodes() {
|
||||
if (mapperm) {
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
removeNode(node.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteNode(nodeid) {
|
||||
if (nodeid == Mconsole.root && gType == "centered") {
|
||||
alert("You can't delete this topic, it is the root of your graph.");
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/topics/" + nodeid,
|
||||
});
|
||||
if (nodeid == Mconsole.root && gType == "centered") {
|
||||
alert("You can't delete this topic, it is the root of your graph.");
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/topics/" + nodeid,
|
||||
});
|
||||
}
|
||||
|
||||
function deleteSelectedNodes() {
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l-1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
deleteNode(node.id);
|
||||
}
|
||||
}
|
||||
var l = MetamapsModel.selectedNodes.length;
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
var node = MetamapsModel.selectedNodes[i];
|
||||
deleteNode(node.id);
|
||||
}
|
||||
}
|
0
app/assets/javascripts/Jit/test.js
Normal file
207
app/assets/javascripts/Jit/topicCard.js
Normal file
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
* @file
|
||||
* There is a lot of code that goes into creating the "label" of a node
|
||||
* This includes editable cards with all node details, and some controls
|
||||
* onCreateLabelHandler is the main function of this file, and the file
|
||||
* also contains a bunch of helper functions
|
||||
*
|
||||
* html and littleHTML are potentially confusing variables
|
||||
* html is the contents of the card shown when you click on a node's label.
|
||||
* littleHTML creates little controls for removing/hiding nodes from the canvas
|
||||
*
|
||||
* This function features PHP-style variable substitution because the strings
|
||||
* are so damn long. Values are identified by $_id_$, and then a regular
|
||||
* expression is substituted in later (for html, in a separate function).
|
||||
*/
|
||||
|
||||
function buildCardWithHogan(node) {
|
||||
var nodeValues = {};
|
||||
var authorized = authorizeToEdit(node);
|
||||
|
||||
//link is rendered differently if user is logged out or in
|
||||
var go_link, a_tag, close_a_tag;
|
||||
if (!authorized) {
|
||||
go_link = '';
|
||||
if (node.getData("link") != "") {
|
||||
a_tag = '<a href="' + node.getData("link") + '" target="_blank">';
|
||||
close_a_tag = '</a>';
|
||||
} else {
|
||||
a_tag = '';
|
||||
close_a_tag = '';
|
||||
}
|
||||
} else {
|
||||
go_link = '<a href="' + node.getData("link") + '" ' +
|
||||
' class="go-link" target="_blank"></a>';
|
||||
a_tag = '';
|
||||
close_a_tag = '';
|
||||
}
|
||||
|
||||
var desc_nil = "Click to add description...";
|
||||
var link_nil = "Click to add link...";
|
||||
|
||||
nodeValues.permission = node.getData("permission");
|
||||
nodeValues.mk_permission = mk_permission(node);
|
||||
nodeValues.map_count = node.getData("inmaps").length;
|
||||
nodeValues.synapse_count = node.getData("synapseCount");
|
||||
nodeValues.id = node.id;
|
||||
nodeValues.metacode = node.getData("metacode");
|
||||
nodeValues.imgsrc = imgArray[node.getData("metacode")].src;
|
||||
nodeValues.name = node.name;
|
||||
nodeValues.userid = node.getData("userid");
|
||||
nodeValues.username = node.getData("username");
|
||||
nodeValues.date = node.getData("date");
|
||||
|
||||
// the code for this is stored in /views/main/_metacodeOptions.html.erb
|
||||
nodeValues.metacode_select = $('#metacodeOptions').html();
|
||||
nodeValues.go_link = go_link;
|
||||
nodeValues.a_tag = a_tag;
|
||||
nodeValues.close_a_tag = close_a_tag;
|
||||
nodeValues.link_nil = link_nil;
|
||||
nodeValues.link = (node.getData("link") == "" && authorized) ? link_nil : node.getData("link");
|
||||
nodeValues.desc_nil = desc_nil;
|
||||
nodeValues.desc = (node.getData("desc") == "" && authorized) ? desc_nil : node.getData("desc");
|
||||
|
||||
// the code for the template is stored in /views/layouts/_templates.html.erb
|
||||
var hoganTemplate = Hogan.compile($('#topicCardTemplate').html());
|
||||
return hoganTemplate.render(nodeValues);
|
||||
}
|
||||
|
||||
function hideCurrentCard() {
|
||||
if (MetamapsModel.showcardInUse) {
|
||||
var node = Mconsole.graph.getNode(MetamapsModel.showcardInUse);
|
||||
hideCard(node);
|
||||
}
|
||||
}
|
||||
|
||||
function hideCard(node) {
|
||||
var card = '.showcard';
|
||||
|
||||
$(card).fadeOut('fast', function () {
|
||||
//node.setData('dim', 25, 'current');
|
||||
Mconsole.plot();
|
||||
});
|
||||
|
||||
MetamapsModel.showcardInUse = null;
|
||||
}
|
||||
|
||||
function populateShowCard(node) {
|
||||
var showCard = document.getElementById('showcard');
|
||||
|
||||
$(showCard).find('.permission').remove();
|
||||
|
||||
var html = buildCardWithHogan(node);
|
||||
|
||||
if (authorizeToEdit(node)) {
|
||||
var perm = document.createElement('div');
|
||||
|
||||
var string = 'permission canEdit';
|
||||
if (userid == node.data.$userid) string += ' yourTopic';
|
||||
perm.className = string;
|
||||
perm.innerHTML = html;
|
||||
showCard.appendChild(perm);
|
||||
} else {
|
||||
var perm = document.createElement('div');
|
||||
perm.className = 'permission cannotEdit';
|
||||
perm.innerHTML = html;
|
||||
showCard.appendChild(perm);
|
||||
}
|
||||
|
||||
var selectingMetacode = false;
|
||||
// attach the listener that shows the metacode title when you hover over the image
|
||||
$('.showcard .metacodeImage').mouseenter(function () {
|
||||
$('.showcard .icon').css('z-index', '4');
|
||||
$('.showcard .metacodeTitle').show();
|
||||
});
|
||||
$('.showcard .linkItem.icon').mouseleave(function () {
|
||||
if (!selectingMetacode) {
|
||||
$('.showcard .metacodeTitle').hide();
|
||||
$('.showcard .icon').css('z-index', '1');
|
||||
}
|
||||
});
|
||||
|
||||
$('.showcard .metacodeTitle').click(function () {
|
||||
if (!selectingMetacode) {
|
||||
selectingMetacode = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
$('.metacodeSelect').show();
|
||||
// add the scroll bar to the list of metacode select options if it isn't already there
|
||||
if (!$('.metacodeSelect ul').hasClass('mCustomScrollbar')) {
|
||||
$('.metacodeSelect ul').mCustomScrollbar();
|
||||
|
||||
$('.metacodeSelect li').click(function () {
|
||||
selectingMetacode = false;
|
||||
var metacodeName = $(this).find('.mSelectName').text();
|
||||
updateMetacode(node, metacodeName);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
selectingMetacode = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.metacodeSelect').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ability to change permission
|
||||
var selectingPermission = false;
|
||||
if (userid == node.data.$userid) {
|
||||
$('.showcard .yourTopic .mapPerm').click(function () {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ($(this).hasClass('co')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('pu')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('pr')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('.permissionSelect li').click(function (event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateTopicPermission(node, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.permissionSelect').remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// when you're typing a description, resize the scroll box to have space
|
||||
$('.best_in_place_desc textarea').bind('keyup', function () {
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height(s.height()).mCustomScrollbar('update');
|
||||
console.log('working');
|
||||
});
|
||||
|
||||
//bind best_in_place ajax callbacks
|
||||
$(showCard).find('.best_in_place_name').bind("ajax:success", function () {
|
||||
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height(s.height()).mCustomScrollbar('update');
|
||||
|
||||
var name = $(this).html();
|
||||
node.name = decodeEntities(name);
|
||||
Mconsole.plot();
|
||||
});
|
||||
|
||||
$(showCard).find('.best_in_place_desc').bind("ajax:success", function () {
|
||||
this.innerHTML = this.innerHTML.replace(/\r/g, '')
|
||||
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height(s.height()).mCustomScrollbar('update');
|
||||
|
||||
var desc = $(this).html();
|
||||
node.setData("desc", desc);
|
||||
});
|
||||
|
||||
$(showCard).find('.best_in_place_link').bind("ajax:success", function () {
|
||||
var link = $(this).html();
|
||||
$(showCard).find('.go-link').attr('href', link);
|
||||
node.setData("link", link);
|
||||
});
|
||||
|
||||
}
|
|
@ -35,594 +35,6 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
|
|||
mapperm = false,
|
||||
touchPos, touchDragNode, mouseIsDown = false;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
function bindMainMenuHover() {
|
||||
|
||||
var menuIsOpen = false
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeMenu = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
// $('.footer .menu').animate({
|
||||
// height: '0px'
|
||||
// }, 300, function() {
|
||||
// sliding1 = false;
|
||||
// menuIsOpen = false;
|
||||
// });
|
||||
$('.footer').css('border-top-right-radius', '5px');
|
||||
$('.logo').animate({
|
||||
'background-position-x': '-10px'
|
||||
}, 200);
|
||||
$('.footer .menu').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
menuIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
var openMenu = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// $('.footer .menu').animate({
|
||||
// height: listLength + 'px'
|
||||
// }, 300, function() {
|
||||
// sliding1 = false;
|
||||
// });
|
||||
$('.footer').css('border-top-right-radius', '0');
|
||||
$('.logo').animate({
|
||||
'background-position-x': '-7px'
|
||||
}, 200);
|
||||
$('.footer .menu').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".logo").hover(openMenu, closeMenu);
|
||||
|
||||
// when on touch screen, make touching on the logo do what hovering does on desktop
|
||||
$("#mainTitle a").bind('touchend', function (evt) {
|
||||
if (!menuIsOpen) {
|
||||
openMenu();
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindSearchHover() {
|
||||
|
||||
var searchIsOpen = false
|
||||
|
||||
// controls the sliding hover of the search
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var openSearch = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1 && !searchIsOpen) {
|
||||
hideCards();
|
||||
sliding1 = true;
|
||||
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
|
||||
width: '200px'
|
||||
}, 200, function () {
|
||||
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({
|
||||
padding: '5px 10px',
|
||||
width: '180px'
|
||||
});
|
||||
$('.sidebarSearchField').focus();
|
||||
sliding1 = false
|
||||
searchIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
var closeSearch = function (closeAfter) {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') {
|
||||
sliding1 = true;
|
||||
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({
|
||||
padding: '5px 0',
|
||||
width: '200px'
|
||||
});
|
||||
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
|
||||
width: '0'
|
||||
}, 200, function () {
|
||||
$('.sidebarSearchField').typeahead('setQuery', '');
|
||||
sliding1 = false;
|
||||
searchIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, closeAfter);
|
||||
}
|
||||
|
||||
// bind the hover events
|
||||
$(".sidebarSearch").hover(function () {
|
||||
openSearch()
|
||||
}, function () {
|
||||
closeSearch(800)
|
||||
});
|
||||
|
||||
$('.sidebarSearchIcon').click(function (e) {
|
||||
$('.sidebarSearchField').focus();
|
||||
});
|
||||
$('.sidebarSearch').click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$('body').click(function (e) {
|
||||
closeSearch(0);
|
||||
});
|
||||
|
||||
// if the search is closed and user hits SHIFT+S
|
||||
$('body').bind('keydown', function (e) {
|
||||
switch (e.which) {
|
||||
case 191:
|
||||
if (e.ctrlKey && !searchIsOpen) {
|
||||
openSearch();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; //console.log(e.which);
|
||||
}
|
||||
});
|
||||
|
||||
// initialize the search box autocomplete results
|
||||
var mapheader = userid ? '<h3 class="search-header">Maps</h3><input type="checkbox" class="limitToMe" id="limitMapsToMe"></input><label for="limitMapsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div>' : '<h3 class="search-header">Maps</h3><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div>';
|
||||
var topicheader = userid ? '<h3 class="search-header">Topics</h3><input type="checkbox" class="limitToMe" id="limitTopicsToMe"></input><label for="limitTopicsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div>' : '<h3 class="search-header">Topics</h3><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div>';
|
||||
$('.sidebarSearchField').typeahead([
|
||||
{
|
||||
name: 'topics',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('.topicTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/topics?term=%QUERY',
|
||||
replace: function () {
|
||||
var q = '/search/topics?term=' + $('.sidebarSearchField').val();
|
||||
if ($("#limitTopicsToMe").is(':checked')) {
|
||||
q += "&user=" + userid.toString();
|
||||
}
|
||||
return q;
|
||||
},
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
typeImageURL: "/assets/icons/wildcard.png",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: topicheader
|
||||
},
|
||||
{
|
||||
name: 'maps',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('.mapTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/maps?term=%QUERY',
|
||||
replace: function () {
|
||||
var q = '/search/maps?term=' + $('.sidebarSearchField').val();
|
||||
if ($("#limitMapsToMe").is(':checked')) {
|
||||
q += "&user=" + userid.toString();
|
||||
}
|
||||
return q;
|
||||
},
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: mapheader
|
||||
},
|
||||
{
|
||||
name: 'mappers',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('.mapperTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/mappers?term=%QUERY',
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: '<h3 class="search-header">Mappers</h3><div class="minimizeResults minimizeMapperResults"></div><div class="clearfloat"></div>'
|
||||
}
|
||||
]);
|
||||
// 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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
$('.tt-dataset-mappers .tt-suggestions').css({
|
||||
'height': '0',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
s.css({
|
||||
'height': '0',
|
||||
'border-top': '1px solid rgb(56, 56, 56)',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
s.css({
|
||||
'height': '0',
|
||||
'border-top': '1px solid rgb(56, 56, 56)',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(this).removeClass('minimizeResults').addClass('maximizeResults');
|
||||
}
|
||||
});
|
||||
minimizeInit = true;
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
$('.sidebarSearch button.addToMap').click(function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
} // end bindSearchHover
|
||||
|
||||
function bindAccountHover() {
|
||||
|
||||
var accountIsOpen = false
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeAccount = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
$('.sidebarAccountIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarAccountBox').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
accountIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
var openAccount = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// hide the other two
|
||||
$('.sidebarFilterBox').hide();
|
||||
$('.sidebarWandBox').hide();
|
||||
$('.sidebarFilterIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarWandIcon').css('background-color', '#0F1519');
|
||||
|
||||
$('.sidebarAccountIcon').css('background-color', '#000');
|
||||
$('.sidebarAccountBox').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
accountIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".sidebarAccount").hover(openAccount, closeAccount);
|
||||
} // end bindAccountHover
|
||||
|
||||
// bind hover events
|
||||
bindMainMenuHover();
|
||||
bindSearchHover();
|
||||
bindAccountHover();
|
||||
|
||||
// disable right click events on the new topic and new synapse input fields
|
||||
$('#new_topic, #new_synapse').bind('contextmenu', function (e) {
|
||||
return false;
|
||||
});
|
||||
|
||||
// initialize the autocomplete results for the metacode spinner
|
||||
$('#topic_name').typeahead([
|
||||
{
|
||||
name: 'topic_autocomplete',
|
||||
limit: 8,
|
||||
template: '<img class="autocompleteSection topicType" width="22" height="22" src="{{typeImageURL}}" alt="{{type}}" title="{{type}}"/><p class="autocompleteSection topicTitle">{{label}}</p><div class="autocompleteSection topicPermission {{permission}}"></div><div class="autocompleteSection topicOriginatorIcon hoverForTip"><span class="tip topicOriginator">{{originator}}</span></div><div class="clearfloat"></div>',
|
||||
remote: {
|
||||
url: '/topics/autocomplete_topic?term=%QUERY'
|
||||
},
|
||||
engine: Hogan
|
||||
}
|
||||
]);
|
||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
||||
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
$('#topic_grabTopic').val(datum.id);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
// bind keyboard handlers
|
||||
$('#topic_name').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
$('.new_topic').submit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// initialize the autocomplete results for the metacode spinner
|
||||
$('#synapse_desc').typeahead([
|
||||
{
|
||||
name: 'synapse_autocomplete',
|
||||
template: "{{label}}",
|
||||
remote: {
|
||||
url: '/search/synapses?term=%QUERY'
|
||||
},
|
||||
engine: Hogan
|
||||
},
|
||||
{
|
||||
name: 'existing_synapses',
|
||||
limit: 50,
|
||||
template: $('.synapseTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/synapses',
|
||||
replace: function () {
|
||||
var q = '/search/synapses?topic1id=' + $('#synapse_topic1id').val() + '&topic2id=' + $('#synapse_topic2id').val();
|
||||
return q;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: "<h3>Existing Synapses</h3>"
|
||||
},
|
||||
]);
|
||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
||||
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
if (datum.id) { // if they clicked on an existing synapse get it
|
||||
$('#synapse_grabSynapse').val(datum.id);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
// bind keyboard handlers
|
||||
$('#synapse_desc').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
$('.new_synapse').submit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// when either form submits, don't leave the page
|
||||
$('.new_topic, .new_synapse').bind('submit', function (event, data) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
//$(".scroll").mCustomScrollbar();
|
||||
|
||||
// initialize scroll bar for filter by metacode, then hide it and position it correctly again
|
||||
$("#filter_by_metacode").mCustomScrollbar({
|
||||
advanced: {
|
||||
updateOnContentResize: true
|
||||
}
|
||||
});
|
||||
$('.sidebarFilterBox').hide().css({
|
||||
position: 'absolute',
|
||||
top: '35px',
|
||||
right: '-36px'
|
||||
});
|
||||
|
||||
// initialize metacode spinner and then hide it
|
||||
$("#metacodeImg").CloudCarousel({
|
||||
titleBox: $('#metacodeImgTitle'),
|
||||
yRadius: 40,
|
||||
xPos: 150,
|
||||
yPos: 40,
|
||||
speed: 0.3,
|
||||
mouseWheel: true,
|
||||
bringToFront: true
|
||||
});
|
||||
$('.new_topic').hide();
|
||||
|
||||
|
||||
$('.notice.metamaps').delay(10000).fadeOut('fast');
|
||||
$('.alert.metamaps').delay(10000).fadeOut('fast');
|
||||
|
||||
$('#center-container').bind('contextmenu', function (e) {
|
||||
return false;
|
||||
});
|
||||
|
||||
addHoverForSettings();
|
||||
|
||||
//bind best_in_place ajax callbacks
|
||||
$('.best_in_place_desc').bind("ajax:success", function () {
|
||||
$(this).parents('.CardOnGraph').find('.scroll').mCustomScrollbar("update");
|
||||
});
|
||||
$('.best_in_place_link').bind("ajax:success", function () {
|
||||
var link = $(this).html();
|
||||
$(this).parents('.CardOnGraph').find('.go-link').attr('href', link);
|
||||
});
|
||||
|
||||
//bind lightbox clicks
|
||||
$('.openLightbox').click(function (event) {
|
||||
openLightbox($(this).attr('data-open'));
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
// bind permission changer events
|
||||
$('.permIcon').click(function () {
|
||||
$(this).siblings('#map_permission').val($(this).attr('data-permission'));
|
||||
$(this).siblings('.permIcon').find('.mapPermIcon').removeClass('selected');
|
||||
$(this).find('.mapPermIcon').addClass('selected');
|
||||
});
|
||||
|
||||
// bind keyboard handlers
|
||||
$('body').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
enterKeyHandler(e);
|
||||
break;
|
||||
case 27:
|
||||
escKeyHandler();
|
||||
break;
|
||||
default:
|
||||
break; //console.log(e.which);
|
||||
}
|
||||
});
|
||||
|
||||
}); // end document.ready
|
||||
|
||||
function addHoverForSettings() {
|
||||
// controls the sliding hover of the settings for cards
|
||||
$(".permActivator").unbind('mouseover');
|
||||
$(".permActivator").unbind('mouseout');
|
||||
var sliding2 = false;
|
||||
var lT1, lT2;
|
||||
$(".permActivator").bind('mouseover',
|
||||
function () {
|
||||
clearTimeout(lT2);
|
||||
that = this;
|
||||
lT1 = setTimeout(function () {
|
||||
if (!sliding2) {
|
||||
sliding2 = true;
|
||||
$(that).animate({
|
||||
width: '203px',
|
||||
height: '37px'
|
||||
}, 300, function () {
|
||||
sliding2 = false;
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
|
||||
$(".permActivator").bind('mouseout',
|
||||
function () {
|
||||
clearTimeout(lT1);
|
||||
that = this;
|
||||
lT2 = setTimeout(function () {
|
||||
if (!sliding2) {
|
||||
sliding2 = true;
|
||||
$(that).animate({
|
||||
height: '16px',
|
||||
width: '16px'
|
||||
}, 300, function () {
|
||||
sliding2 = false;
|
||||
});
|
||||
}
|
||||
}, 800);
|
||||
}
|
||||
);
|
||||
|
||||
$('.best_in_place_permission').unbind("ajax:success");
|
||||
//bind best_in_place ajax callbacks
|
||||
$('.best_in_place_permission').bind("ajax:success", function () {
|
||||
var permission = $(this).html();
|
||||
var el = $(this).parents('.cardSettings').find('.mapPerm');
|
||||
el.attr('title', permission);
|
||||
if (permission == "commons") el.html("co");
|
||||
else if (permission == "public") el.html("pu");
|
||||
else if (permission == "private") el.html("pr");
|
||||
});
|
||||
} // end addHoverForSettings
|
||||
|
||||
// this is to save the layout of a map
|
||||
function saveLayoutAll() {
|
||||
|
@ -714,14 +126,6 @@ function fetchRelatives(node) {
|
|||
});
|
||||
Mconsole.plot();
|
||||
}
|
||||
/*Mconsole.op.contract(node, {
|
||||
type: 'replot'
|
||||
});
|
||||
Mconsole.op.expand(node, {
|
||||
type: 'animate',
|
||||
transition: $jit.Trans.Elastic.easeOut,
|
||||
duration: 1000
|
||||
});*/
|
||||
},
|
||||
error: function () {
|
||||
alert('failure');
|
||||
|
@ -825,6 +229,98 @@ function updateMapPermission(mapid, permission) {
|
|||
});
|
||||
}
|
||||
|
||||
function updateMetacodeSet(set, index, custom) {
|
||||
|
||||
if (custom && MetamapsModel.newSelectedMetacodes.length == 0) {
|
||||
alert('Please select at least one metacode to use!');
|
||||
return false;
|
||||
}
|
||||
|
||||
var codesToSwitchTo;
|
||||
MetamapsModel.selectedMetacodeSetIndex = index;
|
||||
MetamapsModel.selectedMetacodeSet = "metacodeset-" + set;
|
||||
|
||||
if (!custom) {
|
||||
codesToSwitchTo = $('#metacodeSwitchTabs' + set).attr('data-metacodes').split(',');
|
||||
$('.customMetacodeList li').addClass('toggledOff');
|
||||
MetamapsModel.selectedMetacodes = [];
|
||||
MetamapsModel.selectedMetacodeNames = [];
|
||||
MetamapsModel.newSelectedMetacodes = [];
|
||||
MetamapsModel.newSelectedMetacodeNames = [];
|
||||
}
|
||||
if (custom) {
|
||||
// uses .slice to avoid setting the two arrays to the same actual array
|
||||
MetamapsModel.selectedMetacodes = MetamapsModel.newSelectedMetacodes.slice(0);
|
||||
MetamapsModel.selectedMetacodeNames = MetamapsModel.newSelectedMetacodeNames.slice(0);
|
||||
codesToSwitchTo = MetamapsModel.selectedMetacodeNames.slice(0);
|
||||
}
|
||||
|
||||
// sort by name
|
||||
codesToSwitchTo.sort();
|
||||
codesToSwitchTo.reverse();
|
||||
|
||||
$('#metacodeImg, #metacodeImgTitle').empty();
|
||||
$('#metacodeImg').removeData('cloudcarousel');
|
||||
var newMetacodes = "";
|
||||
for (var i = 0; i < codesToSwitchTo.length; i++) {
|
||||
newMetacodes += '<img class="cloudcarousel" width="40" height="40" src="' + imgArray[codesToSwitchTo[i]].src + '" title="' + codesToSwitchTo[i] + '"/>';
|
||||
};
|
||||
$('#metacodeImg').empty().append(newMetacodes).CloudCarousel({
|
||||
titleBox: $('#metacodeImgTitle'),
|
||||
yRadius: 40,
|
||||
xPos: 150,
|
||||
yPos: 40,
|
||||
speed: 0.15,
|
||||
mouseWheel: true,
|
||||
bringToFront: true
|
||||
});
|
||||
|
||||
$('#lightbox_overlay').hide();
|
||||
|
||||
var mdata = {
|
||||
"metacodes": {
|
||||
"value": custom ? MetamapsModel.selectedMetacodes.toString() : MetamapsModel.selectedMetacodeSet
|
||||
}
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
url: "/user/updatemetacodes",
|
||||
data: mdata,
|
||||
success: function (data) {
|
||||
console.log('success updating metacodes');
|
||||
//setTimeout(function () {
|
||||
// $('.metacodeTitle').hide();
|
||||
// $('.showcard .icon').css('z-index', '1');
|
||||
//}, 500);
|
||||
},
|
||||
error: function () {
|
||||
alert('failed to update metacodes');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelMetacodeSetSwitch() {
|
||||
if (MetamapsModel.selectedMetacodeSet != "metacodeset-custom") {
|
||||
$('.customMetacodeList li').addClass('toggledOff');
|
||||
MetamapsModel.selectedMetacodes = [];
|
||||
MetamapsModel.selectedMetacodeNames = [];
|
||||
MetamapsModel.newSelectedMetacodes = [];
|
||||
MetamapsModel.newSelectedMetacodeNames = [];
|
||||
}
|
||||
else { // custom set is selected
|
||||
// reset it to the current actual selection
|
||||
$('.customMetacodeList li').addClass('toggledOff');
|
||||
for (var i = 0; i < MetamapsModel.selectedMetacodes.length; i++) {
|
||||
$('#' + MetamapsModel.selectedMetacodes[i]).removeClass('toggledOff');
|
||||
};
|
||||
// uses .slice to avoid setting the two arrays to the same actual array
|
||||
MetamapsModel.newSelectedMetacodeNames = MetamapsModel.selectedMetacodeNames.slice(0);
|
||||
MetamapsModel.newSelectedMetacodes = MetamapsModel.selectedMetacodes.slice(0);
|
||||
}
|
||||
$('#metacodeSwitchTabs').tabs("select", MetamapsModel.selectedMetacodeSetIndex);
|
||||
}
|
||||
|
||||
function MconsoleReset() {
|
||||
|
||||
var tX = Mconsole.canvas.translateOffsetX;
|
||||
|
@ -843,7 +339,6 @@ function openNodeShowcard(node) {
|
|||
$('.showcard').fadeIn('fast');
|
||||
var s = $('.showcard').find('.scroll');
|
||||
s.height(s.height()).mCustomScrollbar();
|
||||
//node.setData('dim', 1, 'current');
|
||||
MetamapsModel.showcardInUse = node.id;
|
||||
}
|
||||
|
||||
|
@ -853,6 +348,13 @@ function openLightbox(which) {
|
|||
|
||||
$('#lightbox_overlay').show();
|
||||
$('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
|
||||
|
||||
//if (MetamapsModel.selectedMetacodeSet == "metacodeset-custom" && !MetamapsModel.metacodeScrollerInit) {
|
||||
if (!MetamapsModel.metacodeScrollerInit) {
|
||||
//$('.customMetacodeList').mCustomScrollbar();
|
||||
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }});
|
||||
MetamapsModel.metacodeScrollerInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
function cancelMapCreate(id) {
|
||||
|
|
93
app/assets/javascripts/jquery/AllMappingPages.js
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* AllMappingPages means:
|
||||
1. being logged in or logged out and,
|
||||
2. either
|
||||
a. being on a Map page, or
|
||||
b. being on a Topic page
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// initialize topic card draggability and resizability
|
||||
$('.showcard').draggable({
|
||||
handle: ".metacodeImage"
|
||||
});
|
||||
$('#showcard').resizable({
|
||||
maxHeight: 500,
|
||||
maxWidth: 500,
|
||||
minHeight: 320,
|
||||
minWidth: 226,
|
||||
resize: function (event, ui) {
|
||||
var p = $('#showcard').find('.scroll');
|
||||
p.height(p.height()).mCustomScrollbar('update');
|
||||
}
|
||||
}).css({
|
||||
display: 'none',
|
||||
top: '300px',
|
||||
left: '100px'
|
||||
});
|
||||
|
||||
function bindFilterHover() {
|
||||
|
||||
var filterIsOpen = false;
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeFilter = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
$('.sidebarFilterIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarFilterBox').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
filterIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
var openFilter = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// hide the other two
|
||||
$('.sidebarAccountBox').hide();
|
||||
$('.sidebarWandBox').hide();
|
||||
$('.sidebarAccountIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarWandIcon').css('background-color', '#0F1519');
|
||||
|
||||
$('.sidebarFilterIcon').css('background-color', '#000');
|
||||
$('.sidebarFilterBox').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
filterIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".sidebarFilter").hover(openFilter, closeFilter);
|
||||
|
||||
} // end bindFilterHover
|
||||
|
||||
bindFilterHover();
|
||||
|
||||
// initialize scroll bar for filter by metacode, then hide it and position it correctly again
|
||||
$("#filter_by_metacode").mCustomScrollbar({
|
||||
advanced: {
|
||||
updateOnContentResize: true
|
||||
}
|
||||
});
|
||||
$('.sidebarFilterBox').hide().css({
|
||||
position: 'absolute',
|
||||
top: '35px',
|
||||
right: '-36px'
|
||||
});
|
||||
|
||||
// prevent right clicks on the main canvas, so as to not get in the way of our right clicks
|
||||
$('#center-container').bind('contextmenu', function (e) {
|
||||
return false;
|
||||
});
|
||||
}); // end document.ready
|
19
app/assets/javascripts/jquery/AuthAllMappingPages.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* AuthAllMappingPages means:
|
||||
1. being logged in and,
|
||||
2. either
|
||||
a. being on a Map page, or
|
||||
b. being on a Topic page
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.sidebarFork').click(function () {
|
||||
saveToMap();
|
||||
});
|
||||
|
||||
// initialize best_in_place editing
|
||||
$('.authenticated div.permission.canEdit .best_in_place').best_in_place();
|
||||
|
||||
}); // end document.ready
|
32
app/assets/javascripts/jquery/AuthCanEditMapPage.js
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* authCanEditMapPage means:
|
||||
1. being logged in and,
|
||||
2. being on a Map page and having edit permissions (your map, or commons map)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// because anyone who can edit the map can collaborate on it in realtime
|
||||
$(".sidebarCollaborateIcon").click(function (event) {
|
||||
if (!goRealtime) {
|
||||
$('.sidebarCollaborate .tip').html('Stop Realtime Collaboration');
|
||||
} else {
|
||||
$('.sidebarCollaborate .tip').html('Start Realtime Collaboration');
|
||||
}
|
||||
goRealtime = !goRealtime;
|
||||
$(".sidebarCollaborateIcon").toggleClass("blue");
|
||||
});
|
||||
|
||||
// because anyone who can edit the map can save a new map layout
|
||||
$('.sidebarSave').click(function () {
|
||||
saveLayoutAll();
|
||||
});
|
||||
|
||||
// because anyone who can edit the map can change the map title
|
||||
$('.mapInfoName .best_in_place_name').bind("ajax:success", function () {
|
||||
var name = $(this).html();
|
||||
$('.mapName').html(name);
|
||||
});
|
||||
|
||||
}); // end document.ready
|
156
app/assets/javascripts/jquery/AuthCanEditMappingPages.js
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
/* authCanEditMappingPages means:
|
||||
1. being logged in and,
|
||||
2. either
|
||||
a. being on a Map page and having edit permissions (your map, or commons map) or,
|
||||
b. being on a Topic page
|
||||
|
||||
this code adds required jQuery for creating, or pulling in, topics and synapses
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
//////
|
||||
//////
|
||||
//// TOPIC CREATION
|
||||
|
||||
// initialize the autocomplete results for the metacode spinner
|
||||
$('#topic_name').typeahead([
|
||||
{
|
||||
name: 'topic_autocomplete',
|
||||
limit: 8,
|
||||
template: $('#topicAutocompleteTemplate').html(),
|
||||
remote: {
|
||||
url: '/topics/autocomplete_topic?term=%QUERY'
|
||||
},
|
||||
engine: Hogan
|
||||
}
|
||||
]);
|
||||
|
||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
||||
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
$('#topic_grabTopic').val(datum.id);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// bind keyboard handlers
|
||||
$('#topic_name').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
$('.new_topic').submit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// initialize metacode spinner and then hide it
|
||||
$("#metacodeImg").CloudCarousel({
|
||||
titleBox: $('#metacodeImgTitle'),
|
||||
yRadius: 40,
|
||||
xPos: 150,
|
||||
yPos: 40,
|
||||
speed: 0.3,
|
||||
mouseWheel: true,
|
||||
bringToFront: true
|
||||
});
|
||||
$('.new_topic').hide();
|
||||
|
||||
|
||||
//////
|
||||
//////
|
||||
//// SYNAPSE CREATION
|
||||
|
||||
// initialize the autocomplete results for synapse creation
|
||||
$('#synapse_desc').typeahead([
|
||||
{
|
||||
name: 'synapse_autocomplete',
|
||||
template: "{{label}}",
|
||||
remote: {
|
||||
url: '/search/synapses?term=%QUERY'
|
||||
},
|
||||
engine: Hogan
|
||||
},
|
||||
{
|
||||
name: 'existing_synapses',
|
||||
limit: 50,
|
||||
template: $('#synapseAutocompleteTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/synapses',
|
||||
replace: function () {
|
||||
var q = '/search/synapses?topic1id=' + $('#synapse_topic1id').val() + '&topic2id=' + $('#synapse_topic2id').val();
|
||||
return q;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: "<h3>Existing Synapses</h3>"
|
||||
},
|
||||
]);
|
||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
||||
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
if (datum.id) { // if they clicked on an existing synapse get it
|
||||
$('#synapse_grabSynapse').val(datum.id);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
});
|
||||
// bind keyboard handlers
|
||||
$('#synapse_desc').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
$('.new_synapse').submit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//////
|
||||
//////
|
||||
//// TOPIC AND SYNAPSE CREATION
|
||||
|
||||
// when either form submits, don't leave the page
|
||||
$('.new_topic, .new_synapse').bind('submit', function (event, data) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// disable right click events on the new topic and new synapse input fields
|
||||
$('#new_topic, #new_synapse').bind('contextmenu', function (e) {
|
||||
return false;
|
||||
});
|
||||
|
||||
//////
|
||||
//////
|
||||
//// SWITCHING METACODE SETS
|
||||
|
||||
$('#metacodeSwitchTabs').tabs({
|
||||
selected: MetamapsModel.selectedMetacodeSetIndex
|
||||
}).addClass("ui-tabs-vertical ui-helper-clearfix");
|
||||
$("#metacodeSwitchTabs .ui-tabs-nav li").removeClass("ui-corner-top").addClass("ui-corner-left");
|
||||
$("#metacodeSwitchTabs .ui-tabs-nav li a").click(function(){
|
||||
// recenter the lightbox when you switch tabs
|
||||
$('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
|
||||
});
|
||||
/*$("#metacodeSetCustom").click(function () {
|
||||
if (!MetamapsModel.metacodeScrollerInit) {
|
||||
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }});
|
||||
MetamapsModel.metacodeScrollerInit = true;
|
||||
}
|
||||
});*/
|
||||
$('.customMetacodeList li').click(function () {
|
||||
if ($(this).attr('class') != 'toggledOff') {
|
||||
$(this).addClass('toggledOff');
|
||||
var value_to_remove = $(this).attr('id');
|
||||
var name_to_remove = $(this).attr('data-name');
|
||||
MetamapsModel.newSelectedMetacodes.splice(MetamapsModel.newSelectedMetacodes.indexOf(value_to_remove), 1);
|
||||
MetamapsModel.newSelectedMetacodeNames.splice(MetamapsModel.newSelectedMetacodeNames.indexOf(name_to_remove), 1);
|
||||
} else if ($(this).attr('class') == 'toggledOff') {
|
||||
$(this).removeClass('toggledOff');
|
||||
MetamapsModel.newSelectedMetacodes.push($(this).attr('id'));
|
||||
MetamapsModel.newSelectedMetacodeNames.push($(this).attr('data-name'));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}); // end document.ready
|
16
app/assets/javascripts/jquery/AuthEveryPage.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* authEveryPage means:
|
||||
1. being logged in and on any page on metamaps
|
||||
|
||||
this code adds required jQuery for the create map lightBox that can be used from any page on metamaps
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// bind permission changer events on the createMap form
|
||||
$('.permIcon').click(function () {
|
||||
$(this).siblings('#map_permission').val($(this).attr('data-permission'));
|
||||
$(this).siblings('.permIcon').find('.mapPermIcon').removeClass('selected');
|
||||
$(this).find('.mapPermIcon').addClass('selected');
|
||||
});
|
||||
|
||||
}); // end document.ready
|
36
app/assets/javascripts/jquery/AuthMapCreatorMapPage.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* AuthMapCreatorMapPage means:
|
||||
1. being on a Map page
|
||||
2. being the original creator of that map
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// ability to change permission of the map
|
||||
var selectingPermission = false;
|
||||
$('.yourMap .mapPermission').click(function () {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ($(this).hasClass('commons')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('public')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ($(this).hasClass('private')) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('.mapPermission .permissionSelect li').click(function (event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateMapPermission(mapid, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.mapPermission .permissionSelect').remove();
|
||||
}
|
||||
});
|
||||
|
||||
}); // end document.ready
|
404
app/assets/javascripts/jquery/EveryPage.js
vendored
Normal file
|
@ -0,0 +1,404 @@
|
|||
// everything in this document.ready function is here because it is needed on every single page on metamaps
|
||||
$(document).ready(function () {
|
||||
|
||||
function bindMainMenuHover() {
|
||||
|
||||
var menuIsOpen = false
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeMenu = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
// $('.footer .menu').animate({
|
||||
// height: '0px'
|
||||
// }, 300, function() {
|
||||
// sliding1 = false;
|
||||
// menuIsOpen = false;
|
||||
// });
|
||||
$('.footer').css('border-top-right-radius', '5px');
|
||||
$('.logo').animate({
|
||||
'background-position-x': '-10px'
|
||||
}, 200);
|
||||
$('.footer .menu').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
menuIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
var openMenu = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// $('.footer .menu').animate({
|
||||
// height: listLength + 'px'
|
||||
// }, 300, function() {
|
||||
// sliding1 = false;
|
||||
// });
|
||||
$('.footer').css('border-top-right-radius', '0');
|
||||
$('.logo').animate({
|
||||
'background-position-x': '-7px'
|
||||
}, 200);
|
||||
$('.footer .menu').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".logo").hover(openMenu, closeMenu);
|
||||
|
||||
// when on touch screen, make touching on the logo do what hovering does on desktop
|
||||
$("#mainTitle a").bind('touchend', function (evt) {
|
||||
if (!menuIsOpen) {
|
||||
openMenu();
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindSearchHover() {
|
||||
|
||||
var searchIsOpen = false
|
||||
|
||||
// controls the sliding hover of the search
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var openSearch = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1 && !searchIsOpen) {
|
||||
hideCards();
|
||||
sliding1 = true;
|
||||
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
|
||||
width: '200px'
|
||||
}, 200, function () {
|
||||
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({
|
||||
padding: '5px 10px',
|
||||
width: '180px'
|
||||
});
|
||||
$('.sidebarSearchField').focus();
|
||||
sliding1 = false
|
||||
searchIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
var closeSearch = function (closeAfter) {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') {
|
||||
sliding1 = true;
|
||||
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({
|
||||
padding: '5px 0',
|
||||
width: '200px'
|
||||
});
|
||||
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
|
||||
width: '0'
|
||||
}, 200, function () {
|
||||
$('.sidebarSearchField').typeahead('setQuery', '');
|
||||
sliding1 = false;
|
||||
searchIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, closeAfter);
|
||||
}
|
||||
|
||||
// bind the hover events
|
||||
$(".sidebarSearch").hover(function () {
|
||||
openSearch()
|
||||
}, function () {
|
||||
closeSearch(800)
|
||||
});
|
||||
|
||||
$('.sidebarSearchIcon').click(function (e) {
|
||||
$('.sidebarSearchField').focus();
|
||||
});
|
||||
$('.sidebarSearch').click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$('body').click(function (e) {
|
||||
closeSearch(0);
|
||||
});
|
||||
|
||||
// if the search is closed and user hits SHIFT+S
|
||||
$('body').bind('keydown', function (e) {
|
||||
switch (e.which) {
|
||||
case 191:
|
||||
if (e.ctrlKey && !searchIsOpen) {
|
||||
openSearch();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; //console.log(e.which);
|
||||
}
|
||||
});
|
||||
|
||||
// initialize the search box autocomplete results
|
||||
var mapheader = userid ? '<h3 class="search-header">Maps</h3><input type="checkbox" class="limitToMe" id="limitMapsToMe"></input><label for="limitMapsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div>' : '<h3 class="search-header">Maps</h3><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div>';
|
||||
var topicheader = userid ? '<h3 class="search-header">Topics</h3><input type="checkbox" class="limitToMe" id="limitTopicsToMe"></input><label for="limitTopicsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div>' : '<h3 class="search-header">Topics</h3><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div>';
|
||||
$('.sidebarSearchField').typeahead([
|
||||
{
|
||||
name: 'topics',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('#topicSearchTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/topics?term=%QUERY',
|
||||
replace: function () {
|
||||
var q = '/search/topics?term=' + $('.sidebarSearchField').val();
|
||||
if ($("#limitTopicsToMe").is(':checked')) {
|
||||
q += "&user=" + userid.toString();
|
||||
}
|
||||
return q;
|
||||
},
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
typeImageURL: "/assets/icons/wildcard.png",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: topicheader
|
||||
},
|
||||
{
|
||||
name: 'maps',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('#mapSearchTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/maps?term=%QUERY',
|
||||
replace: function () {
|
||||
var q = '/search/maps?term=' + $('.sidebarSearchField').val();
|
||||
if ($("#limitMapsToMe").is(':checked')) {
|
||||
q += "&user=" + userid.toString();
|
||||
}
|
||||
return q;
|
||||
},
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: mapheader
|
||||
},
|
||||
{
|
||||
name: 'mappers',
|
||||
dupChecker: function (datum1, datum2) {
|
||||
return false;
|
||||
},
|
||||
template: $('#mapperSearchTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/mappers?term=%QUERY',
|
||||
filter: function (dataset) {
|
||||
if (dataset.length == 0) {
|
||||
dataset.push({
|
||||
value: "No results",
|
||||
label: "No results",
|
||||
rtype: "noresult"
|
||||
});
|
||||
}
|
||||
return dataset;
|
||||
}
|
||||
},
|
||||
engine: Hogan,
|
||||
header: '<h3 class="search-header">Mappers</h3><div class="minimizeResults minimizeMapperResults"></div><div class="clearfloat"></div>'
|
||||
}
|
||||
]);
|
||||
// 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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
$('.tt-dataset-mappers .tt-suggestions').css({
|
||||
'height': '0',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
s.css({
|
||||
'height': '0',
|
||||
'border-top': '1px solid rgb(56, 56, 56)',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(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',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||
} else {
|
||||
s.css({
|
||||
'height': '0',
|
||||
'border-top': '1px solid rgb(56, 56, 56)',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
$(this).removeClass('minimizeResults').addClass('maximizeResults');
|
||||
}
|
||||
});
|
||||
minimizeInit = true;
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
$('.sidebarSearch button.addToMap').click(function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
} // end bindSearchHover
|
||||
|
||||
function bindAccountHover() {
|
||||
|
||||
var accountIsOpen = false
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeAccount = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
$('.sidebarAccountIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarAccountBox').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
accountIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
var openAccount = function () {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// hide the other two
|
||||
$('.sidebarFilterBox').hide();
|
||||
$('.sidebarWandBox').hide();
|
||||
$('.sidebarFilterIcon').css('background-color', '#0F1519');
|
||||
$('.sidebarWandIcon').css('background-color', '#0F1519');
|
||||
|
||||
$('.sidebarAccountIcon').css('background-color', '#000');
|
||||
$('.sidebarAccountBox').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
accountIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".sidebarAccount").hover(openAccount, closeAccount);
|
||||
} // end bindAccountHover
|
||||
|
||||
// bind hover events
|
||||
bindMainMenuHover();
|
||||
bindSearchHover();
|
||||
bindAccountHover();
|
||||
|
||||
// hide notices after 10 seconds
|
||||
$('.notice.metamaps').delay(10000).fadeOut('fast');
|
||||
$('.alert.metamaps').delay(10000).fadeOut('fast');
|
||||
|
||||
//bind lightbox clicks
|
||||
$('.openLightbox').click(function (event) {
|
||||
openLightbox($(this).attr('data-open'));
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
// bind keyboard handlers
|
||||
$('body').bind('keyup', function (e) {
|
||||
switch (e.which) {
|
||||
case 13:
|
||||
enterKeyHandler(e);
|
||||
break;
|
||||
case 27:
|
||||
escKeyHandler();
|
||||
break;
|
||||
default:
|
||||
break; //console.log(e.which);
|
||||
}
|
||||
});
|
||||
|
||||
}); // end document.ready
|
48
app/assets/javascripts/jquery/MapPage.js
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* MapPage means:
|
||||
1. being on a Map page
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
function bindInfoHover() {
|
||||
|
||||
var infoIsOpen = false;
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeInfo = function () {
|
||||
lT = setTimeout(function () {
|
||||
if (!sliding1) {
|
||||
sliding1 = true;
|
||||
$('.mapInfoBox').fadeOut(200, function () {
|
||||
sliding1 = false;
|
||||
infoIsOpen = false;
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
var openInfo = function (event) {
|
||||
clearTimeout(lT);
|
||||
if (!sliding1 && event.target.className != "openCheatsheet openLightbox") {
|
||||
sliding1 = true;
|
||||
|
||||
$('.mapInfoBox').fadeIn(200, function () {
|
||||
sliding1 = false;
|
||||
infoIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$("div.index").hover(openInfo, closeInfo);
|
||||
|
||||
|
||||
} // end bindInfoHover
|
||||
|
||||
bindInfoHover();
|
||||
|
||||
}); // end document.ready
|
|
@ -1,75 +1,166 @@
|
|||
window.realtime = {};
|
||||
|
||||
window.realtime.addTopicToMap = function(topic) {
|
||||
var newPos, tempForT;
|
||||
Mconsole.graph.addNode(topic);
|
||||
tempForT = Mconsole.graph.getNode(topic.id);
|
||||
tempForT.setData('dim', 1, 'start');
|
||||
tempForT.setData('dim', 25, 'end');
|
||||
newPos = new $jit.Complex();
|
||||
newPos.x = tempForT.data.$xloc;
|
||||
newPos.y = tempForT.data.$yloc;
|
||||
tempForT.setPos(newPos, 'start');
|
||||
tempForT.setPos(newPos, 'current');
|
||||
tempForT.setPos(newPos, 'end');
|
||||
Mconsole.fx.plotNode(tempForT, Mconsole.canvas);
|
||||
return Mconsole.labels.plotLabel(Mconsole.canvas, tempForT, Mconsole.config);
|
||||
window.realtime.notifyTimeOut = null;
|
||||
window.realtime.notifyUser = function (message) {
|
||||
if ($('.notice.metamaps').length == 0) {
|
||||
$('body').prepend('<div class="notice metamaps" />');
|
||||
}
|
||||
$('.notice.metamaps').hide().html(message).fadeIn('fast');
|
||||
|
||||
clearTimeout(window.realtime.notifyTimeOut);
|
||||
window.realtime.notifyTimeOut = setTimeout(function () {
|
||||
$('.notice.metamaps').fadeOut('fast');
|
||||
}, 8000);
|
||||
};
|
||||
|
||||
window.realtime.updateTopicOnMap = function(topic) {
|
||||
var newPos, tempForT;
|
||||
tempForT = Mconsole.graph.getNode(topic.id);
|
||||
tempForT.data = topic.data;
|
||||
tempForT.name = topic.name;
|
||||
if (MetamapsModel.showcardInUse === topic.id) {
|
||||
populateShowCard(tempForT);
|
||||
}
|
||||
newPos = new $jit.Complex();
|
||||
newPos.x = tempForT.data.$xloc;
|
||||
newPos.y = tempForT.data.$yloc;
|
||||
tempForT.setPos(newPos, 'start');
|
||||
tempForT.setPos(newPos, 'current');
|
||||
tempForT.setPos(newPos, 'end');
|
||||
return Mconsole.fx.animate({
|
||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
||||
transition: $jit.Trans.Quad.easeInOut,
|
||||
duration: 500
|
||||
});
|
||||
window.realtime.setupSocket = function () {
|
||||
var socket = window.realtime.socket;
|
||||
|
||||
socket.emit('newMapperNotify', {
|
||||
userid: userid,
|
||||
username: username,
|
||||
mapid: mapid
|
||||
});
|
||||
|
||||
// if you're the 'new guy' update your list with who's already online
|
||||
socket.on(userid + '-' + mapid + '-UpdateMapperList', function (data) {
|
||||
// data.userid
|
||||
// data.username
|
||||
//alert(data.username + ' is already online');
|
||||
});
|
||||
|
||||
// receive word that there's a new mapper on the map
|
||||
socket.on('maps-' + mapid + '-newmapper', function (data) {
|
||||
// data.userid
|
||||
// data.username
|
||||
|
||||
window.realtime.notifyUser(data.username + ' just came online');
|
||||
|
||||
// send this new mapper back your details, and the awareness that you're online
|
||||
var update = {
|
||||
userToNotify: data.userid,
|
||||
username: username,
|
||||
userid: userid,
|
||||
mapid: mapid
|
||||
};
|
||||
socket.emit('updateNewMapperList', update);
|
||||
});
|
||||
|
||||
socket.on('maps-' + mapid + '-lostmapper', function (data) {
|
||||
// data.userid
|
||||
// data.username
|
||||
|
||||
window.realtime.notifyUser(data.username + ' just went offline');
|
||||
});
|
||||
|
||||
socket.on('maps-' + mapid, function (data) {
|
||||
|
||||
|
||||
|
||||
//as long as you weren't the origin of the changes, update your map
|
||||
if (data.origin != userid && goRealtime) {
|
||||
if (data.resource == 'Topic') {
|
||||
topic = $.parseJSON(data.obj);
|
||||
|
||||
if (data.action == 'create') {
|
||||
window.realtime.addTopicToMap(topic);
|
||||
} else if (data.action == 'update' && Mconsole.graph.getNode(topic.id) != 'undefined') {
|
||||
window.realtime.updateTopicOnMap(topic);
|
||||
} else if (data.action == 'destroy' && Mconsole.graph.getNode(topic.id) != 'undefined') {
|
||||
hideNode(topic.id)
|
||||
}
|
||||
|
||||
return;
|
||||
} else if (data.resource == 'Synapse') {
|
||||
synapse = $.parseJSON(data.obj);
|
||||
|
||||
if (data.action == 'create') {
|
||||
window.realtime.addSynapseToMap(synapse);
|
||||
} else if (data.action == 'update' &&
|
||||
Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
||||
window.realtime.updateSynapseOnMap(synapse);
|
||||
} else if (data.action == 'destroy' &&
|
||||
Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
||||
var edge = Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']);
|
||||
hideEdge(edge);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
window.realtime.addSynapseToMap = function(synapse) {
|
||||
var Node1, Node2, tempForS;
|
||||
Node1 = Mconsole.graph.getNode(synapse.data.$direction[0]);
|
||||
Node2 = Mconsole.graph.getNode(synapse.data.$direction[1]);
|
||||
Mconsole.graph.addAdjacence(Node1, Node2, {});
|
||||
tempForS = Mconsole.graph.getAdjacence(Node1.id, Node2.id);
|
||||
tempForS.setDataset('start', {
|
||||
lineWidth: 0.4
|
||||
});
|
||||
tempForS.setDataset('end', {
|
||||
lineWidth: 2
|
||||
});
|
||||
tempForS.data = synapse.data;
|
||||
Mconsole.fx.plotLine(tempForS, Mconsole.canvas);
|
||||
return Mconsole.fx.animate({
|
||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
||||
transition: $jit.Trans.Quad.easeInOut,
|
||||
duration: 500
|
||||
});
|
||||
window.realtime.addTopicToMap = function (topic) {
|
||||
var newPos, tempForT;
|
||||
Mconsole.graph.addNode(topic);
|
||||
tempForT = Mconsole.graph.getNode(topic.id);
|
||||
tempForT.setData('dim', 1, 'start');
|
||||
tempForT.setData('dim', 25, 'end');
|
||||
newPos = new $jit.Complex();
|
||||
newPos.x = tempForT.data.$xloc;
|
||||
newPos.y = tempForT.data.$yloc;
|
||||
tempForT.setPos(newPos, 'start');
|
||||
tempForT.setPos(newPos, 'current');
|
||||
tempForT.setPos(newPos, 'end');
|
||||
Mconsole.fx.plotNode(tempForT, Mconsole.canvas);
|
||||
return Mconsole.labels.plotLabel(Mconsole.canvas, tempForT, Mconsole.config);
|
||||
};
|
||||
|
||||
window.realtime.updateSynapseOnMap = function(synapse) {
|
||||
var k, tempForS, v, wasShowDesc, _ref;
|
||||
tempForS = Mconsole.graph.getAdjacence(synapse.data.$direction[0], synapse.data.$direction[1]);
|
||||
wasShowDesc = tempForS.data.$showDesc;
|
||||
_ref = synapse.data;
|
||||
for (k in _ref) {
|
||||
v = _ref[k];
|
||||
tempForS.data[k] = v;
|
||||
}
|
||||
tempForS.data.$showDesc = wasShowDesc;
|
||||
if (MetamapsModel.edgecardInUse === synapse.data.$id) {
|
||||
editEdge(tempForS, false);
|
||||
}
|
||||
return Mconsole.plot();
|
||||
window.realtime.updateTopicOnMap = function (topic) {
|
||||
var newPos, tempForT;
|
||||
tempForT = Mconsole.graph.getNode(topic.id);
|
||||
tempForT.data = topic.data;
|
||||
tempForT.name = topic.name;
|
||||
if (MetamapsModel.showcardInUse === topic.id) {
|
||||
populateShowCard(tempForT);
|
||||
}
|
||||
newPos = new $jit.Complex();
|
||||
newPos.x = tempForT.data.$xloc;
|
||||
newPos.y = tempForT.data.$yloc;
|
||||
tempForT.setPos(newPos, 'start');
|
||||
tempForT.setPos(newPos, 'current');
|
||||
tempForT.setPos(newPos, 'end');
|
||||
return Mconsole.fx.animate({
|
||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
||||
transition: $jit.Trans.Quad.easeInOut,
|
||||
duration: 500
|
||||
});
|
||||
};
|
||||
|
||||
window.realtime.addSynapseToMap = function (synapse) {
|
||||
var Node1, Node2, tempForS;
|
||||
Node1 = Mconsole.graph.getNode(synapse.data.$direction[0]);
|
||||
Node2 = Mconsole.graph.getNode(synapse.data.$direction[1]);
|
||||
Mconsole.graph.addAdjacence(Node1, Node2, {});
|
||||
tempForS = Mconsole.graph.getAdjacence(Node1.id, Node2.id);
|
||||
tempForS.setDataset('start', {
|
||||
lineWidth: 0.4
|
||||
});
|
||||
tempForS.setDataset('end', {
|
||||
lineWidth: 2
|
||||
});
|
||||
tempForS.data = synapse.data;
|
||||
Mconsole.fx.plotLine(tempForS, Mconsole.canvas);
|
||||
return Mconsole.fx.animate({
|
||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
||||
transition: $jit.Trans.Quad.easeInOut,
|
||||
duration: 500
|
||||
});
|
||||
};
|
||||
|
||||
window.realtime.updateSynapseOnMap = function (synapse) {
|
||||
var k, tempForS, v, wasShowDesc, _ref;
|
||||
tempForS = Mconsole.graph.getAdjacence(synapse.data.$direction[0], synapse.data.$direction[1]);
|
||||
wasShowDesc = tempForS.data.$showDesc;
|
||||
_ref = synapse.data;
|
||||
for (k in _ref) {
|
||||
v = _ref[k];
|
||||
tempForS.data[k] = v;
|
||||
}
|
||||
tempForS.data.$showDesc = wasShowDesc;
|
||||
if (MetamapsModel.edgecardInUse === synapse.data.$id) {
|
||||
editEdge(tempForS, false);
|
||||
}
|
||||
return Mconsole.plot();
|
||||
};
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
}
|
||||
|
||||
.best_in_place_name input{
|
||||
.best_in_place_name textarea, .best_in_place_name input {
|
||||
height: 15px;
|
||||
padding: 5px 0;
|
||||
width: 100%;
|
||||
|
|
|
@ -26,5 +26,19 @@ class UsersController < ApplicationController
|
|||
respond_with(@user, location: session[:previous_url]) do |format|
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /user/updatemetacodes
|
||||
def updatemetacodes
|
||||
@user = current_user
|
||||
|
||||
@m = params[:metacodes][:value]
|
||||
@user.settings.metacodes=@m.split(',')
|
||||
|
||||
@user.save
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: @user }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<h3 class="accountHeader">Hello <%= account.name.split[0...1][0] %>!</h3>
|
||||
<ul>
|
||||
<li class="accountIcon accountMaps"><a href="/maps/mappers/<%= account.id %>">My Maps</a></li>
|
||||
<li class="accountIcon accountSettings"><%= link_to "Settings", edit_user_url(account) %></li>
|
||||
<li class="accountIcon accountSettings"><%= link_to "Account", edit_user_url(account) %></li>
|
||||
<% if account.admin %>
|
||||
<li class="accountIcon accountSettings"><%= link_to "Admin", metacodes_path %></li>
|
||||
<% end %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<div id="lightbox_overlay">
|
||||
<div id="lightbox_main">
|
||||
<a id="lightbox_close" onclick="cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" href="#"></a>
|
||||
<a id="lightbox_close" onclick="cancelMetacodeSetSwitch();cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" href="#"></a>
|
||||
<div id="lightbox_content">
|
||||
|
||||
<div class="lightboxContent" id="about">
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
<div class="lightboxContent" id="cheatsheet">
|
||||
<%= render :partial => 'layouts/cheatsheet' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if authenticated? %>
|
||||
<div class="lightboxContent" id="invite">
|
||||
|
@ -58,11 +58,15 @@
|
|||
<div class="lightboxContent" id="forkmap">
|
||||
<%= render :partial => 'maps/fork' %>
|
||||
</div>
|
||||
|
||||
<div class="lightboxContent" id="switchMetacodes">
|
||||
<%= render :partial => 'layouts/switchmetacodes' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="lightbox_screen" onclick="cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" style="height: 100%;"></div>
|
||||
<div id="lightbox_screen" onclick="cancelMetacodeSetSwitch();cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" style="height: 100%;"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
<%#
|
||||
# @file
|
||||
# templates for the upper right autocomplete results
|
||||
#%>
|
||||
|
||||
<div class="templates">
|
||||
|
||||
<script type="text/template" class="topicTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<div class="topicMetacode">
|
||||
<img src="{{typeImageURL}}" class="topicIcon" />
|
||||
<span class="metacodeTip">{{type}}</span>
|
||||
</div>
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
<p class="resultDesc">{{description}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
|
||||
<% if controller_name == 'maps' && action_name == 'show' && authenticated? && @map.authorize_to_edit(@current) %>
|
||||
<button class="addToMap hoverForTip" onclick="return keepFromCommons(event, {{id}})">
|
||||
<span class="tip">add to map</span>
|
||||
</button>
|
||||
<% end %>
|
||||
<a href="/topics/{{id}}" target="_blank" class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</a>
|
||||
<div class="mapCount hoverForTip">
|
||||
<span class="tip">appears on this # of maps</span>
|
||||
{{mapCount}}
|
||||
</div>
|
||||
<div class="synapseCount hoverForTip">
|
||||
<span class="tip"> has this # of synapses</span>
|
||||
{{synapseCount}}
|
||||
</div>
|
||||
<div class="topicOriginatorIcon hoverForTip">
|
||||
<span class="tip topicOriginator">created by {{originator}}</span>
|
||||
</div>
|
||||
<div class="topicPermission {{permission}} hoverForTip">
|
||||
<span class="tip">topic is {{permission}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" class="mapTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<img class="icon" src="/assets/map.png">
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
<p class="resultDesc">{{description}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
<a href="/maps/{{id}}" target="_blank" class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</a>
|
||||
<div class="topicCount hoverForTip">
|
||||
<span class="tip">has this # of topics</span>
|
||||
{{topicCount}}
|
||||
</div>
|
||||
<div class="synapseCount hoverForTip">
|
||||
<span class="tip">has this # of synapses</span>
|
||||
{{synapseCount}}
|
||||
</div>
|
||||
<div class="mapContributorsIcon hoverForTip">
|
||||
<span class="tip mapContributors">{{contributorList}}</span>
|
||||
{{contributorCount}}
|
||||
</div>
|
||||
<div class="mapPermission {{permission}} hoverForTip">
|
||||
<span class="tip">map is {{permission}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" class="mapperTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<img class="icon" width="28" height="28" src="/assets/MMCCicon_mapper.png">
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
<a href="/maps/mappers/{{id}}" target="_blank" class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</a>
|
||||
<div class="mapCount hoverForTip">
|
||||
<span class="tip">created this # of maps</span>
|
||||
{{mapCount}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" class="synapseTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<p class="autocompleteSection synapseDesc">{{label}}</p>
|
||||
<div class="autocompleteSection synapsePermission {{permission}}"></div>
|
||||
<div class="autocompleteSection synapseOriginatorIcon hoverForTip">
|
||||
<span class="tip synapseOriginator">{{originator}}</span>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
</div>
|
69
app/views/layouts/_switchmetacodes.html.erb
Normal file
|
@ -0,0 +1,69 @@
|
|||
<%#
|
||||
# @file
|
||||
# The inner HTML for switching your metacode set
|
||||
#%>
|
||||
|
||||
<% metacodes = current_user.settings.metacodes %>
|
||||
<% selectedSet = metacodes[0].include?("metacodeset") ? metacodes[0].sub("metacodeset-","") : "custom" %>
|
||||
<% allMetacodeSets = MetacodeSet.order("name").all %>
|
||||
<% if selectedSet == "custom"
|
||||
index = allMetacodeSets.length
|
||||
else
|
||||
set = MetacodeSet.find(selectedSet.to_i)
|
||||
index = allMetacodeSets.index(set)
|
||||
end %>
|
||||
<h3>Switch Metacode Set</h3>
|
||||
|
||||
<div id="metacodeSwitchTabs">
|
||||
<ul>
|
||||
<% allMetacodeSets.each do |m| %>
|
||||
<li><a href="#metacodeSwitchTabs<%= m.id %>" data-set-id="<%= m.id %>"><%= m.name %></a></li>
|
||||
<% end %>
|
||||
<li><a href="#metacodeSwitchTabsCustom" data-set-id="custom" id="metacodeSetCustom">Custom</a></li>
|
||||
</ul>
|
||||
<% allMetacodeSets.each_with_index do |m, localindex| %>
|
||||
<div id="metacodeSwitchTabs<%= m.id %>"
|
||||
data-metacodes="<%= m.metacodes.map(&:name).join(',') %>">
|
||||
<p class="setTitle"><%= m.name %></p>
|
||||
<p><%= m.desc %></p>
|
||||
<% @list = '' %>
|
||||
<% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %>
|
||||
<% @list += '<li><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% end %>
|
||||
<div class="metacodeSetList">
|
||||
<ul>
|
||||
<%= @list.html_safe %>
|
||||
</ul>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
<button class="button" onclick="updateMetacodeSet(<%= m.id %>, <%= localindex %>, false);">Switch to Set</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="metacodeSwitchTabsCustom">
|
||||
<p>Pick Your Own Metacodes</p>
|
||||
<% @list = '' %>
|
||||
<% Metacode.order("name").all.each_with_index do |m, index| %>
|
||||
<% if selectedSet == "custom" %>
|
||||
<% mClass = metacodes.index(m.id.to_s) == nil ? "toggledOff" : "" %>
|
||||
<% else %>
|
||||
<% mClass = "toggledOff" %>
|
||||
<% end %>
|
||||
<% @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" class="' + mClass + '"><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% end %>
|
||||
|
||||
<div class="customMetacodeList">
|
||||
<ul>
|
||||
<%= @list.html_safe %>
|
||||
</ul>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
<button class="button" onclick="updateMetacodeSet('custom', <%= allMetacodeSets.length %>, true);">Switch to Custom Set</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfloat"></div>
|
||||
|
||||
<script>
|
||||
MetamapsModel.selectedMetacodeSet = "metacodeset-<%= selectedSet %>";
|
||||
MetamapsModel.selectedMetacodeSetIndex = <%= index %>;
|
||||
</script>
|
157
app/views/layouts/_templates.html.erb
Normal file
|
@ -0,0 +1,157 @@
|
|||
<%#
|
||||
# @file
|
||||
# templates for the upper right autocomplete results
|
||||
#%>
|
||||
|
||||
<div class="templates">
|
||||
|
||||
<script type="text/template" id="topicSearchTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<div class="topicMetacode">
|
||||
<img src="{{typeImageURL}}" class="topicIcon" />
|
||||
<span class="metacodeTip">{{type}}</span>
|
||||
</div>
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
<p class="resultDesc">{{description}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
|
||||
<% if controller_name == 'maps' && action_name == 'show' && authenticated? && @map.authorize_to_edit(@current) %>
|
||||
<button class="addToMap hoverForTip" onclick="return keepFromCommons(event, {{id}})">
|
||||
<span class="tip">add to map</span>
|
||||
</button>
|
||||
<% end %>
|
||||
<div class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</div>
|
||||
<div class="mapCount hoverForTip">
|
||||
<span class="tip">appears on this # of maps</span>
|
||||
{{mapCount}}
|
||||
</div>
|
||||
<div class="synapseCount hoverForTip">
|
||||
<span class="tip"> has this # of synapses</span>
|
||||
{{synapseCount}}
|
||||
</div>
|
||||
<div class="topicOriginatorIcon hoverForTip">
|
||||
<span class="tip topicOriginator">created by {{originator}}</span>
|
||||
</div>
|
||||
<div class="topicPermission {{permission}} hoverForTip">
|
||||
<span class="tip">topic is {{permission}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="mapSearchTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<img class="icon" src="/assets/map.png">
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
<p class="resultDesc">{{description}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
<div class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</div>
|
||||
<div class="topicCount hoverForTip">
|
||||
<span class="tip">has this # of topics</span>
|
||||
{{topicCount}}
|
||||
</div>
|
||||
<div class="synapseCount hoverForTip">
|
||||
<span class="tip">has this # of synapses</span>
|
||||
{{synapseCount}}
|
||||
</div>
|
||||
<div class="mapContributorsIcon hoverForTip">
|
||||
<span class="tip mapContributors">{{contributorList}}</span>
|
||||
{{contributorCount}}
|
||||
</div>
|
||||
<div class="mapPermission {{permission}} hoverForTip">
|
||||
<span class="tip">map is {{permission}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="mapperSearchTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<img class="icon" width="28" height="28" src="/assets/MMCCicon_mapper.png">
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
</div>
|
||||
<div class="autoOptions">
|
||||
<div class="goTo hoverForTip">
|
||||
<span class="tip">open in new tab</span>
|
||||
</div>
|
||||
<div class="mapCount hoverForTip">
|
||||
<span class="tip">created this # of maps</span>
|
||||
{{mapCount}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="synapseAutocompleteTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<p class="autocompleteSection synapseDesc">{{label}}</p>
|
||||
<div class="autocompleteSection synapsePermission {{permission}}"></div>
|
||||
<div class="autocompleteSection synapseOriginatorIcon hoverForTip">
|
||||
<span class="tip synapseOriginator">{{originator}}</span>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="topicAutocompleteTemplate">
|
||||
<img class="autocompleteSection topicType" width="22" height="22" src="{{typeImageURL}}" alt="{{type}}" title="{{type}}" />
|
||||
<p class="autocompleteSection topicTitle">{{label}}</p>
|
||||
<div class="autocompleteSection topicPermission {{permission}}"></div>
|
||||
<div class="autocompleteSection topicOriginatorIcon hoverForTip">
|
||||
<span class="tip topicOriginator">{{originator}}</span>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/template" id="topicCardTemplate">
|
||||
<div class="CardOnGraph" id="topic_{{id}}">
|
||||
<span class="title">
|
||||
<span class="best_in_place best_in_place_name"
|
||||
data-url="/topics/{{id}}"
|
||||
data-object="topic"
|
||||
data-attribute="name"
|
||||
data-type="textarea">{{name}}</span>
|
||||
</span>
|
||||
<div class="links">
|
||||
<div class="linkItem icon">
|
||||
<div class="metacodeTitle">{{metacode}}</div>
|
||||
<div class="metacodeImage" style="background-image:url({{imgsrc}});" title="click and drag to move card"></div>
|
||||
</div>
|
||||
<div class="linkItem contributor hoverForTip">
|
||||
<div class="tip">Created by {{username}} on {{date}}</div>
|
||||
</div>
|
||||
<a href="/maps/topics/{{id}}" class="linkItem mapCount hoverForTip" title="Click to see which maps topic appears on" target="_blank">
|
||||
{{map_count}}
|
||||
</a>
|
||||
<div class="linkItem synapseCount">{{synapse_count}}</div>
|
||||
<div class="linkItem mapPerm {{mk_permission}}"></div>
|
||||
<a href="/topics/{{id}}" class="linkItem topicPopout" title="Open topic in new tab" target="_blank"></a>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
<div class="metacodeSelect">{{{metacode_select}}}</div>
|
||||
<div class="scroll">
|
||||
<div class="desc">
|
||||
<span class="best_in_place best_in_place_desc" data-url="/topics/{{id}}" data-object="topic" data-nil="{{desc_nil}}" data-attribute="desc" data-type="textarea">{{desc}}</span>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="link">
|
||||
{{a_tag}}<span class="best_in_place best_in_place_link" data-url="/topics/{{id}}" data-object="topic" data-nil="{{link_nil}}" data-attribute="link" data-type="input">{{link}}</span>{{close_a_tag}} {{{go_link}}}
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
|
@ -51,7 +51,7 @@
|
|||
<div class="sidebarSearchIcon"></div>
|
||||
<input type="text" class="sidebarSearchField"></input>
|
||||
<div class="clearfloat"></div>
|
||||
<%= render :partial => 'layouts/searchtemplates' %>
|
||||
<%= render :partial => 'layouts/templates' %>
|
||||
</div>
|
||||
<div class="sidebarAccount">
|
||||
<div class="sidebarAccountIcon"></div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<div class="mapCard">
|
||||
<span class="title">
|
||||
<%= best_in_place map, :name, :type => :input, :classes => 'best_in_place_name' %>
|
||||
<%= best_in_place map, :name, :type => :textarea, :classes => 'best_in_place_name' %>
|
||||
</span>
|
||||
<div class="links">
|
||||
<div class="linkItem icon">
|
||||
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div class="scroll">
|
||||
<div class="desc">
|
||||
<%= best_in_place map, :desc, :type => :textarea, :nil => "<span class='gray'>Click to add description.</span>", :classes => 'best_in_place_desc' %>
|
||||
<%= best_in_place map, :desc, :type => :textarea, :nil => "Click to add description.", :classes => 'best_in_place_desc' %>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<% if (authenticated? && @map.authorize_to_edit(user)) || (!authenticated? && @map.desc != "" && @map.desc != nil )%>
|
||||
<div class="mapInfoDesc">
|
||||
<%= best_in_place @map, :desc, :type => :textarea, :nil => "<span class='gray'>Click to add description.</span>", :classes => 'best_in_place_desc' %>
|
||||
<%= best_in_place @map, :desc, :type => :textarea, :nil => "Click to add description.", :classes => 'best_in_place_desc' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -4,11 +4,17 @@
|
|||
#%>
|
||||
<div class="anypage">
|
||||
<%= form_for Topic.new, url: topics_url, remote: true do |form| %>
|
||||
<div class="openMetacodeSwitcher openLightbox" data-open="switchMetacodes"></div>
|
||||
<div id="metacodeImg">
|
||||
<% @m = user.settings.metacodes %>
|
||||
<% @metacodes = [] %>
|
||||
<% @m.each do |m| %>
|
||||
<% @metacodes.push(Metacode.find(m.to_i)) %>
|
||||
<% set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false %>
|
||||
<% if set %>
|
||||
<% @metacodes = set.metacodes %>
|
||||
<% else %>
|
||||
<% @metacodes = [] %>
|
||||
<% @m.each do |m| %>
|
||||
<% @metacodes.push(Metacode.find(m.to_i)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %>
|
||||
<% @metacodes.each do |metacode| %>
|
||||
|
@ -26,5 +32,15 @@
|
|||
<%= form.hidden_field :addSynapse, :value => false %>
|
||||
<div id="metacodeImgTitle"></div>
|
||||
<div class="clearfloat"></div>
|
||||
<script>
|
||||
<% @metacodes.each do |metacode| %>
|
||||
<% if !set %>
|
||||
MetamapsModel.selectedMetacodes.push("<%= metacode.id %>");
|
||||
MetamapsModel.newSelectedMetacodes.push("<%= metacode.id %>");
|
||||
MetamapsModel.selectedMetacodeNames.push("<%= metacode.name %>");
|
||||
MetamapsModel.newSelectedMetacodeNames.push("<%= metacode.name %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -59,247 +59,63 @@
|
|||
<div class="clearfloat"></div>
|
||||
|
||||
<% if authenticated? %>
|
||||
|
||||
<% # add these if you have edit permissions on the map %>
|
||||
<% if @map.permission == "commons" || @map.user == user %>
|
||||
|
||||
<% # for creating and pulling in topics and synapses %>
|
||||
<%= render :partial => 'newtopic' %>
|
||||
<%= render :partial => 'newsynapse' %>
|
||||
<% end %>
|
||||
<%= render :partial => 'main/metacodeoptions' %>
|
||||
|
||||
<% # for saving layouts %>
|
||||
<% if @map.permission == "commons" || @map.user == user %>
|
||||
<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
|
||||
|
||||
<% # for saving the layout of the map %>
|
||||
<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
|
||||
<%= form.hidden_field "coordinates", :value => "" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
function bindFilterHover() {
|
||||
|
||||
var filterIsOpen = false;
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeFilter = function() {
|
||||
lT = setTimeout(function() {
|
||||
if (! sliding1) {
|
||||
sliding1 = true;
|
||||
$('.sidebarFilterIcon').css('background-color','#0F1519');
|
||||
$('.sidebarFilterBox').fadeOut(200, function() {
|
||||
sliding1 = false;
|
||||
filterIsOpen = false;
|
||||
});
|
||||
}
|
||||
},300);
|
||||
}
|
||||
|
||||
var openFilter = function() {
|
||||
clearTimeout(lT);
|
||||
if (! sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// hide the other two
|
||||
$('.sidebarAccountBox').hide();
|
||||
$('.sidebarWandBox').hide();
|
||||
$('.sidebarAccountIcon').css('background-color','#0F1519');
|
||||
$('.sidebarWandIcon').css('background-color','#0F1519');
|
||||
|
||||
$('.sidebarFilterIcon').css('background-color','#000');
|
||||
$('.sidebarFilterBox').fadeIn(200, function() {
|
||||
sliding1 = false;
|
||||
filterIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".sidebarFilter").hover(openFilter, closeFilter);
|
||||
|
||||
} // end bindFilterHover
|
||||
|
||||
function bindInfoHover() {
|
||||
|
||||
var infoIsOpen = false;
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeInfo = function() {
|
||||
lT = setTimeout(function() {
|
||||
if (! sliding1) {
|
||||
sliding1 = true;
|
||||
$('.mapInfoBox').fadeOut(200, function() {
|
||||
sliding1 = false;
|
||||
infoIsOpen = false;
|
||||
});
|
||||
}
|
||||
},300);
|
||||
}
|
||||
|
||||
var openInfo = function(event) {
|
||||
clearTimeout(lT);
|
||||
if (! sliding1 && event.target.className != "openCheatsheet openLightbox") {
|
||||
sliding1 = true;
|
||||
|
||||
$('.mapInfoBox').fadeIn(200, function() {
|
||||
sliding1 = false;
|
||||
infoIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$("div.index").hover(openInfo, closeInfo);
|
||||
|
||||
|
||||
} // end bindInfoHover
|
||||
|
||||
bindFilterHover();
|
||||
bindInfoHover();
|
||||
|
||||
$('.sidebarSave').click(function() {
|
||||
saveLayoutAll();
|
||||
});
|
||||
$('.sidebarFork').click(function() {
|
||||
saveToMap();
|
||||
});
|
||||
|
||||
$(".sidebarCollaborateIcon").click(function(event) {
|
||||
if (!goRealtime) {
|
||||
$('.sidebarCollaborate .tip').html('Stop Realtime Collaboration');
|
||||
} else {
|
||||
$('.sidebarCollaborate .tip').html('Start Realtime Collaboration');
|
||||
}
|
||||
goRealtime = !goRealtime;
|
||||
$(".sidebarCollaborateIcon").toggleClass("blue");
|
||||
});
|
||||
|
||||
// initialize best_in_place editing
|
||||
$('.authenticated div.permission.canEdit .best_in_place').best_in_place();
|
||||
|
||||
<% if @map.user == user %>
|
||||
// ability to change permission
|
||||
var selectingPermission = false;
|
||||
$('.yourMap .mapPermission').click(function() {
|
||||
if (!selectingPermission) {
|
||||
selectingPermission = true;
|
||||
$(this).addClass('minimize'); // this line flips the drop down arrow to a pull up arrow
|
||||
if ( $(this).hasClass('commons') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="public"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('public') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="private"></li></ul>');
|
||||
} else if ( $(this).hasClass('private') ) {
|
||||
$(this).append('<ul class="permissionSelect"><li class="commons"></li><li class="public"></li></ul>');
|
||||
}
|
||||
$('.mapPermission .permissionSelect li').click(function(event) {
|
||||
selectingPermission = false;
|
||||
var permission = $(this).attr('class');
|
||||
updateMapPermission(mapid, permission);
|
||||
event.stopPropagation();
|
||||
});
|
||||
} else {
|
||||
selectingPermission = false;
|
||||
$(this).removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
|
||||
$('.mapPermission .permissionSelect').remove();
|
||||
}
|
||||
});
|
||||
<% end %>
|
||||
|
||||
//bind best_in_place ajax callbacks
|
||||
$('.mapInfoName .best_in_place_name').bind("ajax:success", function() {
|
||||
var name = $(this).html();
|
||||
$('.mapName').html(name);
|
||||
});
|
||||
|
||||
$('.showcard').draggable({ handle: ".metacodeImage" });
|
||||
$('#showcard').resizable({
|
||||
maxHeight: 500,
|
||||
maxWidth: 500,
|
||||
minHeight: 320,
|
||||
minWidth: 226,
|
||||
resize: function( event, ui ) {
|
||||
var p = $('#showcard').find('.scroll');
|
||||
p.height( p.height() ).mCustomScrollbar('update');
|
||||
}
|
||||
}).css({
|
||||
display: 'none',
|
||||
top: '300px',
|
||||
left: '100px'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
var dragged = 0;
|
||||
mapid = <%= @map.id %>;
|
||||
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
|
||||
mapperm = true;
|
||||
|
||||
<% end %>
|
||||
|
||||
viewMode = "graph";
|
||||
json = <%= @mapjson %>;
|
||||
if (json.length > 0) {
|
||||
$(window).load(function() {
|
||||
<% if (@map.arranged) %>
|
||||
initialize("arranged");
|
||||
<% else %>
|
||||
initialize("chaotic");
|
||||
<% end %>
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(window).load(function() {
|
||||
initialize("chaotic", true);
|
||||
});
|
||||
}
|
||||
//window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); // this is for the heroku staging environment
|
||||
//window.realtime.socket = io.connect('http://metamaps.cc:5001'); // this is for metamaps.cc
|
||||
window.realtime.socket = io.connect('http://localhost:5001'); // this is for localhost development
|
||||
|
||||
window.realtime.socket.on('connect', function() {
|
||||
subscribeToRooms();
|
||||
console.log('socket connected');
|
||||
});
|
||||
function subscribeToRooms() {
|
||||
window.realtime.socket.on('maps-' + mapid, function(data) {
|
||||
//as long as you weren't the origin of the changes, update your map
|
||||
if (data.origin != userid && goRealtime) {
|
||||
if (data.resource == 'Topic') {
|
||||
topic = $.parseJSON(data.obj);
|
||||
|
||||
if (data.action == 'create') {
|
||||
window.realtime.addTopicToMap(topic);
|
||||
}
|
||||
else if (data.action == 'update' && Mconsole.graph.getNode(topic.id) != 'undefined') {
|
||||
window.realtime.updateTopicOnMap(topic);
|
||||
}
|
||||
else if (data.action == 'destroy' && Mconsole.graph.getNode(topic.id) != 'undefined') {
|
||||
hideNode(topic.id)
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (data.resource == 'Synapse') {
|
||||
synapse = $.parseJSON(data.obj);
|
||||
|
||||
if (data.action == 'create') {
|
||||
window.realtime.addSynapseToMap(synapse);
|
||||
}
|
||||
else if (data.action == 'update' &&
|
||||
Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
||||
window.realtime.updateSynapseOnMap(synapse);
|
||||
}
|
||||
else if (data.action == 'destroy' &&
|
||||
Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
||||
var edge = Mconsole.graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']);
|
||||
hideEdge(edge);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
<% # for populating the change metacode list on the topic card %>
|
||||
<%= render :partial => 'main/metacodeoptions' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script>
|
||||
var dragged = 0;
|
||||
mapid = <%= @map.id %>;
|
||||
<% if (@map.permission == "commons" && authenticated? ) || @map.user == user %>
|
||||
mapperm = true;
|
||||
<% end %>
|
||||
|
||||
viewMode = "graph";
|
||||
json = <%= @mapjson %>;
|
||||
if (json.length > 0) {
|
||||
$(window).load(function () {
|
||||
<% if (@map.arranged) %>
|
||||
initialize("arranged");
|
||||
<% else %>
|
||||
initialize("chaotic");
|
||||
<% end %>
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$(window).load(function () {
|
||||
initialize("chaotic", true);
|
||||
});
|
||||
}
|
||||
|
||||
<% if authenticated? && (@map.permission == "commons" || @map.user == user) %>
|
||||
// this is for the heroku staging environment
|
||||
//window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
|
||||
|
||||
// this is for metamaps.cc
|
||||
//window.realtime.socket = io.connect('http://metamaps.cc:5001');
|
||||
|
||||
// this is for localhost development
|
||||
window.realtime.socket = io.connect('http://localhost:5001');
|
||||
|
||||
window.realtime.socket.on('connect', function () {
|
||||
console.log('socket connected');
|
||||
window.realtime.setupSocket();
|
||||
});
|
||||
<% end %>
|
||||
|
||||
</script>
|
|
@ -20,7 +20,6 @@ $(document).ready(function() {
|
|||
$('#metacodes_value').val(selectMetacodes.toString());
|
||||
|
||||
$('.editMetacodes li').click(function() {
|
||||
console.log($(this).attr('class'));
|
||||
if ($(this).attr('class') != 'toggledOff') {
|
||||
$(this).addClass('toggledOff');
|
||||
var value_to_remove = $(this).attr('id');
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="index">
|
||||
<div class="openCheatsheet openLightbox" data-open="cheatsheet"></div>
|
||||
<span><img width="35" height="35" src="/assets/<%= @topic.metacode.icon %>"></span>
|
||||
<span><img width="35" height="35" src="<%= @topic.metacode.icon %>"></span>
|
||||
<span class="mapName"><%= @topic.name %></span>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
|
@ -55,76 +55,7 @@
|
|||
<% end %>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
function bindFilterHover() {
|
||||
|
||||
var filterIsOpen = false
|
||||
|
||||
// controls the sliding hover of the bottom left menu
|
||||
var sliding1 = false;
|
||||
var lT;
|
||||
|
||||
var closeFilter = function() {
|
||||
lT = setTimeout(function() {
|
||||
if (! sliding1) {
|
||||
sliding1 = true;
|
||||
$('.sidebarFilterIcon').css('background-color','#0F1519');
|
||||
$('.sidebarFilterBox').fadeOut(200, function() {
|
||||
sliding1 = false;
|
||||
filterIsOpen = false;
|
||||
});
|
||||
}
|
||||
},300);
|
||||
}
|
||||
|
||||
var openFilter = function() {
|
||||
clearTimeout(lT);
|
||||
if (! sliding1) {
|
||||
sliding1 = true;
|
||||
|
||||
// hide the other two
|
||||
$('.sidebarAccountBox').hide();
|
||||
$('.sidebarWandBox').hide();
|
||||
$('.sidebarAccountIcon').css('background-color','#0F1519');
|
||||
$('.sidebarWandIcon').css('background-color','#0F1519');
|
||||
|
||||
$('.sidebarFilterIcon').css('background-color','#000');
|
||||
$('.sidebarFilterBox').fadeIn(200, function() {
|
||||
sliding1 = false;
|
||||
filterIsOpen = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
// bind the hover events
|
||||
$(".sidebarFilter").hover(openFilter, closeFilter);
|
||||
|
||||
} // end bindFilterHover
|
||||
bindFilterHover();
|
||||
|
||||
$('.sidebarFork').click(function() {
|
||||
saveToMap();
|
||||
});
|
||||
|
||||
// initialize best_in_place editing
|
||||
$('.authenticated div.permission.canEdit .best_in_place').best_in_place();
|
||||
|
||||
$('.showcard').draggable({ handle: ".icon" });
|
||||
$('#showcard').resizable({
|
||||
maxHeight: 500,
|
||||
maxWidth: 500,
|
||||
minHeight: 320,
|
||||
minWidth: 226
|
||||
}).css({
|
||||
display: 'none',
|
||||
top: '300px',
|
||||
left: '100px'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
json = <%= @relatives %>;
|
||||
json = <%= @relatives %>;
|
||||
$(window).load(function() {
|
||||
initialize("centered");
|
||||
});
|
||||
|
|
|
@ -41,6 +41,7 @@ ISSAD::Application.routes.draw do
|
|||
devise_scope :user do
|
||||
get "sign_out", :to => "devise/sessions#destroy"
|
||||
end
|
||||
match 'user/updatemetacodes', to: 'users#updatemetacodes', via: :post, as: :updatemetacodes
|
||||
|
||||
resources :users, except: [:show, :index]
|
||||
|
||||
|
|
|
@ -30,14 +30,48 @@ function start() {
|
|||
redis.subscribe('maps');
|
||||
|
||||
io.on('connection', function(socket){
|
||||
|
||||
// this will ping everyone on a map with updates to the map
|
||||
redis.on('message', function(channel, message){
|
||||
console.log(message);
|
||||
var m = JSON.parse(message);
|
||||
var room;
|
||||
room = 'maps-' + m.mapid;
|
||||
var room = 'maps-' + m.mapid;
|
||||
|
||||
socket.emit(room, m);
|
||||
});
|
||||
|
||||
// this will ping a new person with awareness of who's already on the map
|
||||
socket.on('updateNewMapperList', function(data) {
|
||||
var existingUser = { userid: data.userid, username: data.username };
|
||||
socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just joined the map
|
||||
socket.on('newMapperNotify', function (data) {
|
||||
socket.set('mapid', data.mapid);
|
||||
socket.set('userid', data.userid);
|
||||
socket.set('username', data.username);
|
||||
|
||||
var newUser = { userid: data.userid, username: data.username };
|
||||
|
||||
socket.broadcast.emit('maps-' + data.mapid + '-newmapper', newUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just left the map
|
||||
socket.on('disconnect', function () {
|
||||
var socketUserName, socketUserID;
|
||||
socket.get('userid', function (err, id) {
|
||||
socketUserID = id;
|
||||
});
|
||||
socket.get('username', function (err, name) {
|
||||
socketUserName = name;
|
||||
});
|
||||
var data = { username: socketUserName, userid: socketUserID };
|
||||
socket.get('mapid', function (err, mapid) {
|
||||
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|