chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

board.html (5456B)


      1 <!doctype html>
      2 <html lang="en">
      3 <head>
      4 <meta charset="utf-8">
      5 <meta name="viewport" content="width=device-width, initial-scale=1">
      6 <title>Board - Chamesle</title>
      7 <meta name="description" content="The Chamesle community board.">
      8 <link rel="canonical" href="https://chamesle.org/board.html">
      9 <meta property="og:type" content="website">
     10 <meta property="og:site_name" content="Chamesle">
     11 <meta property="og:title" content="Board - Chamesle">
     12 <meta property="og:description" content="The Chamesle community board.">
     13 <meta property="og:url" content="https://chamesle.org/board.html">
     14 <link rel="stylesheet" href="style.css?25">
     15 <link rel="icon" href="img/logo.png">
     16 </head>
     17 <body>
     18 
     19 <div id="page">
     20 
     21 <div id="top">
     22 <h1><a href="./"><img src="img/banner.png" alt="Chamesle Linux" width="223" height="56"></a></h1>
     23 </div>
     24 
     25 <div id="nav">
     26 <a href="./">Home</a> |
     27 <a href="download.html">Download</a> |
     28 <a href="docs.html">Handbook</a> |
     29 <a href="packages.html">Packages</a> |
     30 <a href="new.html">News</a> |
     31 <b>Board</b> |
     32 <a href="chat.html">Chat</a> |
     33 <a href="source.html">Source</a> |
     34 <a href="https://x22.chamesle.org/">X22</a> |
     35 <a href="https://github.com/tortr-rs/mag">mag</a> |
     36 <a href="about.html">About</a>
     37 </div>
     38 
     39 <main>
     40 <h2>Board</h2>
     41 <p><i>Ask for help, show off your desktop, share ideas. You log in with your GitHub account, right here.</i></p>
     42 
     43 
     44 <div class="bar" id="sort">
     45   <button data-s="hot" class="on">Hot</button>
     46   <button data-s="new">New</button>
     47   <button data-s="top">Top</button>
     48   <a class="button" href="submit.html">New post</a>
     49 </div>
     50 <div class="bar" id="cats"><button data-c="" class="on">Everything</button></div>
     51 <ul class="posts" id="posts"></ul>
     52 <p id="empty" class="small"></p>
     53 </main>
     54 
     55 <hr>
     56 <div id="foot">
     57 Something wrong on this page? Tell us on the <a href="board.html">board</a>.<br>
     58 Chamesle installs with <code>chamesle-install</code>, or by hand from the <a href="docs.html">handbook</a>.<br>
     59 <a href="https://ko-fi.com/L6N725GI1V">Ko-fi</a><br>
     60 <a href="#" id="edit-link">Edit text</a><br>
     61 $Date: 2026-11-14 $
     62 </div>
     63 
     64 </div>
     65 
     66 <script>
     67 var CATS = {
     68   'q-a': ['Help', 'DIC_kwDOShHmjc4DJQSa', 'Q&A'],
     69   'show-and-tell': ['Show your desktop', 'DIC_kwDOShHmjc4DJQSc', 'Show and tell'],
     70   'ideas': ['Ideas', 'DIC_kwDOShHmjc4DJQSb', 'Ideas'],
     71   'general': ['General', 'DIC_kwDOShHmjc4DJQSZ', 'General'],
     72   'announcements': ['Announcements', 'DIC_kwDOShHmjc4DJQSY', 'Announcements']
     73 };
     74 function esc(s) { var d = document.createElement('div'); d.textContent = s || ''; return d.innerHTML; }
     75 function ago(t) {
     76   var s = (Date.now() - new Date(t)) / 1000;
     77   if (s < 3600) return Math.max(1, Math.round(s / 60)) + ' min ago';
     78   if (s < 86400) return Math.round(s / 3600) + ' h ago';
     79   if (s < 86400 * 30) return Math.round(s / 86400) + ' d ago';
     80   return new Date(t).toLocaleDateString();
     81 }
     82 function giscus(el, cat, mapping, term) {
     83   var s = document.createElement('script'), c = CATS[cat] || CATS.general;
     84   var a = {src: 'https://giscus.app/client.js', 'data-repo': 'tortr-rs/chamesle', 'data-repo-id': 'R_kgDOShHmjQ',
     85     'data-category': c[2], 'data-category-id': c[1], 'data-mapping': mapping, 'data-term': term, 'data-strict': '1',
     86     'data-reactions-enabled': '1', 'data-emit-metadata': '0', 'data-input-position': 'top',
     87     'data-theme': 'preferred_color_scheme', 'data-lang': 'en', crossorigin: 'anonymous', async: ''};
     88   for (var k in a) s.setAttribute(k, a[k]);
     89   el.appendChild(s);
     90 }
     91 
     92 var all = [], sort = 'hot', cat = '';
     93 function score(p) {
     94   if (sort === 'new') return +new Date(p.at);
     95   if (sort === 'top') return p.v * 1000 + p.k;
     96   var hours = (Date.now() - new Date(p.at)) / 3600000;
     97   return (p.v + p.k / 2 + 1) / Math.pow(hours + 2, 1.5);
     98 }
     99 function show() {
    100   var list = all.filter(function (p) { return !cat || p.c === cat; });
    101   list.sort(function (a, b) { return score(b) - score(a); });
    102   var out = document.getElementById('posts');
    103   out.innerHTML = '';
    104   list.forEach(function (p) {
    105     var li = document.createElement('li'), c = CATS[p.c] || [p.c];
    106     li.innerHTML = '<div class="votes"><span>&#9650;</span>' + p.v + '</div><div><h3><a href="post.html?n=' + p.n + '">' +
    107       esc(p.t) + '</a></h3><p>' + esc(p.b) + '</p><div class="meta"><span class="cat">' + esc(c[0]) + '</span>' +
    108       (p.av ? '<img src="' + esc(p.av) + '&s=32" alt="">' : '') + esc(p.a) + ' &middot; ' + ago(p.at) + ' &middot; ' +
    109       p.k + (p.k === 1 ? ' comment' : ' comments') + '</div></div>';
    110     out.appendChild(li);
    111   });
    112   document.getElementById('empty').textContent = list.length ? '' : 'Nothing here yet. Be the first to post!';
    113 }
    114 var cats = document.getElementById('cats');
    115 Object.keys(CATS).forEach(function (k) {
    116   var b = document.createElement('button'); b.dataset.c = k; b.textContent = CATS[k][0]; cats.appendChild(b);
    117 });
    118 function pick(bar, attr, set) {
    119   bar.addEventListener('click', function (e) {
    120     var b = e.target.closest('button'); if (!b) return;
    121     bar.querySelectorAll('button').forEach(function (x) { x.classList.toggle('on', x === b); });
    122     set(b.dataset[attr]); show();
    123   });
    124 }
    125 pick(document.getElementById('sort'), 's', function (v) { sort = v; });
    126 pick(cats, 'c', function (v) { cat = v; });
    127 fetch('board.json?' + Date.now()).then(function (r) { return r.json(); }).then(function (d) { all = d; show(); })
    128   .catch(function () { document.getElementById('empty').textContent = "Couldn't load the board. Try reloading."; });
    129 </script>
    130 <script src="edit.js"></script>
    131 </body>
    132 </html>