1
0
YouTwitFace 5 жил өмнө
parent
commit
afe8187c2a

+ 50 - 0
gramjs_generator/data/html/404.html

@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Oopsie! | GramJS</title>
+
+        <meta charset="utf-8" />
+        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+        <style type="text/css">
+            body {
+                background-color: #f0f4f8;
+                font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial,
+                    sans-serif;
+            }
+            div {
+                width: 560px;
+                margin: 5em auto;
+                padding: 50px;
+                background-color: #fff;
+                border-radius: 1em;
+            }
+            a:link,
+            a:visited {
+                color: #38488f;
+                text-decoration: none;
+            }
+            @media (max-width: 700px) {
+                body {
+                    background-color: #fff;
+                }
+                div {
+                    width: auto;
+                    margin: 0 auto;
+                    border-radius: 0;
+                    padding: 1em;
+                }
+            }
+        </style>
+    </head>
+    <body>
+        <div>
+            <h1>You seem a bit lost…</h1>
+            <p>
+                You seem to be lost! Don't worry, that's just Telegram's API
+                being itself. Shall we go back to the
+                <a href="index.html">Main Page</a>?
+            </p>
+        </div>
+    </body>
+</html>

+ 236 - 0
gramjs_generator/data/html/core.html

@@ -0,0 +1,236 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <title>GramJS API</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+        <link id="style" href="css/docs.dark.css" rel="stylesheet" />
+        <script>
+            (function() {
+                var style = document.getElementById('style');
+
+                // setTheme(<link />, 'light' / 'dark')
+                function setTheme(theme) {
+                    localStorage.setItem('theme', theme);
+                    return (style.href = 'css/docs.' + theme + '.css');
+                }
+
+                // setThemeOnClick(<link />, 'light' / 'dark', <a />)
+                function setThemeOnClick(theme, button) {
+                    return button.addEventListener('click', function(e) {
+                        setTheme(theme);
+                        e.preventDefault();
+                        return false;
+                    });
+                }
+
+                setTheme(localStorage.getItem('theme') || 'light');
+
+                document.addEventListener('DOMContentLoaded', function() {
+                    setThemeOnClick(
+                        'light',
+                        document.getElementById('themeLight')
+                    );
+                    setThemeOnClick(
+                        'dark',
+                        document.getElementById('themeDark')
+                    );
+                });
+            })();
+        </script>
+        <link
+            href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
+            rel="stylesheet"
+        />
+    </head>
+    <body>
+        <div id="main_div">
+            <noscript
+                >Please enable JavaScript if you would like to use
+                search.</noscript
+            >
+            <h1>GramJS API</h1>
+            <p>
+                This documentation was generated straight from the
+                <code>scheme.tl</code> provided by Telegram. However, there is
+                no official documentation per se on what the methods,
+                constructors and types mean. Nevertheless, this page aims to
+                provide easy access to all the available methods, their
+                definition and parameters.
+            </p>
+            <p id="themeSelect">
+                <a href="#" id="themeLight">light</a> /
+                <a href="#" id="themeDark">dark</a> theme.
+            </p>
+            <p>Please note that when you see this:</p>
+            <pre>
+---functions---
+users.getUsers#0d91a548 id:Vector&lt;InputUser&gt; = Vector&lt;User&gt;</pre
+            >
+
+            <p>
+                This is <b>not</b> Python code. It's the "TL definition". It's
+                an easy-to-read line that gives a quick overview on the
+                parameters and its result. You don't need to worry about this.
+                See
+                <a
+                    href="https://docs.telethon.dev/en/latest/developing/understanding-the-type-language.html"
+                    >Understanding the Type Language</a
+                >
+                for more details on it.
+            </p>
+
+            <h3>Index</h3>
+            <ul>
+                <li>
+                    <a href="#methods">Methods</a>
+                    (<a href="methods/index.html">full list</a>)
+                </li>
+                <li>
+                    <a href="#types">Types</a>
+                    (<a href="types/index.html">full list</a>)
+                </li>
+                <li>
+                    <a href="#constructors">Constructors</a>
+                    (<a href="constructors/index.html">full list</a>)
+                </li>
+                <li><a href="#core">Core types</a></li>
+                <li><a href="#example">Full example</a></li>
+            </ul>
+
+            <h3 id="methods">Methods</h3>
+            <p>
+                Currently there are <b>{methodCount} methods</b> available for
+                the layer {layer}.
+                <a href="methods/index.html">See the complete method list</a>.
+                <br /><br />
+                Methods, also known as <i>requests</i>, are used to interact
+                with the Telegram API itself and are invoked through
+                <code>client(Request(...))</code>. <b>Only these</b> can be used
+                like that! You cannot invoke types or constructors, only
+                requests. After this, Telegram will return a
+                <code>result</code>, which may be, for instance, a bunch of
+                messages, some dialogs, users, etc.
+            </p>
+
+            <h3 id="types">Types</h3>
+            <p>
+                Currently there are <b>{typeCount} types</b>.
+                <a href="types/index.html">See the complete list of types</a>.
+            </p>
+
+            <p>
+                The Telegram types are the <i>abstract</i> results that you
+                receive after invoking a request. They are "abstract" because
+                they can have multiple constructors. For instance, the abstract
+                type <code>User</code> can be either <code>UserEmpty</code> or
+                <code>User</code>. You should, most of the time, make sure you
+                received the desired type by using the
+                <code>isinstance(result, Constructor)</code> Python function.
+                When a request needs a Telegram type as argument, you should
+                create an instance of it by using one of its, possibly multiple,
+                constructors.
+            </p>
+
+            <h3 id="constructors">Constructors</h3>
+            <p>
+                Currently there are <b>{constructorCount} constructors</b>.
+                <a href="constructors/index.html"
+                    >See the list of all constructors</a
+                >.
+            </p>
+
+            <p>
+                Constructors are the way you can create instances of the
+                abstract types described above, and also the instances which are
+                actually returned from the functions although they all share a
+                common abstract type.
+            </p>
+
+            <h3 id="core">Core types</h3>
+            <p>
+                Core types are types from which the rest of Telegram types build
+                upon:
+            </p>
+            <ul>
+                <li id="int">
+                    <b>int</b>: The value should be an integer type, like
+                    <span class="sh1">42</span>. It should have 32 bits or less.
+                    You can check the bit length by calling
+                    <code>a.bit_length()</code>, where <code>a</code> is an
+                    integer variable.
+                </li>
+                <li id="long">
+                    <b>long</b>: Different name for an integer type. The numbers
+                    given should have 64 bits or less.
+                </li>
+                <li id="int128">
+                    <b>int128</b>: Another integer type, should have 128 bits or
+                    less.
+                </li>
+                <li id="int256">
+                    <b>int256</b>: The largest integer type, allowing 256 bits
+                    or less.
+                </li>
+                <li id="double">
+                    <b>double</b>: The value should be a floating point value,
+                    such as <span class="sh1">123.456</span>.
+                </li>
+                <li id="vector">
+                    <b>Vector&lt;T&gt;</b>: If a type <code>T</code> is wrapped
+                    around <code>Vector&lt;T&gt;</code>, then it means that the
+                    argument should be a <i>list</i> of it. For instance, a
+                    valid value for <code>Vector&lt;int&gt;</code> would be
+                    <code>[1, 2, 3]</code>.
+                </li>
+                <li id="string">
+                    <b>string</b>: A valid UTF-8 string should be supplied. This
+                    is right how Python strings work, no further encoding is
+                    required.
+                </li>
+                <li id="bool">
+                    <b>Bool</b>: Either <code>True</code> or <code>False</code>.
+                </li>
+                <li id="true">
+                    <b>flag</b>: These arguments aren't actually sent but rather
+                    encoded as flags. Any truthy value (<code>True</code>,
+                    <code>7</code>) will enable this flag, although it's
+                    recommended to use <code>True</code> or <code>None</code> to
+                    symbolize that it's not present.
+                </li>
+                <li id="bytes">
+                    <b>bytes</b>: A sequence of bytes, like
+                    <code>b'hello'</code>, should be supplied.
+                </li>
+                <li id="date">
+                    <b>date</b>: Although this type is internally used as an
+                    <code>int</code>, you can pass a <code>datetime</code> or
+                    <code>date</code> object instead to work with date
+                    parameters.<br />
+                    Note that the library uses the date in <b>UTC+0</b>, since
+                    timezone conversion is not responsibility of the library.
+                    Furthermore, this eases converting into any other timezone
+                    without the need for a middle step.
+                </li>
+            </ul>
+
+            <h3 id="example">Full example</h3>
+            <p>
+                All methods shown here have dummy examples on how to write them,
+                so you don't get confused with their TL definition. However,
+                this may not always run. They are just there to show the right
+                syntax.
+            </p>
+
+            <p>
+                You should check out
+                <a
+                    href="https://docs.telethon.dev/en/latest/concepts/full-api.html"
+                    >how to access the full API</a
+                >
+                in ReadTheDocs.
+            </p>
+        </div>
+        <script src="js/search.js"></script>
+    </body>
+</html>

+ 185 - 0
gramjs_generator/data/html/css/docs.dark.css

@@ -0,0 +1,185 @@
+body {
+    font-family: 'Nunito', sans-serif;
+    color: #bbb;
+    background-color:#000;
+    font-size: 16px;
+}
+
+a {
+    color: #42aaed;
+    text-decoration: none;
+}
+
+pre {
+    font-family: 'Source Code Pro', monospace;
+    padding: 8px;
+    color: #567;
+    background: #080a0c;
+    border-radius: 0;
+    overflow-x: auto;
+}
+
+a:hover {
+    color: #64bbdd;
+    text-decoration: underline;
+}
+
+table {
+    width: 100%;
+    max-width: 100%;
+}
+
+table td {
+    border-top: 1px solid #111;
+    padding: 8px;
+}
+
+.horizontal {
+    margin-bottom: 16px;
+    list-style: none;
+    background: #080a0c;
+    border-radius: 4px;
+    padding: 8px 16px;
+}
+
+.horizontal li {
+    display: inline-block;
+    margin: 0 8px 0 0;
+}
+
+.horizontal img {
+    display: inline-block;
+    margin: 0 8px -2px 0;
+}
+
+h1, summary.title {
+    font-size: 24px;
+}
+
+h3 {
+    font-size: 20px;
+}
+
+#main_div {
+  padding: 20px 0;
+  max-width: 800px;
+  margin: 0 auto;
+}
+
+pre::-webkit-scrollbar {
+    visibility: visible;
+    display: block;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-track:horizontal {
+    background: #222;
+    border-radius: 0;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-thumb:horizontal {
+    background: #444;
+    border-radius: 0;
+    height: 12px;
+}
+
+:target {
+    border: 2px solid #149;
+    background: #246;
+    padding: 4px;
+}
+
+/* 'sh' stands for Syntax Highlight */
+span.sh1 {
+    color: #f93;
+}
+
+span.tooltip {
+    border-bottom: 1px dashed #ddd;
+}
+
+#searchBox {
+    width: 100%;
+    border: none;
+    height: 20px;
+    padding: 8px;
+    font-size: 16px;
+    border-radius: 2px;
+    border: 2px solid #222;
+    background: #000;
+    color: #eee;
+}
+
+#searchBox:placeholder-shown {
+    color: #bbb;
+    font-style: italic;
+}
+
+button {
+    border-radius: 2px;
+    font-size: 16px;
+    padding: 8px;
+    color: #bbb;
+    background-color: #111;
+    border: 2px solid #146;
+    transition-duration: 300ms;
+}
+
+button:hover {
+    background-color: #146;
+    color: #fff;
+}
+
+/* https://www.w3schools.com/css/css_navbar.asp */
+ul.together {
+    list-style-type: none;
+    margin: 0;
+    padding: 0;
+    overflow: hidden;
+}
+
+ul.together li {
+    float: left;
+}
+
+ul.together li a {
+    display: block;
+    border-radius: 8px;
+    background: #111;
+    padding: 4px 8px;
+    margin: 8px;
+}
+
+/* https://stackoverflow.com/a/30810322 */
+.invisible {
+    left: 0;
+    top: -99px;
+    padding: 0;
+    width: 2em;
+    height: 2em;
+    border: none;
+    outline: none;
+    position: fixed;
+    box-shadow: none;
+    color: transparent;
+    background: transparent;
+}
+
+@media (max-width: 640px) {
+    h1, summary.title {
+        font-size: 18px;
+    }
+    h3 {
+        font-size: 16px;
+    }
+
+    #dev_page_content_wrap {
+        padding-top: 12px;
+    }
+
+    #dev_page_title {
+        margin-top: 10px;
+        margin-bottom: 20px;
+    }
+}

+ 229 - 0
gramjs_generator/data/html/css/docs.h4x0r.css

@@ -0,0 +1,229 @@
+/* Begin of https://cdn.jsdelivr.net/npm/hack-font@3/build/web/hack.css
+ *
+ *  Hack typeface https://github.com/source-foundry/Hack
+ *  License: https://github.com/source-foundry/Hack/blob/master/LICENSE.md
+ */
+@font-face {
+  font-family: 'Hack';
+  src: url('fonts/hack-regular.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-regular.woff?sha=3114f1256') format('woff');
+  font-weight: 400;
+  font-style: normal;
+}
+
+@font-face {
+  font-family: 'Hack';
+  src: url('fonts/hack-bold.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bold.woff?sha=3114f1256') format('woff');
+  font-weight: 700;
+  font-style: normal;
+}
+
+@font-face {
+  font-family: 'Hack';
+  src: url('fonts/hack-italic.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-italic.woff?sha=3114f1256') format('woff');
+  font-weight: 400;
+  font-style: italic;
+}
+
+@font-face {
+  font-family: 'Hack';
+  src: url('fonts/hack-bolditalic.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bolditalic.woff?sha=3114f1256') format('woff');
+  font-weight: 700;
+  font-style: italic;
+}
+
+/* End of https://cdn.jsdelivr.net/npm/hack-font@3/build/web/hack.css */
+
+body {
+    font-family: 'Hack', monospace;
+    color: #0a0;
+    background-color: #000;
+    font-size: 16px;
+}
+
+::-moz-selection {
+    color: #000;
+    background: #0a0;
+}
+
+::selection {
+    color: #000;
+    background: #0a0;
+}
+
+a {
+    color: #0a0;
+}
+
+pre {
+    padding: 8px;
+    color: #0c0;
+    background: #010;
+    border-radius: 0;
+    overflow-x: auto;
+}
+
+a:hover {
+    color: #0f0;
+    text-decoration: underline;
+}
+
+table {
+    width: 100%;
+    max-width: 100%;
+}
+
+table td {
+    border-top: 1px solid #111;
+    padding: 8px;
+}
+
+.horizontal {
+    margin-bottom: 16px;
+    list-style: none;
+    background: #010;
+    border-radius: 4px;
+    padding: 8px 16px;
+}
+
+.horizontal li {
+    display: inline-block;
+    margin: 0 8px 0 0;
+}
+
+.horizontal img {
+    opacity: 0;
+    display: inline-block;
+    margin: 0 8px -2px 0;
+}
+
+h1, summary.title {
+    font-size: 24px;
+}
+
+h3 {
+    font-size: 20px;
+}
+
+#main_div {
+  padding: 20px 0;
+  max-width: 800px;
+  margin: 0 auto;
+}
+
+pre::-webkit-scrollbar {
+    visibility: visible;
+    display: block;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-track:horizontal {
+    background: #222;
+    border-radius: 0;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-thumb:horizontal {
+    background: #444;
+    border-radius: 0;
+    height: 12px;
+}
+
+:target {
+    border: 2px solid #0f0;
+    background: #010;
+    padding: 4px;
+}
+
+/* 'sh' stands for Syntax Highlight */
+span.sh1 {
+    color: #0f0;
+}
+
+span.tooltip {
+    border-bottom: 1px dashed #ddd;
+}
+
+#searchBox {
+    width: 100%;
+    border: none;
+    height: 20px;
+    padding: 8px;
+    font-size: 16px;
+    border-radius: 2px;
+    border: 2px solid #222;
+    background: #000;
+    color: #0e0;
+    font-family: 'Hack', monospace;
+}
+
+#searchBox:placeholder-shown {
+    color: #0b0;
+    font-style: italic;
+}
+
+button {
+    font-size: 16px;
+    padding: 8px;
+    color: #0f0;
+    background-color: #071007;
+    border: 2px solid #131;
+    transition-duration: 300ms;
+    font-family: 'Hack', monospace;
+}
+
+button:hover {
+    background-color: #131;
+}
+
+/* https://www.w3schools.com/css/css_navbar.asp */
+ul.together {
+    list-style-type: none;
+    margin: 0;
+    padding: 0;
+    overflow: hidden;
+}
+
+ul.together li {
+    float: left;
+}
+
+ul.together li a {
+    display: block;
+    border-radius: 8px;
+    background: #121;
+    padding: 4px 8px;
+    margin: 8px;
+}
+
+/* https://stackoverflow.com/a/30810322 */
+.invisible {
+    left: 0;
+    top: -99px;
+    padding: 0;
+    width: 2em;
+    height: 2em;
+    border: none;
+    outline: none;
+    position: fixed;
+    box-shadow: none;
+    color: transparent;
+    background: transparent;
+}
+
+@media (max-width: 640px) {
+    h1, summary.title {
+        font-size: 18px;
+    }
+    h3 {
+        font-size: 16px;
+    }
+
+    #dev_page_content_wrap {
+        padding-top: 12px;
+    }
+
+    #dev_page_title {
+        margin-top: 10px;
+        margin-bottom: 20px;
+    }
+}

+ 182 - 0
gramjs_generator/data/html/css/docs.light.css

@@ -0,0 +1,182 @@
+body {
+    font-family: 'Nunito', sans-serif;
+    color: #333;
+    background-color:#eee;
+    font-size: 16px;
+}
+
+a {
+    color: #329add;
+    text-decoration: none;
+}
+
+pre {
+    font-family: 'Source Code Pro', monospace;
+    padding: 8px;
+    color: #567;
+    background: #e0e4e8;
+    border-radius: 0;
+    overflow-x: auto;
+}
+
+a:hover {
+    color: #64bbdd;
+    text-decoration: underline;
+}
+
+table {
+    width: 100%;
+    max-width: 100%;
+}
+
+table td {
+    border-top: 1px solid #ddd;
+    padding: 8px;
+}
+
+.horizontal {
+    margin-bottom: 16px;
+    list-style: none;
+    background: #e0e4e8;
+    border-radius: 4px;
+    padding: 8px 16px;
+}
+
+.horizontal li {
+    display: inline-block;
+    margin: 0 8px 0 0;
+}
+
+.horizontal img {
+    display: inline-block;
+    margin: 0 8px -2px 0;
+}
+
+h1, summary.title {
+    font-size: 24px;
+}
+
+h3 {
+    font-size: 20px;
+}
+
+#main_div {
+  padding: 20px 0;
+  max-width: 800px;
+  margin: 0 auto;
+}
+
+pre::-webkit-scrollbar {
+    visibility: visible;
+    display: block;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-track:horizontal {
+    background: #def;
+    border-radius: 0;
+    height: 12px;
+}
+
+pre::-webkit-scrollbar-thumb:horizontal {
+    background: #bdd;
+    border-radius: 0;
+    height: 12px;
+}
+
+:target {
+    border: 2px solid #f8f800;
+    background: #f8f8f8;
+    padding: 4px;
+}
+
+/* 'sh' stands for Syntax Highlight */
+span.sh1 {
+    color: #f70;
+}
+
+span.tooltip {
+    border-bottom: 1px dashed #444;
+}
+
+#searchBox {
+    width: 100%;
+    border: none;
+    height: 20px;
+    padding: 8px;
+    font-size: 16px;
+    border-radius: 2px;
+    border: 2px solid #ddd;
+}
+
+#searchBox:placeholder-shown {
+    font-style: italic;
+}
+
+button {
+    border-radius: 2px;
+    font-size: 16px;
+    padding: 8px;
+    color: #000;
+    background-color: #f7f7f7;
+    border: 2px solid #329add;
+    transition-duration: 300ms;
+}
+
+button:hover {
+    background-color: #329add;
+    color: #f7f7f7;
+}
+
+/* https://www.w3schools.com/css/css_navbar.asp */
+ul.together {
+    list-style-type: none;
+    margin: 0;
+    padding: 0;
+    overflow: hidden;
+}
+
+ul.together li {
+    float: left;
+}
+
+ul.together li a {
+    display: block;
+    border-radius: 8px;
+    background: #e0e4e8;
+    padding: 4px 8px;
+    margin: 8px;
+}
+
+/* https://stackoverflow.com/a/30810322 */
+.invisible {
+    left: 0;
+    top: -99px;
+    padding: 0;
+    width: 2em;
+    height: 2em;
+    border: none;
+    outline: none;
+    position: fixed;
+    box-shadow: none;
+    color: transparent;
+    background: transparent;
+}
+
+@media (max-width: 640px) {
+    h1, summary.title {
+        font-size: 18px;
+    }
+    h3 {
+        font-size: 16px;
+    }
+
+    #dev_page_content_wrap {
+        padding-top: 12px;
+    }
+
+    #dev_page_title {
+        margin-top: 10px;
+        margin-bottom: 20px;
+    }
+}

+ 35 - 0
gramjs_generator/data/html/img/arrow.svg

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   version="1.1"
+   id="svg2"
+   viewBox="0 0 9 15"
+   height="15"
+   width="9">
+  <defs
+     id="defs4" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     transform="translate(0,-1037.3622)"
+     id="layer1">
+    <path
+       id="path4163"
+       d="m 0.1049,1039.6602 5.34527,5.0641 -5.43588,5.4358 1.81196,1.812 7.15946,-7.1594 -7.0291,-7.0604 z"
+       style="fill:#42aaed;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+  </g>
+</svg>

+ 244 - 0
gramjs_generator/data/html/js/search.js

@@ -0,0 +1,244 @@
+root = document.getElementById("main_div");
+root.innerHTML = `
+<!-- You can append '?q=query' to the URL to default to a search -->
+<input id="searchBox" type="text" onkeyup="updateSearch(event)"
+       placeholder="Search for requests and types…" />
+
+<div id="searchDiv">
+    <div id="exactMatch" style="display:none;">
+        <b>Exact match:</b>
+        <ul id="exactList" class="together">
+        </ul>
+    </div>
+
+    <details id="methods" open><summary class="title">Methods (<span id="methodsCount">0</span>)</summary>
+        <ul id="methodsList" class="together">
+        </ul>
+    </details>
+
+    <details id="types" open><summary class="title">Types (<span id="typesCount">0</span>)</summary>
+        <ul id="typesList" class="together">
+        </ul>
+    </details>
+
+    <details id="constructors"><summary class="title">Constructors (<span id="constructorsCount">0</span>)</summary>
+        <ul id="constructorsList" class="together">
+        </ul>
+    </details>
+</div>
+<div id="contentDiv">
+` + root.innerHTML + "</div>";
+
+// HTML modified, now load documents
+contentDiv = document.getElementById("contentDiv");
+searchDiv = document.getElementById("searchDiv");
+searchBox = document.getElementById("searchBox");
+
+// Search lists
+methodsDetails = document.getElementById("methods");
+methodsList = document.getElementById("methodsList");
+methodsCount = document.getElementById("methodsCount");
+
+typesDetails = document.getElementById("types");
+typesList = document.getElementById("typesList");
+typesCount = document.getElementById("typesCount");
+
+constructorsDetails = document.getElementById("constructors");
+constructorsList = document.getElementById("constructorsList");
+constructorsCount = document.getElementById("constructorsCount");
+
+// Exact match
+exactMatch = document.getElementById("exactMatch");
+exactList = document.getElementById("exactList");
+
+try {
+    requests = [{requestNames}];
+    types = [{typeNames}];
+    constructors = [{constructorNames}];
+
+    requestsu = [{requestUrls}];
+    typesu = [{typeUrls}];
+    constructorsu = [{constructorUrls}];
+} catch (e) {
+    requests = [];
+    types = [];
+    constructors = [];
+    requestsu = [];
+    typesu = [];
+    constructorsu = [];
+}
+
+if (typeof prependPath !== 'undefined') {
+    for (var i = 0; i != requestsu.length; ++i) {
+        requestsu[i] = prependPath + requestsu[i];
+    }
+    for (var i = 0; i != typesu.length; ++i) {
+        typesu[i] = prependPath + typesu[i];
+    }
+    for (var i = 0; i != constructorsu.length; ++i) {
+        constructorsu[i] = prependPath + constructorsu[i];
+    }
+}
+
+// Assumes haystack has no whitespace and both are lowercase.
+//
+// Returns the penalty for finding the needle in the haystack
+// or -1 if the needle wasn't found at all.
+function find(haystack, needle) {
+    if (haystack.indexOf(needle) != -1) {
+        return 0;
+    }
+    var hi = 0;
+    var ni = 0;
+    var penalty = 0;
+    var started = false;
+    while (true) {
+        while (needle[ni] < 'a' || needle[ni] > 'z') {
+            ++ni;
+            if (ni == needle.length) {
+                return penalty;
+            }
+        }
+        while (haystack[hi] != needle[ni]) {
+            ++hi;
+            if (started) {
+                ++penalty;
+            }
+            if (hi == haystack.length) {
+                return -1;
+            }
+        }
+        ++hi;
+        ++ni;
+        started = true;
+        if (ni == needle.length) {
+            return penalty;
+        }
+        if (hi == haystack.length) {
+            return -1;
+        }
+    }
+}
+
+// Given two input arrays "original" and "original urls" and a query,
+// return a pair of arrays with matching "query" elements from "original".
+//
+// TODO Perhaps return an array of pairs instead a pair of arrays (for cache).
+function getSearchArray(original, originalu, query) {
+    var destination = [];
+    var destinationu = [];
+
+    for (var i = 0; i < original.length; ++i) {
+        var penalty = find(original[i].toLowerCase(), query);
+        if (penalty > -1 && penalty < original[i].length / 3) {
+            destination.push(original[i]);
+            destinationu.push(originalu[i]);
+        }
+    }
+
+    return [destination, destinationu];
+}
+
+// Modify "countSpan" and "resultList" accordingly based on the elements
+// given as [[elements], [element urls]] (both with the same length)
+function buildList(countSpan, resultList, foundElements) {
+    var result = "";
+    for (var i = 0; i < foundElements[0].length; ++i) {
+        result += '<li>';
+        result += '<a href="' + foundElements[1][i] + '">';
+        result += foundElements[0][i];
+        result += '</a></li>';
+    }
+
+    if (countSpan) {
+        countSpan.innerHTML = "" + foundElements[0].length;
+    }
+    resultList.innerHTML = result;
+}
+
+function updateSearch(event) {
+    var query = searchBox.value.toLowerCase();
+    if (!query) {
+        contentDiv.style.display = "";
+        searchDiv.style.display = "none";
+        return;
+    }
+
+    contentDiv.style.display = "none";
+    searchDiv.style.display = "";
+
+    var foundRequests = getSearchArray(requests, requestsu, query);
+    var foundTypes = getSearchArray(types, typesu, query);
+    var foundConstructors = getSearchArray(constructors, constructorsu, query);
+
+    var original = requests.concat(constructors);
+    var originalu = requestsu.concat(constructorsu);
+    var destination = [];
+    var destinationu = [];
+
+    for (var i = 0; i < original.length; ++i) {
+        if (original[i].toLowerCase().replace("request", "") == query) {
+            destination.push(original[i]);
+            destinationu.push(originalu[i]);
+        }
+    }
+
+    if (event && event.keyCode == 13) {
+        if (destination.length != 0) {
+            window.location = destinationu[0];
+        } else if (methodsDetails.open && foundRequests[1].length) {
+            window.location = foundRequests[1][0];
+        } else if (typesDetails.open && foundTypes[1].length) {
+            window.location = foundTypes[1][0];
+        } else if (constructorsDetails.open && foundConstructors[1].length) {
+            window.location = foundConstructors[1][0];
+        }
+        return;
+    }
+
+    buildList(methodsCount, methodsList, foundRequests);
+    buildList(typesCount, typesList, foundTypes);
+    buildList(constructorsCount, constructorsList, foundConstructors);
+
+    // Now look for exact matches
+    if (destination.length == 0) {
+        exactMatch.style.display = "none";
+    } else {
+        exactMatch.style.display = "";
+        buildList(null, exactList, [destination, destinationu]);
+        return destinationu[0];
+    }
+}
+
+function getQuery(name) {
+    var query = window.location.search.substring(1);
+    var vars = query.split("&");
+    for (var i = 0; i != vars.length; ++i) {
+        var pair = vars[i].split("=");
+        if (pair[0] == name)
+            return decodeURI(pair[1]);
+    }
+}
+
+document.onkeydown = function (e) {
+    if (e.key == '/' || e.key == 's' || e.key == 'S') {
+        if (document.activeElement != searchBox) {
+            searchBox.focus();
+            return false;
+        }
+    } else if (e.key == '?') {
+        alert('Pressing any of: /sS\nWill focus the search bar\n\n' +
+              'Pressing: enter\nWill navigate to the first match')
+    }
+}
+
+var query = getQuery('q');
+if (query) {
+    searchBox.value = query;
+}
+
+var exactUrl = updateSearch();
+var redirect = getQuery('redirect');
+if (exactUrl && redirect != 'no') {
+    window.location = exactUrl;
+}