|
22 | 22 | 'Text was entered in a form and it is going to be lost!\n' + |
23 | 23 | 'Are you sure you want to close the application?'; |
24 | 24 |
|
25 | | - // Settings objects for Perl scripts |
26 | | - // Interactive script: |
| 25 | + // PEB settings objects for auto-started Perl interactive scripts: |
27 | 26 | var messenger_one = {}; |
28 | 27 | messenger_one.scriptRelativePath = 'perl-scripts/messenger.pl'; |
| 28 | + |
29 | 29 | messenger_one.inputData = function() { |
30 | 30 | var message = {}; |
31 | 31 | if(("tempfile" in messenger_one)) { |
|
38 | 38 |
|
39 | 39 | var messenger_two = {}; |
40 | 40 | messenger_two.scriptRelativePath = 'perl-scripts/messenger.pl'; |
| 41 | + |
41 | 42 | messenger_two.inputData = function() { |
42 | 43 | var message = {}; |
43 | 44 | if(("tempfile" in messenger_two)) { |
|
50 | 51 |
|
51 | 52 | var interactive_one = {}; |
52 | 53 | interactive_one.scriptRelativePath = 'perl-scripts/interactive-windows.pl'; |
| 54 | + |
53 | 55 | interactive_one.inputData = function() { |
54 | 56 | var input = {}; |
55 | 57 | input.mode = "unix-epoch"; |
56 | 58 | return JSON.stringify(input); |
57 | 59 | } |
| 60 | + |
58 | 61 | interactive_one.stdoutFunction = function (stdout) { |
59 | 62 | var target = document.getElementById('instance-one-output'); |
60 | 63 | var output = JSON.parse(stdout); |
|
72 | 75 |
|
73 | 76 | var interactive_two = {}; |
74 | 77 | interactive_two.scriptRelativePath = 'perl-scripts/interactive-windows.pl'; |
| 78 | + |
75 | 79 | interactive_two.inputData = function() { |
76 | 80 | var input = {}; |
77 | 81 | input.mode = "local-time"; |
78 | 82 | return JSON.stringify(input); |
79 | 83 | } |
| 84 | + |
80 | 85 | interactive_two.stdoutFunction = function (stdout) { |
81 | 86 | var target = document.getElementById('instance-two-output'); |
82 | 87 | var output = JSON.parse(stdout); |
|
91 | 96 | target.innerHTML = html; |
92 | 97 | }; |
93 | 98 | } |
94 | | - |
95 | | - // Other PEB tests: |
96 | | - var open_file = {}; |
97 | | - open_file.scriptRelativePath = 'perl-scripts/open-files.pl'; |
98 | | - open_file.stdoutFunction = function (stdout) { |
99 | | - displayTestResult('open-file', stdout); |
100 | | - } |
101 | | - |
102 | | - var open_files = {}; |
103 | | - open_files.scriptRelativePath = 'perl-scripts/open-files.pl'; |
104 | | - open_files.stdoutFunction = function (stdout) { |
105 | | - displayTestResult('open-files', stdout); |
106 | | - } |
107 | | - |
108 | | - var open_directory = {}; |
109 | | - open_directory.scriptRelativePath = 'perl-scripts/open-directory.pl'; |
110 | | - open_directory.stdoutFunction = function (stdout) { |
111 | | - displayTestResult('open-directory', stdout); |
112 | | - } |
113 | | - |
114 | | - var perl_info = {}; |
115 | | - perl_info.scriptRelativePath = 'perl-scripts/perl-info.pl'; |
116 | | - perl_info.stdoutFunction = function (stdout) { |
117 | | - clearTestData(); |
118 | | - displayTestResult('perl-info', stdout); |
119 | | - } |
120 | | - |
121 | | - var sqlite = {}; |
122 | | - sqlite.scriptRelativePath = 'perl-scripts/sqlite.pl'; |
123 | | - sqlite.stdoutFunction = function (stdout) { |
124 | | - clearTestData(); |
125 | | - displayTestResult('sqlite-test', stdout); |
126 | | - } |
127 | | - |
128 | | - // Settings objects for the filesystem dialogs: |
129 | | - var select_file = {}; |
130 | | - select_file.type = 'single-file'; |
131 | | - select_file.receiverFunction = function (fileName) { |
132 | | - open_file.inputData = fileName; |
133 | | - clearTestData(); |
134 | | - peb.startScript('open_file.script'); |
135 | | - } |
136 | | - |
137 | | - var new_file_name = {}; |
138 | | - new_file_name.type = 'new-file-name'; |
139 | | - new_file_name.receiverFunction = function (fileName) { |
140 | | - clearTestData(); |
141 | | - var pre = document.createElement("pre"); |
142 | | - pre.innerHTML = 'New file name: ' + fileName; |
143 | | - document.getElementById('tests').appendChild(pre); |
144 | | - } |
145 | | - |
146 | | - var select_files = {}; |
147 | | - select_files.type = 'multiple-files'; |
148 | | - select_files.receiverFunction = function (fileNames) { |
149 | | - open_files.inputData = fileNames; |
150 | | - clearTestData(); |
151 | | - peb.startScript('open_files.script'); |
152 | | - } |
153 | | - |
154 | | - var select_directory = {}; |
155 | | - select_directory.type = 'directory'; |
156 | | - select_directory.receiverFunction = function (directoryName) { |
157 | | - open_directory.inputData = directoryName; |
158 | | - clearTestData(); |
159 | | - peb.startScript('open_directory.script'); |
160 | | - } |
161 | | - |
162 | | - function startPerlInfo() { |
163 | | - peb.startScript('perl_info.script'); |
164 | | - } |
165 | | - |
166 | | - function startSqlite() { |
167 | | - peb.startScript('sqlite.script'); |
168 | | - } |
169 | | - |
170 | | - function clearTestData() { |
171 | | - var container = document.getElementById('tests'); |
172 | | - while (container.firstChild) { |
173 | | - container.removeChild(container.firstChild); |
174 | | - } |
175 | | - } |
176 | | - |
177 | | - function displayTestResult(id, stdout) { |
178 | | - var existingElement = document.getElementById(id); |
179 | | - if (existingElement === null) { |
180 | | - clearTestData(); |
181 | | - var newElement = document.createElement("pre"); |
182 | | - newElement.id = id; |
183 | | - newElement.innerHTML = stdout; |
184 | | - document.getElementById('tests').appendChild(newElement); |
185 | | - } else { |
186 | | - existingElement.innerHTML = existingElement.innerHTML + stdout; |
187 | | - } |
188 | | - } |
189 | 99 | </script> |
190 | 100 |
|
191 | 101 | <script src="jquery/jquery-1.12.4.min.js"></script> |
192 | 102 | <script src="bootstrap/js/bootstrap.js"></script> |
193 | 103 | <script src="bootstrap/js/bootstrap-dropdown.js"></script> |
| 104 | + <script src="peb-demo.js"></script> |
194 | 105 |
|
195 | 106 | <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" media="all"> |
196 | 107 | <link rel="stylesheet" type="text/css" href="bootstrap/css/darkly-theme.css" media="all"> |
197 | | - |
198 | | - <style type='text/css'> |
199 | | - body { |
200 | | - padding-top: 65px; |
201 | | - } |
202 | | - |
203 | | - pre { |
204 | | - margin: 4px; |
205 | | - text-align: left; |
206 | | - font-size: 14px; |
207 | | - font-family: sans-serif; |
208 | | - } |
209 | | - |
210 | | - .navbar .navbar-header { |
211 | | - text-align: center; |
212 | | - vertical-align: middle; |
213 | | - } |
214 | | - |
215 | | - .navbar .navbar-nav { |
216 | | - display: inline-block; |
217 | | - float: center; |
218 | | - } |
219 | | - |
220 | | - .navbar-toggle { |
221 | | - float: center; |
222 | | - margin: 10px; |
223 | | - vertical-align: middle; |
224 | | - } |
225 | | - |
226 | | - .introduction { |
227 | | - font-size: 20px; |
228 | | - } |
229 | | - |
230 | | - .interactive-output { |
231 | | - font-size: 20px; |
232 | | - margin-bottom: 20px; |
233 | | - } |
234 | | - </style> |
| 108 | + <link rel="stylesheet" type="text/css" href="peb-demo.css" media="all"> |
235 | 109 | </head> |
236 | 110 |
|
237 | 111 | <body> |
|
0 commit comments