From 3e4368c0f470ae7159160adff41c6d87e607f151 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 21 Feb 2013 19:59:59 -0500 Subject: [PATCH] This commit did three things: 1) Make Seek case insensitive for topic name search 2) Changed indentation in find.js 3) Removed some commented code in onCanvasSearch - if you want to recover it, it's in this commit --- app/assets/javascripts/Jit/find.js | 87 ++++++++++++------------------ 1 file changed, 34 insertions(+), 53 deletions(-) diff --git a/app/assets/javascripts/Jit/find.js b/app/assets/javascripts/Jit/find.js index 01cbb242..1b4dfef4 100644 --- a/app/assets/javascripts/Jit/find.js +++ b/app/assets/javascripts/Jit/find.js @@ -75,20 +75,12 @@ function showCategory(category, duration) { }); } - - - // Define the Find/Filters possibilities - var findTopics = ['name','metacode', 'mapper (by name)', 'map (by name)'] var findSynapses = ['topics (by name)', 'directionality', 'mapper (by name)', 'map (by name)'] var findMaps = ['name', 'topic (by name)', 'mapper (by name)', 'synapse (by topics)'] var findMappers = ['name', 'topic (by name)', 'map (by name)', 'synapse (by topics)'] - - - - // These functions toggle ALL nodes and synapses on the page function hideAll(duration) { if (duration == null) duration = 500; @@ -121,47 +113,38 @@ function showAll(duration) { }); } - - - /// Traverse the Graph and only show the searched for nodes - -function onCanvasSearch(name,mapID,mapperID) { - - Mconsole.graph.eachNode( function (n) { - if (name != null) { - if (n.name.indexOf(name) !== -1 && name != "") { - n.setData('onCanvas', true); - //$('.name.topic_' + n.id).css('display','block'); - } - else { - n.setData('onCanvas', false); - //$('.name.topic_' + n.id).css('display','none'); - } - } - else if (mapID != null) { - if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) { - n.setData('onCanvas', true); - //$('.name.topic_' + n.id).css('display','block'); - } - else { - n.setData('onCanvas', false); - //$('.name.topic_' + n.id).css('display','none'); - } - } - else if (mapperID != null) { - if (n.getData('userid').toString() == mapperID) { - n.setData('onCanvas', true); - //$('.name.topic_' + n.id).css('display','block'); - } - else { - n.setData('onCanvas', false); - //$('.name.topic_' + n.id).css('display','none'); - } - } - Mconsole.plot(); - }); -} +function onCanvasSearch(searchQuery, mapID, mapperID) { + searchQuery = name.toLowerCase(); + Mconsole.graph.eachNode(function (n) { + nodeName = n.name.toLowerCase(); + if (name != null) { + if (nodeName.indexOf(searchQuery) !== -1 && searchQuery != "") { + n.setData('onCanvas', true); + } + else { + n.setData('onCanvas', false); + } + } + else if (mapID != null) { + if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) { + n.setData('onCanvas', true); + } + else { + n.setData('onCanvas', false); + } + } + else if (mapperID != null) { + if (n.getData('userid').toString() == mapperID) { + n.setData('onCanvas', true); + } + else { + n.setData('onCanvas', false); + } + } + Mconsole.plot(); + }); +}//onCanvasSearch function clearCanvas() { Mconsole.graph.eachNode(function(n) { @@ -201,13 +184,11 @@ function clearFoundData() { -//// -//// -//// -//// Define all the dynamic interactions for the FIND/FILTER using Jquery +/** + * Define all the dynamic interactions for the FIND/FILTER using Jquery + */ $(document).ready(function() { - // this sets up the initial opening of the find box $('#sideOptionFind').bind('click',function(){ if (!findOpen) openFind();