Last active
November 21, 2023 00:50
-
-
Save Juandresyn/b6e2d0106d87279e681bd54c5089e758 to your computer and use it in GitHub Desktop.
electric-confetti-protection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const name = 'ele' + 'ctr' + 'ic' + 'con' + 'fet' + 'ti'; | |
const allowedDomains = [ | |
`${name}.co${'m'}`, | |
'shopify', | |
'myshopify', | |
'127.0.0.1', | |
'localhost', | |
'klarna' | |
]; | |
const ProtectMsg = 'This Site is not allowed to be used on this domain. Please use the following domain: ' | |
if ( | |
window.location.hostname && | |
!allowedDomains.some((domain) => window.location.hostname.includes(domain)) | |
) { | |
alert(`${ProtectMsg} ${name}.com`); | |
document.querySelector( | |
'body', | |
).innerHTML = `<div style='position:relative; padding-bottom:calc(42.40% + 44px)'><iframe src="https://giphy.com/embed/SbN0WomN4S7Z7tpKOC" width="480" height="400" frameBorder="0" class="giphy-embed" allowFullScreen></iframe> | |
<h1>${ProtectMsg} <a href="https://${name}.com">${name}.com</a></h1>`; | |
const e = document.querySelector('head'); | |
e.parentElement.removeChild(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment