| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library trydart.ui; | 5 library trydart.ui; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'dart:async' show | 9 import 'dart:async' show |
| 10 Future, | 10 Future, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 Map<String, Function> codeCallbacks = new Map<String, Function>(); | 87 Map<String, Function> codeCallbacks = new Map<String, Function>(); |
| 88 | 88 |
| 89 void onCodeChange(Event event) { | 89 void onCodeChange(Event event) { |
| 90 SelectElement select = event.target; | 90 SelectElement select = event.target; |
| 91 String id = select.querySelectorAll('option')[select.selectedIndex].id; | 91 String id = select.querySelectorAll('option')[select.selectedIndex].id; |
| 92 Function action = codeCallbacks[id]; | 92 Function action = codeCallbacks[id]; |
| 93 if (action != null) action(event); | 93 if (action != null) action(event); |
| 94 outputFrame.style.display = 'none'; | 94 outputFrame.style.display = 'none'; |
| 95 outputDiv.nodes.clear(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 buildUI() { | 98 buildUI() { |
| 98 interaction = new InteractionManager(); | 99 interaction = new InteractionManager(); |
| 99 | 100 |
| 100 CompilationUnit.onChanged.listen(interaction.onCompilationUnitChanged); | 101 CompilationUnit.onChanged.listen(interaction.onCompilationUnitChanged); |
| 101 | 102 |
| 102 window.localStorage['currentSample'] = '$currentSample'; | 103 window.localStorage['currentSample'] = '$currentSample'; |
| 103 | 104 |
| 104 buildCode(interaction); | 105 buildCode(interaction); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 192 |
| 192 tryColumn.append(inputWrapper); | 193 tryColumn.append(inputWrapper); |
| 193 outputFrame.style.display = 'none'; | 194 outputFrame.style.display = 'none'; |
| 194 runColumn.append(outputFrame); | 195 runColumn.append(outputFrame); |
| 195 runColumn.append(outputWrapper); | 196 runColumn.append(outputWrapper); |
| 196 runColumn.append(hackDiv); | 197 runColumn.append(hackDiv); |
| 197 | 198 |
| 198 var settingsElement = document.getElementById('settings'); | 199 var settingsElement = document.getElementById('settings'); |
| 199 settingsElement.onClick.listen(openSettings); | 200 settingsElement.onClick.listen(openSettings); |
| 200 | 201 |
| 201 window.onMessage.listen(interaction.onMessage); | 202 window.onMessage.listen(interaction.onWindowMessage); |
| 202 | 203 |
| 203 observer = new MutationObserver(interaction.onMutation) | 204 observer = new MutationObserver(interaction.onMutation) |
| 204 ..observe( | 205 ..observe( |
| 205 mainEditorPane, childList: true, characterData: true, subtree: true); | 206 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 206 | 207 |
| 207 scheduleMicrotask(() { | 208 scheduleMicrotask(() { |
| 208 mainEditorPane.appendText(currentSource); | 209 mainEditorPane.appendText(currentSource); |
| 209 }); | 210 }); |
| 210 | 211 |
| 211 // You cannot install event handlers on window.applicationCache | 212 // You cannot install event handlers on window.applicationCache |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 window.localStorage['compilationPaused'] = '$compilationPaused'; | 467 window.localStorage['compilationPaused'] = '$compilationPaused'; |
| 467 window.localStorage['codeFont'] = '$codeFont'; | 468 window.localStorage['codeFont'] = '$codeFont'; |
| 468 | 469 |
| 469 dialog.style.height = '0px'; | 470 dialog.style.height = '0px'; |
| 470 } | 471 } |
| 471 form.onSubmit.listen(onSubmit); | 472 form.onSubmit.listen(onSubmit); |
| 472 | 473 |
| 473 var doneButton = document.getElementById('settings-done'); | 474 var doneButton = document.getElementById('settings-done'); |
| 474 doneButton.onClick.listen(onSubmit); | 475 doneButton.onClick.listen(onSubmit); |
| 475 } | 476 } |
| OLD | NEW |