|
23 | 23 | <meta charset="utf-8"> |
24 | 24 |
|
25 | 25 | <script> |
| 26 | + // Change file paths according to the operating suystem: |
| 27 | + var operating_system = ''; |
| 28 | + var perl_interpreter = ''; |
| 29 | + var interactive_script = ''; |
| 30 | + |
| 31 | + if (navigator.userAgent.indexOf('Linux') != -1) { |
| 32 | + operating_system = 'Linux' |
| 33 | + perl_interpreter = 'perl/bin/perl'; |
| 34 | + interactive_script = 'perl-scripts/interactive.pl'; |
| 35 | + } |
| 36 | + |
| 37 | + if (navigator.userAgent.indexOf('Win') != -1) { |
| 38 | + operating_system = 'Windows' |
| 39 | + perl_interpreter = 'perl/perl/bin/wperl.exe'; |
| 40 | + interactive_script = 'perl-scripts/interactive-tempfile.pl'; |
| 41 | + } |
| 42 | + |
| 43 | + console.log('Operating system: ' + operating_system) |
| 44 | + console.log('Perl interpreter: ' + perl_interpreter) |
| 45 | + console.log('Interactive script: ' + interactive_script) |
| 46 | + |
26 | 47 | // PEB page settings: |
27 | 48 | var pebSettings = {}; // 'pebSettings' object name is hard-coded. |
28 | | - pebSettings.perlInterpreter = 'perl/bin/perl'; |
29 | | - // pebSettings.perlInterpreter = 'perl/perl/bin/wperl.exe'; |
| 49 | + pebSettings.perlInterpreter = perl_interpreter; |
30 | 50 | pebSettings.autoStartScripts = ['interactive_one', 'interactive_two']; |
31 | 51 | pebSettings.cutLabel = '- Cut -'; |
32 | 52 | pebSettings.copyLabel = '- Copy -'; |
|
42 | 62 |
|
43 | 63 | // PEB settings objects for auto-started Perl interactive scripts: |
44 | 64 | var interactive_one = {}; |
45 | | - interactive_one.scriptRelativePath = 'perl-scripts/interactive-tempfile.pl'; |
| 65 | + interactive_one.scriptRelativePath = interactive_script; |
46 | 66 |
|
47 | 67 | interactive_one.inputData = function() { |
48 | 68 | var data = {} |
|
56 | 76 | var target = document.getElementById('instance-one-output'); |
57 | 77 | var output = JSON.parse(stdout); |
58 | 78 | var html; |
59 | | - if(("user_input" in output)) { |
| 79 | + if ("user_input" in output) { |
60 | 80 | html = output.time + '<br>' + output.user_input; |
61 | 81 | } else { |
62 | 82 | html = output.time; |
|
71 | 91 | } |
72 | 92 |
|
73 | 93 | var interactive_two = {}; |
74 | | - interactive_two.scriptRelativePath = 'perl-scripts/interactive-tempfile.pl'; |
| 94 | + interactive_two.scriptRelativePath = interactive_script; |
75 | 95 |
|
76 | 96 | interactive_two.inputData = function() { |
77 | 97 | var data = {} |
|
85 | 105 | var target = document.getElementById('instance-two-output'); |
86 | 106 | var output = JSON.parse(stdout); |
87 | 107 | var html; |
88 | | - if(("user_input" in output)) { |
| 108 | + if ("user_input" in output) { |
89 | 109 | html = output.time + '<br>' + output.user_input; |
90 | 110 | } else { |
91 | 111 | html = output.time; |
|
0 commit comments