Replace carriage returns (how did those randomly get in there?)

This commit is contained in:
Daniel Sinn
2015-11-30 01:15:06 -05:00
parent bd261df32f
commit 756ae89a51
+10 -10
View File
@@ -266,7 +266,7 @@ $('.jsResetSection').on('click', function () {
steak: '3.582', steak: '3.582',
sting: '3.592', sting: '3.592',
vector: '3.595', vector: '3.595',
beats: '3.600' beats: '3.600'
}, },
codes = { codes = {
'.-': 'a', '.-': 'a',
@@ -286,7 +286,7 @@ $('.jsResetSection').on('click', function () {
'...': 's', '...': 's',
'-': 't', '-': 't',
'...-': 'v', '...-': 'v',
'-..-': 'x' '-..-': 'x'
}, },
codeRegex = new RegExp(' *(' + Object.keys(codes).join('|').replace(/\./g, '\\.') + ')(?![\.-]) *', 'g'), codeRegex = new RegExp(' *(' + Object.keys(codes).join('|').replace(/\./g, '\\.') + ')(?![\.-]) *', 'g'),
$rows = {}, $rows = {},
@@ -295,7 +295,7 @@ $('.jsResetSection').on('click', function () {
for (var word in freqs) { for (var word in freqs) {
var $row = $('<tr><td>' + word + '</td><td>' + freqs[word] + '</td></tr>'); var $row = $('<tr><td>' + word + '</td><td>' + freqs[word] + '</td></tr>');
$table.append($row); $table.append($row);
$rows[word + word] = $row; // Concat to handle the wrap around $rows[word + word] = $row; // Concat to handle the wrap around
} }
$('#morseInput').on('keyup', function () { $('#morseInput').on('keyup', function () {
@@ -309,7 +309,7 @@ $('.jsResetSection').on('click', function () {
regexes.push(new RegExp( regexes.push(new RegExp(
line.replace(codeRegex, codeRegexCallback) line.replace(codeRegex, codeRegexCallback)
.replace(codeRegex, codeRegexCallback) .replace(codeRegex, codeRegexCallback)
)); ));
}); });
console.log(regexes); console.log(regexes);
@@ -318,17 +318,17 @@ $('.jsResetSection').on('click', function () {
$.each(regexes, function (i, regex) { $.each(regexes, function (i, regex) {
if (!regex.test(word)) { if (!regex.test(word)) {
matchAll = false; matchAll = false;
return false; return false;
} }
}); });
$rows[word].toggleClass('inactive', !matchAll); $rows[word].toggleClass('inactive', !matchAll);
} }
}); });
function codeRegexCallback(match, code) { function codeRegexCallback(match, code) {
return codes[code]; return codes[code];
} }
})(); })();
(function () { (function () {