made with esnextbin
Last active
May 12, 2016 13:11
-
-
Save cbenz/5dd4305034f4008c758ca22269347088 to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<h1>Bruno simulator</h1> | |
<p>Type some text then read the version of Bruno!</p> | |
<label>Text: <input id="text" type="text"></label> | |
<p id="result"></p> | |
</body> | |
</html> |
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
const cedilla = "̧" | |
const input = document.getElementById("text") | |
const result = document.getElementById("result") | |
input.addEventListener('input', (event) => { | |
const text = event.target.value | |
const newText = text.split('').map( | |
(char) => Math.random() > 0.2 ? char + cedilla : char | |
).join('').normalize('NFC') | |
result.innerHTML = newText | |
}) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0" | |
} |
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
"use strict"; | |
var cedilla = "̧"; | |
var input = document.getElementById("text"); | |
var result = document.getElementById("result"); | |
input.addEventListener('input', function (event) { | |
var text = event.target.value; | |
var newText = text.split('').map(function (char) { | |
return Math.random() > 0.2 ? char + cedilla : char; | |
}).join('').normalize('NFC'); | |
result.innerHTML = newText; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment