Skip to content

Commit

Permalink
Merge pull request #1 from artemisbot/morse-fixes
Browse files Browse the repository at this point in the history
Morse fixes
  • Loading branch information
tlwr authored Feb 4, 2017
2 parents b9f1cf9 + a30babc commit 718e1dc
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 18 deletions.
64 changes: 63 additions & 1 deletion build/prod/cyberchef.htm

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion build/prod/index.html

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion build/prod/scripts.js

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions src/js/operations/MorseCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ var MorseCode = {
var dash = format[0];
var dot = format[1];

var letter_delim = MorseCode.OPTION_TABLE[args[1]];
var word_delim = MorseCode.OPTION_TABLE[args[2]];
var letterDelim = MorseCode.OPTION_TABLE[args[1]];
var wordDelim = MorseCode.OPTION_TABLE[args[2]];

input = input.split(/\r?\n/);
input = Array.prototype.map.call(input, function(line) {
Expand Down Expand Up @@ -122,16 +122,16 @@ var MorseCode = {
switch(match) {
case "<dash>": return dash;
case "<dot>": return dot;
case "<ld>": return letter_delim;
case "<wd>": return word_delim;
case "<ld>": return letterDelim;
case "<wd>": return wordDelim;
}
}
);

return input;
},


/**
* From Morse Code operation.
*
Expand All @@ -155,27 +155,26 @@ var MorseCode = {
reverseTable();
}

var letter_delim = MorseCode.OPTION_TABLE[args[0]];
var word_delim = MorseCode.OPTION_TABLE[args[1]];
var letterDelim = MorseCode.OPTION_TABLE[args[0]];
var wordDelim = MorseCode.OPTION_TABLE[args[1]];

input = input.replace(/-|_|dash/ig, "<dash>")
input = input.replace(/\.|dot/ig, "<dot>")
input = input.replace(/-|_|dash/ig, "<dash>");
input = input.replace(/\.|dot/ig, "<dot>");

var words = input.split(word_delim);
var words = input.split(wordDelim);
words = Array.prototype.map.call(words, function(word) {
var signals = word.split(letter_delim);
var signals = word.split(letterDelim);

var letters = signals.map(function(signal) {
return reversedTable[signal];
});

var word = letters.join("");
return word;
return letters.join("");
});
words = words.join(" ");

return words;
};
})(),

};
43 changes: 43 additions & 0 deletions src/static/stats.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
<<<<<<< HEAD
203 source files
<<<<<<< HEAD
<<<<<<< HEAD
104401 lines
size

136 JavaScript source files
95311 lines
3.4M size
=======
104403 lines
4.0M size

136 JavaScript source files
95313 lines
3.5M size
>>>>>>> master
=======
104466 lines
4.0M size

136 JavaScript source files
95316 lines
3.4M size
>>>>>>> master
=======
211 source files
114840 lines
4.3M size

141 JavaScript source files
105680 lines
3.7M size
>>>>>>> master

83 third party JavaScript source files
86258 lines
3.0M size

58 first party JavaScript source files
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
18934 lines
729K size
=======
18936 lines
728K size
>>>>>>> master
=======
18939 lines
724K size
>>>>>>> master
=======
19422 lines
732K size
>>>>>>> master

3.4M uncompressed JavaScript size
1.9M compressed JavaScript size
Expand Down

0 comments on commit 718e1dc

Please sign in to comment.