From 02d729e98a9445f9109758c0f9d46c9422b560ad Mon Sep 17 00:00:00 2001 From: yujinpan <1192878390@qq.com> Date: Thu, 4 Mar 2021 15:30:37 +0800 Subject: [PATCH] fix: init must be document ready --- scripts/super-image-reptile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/super-image-reptile.js b/scripts/super-image-reptile.js index 85c262f..73cb0a1 100644 --- a/scripts/super-image-reptile.js +++ b/scripts/super-image-reptile.js @@ -55,7 +55,7 @@ advance(); // 初始化 - init(); + document.addEventListener('DOMContentLoaded', init); /** * 初始化 @@ -531,8 +531,8 @@ const canvasContextPrototype = CanvasRenderingContext2D.prototype; canvasContextPrototype.drawImage_ = CanvasRenderingContext2D.prototype.drawImage; canvasContextPrototype.drawImage = function () { - const src = arguments[0].src; - if (src.startsWith('http') && location.origin !== src.slice(0, src.indexOf('/', 8)) && src.crossOrigin === undefined) { + const { src, crossOrigin } = arguments[0]; + if (src.startsWith('http') && location.origin !== src.slice(0, src.indexOf('/', 8)) && !crossOrigin) { console.log('%c 【自动获取图片】站点正在加载无法下载的图片,请自行访问该链接下载:', 'color: orange;', src); return; }