javascript:jquery:terminal_emulator_plugin

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
javascript:jquery:terminal_emulator_plugin [2019/08/19 07:23] ともやんjavascript:jquery:terminal_emulator_plugin [2019/09/05 01:09] (現在) ともやん
行 1: 行 1:
 <html> <html>
-  <script src="https://www.tomoyan.net/_media/javascript/jquery/jquery.terminal-2.7.1.min.js"></script> +  <script src="/_media/javascript/jquery/terminal/jquery.terminal-2.7.1.min.js?cache=-1"></script> 
-  <link href="https://www.tomoyan.net/_media/javascript/jquery/jquery.terminal-2.7.1.css" rel="stylesheet"/>+  <link href="/_media/javascript/jquery/terminal/jquery.terminal-2.7.1.css?cache=-1" rel="stylesheet"/>
   <script>   <script>
     jQuery(function($, undefined) {     jQuery(function($, undefined) {
行 7: 行 7:
       term.terminal(function(command, term) {       term.terminal(function(command, term) {
         if (command == 'help') {         if (command == 'help') {
-          term.echo('load python - Python Interpreter'); +          term.echo('clsclear Clear Terminal');
-        } +
-        else if (command == 'load python') { +
-          if (typeof(pyodide) != 'undefined'+
-            return; +
- +
-          self.startTime = new Date(); +
-          self.languagePluginUrl = '/_media/python/pyodide/'; +
-          $.ajax({ +
-            url: self.languagePluginUrl + 'pyodide_dev.js', +
-            async: false, +
-            dataType: "script" +
-          }); +
-          $('<link/>',+
-            rel: 'stylesheet', type: 'text/css', href: self.languagePluginUrl + 'renderedhtml.css' +
-          }).appendTo('head'); +
-          languagePluginLoader.then(() => { +
-            term.echo('languagePluginLoader.then()'); +
-            function pushCode(line) { +
-              handleResult(c.push(line)) +
-            } +
-            self.endTime = new Date(); +
-            var ms = self.endTime.getTime() self.startTime.getTime(); +
-            term.terminal( +
-              pushCode, +
-              { +
-                greetings: "Interpreter Loading time: " + ms + "ms\r\n" +  +
-                           "Welcome to the Pyodide terminal emulator 🐍", +
-                prompt: "[[;red;]>>> ]" +
-              } +
-            ); +
-            pyodide.runPython(` +
-              import io, code, sys +
-              from js import term, pyodide +
- +
-              class Console(code.InteractiveConsole): +
-                def runcode(self, code): +
-                  sys.stdout = io.StringIO() +
-                  sys.stderr = io.StringIO() +
-                  term.runPython("\\n".join(self.buffer)) +
-              _c = Console(locals=globals()) +
-            `) +
- +
-            var c = pyodide.pyimport('_c') +
- +
-            function handleResult(result) { +
-              if (result) { +
-                term.set_prompt('[[;gray;]... ]') +
-              } else { +
-                term.set_prompt('[[;red;]>>> ]') +
-                var stderr = pyodide.runPython("sys.stderr.getvalue()").trim() +
-                if (stderr) { +
-                  term.echo(`[[;red;]${stderr}]`) +
-                } else { +
-                  var stdout = pyodide.runPython("sys.stdout.getvalue()"+
-                  if (stdout) { +
-                    term.echo(stdout.trim()) +
-                  } +
-                } +
-              } +
-            } +
- +
-            term.runPython = function(code) { +
-              pyodide.runPythonAsync(code).then( +
-                term.handlePythonResult, term.handlePythonError +
-              ) +
-            } +
- +
-            term.handlePythonResult = function(result) { +
-              if (result === undefined) { +
-                return +
-              } else if (result['_repr_html_'] !== undefined) { +
-                term.echo(result['_repr_html_'], {raw: true}) +
-              } else { +
-                term.echo(result.toString()) +
-              } +
-            } +
- +
-            term.handlePythonError = function(result) { +
-              term.error(result.toString()) +
-            } +
-          });+
         }         }
         else if (command !== '') {         else if (command !== '') {
行 106: 行 25:
         navigator.userAgent,         navigator.userAgent,
         name: 'js_demo',         name: 'js_demo',
-        height: 200,+        height: 400,
         prompt: 'js > '         prompt: 'js > '
       });       });
 +      
       function dir(object) {       function dir(object) {
         var result = '';         var result = '';
  • javascript/jquery/terminal_emulator_plugin.1566166988.txt.gz
  • 最終更新: 2019/08/19 07:23
  • by ともやん