<commit_before>/* Welcome to the Fun Button!

To continbute a function, following the directions below:
1. Copy the example function below and paste it between the ***** lines to begin.
2. Change the name of your function to a name of your choice.
3. Customize your function so that it works the way you'd like.
        -You can debug your function by calling it from the console of your preview.
4. When your function is done, add the NAME OF YOUR FUNCTION without () to the outputJunk array below. 


*/


//Let's the client know this script loaded correctly in the browser
console.log("This loaded y'all!");



//EXAMPLE FUNCTION TEMPLATE
var example = function(){
    //Changes the output element to read "EXAMPLE"
    var myString = 'EXAMPLE'
    
    var outputHolder = document.getElementById('fun-output');//gets the output element in the webpage
    outputHolder.innerHTML = myString; //appends the new script into the output.
};


/**      ___
 * | /  |     |\   |  |\   | \  /
 * |/   |__   | \  |  | \  |  \/
 * |\   |     |  \ |  |  \ |  ||
 * | \  |___  |   \|  |   \|  ||
 *  __      __          ' ______
 * |  \    /  \  |\   |     || 
 * |   |  |    | | \  |     ||
 * |   |  |    | |  \ |     ||
 * |__/    \__/  |   \|     ||
 * ______  __             ____  
 *   ||   /  \  |    |   /       |    |
 *   ||  |    | |    |  |        |____|
 *   ||  |    | |    |  |        |    |
 *   ||   \__/   \__/    \____   |    |
 * */

//Here are some examples of the functions you can make to mess with the webpage!
/**var manyZoos = function(){//this could be done with one line of code...
    //Automatically re-directs the user to a video from Too Many Zoos on YouTube
    
    var sDiv = document.createElement("script"); //Creates a new script element
    sDiv.innerHTML = "window.location = 'https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0'"; //Sets the HTML content of the element to re-direct the user
    var outputEl = document.getElementById('fun-output');//gets the output element in the webpage
    outputEl.appendChild(sDiv); //appends the new script into the output.
    window.open("https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0");
};
var showRandall = function(){
    var RandallEl = document.createElement('img');
    RandallEl.setAttribute("src","https://preview.ibb.co/nymVPQ/hedgehogg.png");
    RandallEl.setAttribute("title","This is Randall, made by a mix of pure love, math, and malice.");
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(RandallEl);
};

var showEvan = function(){
    var EvanEl = document.createElement('img');
    EvanEl.setAttribute("src","https://preview.ibb.co/c299Sb/2016_12_05_05_54_32.jpg");
    EvanEl.setAttribute("title","<NAME>, The best Evaugn in town");
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(EvanEl);
};
**/
var randPicture = function(){
	var picRnd = Math.round(Math.random()*(picList.length-1));
    var picEl = document.createElement('img');
    picEl.setAttribute("src",picList[picRnd]);
    picEl.setAttribute("title",picTitle[picRnd]);
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(picEl);
};
var picList = [
	"https://preview.ibb.co/nymVPQ/hedgehogg.png",
	"https://preview.ibb.co/c299Sb/2016_12_05_05_54_32.jpg",
	];
var picTitle = [
	"This is Randall, made by a mix of pure love, math, and malice.",
	"Pimp <NAME>, The best Evaugn in town"
	];
	
var randVideo = function(){
	var type = randomChoice(videoList);
	var video = randomChoice(type);
	//Math.round(Math.random()*(videoList.length-1));
	//var objRnd = Math.round(Math.random()*(videoList.otoRnd.length));
	window.open(video);
};

var videoList = 
	[
		
		//Otomatone Videos curated by Ben
		[
		"https://www.youtube.com/embed/4ROqQ99zVtQ?autoplay=1&controls=0",
		"https://www.youtube.com/embed/8OQtrmhpIXU?autoplay=1&controls=0",
		"https://www.youtube.com/embed/9uuwbSUdW8M?autoplay=1&controls=0",
		"https://www.youtube.com/embed/-FwAQ7BxZQ4?autoplay=1&controls=0",
		"https://www.youtube.com/embed/KIoIsDXXZp0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/A2_liowdedI?autoplay=1&controls=0",
		"https://www.youtube.com/embed/MEianU8A7tY?autoplay=1&controls=0",
		"https://www.youtube.com/embed/G8iEMVr7GFg?autoplay=1&controls=0",
		"https://www.youtube.com/embed/x0plnLJ7Dm0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/uh8s8-LD5io?autoplay=1&controls=0",
		"https://www.youtube.com/embed/e4zjgUoXU_U?autoplay=1&controls=0",
		"https://www.youtube.com/embed/VlqA0uq6i6E?autoplay=1&controls=0",
		"https://www.youtube.com/embed/Oub55g9wog0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/HmFsmw3ICcI?autoplay=1&controls=0"
		],
		[
		//too many zooz and that weird saxophone guy
		"https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0",
		"https://www.youtube.com/embed/jEHOsWTsdkY?autoplay=1&controls=0"
		],
		//Indian Thriller.
		["https://www.youtube.com/embed/x81iip6psks?autoplay=1&controls=0"]
];

var backgroundList = [
	"url('https://preview.ibb.co/kcbz5m/shlop.jpg')",
	"url('https://preview.ibb.co/krFfzQ/3322.jpg')"
	];
	
var rndSolitaire = [
	"https://image.ibb.co/hBHdLG/Shlok_2.png",
	"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAABRCAYAAADl0knmAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJTUUH4QsDACAPcZLFSwAABd1JREFUeNrtnX1o1HUcx1/f2113N7ebbjMLmqarnNkDhlD5j81sEEKCM2VFZIoGkf2RUtpgZaHTSA2EAsG5KDtkD2FkQaYpQY7AcGpsszlxyoXtdu3JPbS7+/bHNt1t97yb97v8vP66u333+7HP696f3+d72+2U1hohtTFJCUS<KEY>",
	"https://cdn.modernfarmer.com/wp-content/uploads/2013/09/saanen.jpg"
	];

/**	
var shlopified = function(){
    document.body.style.backgroundImage = "url('https://preview.ibb.co/kcbz5m/shlop.jpg')";
};
var kennybunny = function(){
    document.body.style.backgroundImage = "url('https://preview.ibb.co/krFfzQ/3322.jpg')";
};

**/
var solitaire = function(){
			var instruct = document.createElement("P");                      
			var t = document.createTextNode("Having fun yet?");
			var outputEl = document.getElementById('fun-output');
			outputEl.appendChild(t);                                          
			document.body.appendChild(instruct);
			var canvas = document.createElement( 'canvas' );
			var outputCan = document.getElementById('fun-output');
			canvas.style.position = 'fixed';
			canvas.style.zIndex =  "-10";
			canvas.style.top = String(document.documentElement.scrollTop) +"px";
			canvas.style.left = "0px";
			canvas.width = window.innerWidth;
			canvas.height = window.innerHeight;
			outputCan.appendChild(canvas);
			var context = canvas.getContext( '2d' );
			var id = 1;
			var image = document.createElement( 'img' );
			image.src = randomChoice(rndSolitaire);
			var cwidth = image.width, cwidthhalf = cwidth / 2;
			var cheight =image.height, cheighthalf = cheight / 2; 
			console.log("Width: "+cwidth+", Height: "+cheight);
			
			var particles = [];
			var Particle = function ( id, x, y, sx, sy ) {
				if ( sx === 0 ) sx = 2;
				var cx = ( id % 4 ) * cwidth;
				var cy = Math.floor( id / 4 ) * cheight;
				this.update = function () {
					x += sx;
					y += sy;
					if ( x < ( - cwidthhalf ) || x > ( canvas.width + cwidthhalf ) ) {
						var index = particles.indexOf( this );
						particles.splice( index, 1 );
						return false;
					
					}
					if ( y > canvas.height - cheighthalf ) {
						y = canvas.height - cheighthalf;
						sy = - sy * .9; 
					}
					sy += 0.98; 
					context.drawImage( image, cx, cy, cwidth, cheight, Math.floor( x - cwidthhalf ), Math.floor( y - cheighthalf ), cwidth, cheight	);
					return true;
				}
			}
			var throwCard = function ( x, y ) {
				id > 0 ? id -- : id = 1;
				var particle = new Particle( id, x, y, Math.floor( Math.random() * 6 - 3 ) * 2, - Math.random() * 25 );
				particles.push( particle );
			}
			document.addEventListener( 'mousedown', function ( event ) {
    			throwCard( event.clientX, event.clientY );
				document.addEventListener( 'mousemove', onMouseMove, false );
			}, false );
			document.addEventListener( 'mouseup', function ( event ) {
				throwCard( event.clientX, event.clientY );
				document.removeEventListener( 'mousemove', onMouseMove, false );
			}, false );
			function onMouseMove( event ) {
				event.preventDefault();
				throwCard( event.clientX, event.clientY );
			}
			document.addEventListener( 'touchstart', function ( event ) {
				event.preventDefault();
				for ( var i = 0; i < event.changedTouches.length; i ++ ) {
					throwCard( event.changedTouches[ 0 ].pageX, event.changedTouches[ 0 ].pageY );
				}
			}, false );
			document.addEventListener( 'touchmove', function ( event ) {
				event.preventDefault();
				for ( var i = 0; i < event.touches.length; i ++ ) {
					throwCard( event.touches[ i ].pageX, event.touches[ i ].pageY );
				}
			}, false );
			setInterval( function () {
				var i = 0, pl = particles.length;
				while ( i < pl ) {
					particles[ i ].update() ? i ++ : pl --; //check particle.update for condition. If paricle.update returns true, stops loop
				}
			}, 1000/60 );
};
//This array holds all of the possible functions that could randomly be selected when the 'fun' button is pressed.
//Once your function is ready, place its name in the array below!

    
    
var randomChoice = function (funcArray){
	var num = Math.round(Math.random()*(funcArray.length-1));
	var selectedThingy = funcArray[num];
	console.log(num);
	return selectedThingy;
};



var randBackground = function(){
	var randBgsource = randomChoice(backgroundList);
	document.body.style.backgroundImage=randBgsource;
};

var outputJunk = [
    //randPicture,
    //randVideo,
    //randBackground,
    solitaire//by <NAME>
    ];

var clearOutput = function(){
    var outputEl = document.getElementById('fun-output');
    outputEl.innerHTML = "";
};

//This function chooses a random function from the array above and runs it when the user clicks the 'fun' button.
var buttonFun = function (){
    clearOutput();
    var rndIndex = Math.round(Math.random()*(outputJunk.length-1));
	outputJunk[rndIndex]();
};<commit_msg>fixed a mess<commit_after>/* Welcome to the Fun Button!

To continbute a function, following the directions below:
1. Copy the example function below and paste it between the ***** lines to begin.
2. Change the name of your function to a name of your choice.
3. Customize your function so that it works the way you'd like.
        -You can debug your function by calling it from the console of your preview.
4. When your function is done, add the NAME OF YOUR FUNCTION without () to the outputJunk array below. 


*/


//Let's the client know this script loaded correctly in the browser
console.log("This loaded y'all!");



//EXAMPLE FUNCTION TEMPLATE
var example = function(){
    //Changes the output element to read "EXAMPLE"
    var myString = 'EXAMPLE'
    
    var outputHolder = document.getElementById('fun-output');//gets the output element in the webpage
    outputHolder.innerHTML = myString; //appends the new script into the output.
};


/**      ___
 * | /  |     |\   |  |\   | \  /
 * |/   |__   | \  |  | \  |  \/
 * |\   |     |  \ |  |  \ |  ||
 * | \  |___  |   \|  |   \|  ||
 *  __      __          ' ______
 * |  \    /  \  |\   |     || 
 * |   |  |    | | \  |     ||
 * |   |  |    | |  \ |     ||
 * |__/    \__/  |   \|     ||
 * ______  __             ____  
 *   ||   /  \  |    |   /       |    |
 *   ||  |    | |    |  |        |____|
 *   ||  |    | |    |  |        |    |
 *   ||   \__/   \__/    \____   |    |
 * */

//Here are some examples of the functions you can make to mess with the webpage!
/**var manyZoos = function(){//this could be done with one line of code...
    //Automatically re-directs the user to a video from Too Many Zoos on YouTube
    
    var sDiv = document.createElement("script"); //Creates a new script element
    sDiv.innerHTML = "window.location = 'https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0'"; //Sets the HTML content of the element to re-direct the user
    var outputEl = document.getElementById('fun-output');//gets the output element in the webpage
    outputEl.appendChild(sDiv); //appends the new script into the output.
    window.open("https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0");
};
var showRandall = function(){
    var RandallEl = document.createElement('img');
    RandallEl.setAttribute("src","https://preview.ibb.co/nymVPQ/hedgehogg.png");
    RandallEl.setAttribute("title","This is Randall, made by a mix of pure love, math, and malice.");
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(RandallEl);
};

var showEvan = function(){
    var EvanEl = document.createElement('img');
    EvanEl.setAttribute("src","https://preview.ibb.co/c299Sb/2016_12_05_05_54_32.jpg");
    EvanEl.setAttribute("title","<NAME>, The best Evaugn in town");
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(EvanEl);
};
var shlopified = function(){
    document.body.style.backgroundImage = "url('https://preview.ibb.co/kcbz5m/shlop.jpg')";
};
var kennybunny = function(){
    document.body.style.backgroundImage = "url('https://preview.ibb.co/krFfzQ/3322.jpg')";
};

**/
var randPicture = function(){
	console.log("Called randPicture");
	var picRnd = randomChoice(picList);
	var picTitle = randomChoice(picTitles);
    var picEl = document.createElement('img');
    picEl.setAttribute("src",picRnd);
    picEl.setAttribute("title",picTitle);
    var outputEl = document.getElementById('fun-output');
    outputEl.appendChild(picEl);
};
var picList = [
	"https://preview.ibb.co/nymVPQ/hedgehogg.png",
	"https://preview.ibb.co/c299Sb/2016_12_05_05_54_32.jpg"
	];
	
var picTitles = [
	"This is Randall, made by a mix of pure love, math, and malice.",
	"Pimp <NAME>, The best Evaugn in town"
	];
	
var randVideo = function(){
	console.log("Called randVideo");
	var type = randomChoice(videoList);
	var video = randomChoice(type);
	//Math.round(Math.random()*(videoList.length-1));
	//var objRnd = Math.round(Math.random()*(videoList.otoRnd.length));
	window.open(video);
};

var videoList = 
	[
		
		//Otomatone Videos curated by Ben
		[
		"https://www.youtube.com/embed/4ROqQ99zVtQ?autoplay=1&controls=0",
		"https://www.youtube.com/embed/8OQtrmhpIXU?autoplay=1&controls=0",
		"https://www.youtube.com/embed/9uuwbSUdW8M?autoplay=1&controls=0",
		"https://www.youtube.com/embed/-FwAQ7BxZQ4?autoplay=1&controls=0",
		"https://www.youtube.com/embed/KIoIsDXXZp0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/A2_liowdedI?autoplay=1&controls=0",
		"https://www.youtube.com/embed/MEianU8A7tY?autoplay=1&controls=0",
		"https://www.youtube.com/embed/G8iEMVr7GFg?autoplay=1&controls=0",
		"https://www.youtube.com/embed/x0plnLJ7Dm0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/uh8s8-LD5io?autoplay=1&controls=0",
		"https://www.youtube.com/embed/e4zjgUoXU_U?autoplay=1&controls=0",
		"https://www.youtube.com/embed/VlqA0uq6i6E?autoplay=1&controls=0",
		"https://www.youtube.com/embed/Oub55g9wog0?autoplay=1&controls=0",
		"https://www.youtube.com/embed/HmFsmw3ICcI?autoplay=1&controls=0"
		],
		[
		//too many zooz and that weird saxophone guy
		"https://www.youtube.com/embed/IMyqasy2Lco?start=137&autoplay=1&controls=0",
		"https://www.youtube.com/embed/jEHOsWTsdkY?autoplay=1&controls=0"
		],
		//Random Videos
		[
		"https://www.youtube.com/embed/x81iip6psks?autoplay=1&controls=0",
		"https://www.youtube.com/embed/mxhxL1LzKww?start=243&autoplay=1&controls=0"
		]
];

var backgroundList = [
	"url('https://preview.ibb.co/kcbz5m/shlop.jpg')",
	"url('https://preview.ibb.co/krFfzQ/3322.jpg')"
	];
	
var rndSolitaire = [
	"https://image.ibb.co/hBHdLG/Shlok_2.png",
	"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAABRCAYAAADl0knmAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJTUUH4QsDACAPcZLFSwAABd1JREFUeNrtnX1o1HUcx1/f2113N7ebbjMLmqarnNkDhlD5j81sEEKCM2VFZIoGkf2RUtpgZaHTSA2EAsG5KDtkD2FkQaYpQY7AcGpsszlxyoXtdu3JPbS7+/bHNt1t97yb97v8vP66u333+7HP696f3+d72+2U1hohtTFJCUSiIBKFRGCO55va1ddLNWqRCeZryAOdBUqeEDGh/aA6FVz1wx8K/WuOfumneI6koh5sVFVGG4PrTKjVwDSRMCn840cfno7lAPrFnoRK9ChnsYZNIu/2yVSwO1uX1CREols5yxSUSF2T0HDBmatLPpyQRI9yfqJhmZQzeSg4mq1LNsc1nbqVs0wEGiKNy9zKWRazRI9yFksLNVQaSzzKWRx9O1VVGe14f5QhxnjDTg7momBT67gktjG4TgQakmnDbiK30+F9oGBAQrkJkNiuvl4qKTR2GocdhZaoUYukTkafVsc7Mo25M1/KZPSWOt7RmCSSJ2Uy/L4xL8Jgo7OkTIbXmBVBovw6KQW2/qaIWwwhJa+TgkgURKIgEgWRKBIFg2BO<KEY>",
	"https://cdn.modernfarmer.com/wp-content/uploads/2013/09/saanen.jpg"
	];



var solitaire = function(){
			console.log("Called solitaire");
			var instruct = document.createElement("P");                      
			var t = document.createTextNode("Having fun yet?");
			var outputEl = document.getElementById('fun-output');
			outputEl.appendChild(t);                                          
			document.body.appendChild(instruct);
			var canvas = document.createElement( 'canvas' );
			var outputCan = document.getElementById('fun-output');
			canvas.style.position = 'fixed';
			canvas.style.zIndex =  "-10";
			canvas.style.top = String(document.documentElement.scrollTop) +"px";
			canvas.style.left = "0px";
			canvas.width = window.innerWidth;
			canvas.height = window.innerHeight;
			outputCan.appendChild(canvas);
			var context = canvas.getContext( '2d' );
			var id = 1;
			var image = document.createElement( 'img' );
			image.src = randomChoice(rndSolitaire);
			var cwidth = image.width, cwidthhalf = cwidth / 2;
			var cheight =image.height, cheighthalf = cheight / 2;
			console.log("Width: "+cwidth+", Height: "+cheight);
			
			var particles = [];
			var ParticleSolitaire = function ( id, x, y, sx, sy ) {
				if ( sx === 0 ) sx = 2;
				var cx = ( id % 4 ) * cwidth;
				var cy = Math.floor( id / 4 ) * cheight;
				this.update = function () {
					x += sx;
					y += sy;
					if ( x < ( - cwidthhalf ) || x > ( canvas.width + cwidthhalf ) ) {
						var index = particles.indexOf( this );
						particles.splice( index, 1 );
						return false;
					
					}
					if ( y > canvas.height - cheighthalf ) {
						y = canvas.height - cheighthalf;
						sy = - sy * .9; 
					}
					sy += 0.98; 
					context.drawImage( image, cx, cy, cwidth, cheight, Math.floor( x - cwidthhalf ), Math.floor( y - cheighthalf ), cwidth, cheight	);
					return true;
				}
			}
			var throwCard = function ( x, y ) {
				id > 0 ? id -- : id = 1;
				var particle = new ParticleSolitaire( id, x, y, Math.floor( Math.random() * 6 - 3 ) * 2, - Math.random() * 25 );
				particles.push( particle );
			}
			document.addEventListener( 'mousedown', function ( event ) {
    			throwCard( event.clientX, event.clientY );
				document.addEventListener( 'mousemove', onMouseMove, false );
			}, false );
			document.addEventListener( 'mouseup', function ( event ) {
				throwCard( event.clientX, event.clientY );
				document.removeEventListener( 'mousemove', onMouseMove, false );
			}, false );
			function onMouseMove( event ) {
				event.preventDefault();
				throwCard( event.clientX, event.clientY );
			}
			document.addEventListener( 'touchstart', function ( event ) {
				event.preventDefault();
				for ( var i = 0; i < event.changedTouches.length; i ++ ) {
					throwCard( event.changedTouches[ 0 ].pageX, event.changedTouches[ 0 ].pageY );
				}
			}, false );
			document.addEventListener( 'touchmove', function ( event ) {
				event.preventDefault();
				for ( var i = 0; i < event.touches.length; i ++ ) {
					throwCard( event.touches[ i ].pageX, event.touches[ i ].pageY );
				}
			}, false );
			setInterval( function () {
				var i = 0, pl = particles.length;
				while ( i < pl ) {
					particles[ i ].update() ? i ++ : pl --; //check particle.update for condition. If paricle.update returns true, stops loop
				}
			}, 1000/60 );
};

//This array holds all of the possible functions that could randomly be selected when the 'fun' button is pressed.
//Once your function is ready, place its name in the array below!

    
var randomChoice = function (funcArray){
	var num = Math.round(Math.random()*(funcArray.length-1));
	var selectedThingy = funcArray[num];
	console.log(num);
	return selectedThingy;
};



var randBackground = function(){
	console.log("Called randBackground");
	var randBgsource = randomChoice(backgroundList);
	document.body.style.backgroundImage=randBgsource;
};

var outputJunk = [
    randPicture,
    randVideo,
    randBackground,
    solitaire//by <NAME>
    ];

var clearOutput = function(){
    var outputEl = document.getElementById('fun-output');
    outputEl.innerHTML = "";
};

//This function chooses a random function from the array above and runs it when the user clicks the 'fun' button.
var buttonFun = function (){
    clearOutput();
    var rndIndex = Math.round(Math.random()*(outputJunk.length-1));
	outputJunk[rndIndex]();
};
{'fraction_non_alphanumeric': 0.1487378083763626, 'fraction_numerical': 0.02438324727481354, 'mean_word_length': 3.3270583367811337, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 59, 'lorem ipsum': 0, 'www.': 39, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '179005', 'n_tokens_mistral': 8316, 'n_tokens_neox': 7474, 'n_words': 1450}