Created
October 27, 2011 19:36
-
-
Save cowboy/1320618 to your computer and use it in GitHub Desktop.
Wow, I remember making this.. back in 2001? Like my Britney Spears reference on line 25?
This file contains hidden or 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
| var isIE = document.all?true:false; | |
| var isNS4 = document.layers?true:false; | |
| var isNS6 = (document.getElementById&&!document.all)?true:false; | |
| if (isNS4) document.onkeydown = getKey; | |
| document.onselectstart = falseReturn; | |
| document.oncontextmenu = falseReturn; | |
| var height = 300; | |
| var width = 300; | |
| var isPopup = false; | |
| var popupMover; | |
| function trueReturn() { return true; } | |
| function falseReturn() { return false; } | |
| annoyTxtList = new Array("CATCH ME IF YOU CAN", | |
| "LET'S JUST BE FRIENDS", | |
| "WHAZZZUP", | |
| "TALK TO THE HAND", | |
| "LOOK BEHIND YOU", | |
| "OOPS I DID IT AGAIN"); | |
| var annoyTxt = annoyTxtList[0]; | |
| function getRandomPos(axis) { | |
| screenW = window.screen.availWidth; | |
| screenH = window.screen.availHeight; | |
| if (!isIE) { | |
| winW = window.innerWidth; | |
| winH = window.innerHeight; | |
| } | |
| if (isIE) { | |
| winW = document.body.offsetWidth; | |
| winH = document.body.offsetHeight; | |
| } | |
| if (axis == 0) return Math.floor((screenW - width) * Math.random()); | |
| else return Math.floor((screenH - height) * Math.random()); | |
| } | |
| function moveWindow(e) { | |
| self.moveTo(getRandomPos(0), getRandomPos(1)); | |
| } | |
| function popup() { | |
| var str = "height=" + height + ",innerHeight=" + height; | |
| str += ",width=" + width + ",innerWidth=" + width; | |
| str += ",left=" + getRandomPos(0) + ",screenX=" + getRandomPos(0); | |
| str += ",top=" + getRandomPos(1) + ",screenY=" + getRandomPos(1); | |
| var annoyPopup = window.open('annoy.asp', 'popup' + String(Math.floor(Math.random()*1000)), str); | |
| } | |
| function initLauncher() { | |
| window.moveTo(0,0); | |
| if (document.all) { | |
| top.window.resizeTo(screen.availWidth,screen.availHeight); | |
| } else if (document.layers||document.getElementById) { | |
| if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) { | |
| top.window.outerHeight = screen.availHeight; | |
| top.window.outerWidth = screen.availWidth; | |
| } | |
| } | |
| popup(); | |
| } | |
| function getKey(keyStroke) { | |
| if (isNS6) eventChooser = keyStroke.which; | |
| else if (isIE) eventChooser = event.keyCode; | |
| else eventChooser = keyStroke.which; | |
| theKey = String.fromCharCode(eventChooser).toLowerCase(); | |
| if (theKey == 'p') { | |
| if (isPopup) { | |
| document.body.onunload = falseReturn; | |
| self.close(); | |
| } | |
| } else if (theKey == 'q') { | |
| alert("You didn't think 'q' would actually close the popup, did you?? That just wouldn't be annoying enough.\nWell, if you keep trying maybe you'll find the letter that closes the popups..."); | |
| popup();popup();popup();popup(); | |
| } else { | |
| popup(); | |
| } | |
| } | |
| function startPopupMover() { | |
| document.bgColor = "#FF00FF"; | |
| moveWindow(); | |
| popupMover = setInterval(moveWindow, 500); | |
| document.onmousemove = pausePopupMover; | |
| //document.onmousemove = moveWindow; | |
| } | |
| function pausePopupMover() { | |
| document.bgColor = "#00FFFF"; | |
| document.onmousemove = falseReturn; | |
| clearInterval(popupMover); | |
| popupMover = setTimeout(startPopupMover, 50); | |
| } | |
| function doOnunload() { | |
| popup();popup(); | |
| } | |
| function doOnunload2() { | |
| popup();popup();popup();popup();popup(); | |
| } | |
| function doCursor(type) { | |
| if (document.all) { | |
| document.all("annoy").style.cursor = type; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment