JS in own file; Ported Decode writtenMorse engine; design fixes

This commit is contained in:
mmk2410 2015-04-07 22:34:24 +02:00
parent 90fdd71c88
commit bac46e47ac
5 changed files with 318 additions and 47 deletions

57
js/web/web.js Normal file
View file

@ -0,0 +1,57 @@
var dur = 150
var drawerStatus = true
var writtenMorse = true
function drawer(){
if(window.innerWidth <= 1400){
if(drawerStatus){
$('.drawer').show('slide', {direction: 'left'}, dur)
$('.actionbar').before("<div class='overlay' onclick='drawer()'></div>")
$('.overlay').animate({"opacity":"0.4"}, dur)
drawerStatus = false
} else {
$('.drawer').hide('slide', {direction: 'left'}, dur)
$('.overlay').animate({"opacity":"0"}, dur, function callback (){
$('.overlay').remove()
})
drawerStatus = true
}
}
}
function encode(){
var input = $('#textarea').val()
if(writtenMorse){
$("#output").text("The normal morse engine is not ported jet.")
} else {
//TODO port the normal morse decode engine
$("#output").text("The normal morse engine is not ported jet.")
}
$('#outputcard').fadeIn(dur)
}
function decode(){
var input = $('#textarea').val()
if(writtenMorse){
$('#output').text(decodeWrittenMorseManager(input))
} else {
//TODO port the normal morse decode engine
$("#output").text("The normal morse engine is not ported jet.")
}
$('#outputcard').fadeIn(dur)
}
function writtenMorse(){
writtenMorse = true
drawer()
}
function normalMorse(){
writtenMorse = false
drawer()
}
function about(){
$("body").fadeOut(dur, function callback(){
window.location = "http://marcel-kapfer.de/writtenmorse"
})
}