SuperScriptMaterializer/SuperScriptViewer/static/site.js

62 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-04-13 09:46:01 +08:00
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")
}
});
}
2020-04-13 15:36:37 +08:00
// 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")
}
});
previousHighlight = realTarget
}
2020-04-13 09:46:01 +08:00
//cancel event seperate
event.stopPropagation();
}
2020-04-13 12:35:41 +08:00
function queryInfo(obj) {
$.post(window.location,
{
operation: "info",
target: obj
},
function(data, status) {
//set id
$("#propertyWindow-id").text(obj);
//set data
$("#propertyWindow-container").empty()
for (var key in data) {
$("#propertyWindow-container").append("<p><b>" + key + ":</b><br />" + data[key] +"</p>")
}
$("#propertyWindow-main").show();
});
}
function closePropertyWindow() {
$("#propertyWindow-main").hide();
}