Skip to content

Instantly share code, notes, and snippets.

@therealbenpai
Last active April 30, 2022 18:14
Show Gist options
  • Save therealbenpai/5f4ffc921df9d45887d618519c553682 to your computer and use it in GitHub Desktop.
Save therealbenpai/5f4ffc921df9d45887d618519c553682 to your computer and use it in GitHub Desktop.
Matrix
function x() {
const letter = String.fromCharCode(Math.floor(Math.random() * 26) + 65);
const element = document.createElement('p');
element.style.left = `${Math.random() * 100}%`;
element.style.top = `${Math.random() * 100}%`;
element.innerText = letter;
document.body.insertAdjacentElement('beforeend', element);
}
function meta() {
try {
const head = document.getElementsByTagName('head')[0];
const meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = "user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height";
head.insertAdjacentElement('afterbegin', meta);
} catch (e) {
alert(`Error Thrown: ${e}`);
console.error(`Error Thrown: ${e}`);
}
}
function styles() {
try {
const head = document.getElementsByTagName('head')[0];
const cStyle = document.createElement('style');
cStyle.innerHTML = `html {
max-width: 100vw;
max-height: 100vh;
min-width: 100vw;
min-height: 100vh;
width: 100vw;
height: 100vh;
background: linear-gradient(180deg, #002000 10%, black);
}
body {
overflow: hidden;
cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAALhJREFUKFMtzzErhAEcgPHf33xyAxaD1WyUG0hZFOU2Fpard5Muow8gUhbKJiNZxCBnMblvYaEknXSpt/vrzT3z01NPJMerTB3SrKNGvhETZI35OOB0h9YK5/fs4RPFIs07FqJkUNA9YwT7wa1/5pLn+CLrtJIHnKCH7aC/xGN8kOOs4zoZwxVGsbxGJ5Lc5fKIzWFacvFNI5gOTP7wPsPWK09Dqf1L0aOshIrZPt1qr8QAG3ReuPkDpak4nkwqaeUAAAAASUVORK5CYII=), not-allowed;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
p {
font-size: 12px;
position: absolute;
display: block;
color: rgb(0, 150, 0);
}`;
head.insertAdjacentElement('afterbegin', cStyle);
} catch (e) {
alert(`Error Thrown: ${e}`);
console.error(`Error Thrown: ${e}`);
}
}
async function setup() {
document.write('<h1>&#8203;</h1>');
document.title = 'Matrix Area';
meta();
styles();
}
// try {
// document.oncontextmenu = async function (e) {
// document.body.requestFullscreen();
// e.preventDefault();
// console.log('No Right-Clicking');
// const nw = await window.open('https://google.com','_blank','width:100,height:100')
// nw.document.onload = function(e) {
// this.setup()
// setInterval(e => this.x(),10)
// }
// };
// document.onkeydown = async function (e) {
// document.body.requestFullscreen();
// if (e.ctrlKey && e.keyCode == '168') return;
// if (e.keyCode != '27' && e.keyCode != '168') e.preventDefault();
// const nw = await window.open('https://google.com','_blank','width:100,height:100')
// nw.document.onload = function(e) {
// this.setup()
// setInterval(e => this.x(),10)
// }
// };
// document.onscroll = async function (e) {
// document.body.requestFullscreen();
// const nw = await window.open('https://google.com','_blank','width:100,height:100')
// nw.document.onload = function(e) {
// this.setup()
// setInterval(e => this.x(),10)
// }
// e.preventDefault();
// };
// document.onclose = async function (e) {
// e.preventDefault();
// const nw = await window.open('https://google.com','_blank','width:100,height:100')
// nw.document.onload = function(e) {
// this.setup()
// setInterval(e => this.x(),10)
// }
// }
// } catch (e) {
// alert(`Error Thrown: ${e}`);
// console.error(`Error Thrown: ${e}`);
// };
// const ver = window.confirm(
// "When you run this script, this script will clear the current site content. By pressing OK, you understand that may lag your computer. Press OK to continue, or press Cancel to stop"
// )
//if (ver == true) {
setup();
const int = setInterval(e => x(), 10);
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment