IDE/IDE/assets/js/uiop.js
//def to convert blockly to various codes
def to convert blockly to various codes
def to convert blockly to various codes
function convertToPro(proLang)
{
    var code;
    var lang;
    lang=proLang;
    switch(lang)
           {
           case "Java Script":
           {      
      window.LoopTrap = 1000;
      Blockly.JavaScript.INFINITE_LOOP_TRAP = 'if(--window.LoopTrap == 0) throw "Infinite loop.";\n';        
      Blockly.JavaScript.addReservedWords('code');
      code = Blockly.JavaScript.workspaceToCode(workspacePlayground);
      Blockly.JavaScript.INFINITE_LOOP_TRAP = null;
     document.getElementById('code_js').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";     
           }break;
            case "Python":
           {
      code = Blockly.Python.workspaceToCode(workspacePlayground);
        document.getElementById('code_py').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";        
           }break;
           case "PHP":
           {
      code = Blockly.PHP.workspaceToCode(workspacePlayground);
         document.getElementById('code_php').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";      
           }break;               
           case "Lua":
           {
      code = Blockly.Lua.workspaceToCode(workspacePlayground);
                 document.getElementById('code_lua').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";     
           }break;         
            case "Dart":
           {
      code = Blockly.Dart.workspaceToCode(workspacePlayground);
         document.getElementById('code_dart').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";     
           }break;   
        case "XML":
           {
      var xmlDom = Blockly.Xml.workspaceToDom(workspacePlayground);
      code = Blockly.Xml.domToPrettyText(xmlDom);
          document.getElementById('code_xml').innerHTML="<pre><code><textarea style='width:100%;height:1000px' readonly>"+code+"</textarea></pre></code>";     
           }break;  
           default:
           {
           }break;
           }
}
function convertToPro ( proLang ) { var code ; var lang ; lang = proLang ; switch ( lang ) { case "Java Script" : { window . LoopTrap = 1000 ; Blockly . JavaScript . INFINITE_LOOP_TRAP = 'if(--window.LoopTrap == 0) throw "Infinite loop.";\n' ; Blockly . JavaScript . addReservedWords ( 'code' ) ; code = Blockly . JavaScript . workspaceToCode ( workspacePlayground ) ; Blockly . JavaScript . INFINITE_LOOP_TRAP = null ; document . getElementById ( 'code_js' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; case "Python" : { code = Blockly . Python . workspaceToCode ( workspacePlayground ) ; document . getElementById ( 'code_py' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; case "PHP" : { code = Blockly . PHP . workspaceToCode ( workspacePlayground ) ; document . getElementById ( 'code_php' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; case "Lua" : { code = Blockly . Lua . workspaceToCode ( workspacePlayground ) ; document . getElementById ( 'code_lua' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; case "Dart" : { code = Blockly . Dart . workspaceToCode ( workspacePlayground ) ; document . getElementById ( 'code_dart' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; case "XML" : { var xmlDom = Blockly . Xml . workspaceToDom ( workspacePlayground ) ; code = Blockly . Xml . domToPrettyText ( xmlDom ) ; document . getElementById ( 'code_xml' ) . innerHTML = "<pre><code><textarea style='width:100%;height:1000px' readonly>" + code + "</textarea></pre></code>" ; } break ; default : { } break ; } }
def to convert blockly to various codes
def to convert blockly to various codes
//alert(lang); //alert(code); //alert(code); //alert(code); //alert(code); //alert(code); /**/