The [TOOLFK] online Morse code translation and conversion tool to be recommended in this article provides an online Morse code conversion function.
Website name: ToolFk
website link: https://www.toolfk.com/Tool
link: https://www.toolfk.com/tool-online-morse
website link: https://www.toolfk.com/Tool
link: https://www.toolfk.com/tool-online-morse
Code teaching
This tool [Online Morse Code Translation and Conversion Tool] depends on the following plugins
https://github.com/hustcc/xmorse
STEP 1 interface
STEP2
The front-end code of online Morse code is as follows
var sourceArea = toolfk.create_codeMirror('code'); var targetArea = toolfk.create_codeMirror('result'); sourceArea.setValue(DEFAULT_VALUE); $(".btn-encode").click(function(){ toolfk.encode_morse({ source:sourceArea, target:targetArea }); }); $(".btn-decode").click(function(){ toolfk.decode_morse({ source:sourceArea, target:targetArea }); }); $(".copy-code").click(function(){ toolfk.code_code({ source:sourceArea, target:targetArea, }); });
decode_morse:function(options){
if (toolfk.beautify_default.beautify_in_progress) {
return;
}
var opts = $.extend({},toolfk.beautify_default, options);
var source = opts.source.getValue();
if(source==''){
return layer.msg(NOT_EMPTY);
}
toolfk.beautify_default.beautify_in_progress = true;
var index = layer.load();
var value = xmorse.decode(source);
if(!value){
value = DEFAULT_VALUE;
}
opts.target.setValue(value);
layer.close(index);
toolfk.report('morse_decode',value);
toolfk.beautify_default.beautify_in_progress = false;
},
留言
發佈留言