popup_note.js 644 B

12345678910111213141516171819
  1. function popup_init() {
  2. $("code:not([class])").each(function () {
  3. if ($(this).attr("init") != "1") {
  4. if ($(this).text().length == 0) {
  5. return;
  6. }
  7. const noteText = $(this).html();
  8. $(this).html("");
  9. if ($(this).offset().left < $(document.body).width() / 2) {
  10. $(this).append('<div class="popup_contence" style="left: -15px;">' + marked(noteText) + "</div>");
  11. $(".popup_contence:after").css("left", "0");
  12. } else {
  13. $(this).append('<div class="popup_contence" style="right: -15px;">' + marked(noteText) + "</div>");
  14. $(".popup_contence:after").css("right", "0");
  15. }
  16. $(this).attr("init", "1");
  17. }
  18. });
  19. }