public
Last active

  • Download Gist
Custom Heavy Load
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
// ==UserScript==
// @name Custom Heavy Load
// @namespace PapaNachos
// @include http://www.reddit.com/*
// @include *.mtu.edu/*
// @version 1.2.1
// ==/UserScript==
//******************************************************************************************************************
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//READ ME. NO REALLY, READ THIS
//Anything written using "//" is not actually part of the code. These are called comments and don't affect anything
//Usually they contain notes about how the program works.
//Hopefully this should be simple enough that someone without code experience can operate it
//
//Note: Not all parts of this program are guaranteed to work. I've tested everything as best as possible, but
//it is difficult to do without being able to access the heavy load page whenever I need it
//I also can't guarantee that it works on all systems in all browsers. I hope it works for your system,
//but I don't have the means to to test everything
//SERIOUSLY. READ THAT.
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//******************************************************************************************************************
if (document.title.indexOf('Ow') !== -1) {
//******************************************************************************************************************
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//THINGS YOU CAN MESS WITH
//These are some settings that currently let you modify parts of the script
var rotation_delay = 5;//This controls how long that the program waits between image swaps. It's measured in seconds
var random = false;//This allows you to choose which mode the program operates in. There are two options:
//if random = false then the program will operate in a loop that always goes in the same direction
//if random = true then the program will automatically select a different random image every time the image swaps
var custom_text = true; //This allows you to display custom text instead of the default heavy load message
//if custom_text = true "phrase1" and "phrase2" will override "reddit is under heavy load right now" and "please try again in a few minutes" respectively
//if custom_text = false the text will not change
var vertical_offset = 400; //This variable controls how close the image will get to the top of the screen.
//Reddit's default value is 275
//HIGHER NUMBERS BRING IT CLOSER TO THE TOP
//DON'T MESS WITH ANYTHING BELOW THIS EXCEPT FOR THE HUGE LIST OF image[#]
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//******************************************************************************************************************
var num = 0;
var images = new Array(); //Defines an array to store image/text combinations
var choice; //Pretty simple automatic array index generator
var milliseconds_per_second = 1000; //The rotation interval is measured in milliseconds, this allows an easy conversion
document.body.innerHTML = document.body.innerHTML.replace("<h2>reddit is under heavy load right now</h2>",""); //I broke this into 2 commands in case Reddit decides to format their source in the future
document.body.innerHTML = document.body.innerHTML.replace("<h3>please try again in a few minutes.","<div id=\"HeavyLoadPonyText\"></div>"); //It also creates a new element I can access later, Thanks hiles
var textbox = document.getElementById("HeavyLoadPonyText"); //Greatly simplifies text swapping
textbox.innerHTML = "<h2>reddit is under heavy load right now</h2><h3>please try again in a few minutes."; //Restores it to the factory settings
var img = document.getElementsByTagName('img')[0]; //Finds the target image
document.head.innerHTML = document.head.innerHTML.replace("margin-top:-275px","margin-top:-"+vertical_offset+"px")
//******************************************************************************************************************
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//MORE THINGS YOU CAN MESS WITH
//This area contains a giant list of images that the script will pull from
//The basic format is:
//image[num++] = {srd:"URL",width:x,height:y,text:"phrase"};//Comment
//"URL" is where on the internet you can find the image
//It should start with either "http://" or "https://"
//And end with something like ".gif",width: ".jpg",width: or "png"
//Those are image types and will work with this script
//If it ends with something that is not an image type such as ".html", ".htm",or ".php"
//You will run into trouble
//"x" represents how wide the image is. If you set this to something different than the regular resolution of the image it will stretch or shrink it as appropriate
//"y" represents how tall the image is. It works the same way as x. I recommend not setting y above 400, but its up to you
//If you set x or y to something other than the default, remember to scale the other appropriately or your image will be distorted
//If you change x use the equation "new y = ((new x/old x) * old y)" to find what the new value for y should be
//If you change y use the equation "new x = ((new y/old y) * old x)" to find what the new value for x should be
//"phrase" lets you customize the text message that is displayed
//This only works if custom_text is set to true
//If you decide to insert your own phrases, quotation marks will not display properly
//If you wish to make a " appear you need to put \" in place of it in your phrase.
//HTML inserted into the phrase -should- work properly, <h2> and <h3> should be predefined by the webpage
//You're going to want to include <h2></h2>, or <h3></h3> around your phrase to make the formatting work
//DO NOT PUT IN A BLANK PHRASE
//"//Comment" is a note to yourself about what the image is
// The URL is a difficult way to remember it, so this will help keep track of everything
images[num++] = {src:"http://i.imgur.com/mTw94oJ.gif",width:640,height:360,text:"<h2>You broke reddit,</h2><h3>It's okay though</h3>"};//Lyra head bob
images[num++] = {src:"http://i.imgur.com/NaggdFT.png",width:640,height:360,text:"<h2>You promised not to break Reddit</h2><h3>No one breaks a Pinkie Promise</h3>"};//Pinkie Stare
images[num++] = {src:"http://i.imgur.com/Lu9leHR.gif",width:400,height:400,text:"<h2>Reddit is down</h2><h3>Why don't you take a nap while you wait</h3>"};//Luna Twitch
images[num++] = {src:"http://i.imgur.com/1RWPtKy.jpg",width:400,height:400,text:"<h2>Oh no, you can't waste more time on the internet</h2><h3>Your life must be awful</h3>"};//Twilight Nobody Cares
images[num++] = {src:"http://i.imgur.com/dlIl34A.png",width:640,height:200,text:"<h3>\"Moon?\"</h3><h3>\"Moon.\"</h3><h3>\"TO THE <b><b><b>MOOOOOOOON!\"</b></b></b></h3>"};//Pissed Princesses
images[num++] = {src:"http://i.imgur.com/6DMMeKe.png",width:400,height:400,text:"<h2>Go back to what you were doing</h2><h3>Don't mind me</h3>"};//It's not creepy.
images[num++] = {src:"http://i.imgur.com/PZfk2ve.png",width:224,height:400,text:"<h3>Reddit is down</h3><h2>FOR-EV-ER</h2>"};//Pinkie FOREVER
images[num++] = {src:"http://i.imgur.com/64J1tx8.png",width:400,height:400,text:"<h2>Reddit is down</h2><h3>So here's Scootaloo in a tree</h3>"};//Scootaloo in a tree
images[num++] = {src:"http://i.imgur.com/ddcl1I0.png",width:640,height:360,text:"<h2>Hello, Tech Support?</h2><h3>I think I found a bug</h3>"};//Dash's Mini-Me
images[num++] = {src:"http://i.imgur.com/S86OxTD.png",width:400,height:400,text:"<h2>Reddit is down, so have some Derpy</h2><h3>Why else would you use the internet?</h3>"};//Derpy Sombrero
images[num++] = {src:"http://i.imgur.com/3rXXQV1.png",width:400,height:400,text:"<h2>All you have to do is build an exact copy of Reddit's servers</h2><h3>You have 2 minutes</h3>"};//Nervous Twilight
images[num++] = {src:"http://i.imgur.com/sfZuuf9.png",width:400,height:400,text:"<h2>Stand back</h2><h3>We've got this</h3>"};//Twilight and Spike ready for battle
images[num++] = {src:"http://i.imgur.com/JCBAYAP.png",width:400,height:400,text:"<h2>Fascinating!</h2><h3>I have just the book for this</h3>"};//Twilight excited
images[num++] = {src:"http://i.imgur.com/qADpCWR.png",width:452,height:400,text:"<h2>Don't worry</h2><h3>I know just the spell for this</h3>"};//Twilight um... doing something?
images[num++] = {src:"http://i.imgur.com/sMLjJ.gif",width:320,height:180,text:"<h2>Meanwhile</h2><h3>Over in Reddit's server room</h3>"};//Rainboom
images[num++] = {src:"http://i.imgur.com/TUpkrFE.png",width:400,height:400,text:"<h2>whatisthisidonteven</h2>"};//Twiderp
images[num++] = {src:"http://i.imgur.com/bcLUXFs.gif",width:300,height:300,text:"<h2>THE.</h2><h2><b>WORST.</b></h2><h2><b><b>POSSIBLE.</b></b></h2><h2><b><b><b><b>THING.</b></b></b></b></h2>"};//Rarity frightened
images[num++] = {src:"http://i.imgur.com/4AWWSas.gif",width:600,height:360,text:"<h2>Stop</h2><h3>Hammertime</h3>"};//CMC dancing
images[num++] = {src:"http://i.imgur.com/doGE0sk.gif",width:300,height:300,text:"<h2>The Great and Powerful Trixie doesn't trust servers"};//The Great and Powerful Scrunchy Face
images[num++] = {src:"http://i.imgur.com/vjGavLe.gif",width:300,height:300,text:"<h2>Reddit is down right now</h2><h3>Don't worry, it's not your fault</h3>"};//Derpy happy
images[num++] = {src:"http://i.imgur.com/rpMUq00.gif",width:400,height:400,text:"<h1>Dear Princess Celestia,</h1><h3>Today I ruined everything</h3>"};//Celestia eyebrows
images[num++] = {src:"http://i.imgur.com/DzliUCA.gif",width:400,height:235,text:"<h2>Reddit couldn't handle us</h2>"};//Pinkie Pie/Fluttershy Swag
images[num++] = {src:"http://i.imgur.com/MVz4MLY.gif",width:635,height:360,text:"<h3>Fix it.</h3><h2>NOW!</h2>"};//Flutterstare
images[num++] = {src:"http://i.imgur.com/1rQPGPO.gif",width:400,height:400,text:"<h2>OMIGOSHOMIGOSHOMIGOSH</h2><h3>OMIGOSHOMIGOSHOMIGOSHOMIGOSH</h3>"};//OMIGOSHOMIGOSHOMIGOSHOMIGOSHOMIGOSH
images[num++] = {src:"http://i.imgur.com/IskzGlS.gif",width:300,height:400,text:"<h2>And then you let her near the servers?</h2><h3>Um...</h3>"};//Twilight coffee
images[num++] = {src:"http://i.imgur.com/0SWrJiE.gif",width:400,height:400,text:"<h2>Reddit is down.</h2><h3>If you know what I mean</h3>"};//Cherilee Eyebrows
images[num++] = {src:"http://i.imgur.com/MuZxsct.gif",width:300,height:300,text:"<h1><i>Serious Business.</i></h1>"};//Twilight LOL INTERNET
images[num++] = {src:"http://i.imgur.com/fpiVyL3.gif",width:640,height:360,text:"<h3>Can I get a</h3><h2><b>BIZZAM</b></h2>"};//Canni excited
images[num++] = {src:"http://i.imgur.com/gpbLMkU.gif",width:640,height:360,text:"<h2>Oh look,</h2><h3>Something else <b><i>you</i></b> can't do</h3>"};//Twilight sucks at DDR
images[num++] = {src:"http://i.imgur.com/t66Ghiy.gif",width:300,height:300,text:"<h2>What'cha doing?</h2>"};//Dash looking at something
images[num++] = {src:"http://i.imgur.com/IkFk3X1.jpg",width:320,height:180,text:"<h2>Derpy is under heavy load right now</h2>"};//Derpy + Muffins
images[num++] = {src:"http://i.imgur.com/T8FnF6S.gif",width:297,height:400,text:"<h2>Did you say something darling?</h2><h3>I was a bit distracted</h3>"};//Rarity Prance
images[num++] = {src:"http://i.imgur.com/HEDhALI.gif",width:550,height:233,text:"<h2>Cutie Mark Crusaders Network Adminstrators!</h2><h3>... Oops ...</h3>"};//CMC loading
images[num++] = {src:"http://i.imgur.com/44EZkM3.gif",width:770,height:136,text:"<h2>Reddit is down</h2><h3>Why not go outside?</h3>"};//Pinkie Trampoline
images[num++] = {src:"http://i.imgur.com/gSVh3.png",width:570,height:340,text:"<h2>Reddit is under heavy load right now.</h2><h3>You're not helping, by the way.</h3>"};//Derpy hammer, Thanks Jibodeah
images[num++] = {src:"http://i.imgur.com/cK1jmbH.png",width:750,height:325,text:"<h2>Hold your horses</h2><h3>We're just taking a quick break</h3>"};//Karma and Discentia, Thanks RedToxin
//DON'T MESS WITH ANYTHING BELOW HERE
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//******************************************************************************************************************
choice = Math.floor(Math.random() * num);
changeimage();//First time it runs
setInterval(function(){changeimage()},rotation_delay * milliseconds_per_second);//Sets it to loop repeatedly
}
function changeimage(){
if(random == false) {
choice++; //Simple increment that wraps around
choice %= num; //Modulus equals, BITCHES. Ah yeah
}
else
{
var lastchoice = choice;
while(lastchoice == choice) {//ensures a different image each time
choice = Math.floor(Math.random() * num);
}
}
if(custom_text == true) {
//Dumps whatever HTML was included into the textbox below the image
textbox.innerHTML = images[choice].text;
}
//Swap out the image and adjust for the proper height and width
img.src = images[choice].src;
img.height = images[choice].height;
img.width = images[choice].width;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.