diff --git a/css/style.css b/css/style.css index be455e1f0..564398013 100644 --- a/css/style.css +++ b/css/style.css @@ -16,6 +16,12 @@ font-weight: 500; src: local('Fira Sans Medium'), url("../fonts/FiraSans-Medium.woff") format('woff'); } +@font-face { + font-family: 'fontello'; + src: url('../fonts/fontello.svg?32953337#fontello') format('svg'); + font-weight: normal; + font-style: normal; +} body { font-family: 'Fira Sans', "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -277,6 +283,34 @@ ul.laundry-list { outline: none; } + [class^="icon-"]:before, [class*=" icon-"]:before { + font-family: "fontello"; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + margin-right: .2em; + text-align: center; + /* opacity: .8; */ + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + position: relative; + float: right; + font-size: 120%; + +} + +.icon-link-ext:before { content: '\e800'; } /* '' */ + #result { background-color: #E2EEF6; margin-top: 10px; diff --git a/fonts/fontello.svg b/fonts/fontello.svg new file mode 100644 index 000000000..58293ec65 --- /dev/null +++ b/fonts/fontello.svg @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/index.html b/index.html index ef9bcdb9e..af86051b0 100644 --- a/index.html +++ b/index.html @@ -49,8 +49,8 @@
fn main() { // A simple integer calculator: - // `+` or `-` means add/sub by 1 - // `*` or `/` means mul/div by 2 + // `+` or `-` means add or subtract by 1 + // `*` or `/` means multiply or divide by 2 let program = "+ + * - /"; let mut accumulator = 0; @@ -121,7 +123,7 @@Featuring
return os; } - + var platform = detect_platform(); var rec_package_name = "nightly"; @@ -149,7 +151,7 @@Featuring
var rec_dl_addy = "http://static.rust-lang.org/dist/" + rec_download_file; var rec_inst_link = document.getElementById("inst-link"); rec_inst_link.setAttribute("href", rec_dl_addy); - + diff --git a/js/editor.js b/js/editor.js index 3b8eb8445..20ac75179 100644 --- a/js/editor.js +++ b/js/editor.js @@ -14,6 +14,7 @@ var editorDiv = document.getElementById("editor"); var staticCode = document.getElementById("static-code"); var runButton = document.getElementById("run-code"); var resultDiv = document.getElementById("result"); +var playLink = document.getElementById("playlink"); // Background colors for program result on success/error var successColor = "#E2EEF6"; @@ -121,10 +122,15 @@ function handleResult(statusCode, message) { } } -// Called on successful program run +// Called on successful program run: display output and link to playground function handleSuccess(message) { resultDiv.style.backgroundColor = successColor; - resultDiv.innerHTML = escapeHTML(message); + var program = encodeURIComponent(editor.getValue()); + playLink.href = "http://play.rust-lang.org/?code=" + program + "&run=1" + // console.log(playLink.href); + resultDiv.innerHTML = ''; // clear resultDiv, then add + resultDiv.appendChild(playLink); // playLink icon and message + resultDiv.innerHTML += escapeHTML(message); } // Called when program run results in warning(s) @@ -164,7 +170,12 @@ function handleProblem(message, problem) { }).join("
"); // Setting message - resultDiv.innerHTML = cleanMessage; + var program = encodeURIComponent(editor.getValue()); + playLink.href = "http://play.rust-lang.org/?code=" + program + "&run=1" + // console.log(playLink.href); + resultDiv.innerHTML = ''; // clear resultDiv, then add + resultDiv.appendChild(playLink); // playLink icon and error message + resultDiv.innerHTML += cleanMessage; // Highlighting the lines var ranges = parseProblems(lines);