about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-09-21 23:43:03 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2016-10-05 21:14:55 +0200
commit8983d1e67acdffb697497c8ddb49c355c8c1fdfc (patch)
tree213567efd3a22b1c4fd658452455e71a1203b52b
parent5cc6c6b1b76960441c39ef29e951f22de45da15b (diff)
downloadrust-8983d1e67acdffb697497c8ddb49c355c8c1fdfc.tar.gz
rust-8983d1e67acdffb697497c8ddb49c355c8c1fdfc.zip
Fixes run button appearing when it shouldn't
-rw-r--r--src/librustdoc/html/layout.rs4
-rw-r--r--src/librustdoc/html/static/extra.js25
-rw-r--r--src/librustdoc/html/static/playpen.js5
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;
     }