🐛 Fix the issue of address redirection opening a new window.

This commit is contained in:
Tw93
2023-08-18 21:22:37 +08:00
parent 078fab3fc7
commit b2bfabb6dc

View File

@@ -59,7 +59,7 @@ function externalTargetLink() {
} }
function externalSelfLink() { function externalSelfLink() {
return ['twitter.com', 'www.zhihu.com'].indexOf(location.hostname) > -1; return ['chat.openai.com'].indexOf(location.hostname) > -1;
} }
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
@@ -170,7 +170,7 @@ document.addEventListener('DOMContentLoaded', () => {
// case: download from dataURL -> convert dataURL -> // case: download from dataURL -> convert dataURL ->
} else if (url.startsWith('data:')) { } else if (url.startsWith('data:')) {
downloadFromDataUri(url, filename); downloadFromDataUri(url, filename);
} else if (!externalSelfLink()) { } else if (isDownloadLink(url) || externalSelfLink()) {
handleExternalLink(e, url); handleExternalLink(e, url);
} }
}, true); }, true);