about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-07 09:47:01 +0000
committerbors <bors@rust-lang.org>2017-12-07 09:47:01 +0000
commitbb1bd88ec3adf93b678d08ca631e5b3785d2df1b (patch)
tree98d8855317624ac36d407dbc9633dafe65219ddb /src
parent7b637b778db0ec1063662f731773dd7917790a66 (diff)
parentde3a291455b24f5eed83b9c0f746b8df3dd5715b (diff)
downloadrust-bb1bd88ec3adf93b678d08ca631e5b3785d2df1b.tar.gz
rust-bb1bd88ec3adf93b678d08ca631e5b3785d2df1b.zip
Auto merge of #46221 - GuillaumeGomez:doc-script-load-speedup, r=nrc
Speedup search loading when search url is received

Fixes #45971.

r? @nrc

cc @rust-lang/docs
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/main.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index dc8ce627638..bdd7b7dd0b7 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -119,8 +119,7 @@
             map(function(s) {
                 var pair = s.split("=");
                 params[decodeURIComponent(pair[0])] =
-                    typeof pair[1] === "undefined" ?
-                            null : decodeURIComponent(pair[1]);
+                    typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]);
             });
         return params;
     }
@@ -1822,6 +1821,14 @@
             }
         };
     }
+
+    var params = getQueryStringParams();
+    if (params && params.search) {
+        addClass(document.getElementById("main"), "hidden");
+        var search = document.getElementById("search");
+        removeClass(search, "hidden");
+        search.innerHTML = '<h3 style="text-align: center;">Loading search results...</h3>';
+    }
 }());
 
 // Sets the focus on the search bar at the top of the page