2020-04-18 12:49:48 +08:00
|
|
|
//=======================================settings
|
|
|
|
currentSettings = {
|
|
|
|
"plink": true,
|
|
|
|
"properties": true,
|
|
|
|
"highlight": true,
|
|
|
|
"move": true
|
|
|
|
};
|
|
|
|
$(document).ready(function () {
|
|
|
|
//read settings and apply it
|
|
|
|
for (var key in currentSettings) {
|
|
|
|
currentSettings[key] = localstorageAssist_Get("ssm-settings-" + key, "true") == "true";
|
|
|
|
if (currentSettings[key]) $("#sidepanel-display-" + key).prop("checked", true);
|
|
|
|
else $("#sidepanel-display-" + key).removeProp("checked");
|
|
|
|
}
|
|
|
|
//additional settings
|
|
|
|
if (!currentSettings["plink"]) {
|
|
|
|
$(".link-elink").hide();
|
|
|
|
$(".link-plink").hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
function settingChange(target) {
|
|
|
|
newValue = $("#sidepanel-display-" + target).prop("checked");
|
|
|
|
currentSettings[target] = newValue;
|
|
|
|
localstorageAssist_Set("ssm-settings-" + target, newValue);
|
|
|
|
|
|
|
|
if (target == "plink") {
|
|
|
|
if (currentSettings["plink"]) {
|
|
|
|
$(".link-elink").show();
|
|
|
|
$(".link-plink").show();
|
|
|
|
} else {
|
|
|
|
$(".link-elink").hide();
|
|
|
|
$(".link-plink").hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function localstorageAssist_Get(index, defaultValue) {
|
|
|
|
var cache = localStorage.getItem(index);
|
|
|
|
if (cache == null) {
|
|
|
|
localstorageAssist_Set(index, defaultValue);
|
|
|
|
return defaultValue;
|
|
|
|
} else return cache;
|
|
|
|
}
|
|
|
|
function localstorageAssist_Set(index, value) {
|
|
|
|
localStorage.setItem(index, value);
|
|
|
|
}
|
2020-04-13 09:46:01 +08:00
|
|
|
|
2020-04-18 12:49:48 +08:00
|
|
|
|
|
|
|
//=======================================internal event
|
|
|
|
previousHighlight = "";
|
2020-04-13 09:46:01 +08:00
|
|
|
function highlightLink(target) {
|
|
|
|
realTarget = ".target" + target
|
|
|
|
|
|
|
|
if (previousHighlight != "") {
|
|
|
|
//need restore
|
2020-04-18 12:49:48 +08:00
|
|
|
$(previousHighlight).each(function () {
|
2020-04-13 09:46:01 +08:00
|
|
|
if ($(this).hasClass("link-blink")) {
|
|
|
|
$(this).attr("stroke", "black")
|
|
|
|
}
|
|
|
|
if ($(this).hasClass("link-blinkDelay")) {
|
|
|
|
$(this).attr("fill", "black")
|
|
|
|
}
|
2020-04-14 23:19:06 +08:00
|
|
|
if ($(this).hasClass("link-plink")) {
|
|
|
|
$(this).attr("stroke", "blue")
|
|
|
|
}
|
|
|
|
if ($(this).hasClass("link-elink")) {
|
|
|
|
$(this).attr("stroke", "cyan")
|
|
|
|
}
|
2020-04-13 09:46:01 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-04-13 15:36:37 +08:00
|
|
|
// double one-click, only cancel highlight and don't apply any hightlight
|
2020-05-02 15:10:08 +08:00
|
|
|
// or user disable hightlight
|
|
|
|
if ((realTarget == previousHighlight) || !currentSettings["highlight"]) {
|
2020-04-13 15:36:37 +08:00
|
|
|
previousHighlight = "";
|
|
|
|
} else {
|
|
|
|
//apply new highlight
|
2020-04-18 12:49:48 +08:00
|
|
|
$(realTarget).each(function () {
|
2020-04-13 15:36:37 +08:00
|
|
|
if ($(this).hasClass("link-blink")) {
|
|
|
|
$(this).attr("stroke", "yellow")
|
|
|
|
}
|
|
|
|
if ($(this).hasClass("link-blinkDelay")) {
|
|
|
|
$(this).attr("fill", "yellow")
|
|
|
|
}
|
2020-04-14 23:19:06 +08:00
|
|
|
if ($(this).hasClass("link-plink")) {
|
|
|
|
$(this).attr("stroke", "orange")
|
|
|
|
}
|
|
|
|
if ($(this).hasClass("link-elink")) {
|
|
|
|
$(this).attr("stroke", "orange")
|
|
|
|
}
|
2020-04-13 15:36:37 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
previousHighlight = realTarget
|
|
|
|
}
|
|
|
|
|
2020-04-13 09:46:01 +08:00
|
|
|
//cancel event seperate
|
|
|
|
event.stopPropagation();
|
|
|
|
}
|
2020-04-13 12:35:41 +08:00
|
|
|
|
2020-08-12 12:06:55 +08:00
|
|
|
// type = 0: call from cell
|
|
|
|
// type = 1: call from bb
|
|
|
|
function queryInfo(type, obj) {
|
2020-05-02 15:10:08 +08:00
|
|
|
// confirm user enable this function
|
|
|
|
if (!currentSettings["properties"])
|
|
|
|
return;
|
|
|
|
|
2020-04-13 12:35:41 +08:00
|
|
|
$.post(window.location,
|
|
|
|
{
|
|
|
|
operation: "info",
|
2020-08-12 12:06:55 +08:00
|
|
|
tag: type,
|
2020-04-13 12:35:41 +08:00
|
|
|
target: obj
|
|
|
|
},
|
2020-04-18 12:49:48 +08:00
|
|
|
function (data, status) {
|
2020-04-13 12:35:41 +08:00
|
|
|
//set data
|
2020-04-17 23:31:27 +08:00
|
|
|
$("#sidepanel-properties-container").empty()
|
2020-04-13 12:35:41 +08:00
|
|
|
for (var key in data) {
|
2020-08-12 12:06:55 +08:00
|
|
|
$("#sidepanel-properties-container").append("<div class=\"propertyItem\"></div>");
|
|
|
|
|
|
|
|
var box = $("#sidepanel-properties-container div:last-child");
|
|
|
|
if (data[key]["is_setting"])
|
|
|
|
$(box).append("<p><code class=\"propertyItem\">S</code><b></b><i></i></p>");
|
|
|
|
else
|
|
|
|
$(box).append("<p><b></b><i></i></p>");
|
|
|
|
|
|
|
|
$(box).find("p b").text(data[key]["name"]);
|
|
|
|
$(box).find("p i").text("(" + key + ")");
|
|
|
|
|
|
|
|
for (var i = 0; i < data[key]['data'].length; i++) {
|
|
|
|
$(box).append("<p></p><pre class=\"propertyItem\"></pre>")
|
|
|
|
$(box).find("p:last-child").text(data[key]['data'][0])
|
|
|
|
$(box).find("pre:last-child").text(data[key]['data'][1])
|
|
|
|
}
|
2020-04-13 12:35:41 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|