term_popup.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. function term_popup_init() {
  2. $(".term_link").each(function () {
  3. if ($(this).attr("init") != "1") {
  4. if ($(this).text().length > 0) {
  5. $(this).css("background", "unset");
  6. }
  7. let gid = $(this).attr("gid");
  8. if ($(this).offset().left < $(document.body).width() / 2) {
  9. //出现在左侧
  10. $(this).append(
  11. '<div id="gid_' +
  12. gid +
  13. '" class="guide_contence" style="left: -5px;"></div>'
  14. );
  15. $(".guide_contence:after").css("left", "0");
  16. } else {
  17. //出现在右侧
  18. $(this).append(
  19. '<div id="gid_' +
  20. gid +
  21. '" class="guide_contence" style="right: -5px;"></div>'
  22. );
  23. $(".guide_contence:after").css("right", "0");
  24. }
  25. $(this).attr("init", "1");
  26. }
  27. });
  28. $(".term_link").mouseenter(function () {
  29. if ($(this).children(".guide_contence").first().html().length > 0) {
  30. return;
  31. }
  32. let gid = $(this).attr("gid");
  33. let id = "gid_" + gid;
  34. note_lookup_guid_json(gid, id);
  35. });
  36. }