Skip to content

Commit

Permalink
yippee
Browse files Browse the repository at this point in the history
  • Loading branch information
katsaii committed Feb 10, 2024
1 parent c01ab60 commit 61a76b6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ <h1>Sick of brands?</h1>
ads or surveillance</p>
<ul>
<li><a href="./word-count.html">word counter</a></li>
<li><a href="./morse-code.html">morse code encoder/decoder</a></li>
</ul>
<p>view the JavaScript code <a href="https://github.com/katsaii/sob/blob/main/sob.js">here</a></p>
12 changes: 9 additions & 3 deletions morse-code.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
<a href="./index.html">&lt;&lt; back</a>
<p>paste text in the box below and then click one of the buttons</p>
<textarea id="src" cols="80" rows="10" placeholder="input text here"></textarea>
<ul>
<li><code>a <b>dit</b> (.) has a signal length of 1, a <b>dah</b> has a signal length of 3</code></li>
<li><code>abnormal signal lengths are written directly as a plain hexadecimal digit</code></li>
<li><code>typically all non-word, non-letter pauses last a single bit, but in some cases a signal length of 0 indicates an extended pause</code></li>
</ul>
<hr>
<label for="lang-select">choose a morse code encoding type:</label>
<select id="lang-select">
<option value="international">international</option>
<option value="international-non-latin">international + non-latin extensions</option>
<option value="american">american</option>
<option value="international">international (ITU)</option>
<option value="international-non-latin">international (ITU) + non-latin extensions</option>
<option value="american">american (Morse)</option>
<option value="continental">continental (Gerke)</option>
</select>
<br>
<input type="checkbox" id="check-numbers" checked />
Expand Down
5 changes: 5 additions & 0 deletions morse-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ const getCharSets = () => {
case "american":
charSets.push(Sob.morseCharsAmerican);
break;
case "continental":
charSets.push(Sob.morseCharsContinental);
break;
}
if (getOption("numbers")) {
if (lang == "american") {
charSets.push(Sob.morseCharsNumbersAmerican);
} else if (lang == "continental") {
charSets.push(Sob.morseCharsNumbersContinental);
} else {
charSets.push(Sob.morseCharsNumbers);
}
Expand Down
35 changes: 28 additions & 7 deletions sob.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,30 @@ Sob.morseCharsInternational = [
];

Sob.morseCharsAmerican = [
["A", ".2"], ["B", "2..."], ["C", "..0."],
["D", "2.."], ["E", "."], ["F", ".2."],
["G", "22."], ["H", "...."], ["I", ".."],
["J", "2.2."], ["K", "2.2"], ["L", "4"],
["M", "22"], ["N", "2."], ["O", ".0."],
["A", ".2"], ["B", "2..."], ["C", "..0."],
["D", "2.."], ["E", "."], ["F", ".2."],
["G", "22."], ["H", "...."], ["I", ".."],
["J", "2.2."], ["K", "2.2"], ["L", "4"],
["M", "22"], ["N", "2."], ["O", ".0."],
["P", "....."], ["Q", "..2."], ["R", ".0.."],
["S", "..."], ["T", "2"], ["U", "..2"],
["V", "...2"], ["W", ".22"], ["X", ".2.."],
["S", "..."], ["T", "2"], ["U", "..2"],
["V", "...2"], ["W", ".22"], ["X", ".2.."],
["Y", "..0.."], ["Z", "...0"],
];

Sob.morseCharsContinental = [
["A", ".-"], ["Ä", ".-.-"], ["B", "-..."],
["C", "-.-."], ["CH", "----"], ["D", "-.."],
["E", "."], ["F", "..-."], ["G", "--."],
["H", "...."], ["I", ".."], ["J", ".."],
["K", "-.-"], ["L", ".-.."], ["M", "--"],
["N", "-."], ["O", ".-..."], ["Ö", "---."],
["P", "....."], ["Q", "--.-"], ["R", ".-."],
["S", "..."], ["T", "-"], ["U", "..-"],
["Ŭ", "..--"], ["V", "...-"], ["W", ".--"],
["X", "..-..."], ["Y", "--..."], ["Z", ".--.."],
];

Sob.morseCharsNonLatin = [
["À", ".--.-"], ["Ä", ".-.-"], ["Å", ".--.-"],
["Ą", ".-.-"], ["Æ", ".-.-"], ["Ć", "-.-.."],
Expand Down Expand Up @@ -181,6 +194,14 @@ Sob.morseCharsNumbersAmerican = [
["9", "2..2"], ["0", "B"],
];

Sob.morseCharsNumbersContinental = [
["1", ".--."], ["2", "..-.."],
["3", "...-."], ["4", "....-"],
["5", "---"], ["6", "......"],
["7", "--.."], ["8", "-...."],
["9", "-..-"], ["0", "B"],
];

Sob.morseCharsPunctuation = [
[".", ".-.-.-"], [",", "--..--"], ["?", "..--.."],
["'", ".----."], ["/", "-..-."], ["(", "-.--."],
Expand Down

0 comments on commit 61a76b6

Please sign in to comment.