feat: rebuild the forum index and post-login pages into the mobile view

The list view already handled every table row shape a forum page uses,
but the switch only ever routed viewforum.php and search.php into it;
index.php arrived untouched, so the very first page a visitor lands on
stayed in the desktop layout. It matches the same category/forum row
structure a viewforum.php category page already produces, so no new
building logic was needed, only the routing.

Submitting the login form reveals a second gap: it re-renders the same
URL with a generic confirmation page instead of the form, which the
existing form-lookup silently ignored, leaving that page unstyled too
right before phpBB's own redirect fires. It shares its shape with any
other message phpBB might render there (a wrong password, for example),
so the fix recognises it structurally rather than by its wording, and
carries the original message cell over unchanged the same way the login
form itself is reused rather than rebuilt.
This commit is contained in:
Andre
2026-08-02 16:28:13 +02:00
parent 27551e6937
commit aec883e7c9
3 changed files with 124 additions and 32 deletions
+53 -3
View File
@@ -1,7 +1,7 @@
// ==UserScript==
// @name RIN Mobile
// @description Mobile Ansicht fuer cs.rin.ru: Themenlisten als Karten, Threads als Beitragsstrom
// @version 3.6
// @version 3.7
// @match *://cs.rin.ru/forum/*
// @run-at document-start
// ==/UserScript==
@@ -23,8 +23,13 @@
// die Ladereihenfolge entschied bei gleich benannten Regeln ueber das
// Layout.
var here = location.pathname + location.search;
// index.php wird ueber den Pfad geprueft, nicht ueber "here": der
// Login-Redirect haengt "index.php" gelegentlich als Wert eines
// Query-Parameters an ucp.php, ueber "here" faellt das faelschlich hier
// hinein statt in den Login-Zweig.
var view = /viewtopic\.php/.test(here) ? 'thread'
: /viewforum\.php|search\.php/.test(here) ||
/\/index\.php$/.test(location.pathname) ||
location.pathname === '/forum/' ? 'liste'
: /ucp\.php/.test(here) && /mode=login/.test(here) ? 'login'
: '';
@@ -216,6 +221,16 @@
.rm-login-note summary { cursor:pointer; font-weight:650; opacity:.9; }
.rm-login-note[open] summary { margin-bottom:8px; }
/* Die verschobene td.row1 wird per Klasse zum Block, wie form/table/tr
ueber .rm-login form weiter unten. */
.rm-login-msg { display:block !important; box-sizing:border-box;
padding:22px 14px calc(60px + env(safe-area-inset-bottom)) !important;
text-align:center; font-size:16px; line-height:1.6; }
.rm-login-msg a { display:inline-block; margin-top:8px; padding:12px 24px;
font-size:16px; font-weight:650; border-radius:10px;
color:#fff !important; text-decoration:none !important;
background:rgba(120,170,255,.85); }
/* Das Original-Formular ist tabellenbasiert und wird fuer den gestapelten
Kartenstil komplett auf Block-Elemente umgelegt — derselbe Trick wie bei
.rm-body table im Thread. Ohne Paginierung fehlt hier die .rm-nav, die
@@ -1181,7 +1196,7 @@
function buildLogin() {
var userInput = document.querySelector('input[name="username"]');
var form = userInput && userInput.closest('form');
if (!form) { log.push('login: kein Formular'); return; }
if (!form) { buildLoginInfo(); return; }
var root = document.createElement('div');
root.className = 'rm-root rm-login';
@@ -1218,6 +1233,41 @@
log.push('login=formular');
}
// ucp.php?mode=login liefert ausser dem Formular auch Zwischenseiten ueber
// dieselbe generische "Information"-Vorlage aus — zum Beispiel die
// Bestaetigung nach erfolgreichem Login, vermutlich aber auch andere
// Meldungen wie ein falsches Passwort, fuer die keine Fixture vorliegt.
// Erkannt wird die Vorlage an der Form, nicht am Text: eine Kopfzeile mit
// genau einer th-Zelle traegt in diesem View sonst nirgends eine einzelne
// Nachricht samt Link. Wie beim Formular wandert die Original-Zelle
// unveraendert in die neue Ansicht, damit der Link darin (zurueck zum Index
// oder zu einem anderen Ziel) unangetastet bleibt.
function buildLoginInfo() {
var th = null;
document.querySelectorAll('table.tablebg th').forEach(function (t) {
if (th) return;
var row = t.closest('tr');
if (row && row.children.length === 1) th = t;
});
var msgCell = th && th.closest('table').querySelector('td.row1');
if (!th || !msgCell) { log.push('login: kein Formular, keine Meldung'); return; }
var root = document.createElement('div');
root.className = 'rm-root rm-login';
var title = document.createElement('div');
title.className = 'rm-login-title';
title.textContent = txt(th) || 'Information';
root.appendChild(title);
msgCell.classList.add('rm-login-msg');
root.appendChild(msgCell);
replaceBody(root);
addCrumbs();
log.push('login=meldung');
}
// ==========================================================================
function run() {
@@ -1230,7 +1280,7 @@
if (DEBUG) {
var d = document.createElement('div');
d.className = 'rm-dbg';
d.textContent = 'RIN Mobile v3.6\n' + log.join('\n');
d.textContent = 'RIN Mobile v3.7\n' + log.join('\n');
document.body.insertBefore(d, document.body.firstChild);
}
}