2011-06-24 16:11:32 +00:00
|
|
|
// var R;
|
2011-06-24 15:45:19 +00:00
|
|
|
|
2011-06-24 16:08:29 +00:00
|
|
|
|
2011-06-24 15:45:19 +00:00
|
|
|
$(function() {
|
2011-06-24 20:17:05 +00:00
|
|
|
$(window).resize(function() {
|
|
|
|
var svgAspect = 1220 / 560;
|
|
|
|
var windowWidth = $(window).width();
|
|
|
|
var svgWidth = windowWidth - 20;
|
|
|
|
var svgHeight = parseInt(svgWidth / svgAspect);
|
|
|
|
$('svg').attr("width", svgWidth);
|
|
|
|
$('svg').attr("height", svgHeight);
|
|
|
|
});
|
|
|
|
$(window).resize();
|
2011-06-24 15:45:19 +00:00
|
|
|
$.getJSON("radia.json", {}, function(data) {
|
2011-06-24 16:11:32 +00:00
|
|
|
var R = data;
|
2011-06-24 16:08:29 +00:00
|
|
|
var $texts = [];
|
2011-06-25 21:19:04 +00:00
|
|
|
$('g').each(function() {
|
|
|
|
// console.log("hi");
|
|
|
|
if (typeof($(this).attr("id")) === 'undefined') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(this).click(function() {
|
|
|
|
console.log($(this).attr("id"));
|
|
|
|
});
|
|
|
|
$(this).mouseover(function() {
|
|
|
|
console.log($(this).attr("id"));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2011-06-26 02:26:54 +00:00
|
|
|
|
|
|
|
$('#heartpng').hover(function() {
|
|
|
|
// console.log("HEART damnit");
|
|
|
|
// $('#rajakani').find('line').css({'stroke': '#ff00ff'});
|
|
|
|
$('#loveline').css({'stroke': '#ff00ff'});
|
2011-06-25 23:14:43 +00:00
|
|
|
}, function() {
|
2011-06-26 02:26:54 +00:00
|
|
|
$('#loveline').css({'stroke': '#000000'});
|
2011-06-25 23:14:43 +00:00
|
|
|
});
|
|
|
|
|
2011-06-26 02:26:54 +00:00
|
|
|
// $('#heartpng').click(function() { alert("foo") });
|
2011-06-25 23:14:43 +00:00
|
|
|
|
2011-06-24 15:45:19 +00:00
|
|
|
$('text').each(function() {
|
2011-06-25 20:13:33 +00:00
|
|
|
$(this).css({'cursor': 'pointer'});
|
2011-06-24 15:45:19 +00:00
|
|
|
var $tspan = $(this).children('tspan').eq(0);
|
|
|
|
var key = $.trim($tspan.text());
|
|
|
|
if (R.hasOwnProperty(key)) {
|
|
|
|
thisData = R[key];
|
|
|
|
var $this = $(this);
|
|
|
|
// $this.data("r", thisData);
|
2011-06-26 03:20:09 +00:00
|
|
|
$this.data("key", key);
|
2011-06-24 15:45:19 +00:00
|
|
|
$this.data("name", thisData.name);
|
|
|
|
$this.data("type", thisData.type);
|
|
|
|
$this.data("link", thisData.link);
|
2011-06-26 02:26:54 +00:00
|
|
|
// $this.addClass(thisData.type);
|
2011-06-24 15:45:19 +00:00
|
|
|
$this.tooltip({
|
|
|
|
'delay': 0,
|
|
|
|
'showURL': false,
|
|
|
|
'bodyHandler': function() {
|
2011-06-26 03:20:09 +00:00
|
|
|
var html = "<div class='ttWrapper'>";
|
|
|
|
html += "<div class='tooltipName'>" + $(this).data("name") + "</div>";
|
|
|
|
html += "<div class='padmaPosters'>" + getPostersHTML(PADMA[$(this).data("key")]) + "</div>";
|
|
|
|
html += "</div>";
|
|
|
|
return html;
|
2011-06-24 15:45:19 +00:00
|
|
|
}
|
|
|
|
});
|
2011-06-24 16:08:29 +00:00
|
|
|
$texts.push($this);
|
|
|
|
|
2011-06-25 20:07:37 +00:00
|
|
|
var highlightShadow = '2px 2px 1px #666';
|
|
|
|
var highlightCSS = {
|
|
|
|
'fontWeight': 'bold',
|
|
|
|
'backgroundColor': '#ffff00'
|
|
|
|
}
|
|
|
|
|
|
|
|
var unhighlightCSS = {
|
|
|
|
'fontWeight': 'normal',
|
|
|
|
'backgroundColor': '#ffffff'
|
|
|
|
}
|
|
|
|
|
2011-06-24 15:45:19 +00:00
|
|
|
$this.mouseover(function(e) {
|
2011-06-24 16:08:29 +00:00
|
|
|
var typ = $(this).data("type");
|
|
|
|
for (var i=0; i<$texts.length;i++) {
|
|
|
|
var $t = $texts[i];
|
|
|
|
if ($t.data("type") == typ) {
|
2011-06-25 20:07:37 +00:00
|
|
|
$t.css(highlightCSS);
|
2011-06-24 16:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// $('.' + cls).addClass("highlighted");
|
|
|
|
// console.log($('.' + cls).length);
|
2011-06-24 15:45:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$this.mouseout(function(e) {
|
2011-06-24 16:08:29 +00:00
|
|
|
var typ = $(this).data("type");
|
|
|
|
for (var i=0; i<$texts.length;i++) {
|
|
|
|
var $t = $texts[i];
|
|
|
|
if ($t.data("type") == typ) {
|
2011-06-25 20:07:37 +00:00
|
|
|
$t.css(unhighlightCSS);
|
2011-06-24 16:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// $('.' + cls).removeClass("highlighted");
|
2011-06-24 15:45:19 +00:00
|
|
|
});
|
2011-06-24 16:08:29 +00:00
|
|
|
|
2011-06-24 15:45:19 +00:00
|
|
|
$this.click(function() {
|
2011-06-25 20:07:37 +00:00
|
|
|
window.open($(this).data("link"));
|
|
|
|
// console.log($(this).data("link"));
|
2011-06-24 15:45:19 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2011-06-24 16:08:29 +00:00
|
|
|
|
2011-06-26 03:20:09 +00:00
|
|
|
function getPostersHTML(padma_ids) {
|
|
|
|
var limit = 1;
|
|
|
|
var html = '';
|
|
|
|
for (var i=0; i<padma_ids.length; i++) {
|
|
|
|
if (i>limit) { break; }
|
|
|
|
var posterLink = "http://pad.ma/" + padma_ids[i] + "/poster.png";
|
|
|
|
html += "<img src='" + posterLink + "' />";
|
|
|
|
}
|
|
|
|
return html;
|
|
|
|
}
|