Skip to content

Commit

Permalink
fix: init must be document ready
Browse files Browse the repository at this point in the history
  • Loading branch information
yujinpan committed Mar 4, 2021
1 parent f1645fb commit 02d729e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/super-image-reptile.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
advance();

// 初始化
init();
document.addEventListener('DOMContentLoaded', init);

/**
* 初始化
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 02d729e

Please sign in to comment.