Skip to content

Instantly share code, notes, and snippets.

@TechnoSparks
Last active March 15, 2021 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TechnoSparks/b566db48c504b5d8e73214076cf1a495 to your computer and use it in GitHub Desktop.
Save TechnoSparks/b566db48c504b5d8e73214076cf1a495 to your computer and use it in GitHub Desktop.
<section>
<textarea id="container" rows="10" style="width: 99%" readonly></textarea><br>
<button onclick="heartgen()">Generate &amp; 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