Preact: Support News
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled

This commit is contained in:
Guangcong Luo 2026-03-18 07:33:45 +00:00
parent a7f3c522e0
commit 79b4d0d5e2
3 changed files with 5 additions and 3 deletions

View File

@ -217,6 +217,8 @@ try {
indexContents = indexContents.replace(/<!-- newsid -->/g, newsid);
indexContents = indexContents.replace(/<!-- news -->/g, news);
preactIndexContents = preactIndexContents.replace(/<!-- newsid -->/g, newsid);
preactIndexContents = preactIndexContents.replace(/<!-- news -->/g, news);
let indexContents2 = '';
try {

View File

@ -45,10 +45,9 @@ https://psim.us/dev
<div class="mainmenu-mini-windows">
<div class="mini-window" data-roomid="news">
<h3 class="mini-window-header"><button class="closebutton" tabindex="-1" aria-label="Close"><i class="fa fa-times-circle"></i></button>News</h3>
<div id="room-news" class="mini-window-contents ps-room-light scrollable" style="height: auto;">
<div id="room-news" class="mini-window-contents ps-room-light scrollable" style="height: auto;" data-newsid="<!-- newsid -->">
<div class="readable-bg">
<div class="newsentry"><h4>New updates</h4><p>The Preact alpha test client is very far along!</p><p>Other than the teambuilder, everything else should be ready.</p><p>&mdash;<strong>Zarel</strong> <small class="date">on Apr 9, 2025</small></p></div>
<div class="newsentry"><h4>Preact alpha</h4><p>Welcome to the Preact alpha test client!</p><p>Many parts are unimplemented and there may be bugs; we're using this page to test it.</p><p>&mdash;<strong>Zarel</strong> <small class="date">on Oct 16, 2018</small></p></div>
<!-- news -->
</div>
</div>
</div>

View File

@ -1928,6 +1928,7 @@ export const PS = new class extends PSModel {
arrowKeysUsed = false;
newsHTML = document.querySelector('#room-news .readable-bg')?.innerHTML || '';
newsId = document.getElementById('room-news')?.getAttribute('data-newsid') || null;
libsLoaded = makeLoadTracker();