From de3a291455b24f5eed83b9c0f746b8df3dd5715b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 23 Nov 2017 21:19:48 +0100 Subject: [PATCH] Speedup search loading when search url is received --- src/librustdoc/html/static/main.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 34f649aa2d3..b131d55ff39 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; } @@ -1756,6 +1755,14 @@ } }; } + + var params = getQueryStringParams(); + if (params && params.search) { + addClass(document.getElementById("main"), "hidden"); + var search = document.getElementById("search"); + removeClass(search, "hidden"); + search.innerHTML = '

Loading search results...

'; + } }()); // Sets the focus on the search bar at the top of the page