1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <!DOCTYPE html>
- <html>
- <head>
- <%- header_tpl({site_title = site_title, title = "Index"}) %>
- <!-- JS client-side search. -->
- <script src="/js/fuse.min.js"></script>
- <script type="application/javascript">
- async function get_json(url) {
- try {
- const response = await fetch(url);
- if (!response.ok) {
- throw new Error(`Response status: ${response.status}`);
- }
- const json = await response.json();
- console.log(json);
- return json;
- } catch (error) {
- console.error(error.message);
- }
- }
- async function fuse_init() {
- let [idx_json, keys_json] = await Promise.all([
- get_json('/js/fuse_index.json'),
- get_json('/js/fuse_keys.json')
- ]);
- const fuseOptions = {
- // isCaseSensitive: false,
- // includeScore: false,
- // ignoreDiacritics: false,
- // shouldSort: true,
- // includeMatches: false,
- // findAllMatches: false,
- // minMatchCharLength: 1,
- // location: 0,
- // threshold: 0.6,
- // distance: 100,
- // useExtendedSearch: false,
- // ignoreLocation: false,
- // ignoreFieldNorm: false,
- // fieldNormWeight: 1,
- keys: keys_json,
- };
- return new Fuse(idx_json, fuseOptions);
- }
- let fuse;
- (async () => {fuse = await fuse_init()})();
- </script>
- </head>
- <body>
- <header>
- <h1><%= title %></h1>
- </header>
- <main>
- <section id="obj_list">
- <h2>Recent artifacts</h2>
- <ul>
- <% for _, obj in ipairs(obj_idx) do %>
- <li class="obj_link">
- <a href="<%= obj.href %>">
- <%if obj.tn then %>
- <img src="<%= obj.tn %>" alt="<%= obj.title.data %>" />
- <% end %>
- <%= obj.title.data %>
- <%if obj.title.lang then %>
- <span class="langtag"><%= obj.title.lang %></span>
- <% end %>
- </a>
- </li>
- <% end %>
- </ul>
- </section>
- </main>
- <footer></footer>
- </body>
- </html>
|