VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-form/demo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-form/demo/blockly.js
(function () {
    var _ = absol._;
    var $ = absol.$;
    var $$ = absol.$$;
    _({
        tag: 'flexiconbutton',
        props: {
            text: 'run', icon: 'span.mdi.mdi-play'
        }, on: {
            click: function () {
                runScript();
            }
        }
    }).addTo(document.body);
    var editor = new absol.sclang.SCBlocklyEditor({
        style: {
            height: 1000
        }
    });


    function runScript() {
        ast = editor.getAST();
        var instance = new absol.sclang.SCProgramInstance(ast, {
            Math: Math, absol: absol, Date: Date, Object: Object
        });
        instance.exec();
        var makeData = instance.global.get('makeData');
        console.log(instance.global)
        var now = new Date();
        console.log(makeData(now));
    }

    editor.getView().addTo(document.body);
    editor.addTypeDescriptors(require('./sclang_sample/type_descriptors.js'));

    /*
     console.log('===================');
     console.log(editor.typeMng.detectTypeDescriptorOf('12'));
     console.log(editor.typeMng.detectTypeDescriptorOf('number'));
     console.log(editor.typeMng.detectTypeDescriptorOf('-4'));
     console.log(editor.typeMng.detectTypeDescriptorOf('14'));

     console.log('===================');
     */

    var ast = require('./blockly_sample.js');
    editor.setAST(absol.copyJSVariable(ast));


    _('<h3>preview</h3>').addTo(document.body);
    var editor2 = new absol.sclang.SCBlocklyEditor({
        readOnly: true
    });
    editor2.getView().addTo(document.body).addStyle('pointer-events', 'none');
    editor2.addTypeDescriptors(require('./sclang_sample/type_descriptors.js'));

    _('<h3>ast</h3>').addTo(document.body);
    var demo = _('pre').addTo(document.body);
    editor.on('ast_change', () => {
        editor2.setAST(editor.getAST());
        demo.innerHTML = absol.generateJSVariable(editor.getAST());
    });

    setTimeout(() => {
        dispatchEvent(new Event('resize'));
    }, 100);

})();

VaKeR 2022