chiark / gitweb /
doxygen: take search query from URL GET ?q= parameter, if present.
authorVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 00:27:31 +0000 (01:27 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 21:07:36 +0000 (22:07 +0100)
doxygen/search.js

index c454cec961bd382c047f4a6f1e7e5d4f3b977a67..0480e185f326d733485d6cd0955a54d17842e655 100644 (file)
@@ -88,6 +88,19 @@ var Search = {
             /* Search for the input value (there might be something already,
                for example when going back in the browser) */
             let value = document.getElementById('search-input').value;
+
+            /* Otherwise check the GET parameters for `q` and fill the input
+               with that */
+            if(!value.length) {
+                var args = decodeURIComponent(window.location.search.substr(1)).trim().split('&');
+                for(var i = 0; i != args.length; ++i) {
+                    if(args[i].substring(0, 2) != 'q=') continue;
+
+                    value = document.getElementById('search-input').value = args[i].substring(2);
+                    break;
+                }
+            }
+
             if(value.length) Search.searchAndRender(value);
         }