Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: dart/site/try/iframe.js

Issue 125123002: try.dartlang.org version 5. (Closed) Base URL: /Users/ahe/Dart/all@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 function dartPrint(msg) {
6 window.parent.postMessage(String(msg), "*");
7 }
8
9 window.onerror = function (message, url, lineNumber) {
10 window.parent.postMessage(
11 ["error", {message: message, url: url, lineNumber: lineNumber}], "*");
12 };
13
14 function onMessageReceived(event) {
15 var data = event.data;
16 if (data instanceof Array) {
17 if (data.length == 2 && data[0] == 'source') {
18 var script = document.createElement('script');
19 script.innerHTML = data[1];
20 script.type = 'application/javascript';
21 document.head.appendChild(script);
22 return;
kasperl 2014/01/07 07:18:43 Do you really need this return?
ahe 2014/01/07 14:06:23 No, but it makes it easier to add new cases.
23 }
24 }
25 }
26
27 window.addEventListener("message", onMessageReceived, false);
28
29 (function () {
30 function postScrollHeight() {
31 window.parent.postMessage(["scrollHeight", document.documentElement.scrollHeig ht], "*");
kasperl 2014/01/07 07:18:43 Long line.
ahe 2014/01/07 14:06:23 Done.
32 }
33
34 var observer = new (window.MutationObserver||window.WebKitMutationObserver||wind ow.MozMutationObserver)(function(mutations) {
kasperl 2014/01/07 07:18:43 Long line.
ahe 2014/01/07 14:06:23 Done.
35 postScrollHeight()
36 window.setTimeout(postScrollHeight, 500);
37 });
38
39 observer.observe(
40 document.body,
41 { attributes: true,
42 childList: true,
43 characterData: true,
44 subtree: true });
45 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698