Rev 193 | Rev 267 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 193 | Rev 266 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | <script src="js/workspace.js"></script> |
13 | <script src="js/workspace.js"></script> |
14 | <script src="js/FileSaver.min.js"></script> |
14 | <script src="js/FileSaver.min.js"></script> |
15 | <script src="js/Blob.js"></script> |
15 | <script src="js/Blob.js"></script> |
16 | 16 | ||
17 | 17 | ||
18 | <!-- |
18 | <!-- <script type="text/javascript" src="js/JSRootCore.js?2d&onload=startGUI""></script> --> |
19 | <script type="text/javascript" src="https://root.cern/js/latest/scripts/JSRootCore.js?2d&onload=startGUI"></script> |
19 | <script type="text/javascript" src="https://root.cern/js/latest/scripts/JSRootCore.js?2d&onload=startGUI"></script> |
20 | <script type = "text/javascript" language = "javascript"> |
20 | <script type = "text/javascript" language = "javascript"> |
21 | 21 | ||
22 | var es; |
22 | var es; |
23 | function addLog(message) { |
23 | function addLog(message) { |
24 | var r = document.getElementById('results'); |
24 | var r = document.getElementById('results'); |
Line 49... | Line 49... | ||
49 | function startTask() { |
49 | function startTask() { |
50 | 50 | ||
51 | var r = document.getElementById('results'); |
51 | var r = document.getElementById('results'); |
52 | if ( r.style.display == 'none' ) switchTask(); |
52 | if ( r.style.display == 'none' ) switchTask(); |
53 | r.innerHTML = ''; |
53 | r.innerHTML = ''; |
- | 54 | document.getElementById('drawing').innerHTML = ''; |
|
54 | 55 | ||
55 | 56 | ||
56 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
57 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
57 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
58 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
58 | code = code.replace(/\(|\)/gi, ''); |
59 | code = code.replace(/\(|\)/gi, ''); |
Line 88... | Line 89... | ||
88 | showStat(result.message); |
89 | showStat(result.message); |
89 | } else { |
90 | } else { |
90 | var jsonobj = JSROOT.parse(result.message); |
91 | var jsonobj = JSROOT.parse(result.message); |
91 | var sframe = 'rh'+ (cnt++); |
92 | var sframe = 'rh'+ (cnt++); |
92 | addLog('ROOT_JSON object '+ sframe ); |
93 | addLog('ROOT_JSON object '+ sframe ); |
93 |
|
94 | //var r = document.getElementById('results'); |
- | 95 | var r = document.getElementById('drawing'); |
|
94 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width:60%; height:60%;"></div>'); |
96 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width:60%; height:60%;"></div><br/>'); |
95 | 97 | ||
96 | var frame = document.getElementById(sframe); |
98 | var frame = document.getElementById(sframe); |
- | 99 | //JSROOT.draw(frame, jsonobj, "hist"); |
|
97 | JSROOT.draw( |
100 | JSROOT.draw(sframe, jsonobj, "hist"); |
- | 101 | //addLog('JSON :' + JSON.stringify(jsonobj)+ '<br>'); |
|
- | 102 | ||
98 | frame.scrollIntoView(); |
103 | frame.scrollIntoView(); |
99 | } |
104 | } |
100 | } |
105 | } |
101 | var pBar = document.getElementById('progressor'); |
106 | var pBar = document.getElementById('progressor'); |
102 | pBar.value = result.progress; |
107 | pBar.value = result.progress; |
Line 174... | Line 179... | ||
174 | return xhttp.onreadystatechange(); |
179 | return xhttp.onreadystatechange(); |
175 | } |
180 | } |
176 | 181 | ||
177 | function showCode() { |
182 | function showCode() { |
178 | // Generate JavaScript code and display it. |
183 | // Generate JavaScript code and display it. |
179 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
184 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
180 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
185 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
181 | //var code = Blockly.JSON.fromWorkspace( workspace ); |
186 | //var code = Blockly.JSON.fromWorkspace( workspace ); |
182 | //var code = Blockly.Xml.domToPrettyText(workspace ); |
187 | //var code = Blockly.Xml.domToPrettyText(workspace ); |
183 | code = code.replace(/\(|\)/gi, ''); |
188 | code = code.replace(/\(|\)/gi, ''); |
184 | console.log(code); |
189 | console.log(code); |
185 | console.log(code.length); |
190 | console.log(code.length); |
Line 312... | Line 317... | ||
312 | //displayContents(workspaceBlocks); |
317 | //displayContents(workspaceBlocks); |
313 | 318 | ||
314 | 319 | ||
315 | 320 | ||
316 | </script> |
321 | </script> |
317 | - | ||
- | 322 | <div id="drawing" style="width:800px; height:600px"></div> |
|
318 | </body> |
323 | </body> |
319 | </html> |
324 | </html> |