Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- WORK FINISHED • V2.0 • Last Edit : 22 January 2021 
-> Made on Google Chrome
//
-> Best View In Full :
https://codepen.io/SimonDiligues/full/abmPRXa
//
-->
<div class="logo" style="display: none;"><a class="dos">@</a><a class="uno">@</a></div>

<p id="debug"></p>
	
<div id="selectHero" class="panel" style="display: none;">
	<h1>Selectionnez vos héros déjà acquis !</h1>
	<div id="fullListOfHeroes"></div>
  <input id="nextStep" type="button" value="suivant">
</div>

	<div id="whileHero" class="panel" style="display: none;">
		<h1>Random Weapon</h1>
    <div class="fc">
		<div class="fiftyfifty">
			<div class="fifty main">
				<span style="line-height: 18px;">🧮 Passages : </span>
				<br>
				<span>⏱️ Temps écoulé : </span>
				<hr>
				<h3>Héros</h3>
        <p id="notselectedList" class="fc"></p>
			</div>
			<div class="fifty second">
				<span id="try">0</span>
				<span id="diffcnt">0/s</span>
				<span id="cooldown"><a id="hrs">00</a>:<a id="mins">00</a>:<a id="secs">00</a></span>
				<hr>
				<h3>Sélections</h3>
				<p id="resultList" class="fc"></p>
	</div>      
		</div>
      <div class="fr">
        <input id="start" type="button" value="C'est parti !">
        <input id="reset" type="button" value="Réinitialiser">
      </div>
</div>
	</div>
<div id="detailsHeroes" class="panel" style="display:none;">
  <h1>Personnages acquis</h1>
  <p id="selectedList" class="fc"></p>
</div>
<div id="result" class="panel tripnl" style="padding-top: 0; display: none;">
  <div class="topbar"></div>
    <h1>Prochain personnage</h1>
		<div class="fiftyfifty">
			<div class="fifty">
				<img src="https://img1.picmix.com/output/stamp/normal/9/6/0/0/600069_226ab.gif" class="fireworks">
			</div>
			<div class="fifty"><span id="resultlabel"></span></div>
		</div>
	</div>
	<img class="logosketv" src="https://i48.servimg.com/u/f48/18/06/99/75/logo12.png">
	<span class="logotxt">SKE TV</span>
	<span id="currenthero"></span>
              
            
!

CSS

              
                @font-face {
	font-family: "owlogo";
	src: url("https://cdn.discordapp.com/attachments/639163306749198356/801224528520544286/owlogo.ttf");
} /* Overwatch logo */
@font-face {
	font-family: "owfont";
	src: url(https://static.playoverwatch.com/fonts/big-noodle-too-oblique-1eed6dbdd0.woff);
} /* Overwatch font */

::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

::-webkit-scrollbar-button {
	width: 4px;
	height: 4px;
}

::-webkit-scrollbar-thumb {
	background: #adadad;
	border: 0px solid #ffffff;
	border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
	background: #e0e0e0;
}

::-webkit-scrollbar-thumb:active {
	background: #909090;
}

::-webkit-scrollbar-track {
	background: none;
}

::-webkit-scrollbar-track:hover {
	background: none;
}

::-webkit-scrollbar-track:active {
	background: none;
}

::-webkit-scrollbar-corner {
	background: transparent;
}

* {
	-webkit-touch-callout: none; /* iOS Safari */
	-webkit-user-select: none; /* Safari */
	-khtml-user-select: none; /* Konqueror HTML */
	-moz-user-select: none; /* Firefox */
	-ms-user-select: none; /* Internet Explorer/Edge */
	user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
	box-sizing: border-box;
	font-family: 'Calibri';
	-webkit-font-smoothing: antialiased;
	margin: 0;
	padding: 0;
  cursor: url(https://cdn.discordapp.com/attachments/303406782104207362/315839175406649345/Overwatch.cur), auto;
}

	*:focus {
		outline: 0;
	}

html {
	height: 100%;
	width: 100%;
	background-color: rgb(37, 37, 37);
}

body {
	height: calc(100% - 20px);
}

hr {
	display: block;
	unicode-bidi: isolate;
	margin-block-start: 0.5em;
	margin-block-end: 0.5em;
	margin-inline-start: auto;
	margin-inline-end: auto;
	overflow: hidden;
	border-style: solid;
	border-width: 1px;
	width: 100%;
	border-color: #a96326;
	margin-top: 25px;
	margin-bottom: 0;
}

a {
	cursor: context-menu;
}

h1 {
	font-family: 'owfont';
	color: white;
	font-weight: normal;
	text-align: center;
}

button {
	display: block;
	margin: 2px;
	padding: 10px;
	color: white;
	border: 0;
	cursor: pointer;
}

input[type='button'],
button {
  display: block;
  position: relative;
  padding:  10px 25px;
  margin-left: 20px;
  font-family: "owfont";
  color: white;
  font-weight: bold;
  font-size: 16pt;
  text-transform: capitalize;
  background-color: rgb(250 156 30 / 0.80);
  border: 0;
  border-radius: 2px;
  transition: all .2s ease-in-out;
  cursor: url("https://cdn.discordapp.com/attachments/639163306749198356/801434845497786368/OWlinkselect.cur"), auto;
}

input[type='button']:hover,
button:hover {
  background-color: rgb(250 156 30);
  transform: scale(1.1);
}

input#reset {background-color: rgb(128 128 128 / 0.80);}
input#reset:hover {background-color: gray;}

label, p#notselectedList > span,
#selectedList > span {
	text-transform: capitalize;
  font-family: 'owfont';
}

#selectHero {width: 80%;}
#result {
  position: absolute;
  padding: 0;
  max-width: 40%;
  right: 0;
  top: 0;
}

#result > h1 {
  background-color: rgb(68 68 68);
  padding: 6px 0 6px 0;
}

p#notselectedList > span {line-height: 19px;}

.logo {
	text-align: center;
	z-index: 2;
}

.logo a {
	font-family: 'owlogo';
	font-size: 510pt;
}

a.uno {
	font-family: 'owfont';
	font-size: 510pt;
	-webkit-background-clip: text;
	background-image: url('https://i48.servimg.com/u/f48/18/06/99/75/back11.jpg');
	background-position: center;
	background-repeat: repeat-x;
	background-size: cover;
	color: transparent;
	will-change: transform;
	animation: background-image-animation 165s linear infinite;
	transform: translateX(0) scale(1.1);
	z-index: 1;
}

a.dos {
	position: absolute;
	text-shadow: orange 0 0 8px;
	z-index: -1;
}

@keyframes background-image-animation {
	0% {
		background-position: 0 0;
	}

	100% {
		background-position: -1820px 0;
	}
}

#fullListOfHeroes {
  display: flex;
  flex-direction: row;
  flex-flow: wrap;
  padding: 15px;
  width: 100%;
}

#fullListOfHeroes > .tilechar {
  margin: 5px;
  border: 1px solid gray;
  border-radius: 3px;
  overflow: hidden;
}

#fullListOfHeroes > .tilechar > img {
  height: 100px;
  margin-bottom: 5px;
}

#fullListOfHeroes > .tilechar > div.checkboxpanel {min-width: 100px;}
#fullListOfHeroes > .tilechar:hover {background-color:rgb(250 156 30 / 0.80);}
#fullListOfHeroes > .tilechar:hover > div.checkboxpanel > label {color: white!important;}
#fullListOfHeroes > .tilechar > div.checkboxpanel > input {margin: 5px;}

.fc {display: flex;flex-direction: column;}
.fr{display: flex;flex-direction: row;align-self: center;}

.panel {
	position: relative;
	background-color: rgb(43, 43, 43);
	border: 1px solid #3e3e3e;
  border-radius: 3px;
  margin: 5px;
  padding: 15px;
  width: 50%;
}

.fiftyfifty {
	display: flex;
	flex-direction: row;
	width: 100%;
}

.fifty {
	display: flex;
	flex-direction: column;
	width: 50%;
	padding: 10px;
	color: white;
}

.main {
	text-align: right;
}

.second {
	text-align: left;
}

#resultlabel {
	color: white;
	font-size: 36pt;
	font-weight: bold;
}

.fireworks {
	height: 100px;
	width: 100px;
}

.topbar {
	height: 5px;
	width: 100%;
	background-color: #ff8100;
}

.active {
	background-color: red !important;
}

#resultlabel {
	text-transform: capitalize;
}

.mainpnl > .fiftyfifty {
	height: calc(100% - 70px);
	overflow-y: scroll;
	overflow-x: hidden;
}

img.logosketv {
	position: fixed;
	right: 230px;
	bottom: 20px;
	height: 65px;
	opacity: 0.3;
}

span.logotxt {
  position: fixed;
  right: 20px;
  bottom: 20px;
  font-weight: bold;
  font-size: 40pt;
  color: rgb(102, 102, 102);
  font-family: 'Arial';
}

#currenthero {
	text-align: right;
	color: white;
	position: absolute;
	font-weight: bold;
	font-size: 50pt;
	top: 0;
  right: 30px;
	text-transform: capitalize;
	z-index: 4;
}

span#diffcnt {
	color: gray;
	font-size: 9pt;
	margin-bottom: 6px;
}
              
            
!

JS

              
                "use strict";

let started; //Start or not
let maxThreads = 100000; // Select character after this count of thread
let debugState = false; //Debug

var nextbtn = document.getElementById('nextStep'); //Next Button
var startbtn = document.getElementById('start'); //Start button
var charsCount; //Total count of heroes
var countSelected; //Count of selected heroes

/* -----------
| Characters
*/
var perso = [
	["ana", 0, false, "#6F8AB3", "https://i.servimg.com/u/f48/18/06/99/75/00000031.png"],
	["ange", 0, false, "#EBE8BB", "https://i.servimg.com/u/f48/18/06/99/75/00000021.png"],
	["ashe", 0, false, "#68686A", "https://i.servimg.com/u/f48/18/06/99/75/00000026.png"],
	["baptiste", 0, false, "#58B2CD", "https://i.servimg.com/u/f48/18/06/99/75/00000024.png"],
	["bastion", 0, false, "#7B8F7A", "https://i.servimg.com/u/f48/18/06/99/75/00000013.png"],
	["birgitte", 0, false, "#8A615D", "https://i.servimg.com/u/f48/18/06/99/75/00000029.png"],
	["bouldozer", 0, false, "#DC9344", "https://i.servimg.com/u/f48/18/06/99/75/00000025.png"],
	["chacal", 0, false, "#E9BC51", "https://i.servimg.com/u/f48/18/06/99/75/00000039.png"],
  ["choper", 0, false, "#B58C51", "https://i.servimg.com/u/f48/18/06/99/75/00000041.png"],
	["d.va", 0, false, "#ED92C7", "https://i48.servimg.com/u/f48/18/06/99/75/00000010.png"],
	["doomfist", 0, false, "#84534C", "https://i.servimg.com/u/f48/18/06/99/75/00000032.png"],
	["echo", 0, false, "#9BCBF5", "https://i.servimg.com/u/f48/18/06/99/75/00000027.png"],
	["fatale", 0, false, "#9D6AA6", "https://i.servimg.com/u/f48/18/06/99/75/00000014.png"],
	["faucheur", 0, false, "#7D3F51", "https://i.servimg.com/u/f48/18/06/99/75/00000022.png"],
	["gendji", 0, false, "#96EF42", "https://i48.servimg.com/u/f48/18/06/99/75/00000036.png"],
	["hanzo", 0, false, "#B58C51", "https://i.servimg.com/u/f48/18/06/99/75/00000020.png"],
	["lúcio", 0, false, "#84C851", "https://i.servimg.com/u/f48/18/06/99/75/00000037.png"],
	["mcree", 0, false, "#B0595D", "https://i.servimg.com/u/f48/18/06/99/75/00000040.png"],
	["mei", 0, false, "#6CABEA", "https://i.servimg.com/u/f48/18/06/99/75/00000034.png"],
	["moira", 0, false, "#9672E3", "https://i.servimg.com/u/f48/18/06/99/75/00000028.png"],
	["orisa", 0, false, "#458B42", "https://i.servimg.com/u/f48/18/06/99/75/00000030.png"],
	["pharah", 0, false, "#3C7AC6", "https://i.servimg.com/u/f48/18/06/99/75/00000018.png"],
	["reinhardt", 0, false, "#93A0A4", "https://i.servimg.com/u/f48/18/06/99/75/00000017.png"],
	["sigma", 0, false, "#939FA4", "https://i.servimg.com/u/f48/18/06/99/75/00000023.png"],
	["soldat 76", 0, false, "#6A7894", "https://i.servimg.com/u/f48/18/06/99/75/00000035.png"],
	["sombra", 0, false, "#7258B8", "https://i.servimg.com/u/f48/18/06/99/75/00000033.png"],
	["symmetra", 0, false, "#8EBCCE", "https://i.servimg.com/u/f48/18/06/99/75/00000011.png"],
	["torbjörn", 0, false, "#BF746D", "https://i.servimg.com/u/f48/18/06/99/75/00000016.png"],
	["tracer", 0, false, "#D89342", "https://i.servimg.com/u/f48/18/06/99/75/00000019.png"],
	["winston", 0, false, "#A0A4BB", "https://i.servimg.com/u/f48/18/06/99/75/00000015.png"],
	["zarya", 0, false, "#E77EB5", "https://i.servimg.com/u/f48/18/06/99/75/00000038.png"],
	["zenyatta", 0, false, "#EDE581", "https://i.servimg.com/u/f48/18/06/99/75/00000012.png"]
];

window.onload = function() {
  document.getElementById("selectHero").style.display = "block";
  resetall();
  for (var i = 0; i < perso.length; i++) {
		document.getElementById("fullListOfHeroes").innerHTML += 
      '<div class="tilechar"><img src="' + perso[i][4] + '"><div class="checkboxpanel"><input id="' + perso[i][0] + '" type="checkbox" value="' + perso[i][0] + 
      '" id="' + 
      perso[i][0] + 
      '"/><label for="' + perso[i][0] + '" style="color:' + perso[i][3] + ';">' + perso[i][0] + '</label></div></div>';
		perso[i][1] = 0;
	}
}; //When page load

function resetall() {
  if (debugState === true) {debug();}
  document.getElementById("resultList").innerHTML = '';
	for (var i = 0; i < perso.length; i++) {
		perso[i][1] = 0;
    if (perso[i][2] === true) {
      document.getElementById("resultList").innerHTML += '<span>' + perso[i][1] + '</span>';
    }
	}

	tryingcnt = 0;
	persec = 0;
	diffcnt = 0;
	document.getElementById("currenthero").innerHTML = "";
	document.getElementById("diffcnt").innerHTML = "0/s";
	started = false;
}; //Reset all settings and webpage

$("#nextStep").click(function () {
  if (debugState === true) {debug();}
  countSelected = 0;
  document.getElementById("selectedList").innerHTML = '';
  document.getElementById("notselectedList").innerHTML = '';
  document.getElementById("resultList").innerHTML = '';
  for(var i = 0; i < perso.length; ++i) {
    if ($('#' + perso[i][0]).is(":checked")) {
      document.getElementById("selectedList").innerHTML += 
      '<span style="color:' + perso[i][3] + ';">' + perso[i][0] + ' ✔️</span>';
      perso[i][1] = 1;
      perso[i][2] = true;
      countSelected++;
    } else {
      document.getElementById("notselectedList").innerHTML += '<span style="color:' + perso[i][3] + '">' + perso[i][0] + '</span>';
      document.getElementById("resultList").innerHTML += '<span>' + perso[i][1] + '</span>';
      perso[i][2] = false;
    }
  }
  
  if (countSelected < (perso.length - 2)) {
    document.getElementById("selectHero").style.display = "none";
    document.getElementById("nextStep").style.display = "none";
    document.getElementById("detailsHeroes").style.display = "block";
    document.getElementById("whileHero").style.display = "block";
    document.getElementById("start").style.display = "block";
    document.getElementById("reset").style.display = "block";
  }
});

//When start button is clicked
$("#start").click(function () {
  if (debugState === true) {debug();}
  if (started === false) {
    resetall();
    
    //Counting of selected heroes
    for(var i = 0; i < perso.length; ++i) {
      if(perso[i][2] === false){charsCount++;}
    }

    if (countSelected < (perso.length - 2)) {
      document.getElementById("start").classList.add("active");
      document.getElementById("start").value = "STOP !";
      date_ob = new Date();
      started = true;
      letsgo();
    }
  } else {
    document.getElementById("start").classList.remove("active");
    document.getElementById("start").value = "C'est parti !";
    started = false;
  }
});

$("#reset").click(function () {
	resetall();
});

function formatNumber(num) {
	//Formating great numbers (Exemple : 1000000 will convert to 1.000.000)
	return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
}


let selectedhero; let tryingcnt; let difference; let diffcnt; let persec; //Threads per second
let date_ob; let nhours; let nmins; let nsecs; //Time

function letsgo() {
  if (debugState === true) {debug();}
	if (!tryingcnt || tryingcnt < 1) {
		let date_ob = new Date();
	}

	if ((typeof nsecs !== 'undefined') && (typeof tryingcnt !== 'undefined')) {
		if (nsecs != persec) {
			persec = nsecs;
			document.getElementById("diffcnt").innerHTML = + Math.abs(diffcnt - tryingcnt) + '/s';
			diffcnt = tryingcnt;
		}
	}

	var now = new Date;
	difference = (now - date_ob);

	let hours = Math.floor((difference % (60 * 60 * 1000 * 24)) / (60 * 60 * 1000) * 1);
	let mins = Math.floor(((difference % (60 * 60 * 1000 * 24)) % (60 * 60 * 1000)) / (60 * 1000) * 1);
	let secs = Math.floor((((difference % (60 * 60 * 1000 * 24)) % (60 * 60 * 1000)) % (60 * 1000)) / 1000 * 1);

	nhours = (hours < 10 ? "0" : "") + hours;
	nmins = (mins < 10 ? "0" : "") + mins;
	nsecs = (secs < 10 ? "0" : "") + secs;

	document.getElementById('hrs').firstChild.nodeValue = nhours;
	document.getElementById('mins').firstChild.nodeValue = nmins;
	document.getElementById('secs').firstChild.nodeValue = nsecs;
  
	let getRandomCase = Math.floor(Math.random() * (28 - 0) + 0);
	let random_perso = Math.floor(Math.random() * perso.length);
  
  //If character is not acquiered by the user
  if(perso[random_perso][2] === false) { 
    tryingcnt++; //Add 1 to total of threads
    document.getElementById('try').firstChild.nodeValue = formatNumber(tryingcnt); //Formating total count of threads
    
    document.getElementById("currenthero").innerHTML = perso[random_perso][0]; //Selected hero
    perso[random_perso][1]++; //Add 1 to thread of the character
    
    //Refresh list of counts
    document.getElementById("resultList").innerHTML = '';
    for(var i = 0; i < perso.length; ++i) {
      if(perso[i][2] === false) {
        document.getElementById("resultList").innerHTML += '<span>' + perso[i][1] + '</span>';
      }
    }
  }
  if (started === true && tryingcnt < maxThreads) {
      setTimeout(function () {
        var now = new Date;
        letsgo();
      }, 0);
    } else {
      document.getElementById("start").classList.remove("active");
      document.getElementById("start").value = "C'est parti !";
      started = false;
      if (tryingcnt === maxThreads) {
        selectedhero = perso[random_perso][0];
        document.getElementById("currenthero").style.display = "none";
        document.getElementById("result").style.display = "block";
        document.getElementById("resultlabel").innerHTML = selectedhero + " !";
      }
    }
}

function debug() {
	document.getElementById("debug").innerHTML = perso;
}
              
            
!
999px

Console