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

Unified Diff: dart/site/try/src/compilation.dart

Issue 298273002: Share source code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/site/try/src/leap.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/compilation.dart
diff --git a/dart/site/try/src/compilation.dart b/dart/site/try/src/compilation.dart
index d2cdbc6becb4e5382b7dfd6e2248d59d347f17af..b21ca6119adf3d7c40099f4ad12d509c17679aa6 100644
--- a/dart/site/try/src/compilation.dart
+++ b/dart/site/try/src/compilation.dart
@@ -5,6 +5,7 @@
library trydart.compilation;
import 'dart:html' show
+ AnchorElement,
Blob,
Element,
ErrorEvent,
@@ -12,6 +13,7 @@ import 'dart:html' show
MessageEvent,
Url,
Worker,
+ document,
window;
import 'dart:async' show
@@ -66,6 +68,11 @@ String get currentSource => window.localStorage['currentSource'];
void set currentSource(String text) {
window.localStorage['currentSource'] = text;
+ AnchorElement a = document.querySelector('#share-link');
+ if (a != null) {
+ String sourceQuery = '?source=${Uri.encodeQueryComponent(text)}';
+ a.href = '${Uri.base.resolve(sourceQuery)}';
+ }
}
bool startCompilation() {
« no previous file with comments | « no previous file | dart/site/try/src/leap.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698