previousHighlight = ""; function highlightLink(target) { realTarget = ".target" + target if (previousHighlight != "") { //need restore $(previousHighlight).each(function() { if ($(this).hasClass("link-blink")) { $(this).attr("stroke", "black") } if ($(this).hasClass("link-blinkDelay")) { $(this).attr("fill", "black") } if ($(this).hasClass("link-plink")) { $(this).attr("stroke", "blue") } if ($(this).hasClass("link-elink")) { $(this).attr("stroke", "cyan") } }); } // double one-click, only cancel highlight and don't apply any hightlight if (realTarget == previousHighlight) { previousHighlight = ""; } else { //apply new highlight $(realTarget).each(function() { if ($(this).hasClass("link-blink")) { $(this).attr("stroke", "yellow") } if ($(this).hasClass("link-blinkDelay")) { $(this).attr("fill", "yellow") } if ($(this).hasClass("link-plink")) { $(this).attr("stroke", "orange") } if ($(this).hasClass("link-elink")) { $(this).attr("stroke", "orange") } }); previousHighlight = realTarget } //cancel event seperate event.stopPropagation(); } function queryInfo(obj) { $.post(window.location, { operation: "info", target: obj }, function(data, status) { //set id $("#sidepanel-properties-id").text(obj); //set data $("#sidepanel-properties-container").empty() for (var key in data) { $("#sidepanel-properties-container").append("
" + key + ":
" + data[key] +"") } }); } function sidePanelSwitcher(target) { // 0->property; 1->display; 2->tools //disable all $("#sidepanel-properties").hide(); $("#sidepanel-display").hide(); $("#sidepanel-tools").hide(); $(".tabitem").each(function() { $(this).removeClass("tabitem-activated").addClass("tabitem-deactivated"); }); switch (target) { case 0: $("#sidepanel-properties").show(); $(".tabitem1").each(function() { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; case 1: $("#sidepanel-display").show(); $(".tabitem2").each(function() { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; case 2: $("#sidepanel-tools").show(); $(".tabitem3").each(function() { $(this).removeClass("tabitem-deactivated").addClass("tabitem-activated"); }); break; } }