-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sogoagain/issue1_optionCharset
Add the option to set the characters to use when scrambled
- Loading branch information
Showing
7 changed files
with
15,920 additions
and
6,281 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&display=swap" rel="stylesheet"> | ||
<style> | ||
body {font-family: 'Roboto Mono', monospace; letter-spacing: 5px;} | ||
#container {display: flex; flex-direction: column; justify-content: center; text-align: center;} | ||
</style> | ||
<title>Scrambling Text Example</title> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<h1 id="text"></h1> | ||
</div> | ||
<script src="./scrambling-text.js"></script> | ||
<script> | ||
const TEXTS = [ | ||
'- Friedrich Nietzsche -', | ||
'The doer alone learneth.', | ||
'There are no facts, only interpretations.', | ||
]; | ||
|
||
const scrambler = new window.Scrambler(); | ||
const handleScramble = (text) => { | ||
document.getElementById('text').innerHTML = text; | ||
} | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&display=swap" rel="stylesheet"> | ||
<style> | ||
body { | ||
font-family: 'Roboto Mono', monospace; | ||
letter-spacing: 5px; | ||
} | ||
|
||
#container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
text-align: center; | ||
} | ||
</style> | ||
<title>Scrambling Text Example</title> | ||
</head> | ||
|
||
<body> | ||
<div id="container"> | ||
<h1 id="text"></h1> | ||
</div> | ||
<script src="./scrambling-text.js"></script> | ||
<script> | ||
const TEXTS = [ | ||
'- Friedrich Nietzsche -', | ||
'The doer alone learneth.', | ||
'There are no facts, only interpretations.', | ||
]; | ||
|
||
let i = 0; | ||
function printText() { | ||
scrambler.scramble(TEXTS[i % TEXTS.length], handleScramble); | ||
setTimeout(printText, 5000); | ||
i++; | ||
const scrambler = new window.Scrambler(); | ||
const handleScramble = (text) => { | ||
document.getElementById('text').innerHTML = text; | ||
} | ||
|
||
let i = 0; | ||
function printText() { | ||
const targetText = TEXTS[i % TEXTS.length]; | ||
if (i == 2) { | ||
scrambler.scramble(targetText, handleScramble, { | ||
charactersToUseWhenScrambling: Scrambler.CHARACTERS.ALPHABET, | ||
}); | ||
} else { | ||
scrambler.scramble(targetText, handleScramble); | ||
} | ||
printText(); | ||
</script> | ||
</body> | ||
setTimeout(printText, 5000); | ||
i++; | ||
} | ||
printText(); | ||
</script> | ||
</body> | ||
|
||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.