added undefined error catch

This commit is contained in:
Kevin Froman 2017-04-04 10:19:47 -05:00
parent 2a93d293f8
commit 9b7ac960cc
No known key found for this signature in database
GPG Key ID: 36698DB39DA54065
2 changed files with 11 additions and 3 deletions

View File

@ -24,7 +24,7 @@
<link rel="stylesheet" href="./bootstrap.min.css">
<link rel="stylesheet" href="./bootstrap-theme.min.css">
<link rel="stylesheet" href="./font-awesome.min.css">
<link rel='stylesheet' href='./theme.min.css'>
<link rel='stylesheet' href='./theme.css'>
<script src="./jquery.min.js"></script>
<script src="./bootstrap.min.js"></script>
<script src="./clipboard.min.js"></script>
@ -34,7 +34,7 @@
</head>
<body>
<a href="https://github.com/beardog108/snow10/"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<div class="modal fade" id="outputModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal" id="outputModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -77,7 +77,7 @@
<input type='password' id='confirmPass' placeholder='Confirm password' class='dataItem'>
<br>
</span>
<div class="btn-group" role="group" aria-label="...">
<div class="btn-group" role="group" aria-label="..." id='encodeDecodeArea'>
<button type="button" class="btn btn-primary" id="encode">Encode <i class='fa fa-lock'></i></button>
<button type="button" class="btn btn-primary" id="decode">Decode <i class='fa fa-unlock'></i></button>
</div>

View File

@ -136,10 +136,14 @@ function verifyPass(mode)
}
$('#encode').click(function(){
$('#encodeDecodeArea').css('display', 'none');
go('encode');
$('#encodeDecodeArea').css('display', 'inline-block');
});
$('#decode').click(function(){
$('#encodeDecodeArea').css('display', 'none');
go('decode');
$('#encodeDecodeArea').css('display', 'inline-block');
});
function go(mode) {
@ -178,6 +182,10 @@ function go(mode) {
if(split[i] == one || split[i] == zero)
sanitized = sanitized + split[i]
var output = decodeURIComponent(binToText(sanitized));
if (output === 'undefined'){
showError('Could not decode message. Maybe there wasn\'t one?');
return false;
}
if ($('#useEncrypt').is(':checked'))
{
if (verifyPass('decrypt'))