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() {
|
|
|
|
$.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-24 15:45:19 +00:00
|
|
|
$('text').each(function() {
|
|
|
|
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);
|
|
|
|
$this.data("name", thisData.name);
|
|
|
|
$this.data("type", thisData.type);
|
|
|
|
$this.data("link", thisData.link);
|
2011-06-24 16:08:29 +00:00
|
|
|
$this.addClass(thisData.type);
|
2011-06-24 15:45:19 +00:00
|
|
|
$this.tooltip({
|
|
|
|
'delay': 0,
|
|
|
|
'showURL': false,
|
|
|
|
'bodyHandler': function() {
|
|
|
|
return $(this).data("name");
|
|
|
|
}
|
|
|
|
});
|
2011-06-24 16:08:29 +00:00
|
|
|
$texts.push($this);
|
|
|
|
|
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) {
|
|
|
|
$t.css({'fontWeight': 'bold'});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// $('.' + 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) {
|
|
|
|
$t.css({'fontWeight': 'normal'});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// $('.' + 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() {
|
|
|
|
console.log($(this).data("link"));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2011-06-24 16:08:29 +00:00
|
|
|
|