diff options
| author | bors <bors@rust-lang.org> | 2016-10-08 19:42:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-08 19:42:55 -0700 |
| commit | b98cc352cbb428f3c9a0e608bc57a83109a26a57 (patch) | |
| tree | 02e691aaa242a961ac8e159fed8e95bd038fe7c6 | |
| parent | 19ac57926abb749a93e2eb84502048d9c57f2d7b (diff) | |
| parent | 8983d1e67acdffb697497c8ddb49c355c8c1fdfc (diff) | |
| download | rust-b98cc352cbb428f3c9a0e608bc57a83109a26a57.tar.gz rust-b98cc352cbb428f3c9a0e608bc57a83109a26a57.zip | |
Auto merge of #36637 - GuillaumeGomez:fix_run_button, r=bluss
Fixes run button appearing when it shouldn't Fixes #36621. r? @steveklabnik
| -rw-r--r-- | src/librustdoc/html/layout.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/extra.js | 25 | ||||
| -rw-r--r-- | src/librustdoc/html/static/playpen.js | 5 |
3 files changed, 32 insertions, 2 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 151e138efef..b7c5876c4f9 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -176,10 +176,10 @@ r##"<!DOCTYPE html> krate = layout.krate, play_url = layout.playground_url, play_js = if layout.playground_url.is_empty() { - "".to_string() + format!(r#"<script src="{}extra.js"></script>"#, page.root_path) } else { format!(r#"<script src="{}playpen.js"></script>"#, page.root_path) - }, + } ) } diff --git a/src/librustdoc/html/static/extra.js b/src/librustdoc/html/static/extra.js new file mode 100644 index 00000000000..d9d97d9b883 --- /dev/null +++ b/src/librustdoc/html/static/extra.js @@ -0,0 +1,25 @@ +// Copyright 2014-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/*jslint browser: true, es5: true */ +/*globals $: true, rootPath: true */ + +document.addEventListener('DOMContentLoaded', function() { + 'use strict'; + + if (!window.playgroundUrl) { + var runButtons = document.querySelectorAll(".test-arrow"); + + for (var i = 0; i < runButtons.length; i++) { + runButtons[i].classList.remove("test-arrow"); + } + return; + } +}); diff --git a/src/librustdoc/html/static/playpen.js b/src/librustdoc/html/static/playpen.js index cad97c04e1a..8d8953d56e1 100644 --- a/src/librustdoc/html/static/playpen.js +++ b/src/librustdoc/html/static/playpen.js @@ -15,6 +15,11 @@ document.addEventListener('DOMContentLoaded', function() { 'use strict'; if (!window.playgroundUrl) { + var runButtons = document.querySelectorAll(".test-arrow"); + + for (var i = 0; i < runButtons.length; i++) { + runButtons[i].classList.remove("test-arrow"); + } return; } |
