changed encode and decode to be 2 seperate buttons instead of 'go' and a setting.
This commit is contained in:
parent
2c146fef1a
commit
546900bcdb
@ -55,14 +55,19 @@
|
||||
<br><br>
|
||||
<label>Use Encryption <input type='checkbox' id='useEncrypt' checked></label>
|
||||
<br><br>
|
||||
<div id='one'><button id='toggle' class='btn btn-primary'>Encode Mode <i class='fa fa-lock'></i></button></div>
|
||||
<span id='encryptArea'>
|
||||
<input type='password' id='password' placeholder='Encryption password' class='dataItem'>
|
||||
<br>
|
||||
<input type='password' id='confirmPass' placeholder='Confirm password' class='dataItem'>
|
||||
<br>
|
||||
</span>
|
||||
<button id='go' class='btn btn-success btn-lg dataItem'>Go</button>
|
||||
<!--<div id='one'><button id='toggle' class='btn btn-primary'>Encode Mode <i class='fa fa-lock'></i></button></div>-->
|
||||
<div class="btn-group" role="group" aria-label="...">
|
||||
<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>
|
||||
<br>
|
||||
<!--<button id='go' class='btn btn-success btn-lg dataItem'>Go</button>-->
|
||||
</div>
|
||||
</div>
|
||||
<footer class='center'>made with <i class='fa fa-heart'></i> by <a href='https://chaoswebs.net/'>Beardog</a></footer>
|
||||
|
35
main.js
35
main.js
@ -43,29 +43,11 @@ $('#modalClose').click(function(){
|
||||
$('#copyFeedback').css('display', 'none');
|
||||
});
|
||||
|
||||
window.snowMode = 'encode';
|
||||
|
||||
$("#output").on("click", function () {
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
$('#toggle').click(function(){
|
||||
|
||||
if (window.snowMode == 'encode')
|
||||
{
|
||||
window.snowMode = 'decode';
|
||||
$('#toggle').html("Decode Mode <i class='fa fa-unlock'></i>");
|
||||
$('#confirmPass').css('display', 'none');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.snowMode = 'encode';
|
||||
$('#toggle').html("Encode Mode <i class='fa fa-lock'></i>");
|
||||
$('#confirmPass').css('display', 'inline');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#useZeroWidthCharacters').click(function(){
|
||||
|
||||
if (zero == w_zero)
|
||||
@ -100,7 +82,7 @@ function textToBin(text) {
|
||||
for (var i = 0;i < length; i++) {
|
||||
var bin = text[i].charCodeAt().toString(2);
|
||||
output.push(Array(8-bin.length+1).join("0") + bin);
|
||||
}
|
||||
}
|
||||
return output.join('');
|
||||
}
|
||||
|
||||
@ -134,7 +116,14 @@ function verifyPass(mode)
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#go').click(function(){
|
||||
$('#encode').click(function(){
|
||||
go('encode');
|
||||
});
|
||||
$('#decode').click(function(){
|
||||
go('decode');
|
||||
});
|
||||
|
||||
function go(mode) {
|
||||
var output = '';
|
||||
|
||||
var input = $('#text').val();
|
||||
@ -142,8 +131,8 @@ $('#go').click(function(){
|
||||
if (input == '') { return false; }
|
||||
|
||||
|
||||
// If we're encoding:
|
||||
if (window.snowMode == 'encode')
|
||||
// If we're encoding:
|
||||
if (mode == 'encode')
|
||||
{
|
||||
// If we should use encryption, encrypt first:
|
||||
if ($('#useEncrypt').is(':checked'))
|
||||
@ -184,7 +173,7 @@ $('#go').click(function(){
|
||||
$('#output').val(output.toString());
|
||||
}
|
||||
$('#outputModal').modal();
|
||||
});
|
||||
}
|
||||
|
||||
$('#clearInputButton').click(function(){
|
||||
$('#text').val('');
|
||||
|
Loading…
Reference in New Issue
Block a user