-
Notifications
You must be signed in to change notification settings - Fork 120
site: news nav link with "N NEW" chip + dasImgui announcement #2907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
site/_news/2026-05-27-0-6-3-is-just-around-the-corner-in-the.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| date: 2026-05-27 | ||
| tag: dasImgui | ||
| title: 0.6.3 is just around the corner. In the meantime, check out dasImgui — now with imgui_playwright. | ||
| link: https://borisbat.github.io/dasImgui/ | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| /* Forge nav — "N NEW" news chip. | ||
| * | ||
| * Data source: files/news-meta.json (built by site/blog/build_blog.py). | ||
| * Storage: localStorage["daslang:news:lastSeen"] = "YYYY-MM-DD". | ||
| * | ||
| * Semantics (mirrors blog-counter.js): | ||
| * - First-time visitor (no key) → seeded from news-meta.json baseline_date, | ||
| * which is the 2nd-newest entry's date. | ||
| * So count = 1 (just the newest). | ||
| * - Landing with hash "#news" → key set to newest_date; chip clears. | ||
| * - Click on the news nav link → key set to newest_date. | ||
| * - count > 9 → render "9+ NEW". | ||
| * - count === 0 → chip not rendered. | ||
| * | ||
| * Nav anchors are matched by link.hash === "#news" so the same script works | ||
| * from any page that links to "#news" / "index.html#news" / "../index.html#news". | ||
| */ | ||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| var STORAGE_KEY = 'daslang:news:lastSeen'; | ||
|
|
||
| function readLastSeen() { | ||
| try { return window.localStorage.getItem(STORAGE_KEY); } | ||
| catch (_) { return null; } | ||
| } | ||
|
|
||
| function writeLastSeen(date) { | ||
| try { window.localStorage.setItem(STORAGE_KEY, date); } | ||
| catch (_) { /* private mode / quota — silent */ } | ||
| } | ||
|
|
||
| function newsJsonUrl() { | ||
| // Locate our own <script> tag and derive news-meta.json next to it. | ||
| var scripts = document.getElementsByTagName('script'); | ||
| for (var i = 0; i < scripts.length; i++) { | ||
| var src = scripts[i].getAttribute('src') || ''; | ||
| if (src.indexOf('news-counter.js') !== -1) { | ||
| return src.replace(/news-counter\.js(\?.*)?$/, 'news-meta.json'); | ||
| } | ||
| } | ||
| return 'files/news-meta.json'; | ||
| } | ||
|
|
||
| function findNewsLinks() { | ||
| // Match any nav link whose URL hash is "#news" — works for | ||
| // "#news", "index.html#news", "../index.html#news". | ||
| var links = document.querySelectorAll('.forge-nav__links a[href]'); | ||
| var out = []; | ||
| for (var i = 0; i < links.length; i++) { | ||
| if (links[i].hash === '#news') out.push(links[i]); | ||
| } | ||
| return out; | ||
| } | ||
|
|
||
| function renderChip(anchor, count) { | ||
| if (anchor.querySelector('.forge-blog-chip')) return; | ||
| var chip = document.createElement('span'); | ||
| chip.className = 'forge-blog-chip'; | ||
| chip.textContent = (count > 9 ? '9+' : count) + ' NEW'; | ||
| anchor.appendChild(chip); | ||
| anchor.classList.add('forge-blog-link'); | ||
| } | ||
|
|
||
| function clearChips() { | ||
| var chips = document.querySelectorAll('.forge-nav__links a .forge-blog-chip'); | ||
| for (var i = 0; i < chips.length; i++) { | ||
| var parent = chips[i].parentNode; | ||
| if (parent && parent.hash === '#news') { | ||
| chips[i].remove(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function update(data) { | ||
| // Landing-with-#news: mark seen and render nothing. Early-return so | ||
| // that a silently-failed writeLastSeen (private mode / quota) cannot | ||
| // still cause the chip to render — we are already on the destination. | ||
| if (window.location.hash === '#news') { | ||
| writeLastSeen(data.newest_date); | ||
| return; | ||
| } | ||
| var anchors = findNewsLinks(); | ||
| for (var k = 0; k < anchors.length; k++) { | ||
| (function (a) { | ||
| a.addEventListener('click', function () { | ||
| writeLastSeen(data.newest_date); | ||
| clearChips(); | ||
| }); | ||
| })(anchors[k]); | ||
| } | ||
| var lastSeen = readLastSeen() || data.baseline_date; | ||
| var count = 0; | ||
| for (var i = 0; i < data.news.length; i++) { | ||
| if (data.news[i].date > lastSeen) count++; | ||
| } | ||
| if (count <= 0) return; | ||
| for (var j = 0; j < anchors.length; j++) { | ||
| renderChip(anchors[j], count); | ||
| } | ||
| } | ||
|
|
||
| function start() { | ||
| fetch(newsJsonUrl(), { cache: 'no-cache' }) | ||
| .then(function (r) { return r.ok ? r.json() : null; }) | ||
| .then(function (data) { if (data) update(data); }) | ||
| .catch(function () { /* offline / missing — silent */ }); | ||
| } | ||
|
|
||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', start); | ||
| } else { | ||
| start(); | ||
| } | ||
| })(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.