|
|
@@ -153,6 +153,41 @@ function note_lookup_guid_json(guid, showto) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+function term_load_preview(guid, showto) {
|
|
|
+ $.get(
|
|
|
+ "../term/term.php",
|
|
|
+ {
|
|
|
+ op: "load_id",
|
|
|
+ id: guid,
|
|
|
+ format: "json",
|
|
|
+ },
|
|
|
+ function (data, status) {
|
|
|
+ let html = "";
|
|
|
+ if (status == "success") {
|
|
|
+ try {
|
|
|
+ let result = JSON.parse(data)[0];
|
|
|
+ html = "<div class='term_block'>";
|
|
|
+
|
|
|
+ html += "<h2>" + result.word + "</h2>";
|
|
|
+ html += "<div class='meaning'>" + result.meaning + "</div>";
|
|
|
+ html +=
|
|
|
+ "<div class='term_note' status='1'>" +
|
|
|
+ note_init(result.note) +
|
|
|
+ "</div>";
|
|
|
+ html +=
|
|
|
+ "<div ><a href='../wiki/wiki.php?word=" +
|
|
|
+ result.word +
|
|
|
+ "' target='_blank'>更多</a></div>";
|
|
|
+ html += "</div>";
|
|
|
+ $("#" + showto).html(html);
|
|
|
+ } catch (e) {
|
|
|
+ console.error("note_lookup_guid_json:" + e + " data:" + data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
var term_get_word_to_div_callback = null;
|
|
|
function term_get_word_to_div(strWord, div, callback) {
|
|
|
term_get_word_to_div_callback = callback;
|
|
|
@@ -569,6 +604,10 @@ function term_updata_translation() {
|
|
|
"[",
|
|
|
"<span class='" +
|
|
|
linkclass +
|
|
|
+ "' id='term_link_" +
|
|
|
+ guid +
|
|
|
+ "' gid='" +
|
|
|
+ guid +
|
|
|
"' onclick=\"" +
|
|
|
str_term_fun_word_link +
|
|
|
"('" +
|
|
|
@@ -621,6 +660,7 @@ function term_updata_translation() {
|
|
|
$(this).html(noteText);
|
|
|
}
|
|
|
});
|
|
|
+ term_popup_init();
|
|
|
}
|
|
|
|
|
|
function term_show_win(guid, keyWord = "") {
|
|
|
@@ -773,3 +813,40 @@ function term_get_dict() {
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+function term_popup_init() {
|
|
|
+ $(".term_link").each(function () {
|
|
|
+ if ($(this).attr("init") != "1") {
|
|
|
+ if ($(this).text().length > 0) {
|
|
|
+ $(this).css("background", "unset");
|
|
|
+ }
|
|
|
+ let gid = $(this).attr("gid");
|
|
|
+ if ($(this).offset().left < $(document.body).width() / 2) {
|
|
|
+ //出现在左侧
|
|
|
+ $(this).append(
|
|
|
+ '<div id="gid_' +
|
|
|
+ gid +
|
|
|
+ '" class="guide_contence" style="left: -5px;"></div>'
|
|
|
+ );
|
|
|
+ $(".guide_contence:after").css("left", "0");
|
|
|
+ } else {
|
|
|
+ //出现在右侧
|
|
|
+ $(this).append(
|
|
|
+ '<div id="gid_' +
|
|
|
+ gid +
|
|
|
+ '" class="guide_contence" style="right: -5px;"></div>'
|
|
|
+ );
|
|
|
+ $(".guide_contence:after").css("right", "0");
|
|
|
+ }
|
|
|
+ $(this).attr("init", "1");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $(".term_link").mouseenter(function () {
|
|
|
+ if ($(this).children(".guide_contence").first().html().length > 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let gid = $(this).attr("gid");
|
|
|
+ term_load_preview(gid, "gid_" + gid);
|
|
|
+ });
|
|
|
+}
|