UNPKG

go-blank-npm

Version:

20 lines (18 loc) 1.44 kB
(function(e,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e.GoBlank={},e.axios))})(this,function(e,o){"use strict";const c="https://go-blank.vercel.app/api/website";let n=null,t=null;const d=async()=>{try{const i=window.location.href,f=window.location.hostname,l=(await o.get(c,{headers:{"Content-Type":"application/json"}})).data.find(a=>a.url===i||a.url.includes(f)||i.includes(a.url));s(),l&&l.status==="active"&&r()}catch(i){console.error("Website status check failed:",i)}},r=()=>{n||(n=document.createElement("style"),n.innerHTML=` .website-blanker-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white; z-index: 2147483647; /* Maximum z-index */ opacity: 0; animation: fadeIn 5s forwards; pointer-events: none; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } `,document.head.appendChild(n)),t||(t=document.createElement("div"),t.className="website-blanker-overlay",document.body.appendChild(t))},s=()=>{n&&(document.head.removeChild(n),n=null),t&&(document.body.removeChild(t),t=null)},u=()=>{s()};e.cleanupWebsiteBlanker=u,e.initWebsiteBlanker=d,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});