|
1 | 1 | <!doctype html> |
2 | 2 |
|
3 | 3 | <html> |
4 | | -<markdown-html version="1.18.3" author="PJ568" repo="https://github.com/PJ-568/markdown.html" |
| 4 | +<markdown-html version="1.18.4" author="PJ568" repo="https://github.com/PJ-568/markdown.html" |
5 | 5 | license="CC BY-SA 4.0 International"></markdown-html> |
6 | 6 |
|
7 | 7 | <head> |
|
667 | 667 | }); |
668 | 668 | //// 点击事件委托 |
669 | 669 | document.addEventListener('click', function (event) { |
670 | | - const imgOrSvg = event.target.closest('.content img, .content svg'); |
671 | | - if (imgOrSvg) { |
672 | | - const url = imgOrSvg.getAttribute('src') || imgOrSvg.getAttribute('xlink:href'); |
673 | | - if (url) { |
674 | | - window.open(url, '_blank'); |
675 | | - event.preventDefault(); |
676 | | - } else { |
677 | | - const newWindow = window.open('', '_blank'); |
678 | | - newWindow.document.write(imgOrSvg.outerHTML); |
679 | | - newWindow.document.close(); |
680 | | - event.preventDefault(); |
681 | | - } |
682 | | - return; |
683 | | - } |
684 | 670 | if (event.target.closest('.back-btn')) { |
685 | 671 | window.history.back(); |
686 | 672 | } else if (event.target.closest('.refresh-btn')) { |
|
711 | 697 | window.open(href, '_blank'); |
712 | 698 | event.preventDefault(); |
713 | 699 | } |
| 700 | + } else if (event.target.closest('.content img, .content svg')) { |
| 701 | + const url = event.target.getAttribute('src') || event.target.getAttribute('xlink:href'); |
| 702 | + if (url) { |
| 703 | + window.open(url, '_blank'); |
| 704 | + event.preventDefault(); |
| 705 | + } else { |
| 706 | + const newWindow = window.open('', '_blank'); |
| 707 | + newWindow.document.write(imgOrSvg.outerHTML); |
| 708 | + newWindow.document.close(); |
| 709 | + event.preventDefault(); |
| 710 | + } |
714 | 711 | } |
715 | 712 | }); |
716 | 713 | //// 文档内容加载完毕时触发 |
|
0 commit comments