This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
morse-converter-web/js/web/web.js

62 lines
1.7 KiB
JavaScript

var dur = 150
var drawerStatus = true
var wm = 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(wm){
$("#output").text(encodeWrittenMorseManager(input))
} 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(wm){
$('#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(){
wm = true
$("#normalMorse").css({"color":"#000000"})
$("#writtenMorse").css({"color":"#03a9f4"})
drawer()
}
function normalMorse(){
wm = false
$("#normalMorse").css({"color":"#03a9f4"})
$("#writtenMorse").css({"color":"#000000"})
drawer()
}
function about(){
$("body").fadeOut(dur, function callback(){
window.location = "http://marcel-kapfer.de/writtenmorse"
})
}