Ticket #10868: 0001-Add-a-search-box-to-the-API-documentation.patch

File 0001-Add-a-search-box-to-the-API-documentation.patch, 2.1 KB (added by waddlesplash, 7 years ago)

Git patch v2.

  • docs/user/book.css

    From 543c21e67083155833c44661ff91c022bfb685e9 Mon Sep 17 00:00:00 2001
    From: Augustin Cavalier <ajcsweb@gmail.com>
    Date: Sun, 25 May 2014 17:49:35 -0400
    Subject: [PATCH] Add a search box to the API documentation.
    
    * Uses the "site:" query to limit results to Haiku's API docs
    * CSS pulled in from the userguide site
    ---
     docs/user/book.css    | 13 ++++++++++++-
     docs/user/header.html | 12 +++++++++++-
     2 files changed, 23 insertions(+), 2 deletions(-)
    
    diff --git a/docs/user/book.css b/docs/user/book.css
    index fd8a8f4..a785f5b 100644
    a b h4 a:hover, a:active, h5 a:hover, a:active, h6 a:hover, a:active {  
    141141
    142142#banner span.subtitle {
    143143    position: relative;
    144     top: 54px;
     144    top: 30px;
    145145    left: 272px;
    146146    color: #333333; /* mine shaft */
    147147    text-transform: uppercase;
    h4 a:hover, a:active, h5 a:hover, a:active, h6 a:hover, a:active {  
    150150    font-weight: normal;
    151151}
    152152
     153input[type=text], input[type=password] {
     154  font-size: inherit;
     155  border-top: 1px solid #818181;
     156  border-left: 1px solid #818181;
     157  border-bottom: 1px solid #858585;
     158  border-right: 1px solid #858585;
     159  margin-top: 3px;
     160  padding: 2px;
     161  width: 200px;
     162}
     163
    153164div.header {
    154165    margin-top: 20px;
    155166    margin: 10px auto;
  • docs/user/header.html

    diff --git a/docs/user/header.html b/docs/user/header.html
    index 277802f..396a3a2 100644
    a b  
    44    <meta http-equiv="Content-Type" content="text/html;charset=UTF8">
    55    <title>$title</title>
    66    <link href="book.css" rel="stylesheet" type="text/css">
     7    <script type="text/javascript">
     8        function search(node, event) {
     9            if(event.keyCode == 13)
     10                    window.location.href = 'https://google.com/search?q=' +
     11                        encodeURIComponent('site:api.haiku-os.org ' + node.value);
     12        }
     13    </script>
    714</head>
    815<body>
    916    <div id="banner">
    1017        <div class="logo">
    11             <span class="subtitle">API Documentation</span>
     18            <span class="subtitle">
     19                API Documentation<br>
     20                <input type="text" name="search" placeholder="Search" onkeydown="search(this, event);">
     21            </span>
    1222        </div>
    1323    </div>