Skip to content

Online implement JavaScript landscaping (format), compression, encryption, decryption, obfuscation tool toolfk online Programmer toolbox

hubs edited this page Dec 28, 2018 · 1 revision

  This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports   BarCode Barcode generated online ,  QueryList collector ,  PHP code is run online ,  PHP confusion, encryption, decryption ,  Python code is run online JavaScript online operation ,YAML formatting tools , HTTP simulation query tool HTML online toolbox JavaScript online Toolbox ,CSS online toolbox JSON online toolbox unixtime timestamp conversion Base64 / the URL of / native2ascii conversion CSV conversion kit XML online toolbox the WebSocket online tools Markdown online toolbox Htaccess2nginx conversionHex conversion online online encryption toolkit ,online pseudo-original tools online APK decompile online web screenshot tool online random password generation online generate two-dimensional code qrcode online Crontab Expression Builder ,the online short URL Generator Online calculator tool . And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.

Site name: ToolFk
website links: https://www.toolfk.com/
Tools link: https://www.toolfk.com/tool-format-javascript

? Teaching Code

This tool [Online JavaScript landscaping (format) / encryption / decryption / confused] depends on its Github Codemirror ,? address: https://github.com/codemirror/CodeMirror, encryption, decryption to http: // dean .edwards.name / packer /  library, use landscaping to csso-browser library,https://github.com/css/csso    . Using the following code

STEP 1

STEP 2

? THE CORE CODE IS AS FOLLOWS

beautify_start: 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;
    if (opts.language === 'html') {
        output = beautifier.html (source, opts);
    } Else if (opts.language === 'css') {
        output = beautifier.css (source, opts);
    } Else {
        if (opts.detect_packers) {
            source = toolfk.beautify_unpacker_filter (source);
        }
        output = beautifier.js (source, opts);
    }
    opts.target.setValue (output);
    toolfk.report ( 'beautify', output);
    toolfk.beautify_default.beautify_in_progress = false;
},
pack_js: 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 packer = new Packer;
    if (opts.is_base64) {
        var output = packer.pack (source, 1, opts.is_shrink);
    } Else {
        var output = packer.pack (source, 0, opts.is_shrink);
    }
    opts.target.setValue (output);
    toolfk.report ( 'compress', output);
    toolfk.beautify_default.beautify_in_progress = false;
},
dec_pack: 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;
    try {
        eval ( 'var value = String' + source.slice (4));
        opts.target.setValue (value);
        toolfk.report ( 'deciphering-compress', value);
    } Catch (e) {
        layer.msg (TEXT_ERROR);
    }
    toolfk.beautify_default.beautify_in_progress = false;
},
dec_pack_shrink: 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;
    try {
        eval ( 'var value = String' + source.slice (4));
        var source = toolfk.beautify_unpacker_filter (value);
        output = beautifier.js (source, opts);
        opts.target.setValue (output);
        toolfk.report ( 'decode-code', output);
    } Catch (e) {
        layer.msg (TEXT_ERROR);
    }
    toolfk.beautify_default.beautify_in_progress = false;
},
code_code: function (options) {
    if (toolfk.beautify_default.beautify_in_progress) {
        return;
    }
    var opts = $ .extend ({}, toolfk.beautify_default, options);
    var target = opts.target.getValue ();
    if (target == '') {
        return layer.msg (NOT_EMPTY);
    }
    toolfk.beautify_default.beautify_in_progress = true;
    new ClipboardJS ( '. copy-code', {
        text: function (trigger) {
            layer.msg (COPY_SUCC);
            return target;
        }
    });
    toolfk.beautify_default.beautify_in_progress = false;
},
/ * Css * /
purify_css: 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 value = toolfk.purify_encode (source) .replace (/ \} / g, '} \ n');
    opts.target.setValue (value);
    toolfk.report ( 'purify_css', value);
    toolfk.beautify_default.beautify_in_progress = false;
},
purify_encode: function (text) {
    var val = text;
    val = val.replace (/ \ / \ * (| \ n) * \ * \ // g, ''.?); // remove comments
    val = val.replace (/ ^ \ s + | \ s + $ / g, ''); // Clear both spaces
    val = val.replace (/ (:) \ s + / g, '$ 1'); // plurality of spaces such as the removal of the colon width: 100px => width: 100px
    val = val.replace (/ \ s {2,} / g, ''); // remove extra spaces, such as two or more margin: 10px 20px 30px => margin: 10px 20px 30px
    val = val.replace (/, \ s + | \ s +, / g, ','); // remove extra spaces, such as shared when a plurality of patterns h1, h2, h3 => h1, h2, h3
    val = val.replace (/; {2,} |; \ s + / g, ';'); // remove excess rear space as a plurality of semi-colon, or semicolon width: 200px ;; height: 100px => width: 200px; height: 100px
    val = val.replace (/ \ s * \ {\ s * / g, '{'); // remove excess space behind the selectors such as div {height: 100px} => div {height: 100px}
    val = val.replace (/ \ s *} \ s * / g, '}'); // remove extra spaces, such as in front of the selector div {height: 100px} a {} => div {height: 100px} a { }
    val = val.replace (/ [\ n \ t \ f \ r] / g, ''); // removing wrap, tabs, page breaks, the transport
    val = val.replace (/;} / g, '}');
    return val;
},
optimize_css: 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 lastResult = csso.minify (source, {
        restructure: true
    });
    var value = lastResult.css;
    opts.target.setValue (value);
    toolfk.report ( 'optimize_css', value);
    toolfk.beautify_default.beautify_in_progress = false;
},

It is worth a try for three reasons:

  1. Integrate various programmers often used in development and testing tools.

  2. Simple and beautiful atmosphere of the site pages

  3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service

  4. Also recommend its sister network  www.videofk.com  video download Toolbox 

This link: http://www.hihubs.com/article/366

Clone this wiki locally