HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!-- 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>
@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;
}
"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;
}
Also see: Tab Triggers