本文要推荐的[TOOLFK]在线摩斯电码翻译转换工具 ,提供摩斯电码在线转换功能。

網站名稱:ToolFk
網站鏈結:https://www.toolfk.com/
工具链接:https://www.toolfk.com/tool-online-morse

代码教學

本工具[在线摩斯电码翻译转换工具 ]依赖以下插件

https://github.com/hustcc/xmorse

STEP 1 界面

STEP2

在线摩斯电码前端代码如下

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;
    },