You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dashboard modules (router, table, chart, icons), markdown, QR codes, PWA, and auth.js without third-party scripts
router.js (new) - startRouter(routes, options) for single-page apps: hash mode (default, works on GitHub Pages) or history mode with base; patterns like /mahasiswa/:id, ctx.query (URLSearchParams), a notFound view. A view is a function (may be async, returns HTML or a Node), a URL of an HTML fragment, or { html, run }. When the user navigates again before an async view finishes, its ctx.signal is aborted and its result ignored. History mode intercepts internal <a> clicks. After each navigation focus moves to the first <h1>, the title is announced through role="status", and matching nav links get aria-current="page". Returns { navigate, href, current, stop }.
table.js (new) - createTable(id, options), a replacement for jQuery DataTables: a real <table> from column definitions and rows, sorting per column (aria-sort, Indonesian natural order with Intl.Collator), search, pagination with selectable page size, and a row count announced to screen readers. Cells are always text or Nodes, never HTML. Server mode through source({ page, pageSize, sort, query }) → { rows, total }, with debounced search and late responses dropped.
chart.js (new) - hand-written SVG bar (grouped or stacked), line, and donut charts; not Chart.js and not API-compatible with it. createChart(id, config) → { element, update, remove }, plus niceScale. Round-number axes, Indonesian number format, width follows the container, a palette (--croot-chart-1..8) that keeps 3:1 contrast in croot.css light and dark mode, role="img" with title and description, a data table for screen readers, legend, and tooltips on hover and on keyboard focus.
icons.css (new) - 49 hand-drawn dashboard icons (24x24 grid, 2px strokes) as a separate file next to croot.css (about 1.9 KB gzipped): <span class="icon icon-home" aria-hidden="true">. Color follows currentColor, size is 1em; SVG data URIs as mask-image, so they work cross-origin from jsDelivr. In @layer croot.icons.
markdown.js (new) - markdownToHTML, renderMarkdown, getMarkdown: a CommonMark/GFM subset (headings, emphasis, strikethrough, code, quotes, nested and task lists, tables, links, images) that is safe by design: all raw HTML is escaped, URLs are limited to http(s), mailto, tel, relative and #anchor, and malicious input runs in linear time. getMarkdown returns a Promise that never rejects.
qr.js (new) - qrSVG, renderQR, qrMatrix: QR codes written from scratch (byte mode, UTF-8, versions 1-40 chosen automatically, levels L/M/Q/H) as a single-path SVG. Output tested identical to python-qrcode at sample sizes from version 1 to 40 at all four levels.
pwa.js (new) and serviceworker.js (new) - registerServiceWorker (Promise that never rejects, https/localhost only, a "new version" notice with reload), onNetworkChange, isStandalone, installButton. serviceworker.js is a classic script for importScripts in an sw.js on your own domain: crootjsServiceWorker({ version, precache, offlinePage, maxEntries, networkTimeout }) with a versioned precache, network-first navigation with cache and offline-page fallback, stale-while-revalidate for own assets, and cache-first for exact-version jsDelivr files. Non-GET requests, page fetch()/XHR and other domains are not touched.
auth.js - no more unpinned third-party imports: the QR code comes from qr.js instead of an unversioned Skypack package, and SweetAlert2 (@11, no exact version) is replaced by a native <dialog>. The Google Sign-In login sent the wrong arguments to postJSON (the body was the string "login" and the callback was the cookie value), so it could never log in; fixed. A network failure now shows a message instead of being swallowed. The login token is no longer written to the console. The refresh and mobile login controls are a real <button> and <a>.
template.js - refreshbutton and loginbutton no longer contain onclick or inline styles; loginbutton no longer has the ##URL## placeholder. Wrap them in your own <button>/<a> (auth.js does).
croot.css - align="center"/"right" on th/td is respected (markdown.js tables use it instead of inline styles).
form.js - the error message color uses --croot-danger, so it is readable in croot.css dark mode.
tests/ - 164 tests in Chromium, Firefox and WebKit, including all new modules and a real service worker.