guide.js 999 B

1234567891011121314151617181920212223242526272829303132
  1. function guide_init() {
  2. $("guide").each(function () {
  3. if ($(this).offset().left < $(document.body).width() / 2) {
  4. $(this).append('<div class="guide_contence" style="left: 0;"></div>');
  5. }
  6. else {
  7. $(this).append('<div class="guide_contence" style="right: 0;"></div>');
  8. }
  9. });
  10. $("guide").mouseenter(function () {
  11. if ($(this).children(".guide_contence").first().html().length > 0) {
  12. return;
  13. }
  14. let gid = $(this).attr("gid");
  15. let guideObj = $(this);
  16. $.get("../guide/get.php",
  17. {
  18. id: gid
  19. },
  20. function (data, status) {
  21. try {
  22. let jsonGuide = JSON.parse(data);
  23. $("guide[gid='" + jsonGuide.id + "']").find(".guide_contence").html(marked(jsonGuide.data));
  24. }
  25. catch (e) {
  26. console.error(e);
  27. }
  28. });
  29. });
  30. }