Last active
March 15, 2021 22:14
-
-
Save TechnoSparks/b566db48c504b5d8e73214076cf1a495 to your computer and use it in GitHub Desktop.
This file contains 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
<section> | |
<textarea id="container" rows="10" style="width: 99%" readonly></textarea><br> | |
<button onclick="heartgen()">Generate & Copy</button> | |
</section> | |
<script> | |
function randomiser(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1) + min); //The maximum is inclusive and the minimum is inclusive | |
} | |
function copy() { | |
var container = document.getElementById("container"); | |
container.focus(); | |
container.select(); | |
container.setSelectionRange(0, 1000); | |
document.execCommand("copy"); | |
} | |
function heartgen() { | |
var container = document.getElementById("container"); | |
var heart = ["β€οΈ","π§‘","π","π","π","π","π€","β£οΈ","π","π","π","π","π","π","π"]; | |
var hs = heart.length - 1; | |
var hearts = ""; | |
// get max chars between 185-200 | |
var curMax = randomiser(185, 200); | |
for(var i=0; i<curMax-1; i++) { | |
hearts += heart[randomiser(0, hs)]; | |
} | |
container.innerHTML = hearts; | |
copy(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment