Tony CHEMIT pushed to branch pages at ultreiaio / ird-observe

Commits:

2 changed files:

Changes:

  • index.html
    ... ... @@ -26,6 +26,7 @@
    26 26
         <meta charset="UTF-8">
    
    27 27
         <title>Observe documentation</title>
    
    28 28
         <link rel="stylesheet" href="index.css"/>
    
    29
    +    <script type="application/javascript" src="index.js"></script>
    
    29 30
     </head>
    
    30 31
     <body>
    
    31 32
     <ul class="breadcrumb" id="top">
    
    ... ... @@ -33,7 +34,8 @@
    33 34
     </ul>
    
    34 35
     
    
    35 36
     <h1>Available versions</h1>
    
    36
    -<ul>
    
    37
    +
    
    38
    +<ul id="versions">
    
    37 39
         <li><a href="./latest">Latest documentation</a></li>
    
    38 40
         <li><a href="./stable">Stable documentation</a></li>
    
    39 41
     </ul>
    
    ... ... @@ -56,6 +58,6 @@
    56 58
             </li>
    
    57 59
         </ul>
    
    58 60
     </div>
    
    59
    -
    
    61
    +<script type="application/javascript">loadContent("versions");</script>
    
    60 62
     </body>
    
    61 63
     </html>

  • index.js
    1
    +/*-
    
    2
    + * #%L
    
    3
    + * ObServe Server :: Runner
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10
    + * License, or (at your option) any later version.
    
    11
    + *
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +
    
    23
    +function loadContent(file) {
    
    24
    +    let target = document.getElementById(file);
    
    25
    +    if (target) {
    
    26
    +        let oReq = new XMLHttpRequest();
    
    27
    +        oReq.addEventListener("load",
    
    28
    +            function responseListener() {
    
    29
    +                let json = JSON.parse(this.responseText);
    
    30
    +                let content = "";
    
    31
    +                for (var key in json) {
    
    32
    +                    if (json.hasOwnProperty(key)) {
    
    33
    +                        let date = json[key];
    
    34
    +                        content += '<li><a href="./' + key + '">' + key + '</a> ( last update: ' + date + ' )</li>';
    
    35
    +                    }
    
    36
    +                }
    
    37
    +                content += "";
    
    38
    +                target.innerHTML = content;
    
    39
    +            }
    
    40
    +        );
    
    41
    +        oReq.open("GET", file + ".json");
    
    42
    +        oReq.send();
    
    43
    +    }
    
    44
    +}