| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 typedef void XhrCallback(XMLHttpRequest xhr); | 5 typedef void XhrCallback(XMLHttpRequest xhr); |
| 6 | 6 |
| 7 class Xhr { | 7 class Xhr { |
| 8 static void post(Window window, String url, String data, String contentType, | 8 static void post(Window window, String url, String data, String contentType, |
| 9 XhrCallback onSuccess, XhrCallback onFailure) { | 9 XhrCallback onSuccess, XhrCallback onFailure) { |
| 10 _request(window, 'POST', url, data, contentType, onSuccess, onFailure); | 10 _request(window, 'POST', url, data, contentType, onSuccess, onFailure); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Element status; | 77 Element status; |
| 78 String prefix; | 78 String prefix; |
| 79 | 79 |
| 80 Adminz(Window this.window, Document this.document, String this.prefix) { } | 80 Adminz(Window this.window, Document this.document, String this.prefix) { } |
| 81 | 81 |
| 82 void refresh() { | 82 void refresh() { |
| 83 if (notify != null) | 83 if (notify != null) |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 // Put up refresh UI. | 86 // Put up refresh UI. |
| 87 notify = document.createElement('div'); | 87 notify = new Element.tag('div'); |
| 88 status = document.createElement('div'); | 88 status = new Element.tag('div'); |
| 89 | 89 |
| 90 notify.style.cssText = 'position:absolute;left:0;right:0;bottom:0;z-index:10
000;background:#000;opacity:0.8;height:0;-webkit-transition:height 300ms ease-in
-out;'; | 90 notify.style.cssText = 'position:absolute;left:0;right:0;bottom:0;z-index:10
000;background:#000;opacity:0.8;height:0;-webkit-transition:height 300ms ease-in
-out;'; |
| 91 status.style.cssText = 'padding:20px 40px;color:#fff;font-family:Helvetica,A
rial;font-size:24pt;'; | 91 status.style.cssText = 'padding:20px 40px;color:#fff;font-family:Helvetica,A
rial;font-size:24pt;'; |
| 92 status.text = 'server is restarting'; | 92 status.text = 'server is restarting'; |
| 93 notify.nodes.add(status); | 93 notify.nodes.add(status); |
| 94 document.body.nodes.add(notify); | 94 document.body.nodes.add(notify); |
| 95 | 95 |
| 96 notify.style.setProperty('height', status.offsetHeight.toString().concat('px
')); | 96 notify.style.setProperty('height', status.offsetHeight.toString().concat('px
')); |
| 97 | 97 |
| 98 print(prefix); | 98 print(prefix); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return src.substring(0, src.length - name.length); | 134 return src.substring(0, src.length - name.length); |
| 135 } | 135 } |
| 136 window.console.warn('Adminz was unable find itself in the DOM :-('); | 136 window.console.warn('Adminz was unable find itself in the DOM :-('); |
| 137 return null; | 137 return null; |
| 138 } | 138 } |
| 139 | 139 |
| 140 static void main() { | 140 static void main() { |
| 141 Adminz.attach(window, window.document); | 141 Adminz.attach(window, window.document); |
| 142 } | 142 } |
| 143 } | 143 } |
| OLD | NEW |