filesbox/web/dist/photopea/code/gaoding-extend.js
2024-07-26 14:10:54 +08:00

2 lines
784 B
JavaScript

(function(){if(window.top===window)return;var i=[function(e){return/另存为|导出|存檔為|轉存為/g.test(e)},function(e){return["png","jpg","svg","gif","pdf","emf","webp","bmp","ppm","tiff","ico","dds"].some(function(n){return e.indexOf(n)!==-1})}];function t(e){var n=e.target,o=document.querySelector(".cmanager"),a=n.innerHTML;if(!(window.__GAODING_USER_LOGIN||!o||!o.contains(n))){var s=i.some(function(u){return u(a.toLocaleLowerCase())});s&&(e.preventDefault(),e.stopPropagation(),window.top.postMessage("login","*"))}}document.body.addEventListener("click",t,!0);function r({data:e}){e==="user-init"&&(window.__GAODING_USER_LOGIN=!0,document.body.removeEventListener("click",t,!0),window.removeEventListener("message",r,!1))}window.addEventListener("message",r,!1)})();