From 59e5664c46fb74ad2bdb8bb847bb40b908763b3e Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 27 Jun 2011 03:55:16 +0530 Subject: [PATCH] ugly hack to implement no tooltips for legend items; commented out console.logs --- radia.js | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/radia.js b/radia.js index 11dad37..6d079cf 100644 --- a/radia.js +++ b/radia.js @@ -21,10 +21,10 @@ $(function() { } $(this).click(function() { - console.log($(this).attr("id")); +// console.log($(this).attr("id")); }); $(this).mouseover(function() { - console.log($(this).attr("id")); +// console.log($(this).attr("id")); }); }); @@ -46,23 +46,32 @@ $(function() { if (R.hasOwnProperty(key)) { thisData = R[key]; var $this = $(this); + if (key == 'Journalists') { + J = $this; + } // $this.data("r", thisData); $this.data("key", key); $this.data("name", thisData.name); $this.data("type", thisData.type); $this.data("link", thisData.link); // $this.addClass(thisData.type); - $this.tooltip({ - 'delay': 0, - 'showURL': false, - 'bodyHandler': function() { - var html = "
"; - html += "
" + $(this).data("name") + "
"; - html += "
" + getPostersHTML(PADMA[$(this).data("key")]) + "
"; - html += "
"; - return html; - } - }); +// console.log($this.data("key")); +// console.log($this.hasTooltip()); + if ($this.hasTooltip()) { + $this.tooltip({ + 'delay': 0, + 'showURL': false, + 'bodyHandler': function() { + var html = "
"; + html += "
" + $(this).data("name") + "
"; + html += "
" + getPostersHTML(PADMA[$(this).data("key")]) + "
"; + html += "
"; + return html; + } + }); + } else { +// console.log(key); + } $texts.push($this); var highlightShadow = '2px 2px 1px #666'; @@ -78,6 +87,7 @@ $(function() { $this.mouseover(function(e) { var typ = $(this).data("type"); + if (typ === "") { return } for (var i=0; i<$texts.length;i++) { var $t = $texts[i]; if ($t.data("type") == typ) { @@ -90,6 +100,7 @@ $(function() { $this.mouseout(function(e) { var typ = $(this).data("type"); + if (typ === '') { return; } for (var i=0; i<$texts.length;i++) { var $t = $texts[i]; if ($t.data("type") == typ) { @@ -121,3 +132,19 @@ function getPostersHTML(padma_ids) { } return html; } + +//silly hack to implement no tooltips for legend - but can also be extended to disable tooltips for some items. +jQuery.fn.hasTooltip = function() { + if (typeof(this.data("key")) == 'undefined') { + return false; + } +// console.log(parseInt(this.attr("x"))); + if (parseInt(this.attr("x")) > 1200) { + if ($.inArray(this.data("key"), ["Journalists", "Corporates", "Vaishnavi", "Politicians", "Issues", "Mention of,"]) != -1) { + return false; + } else { + return true; + } + } + return true; +}