mirror of
https://github.com/Andre-Bzk/rin-mobile-userscript.git
synced 2026-11-16 10:05:59 +01:00
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:
@@ -15,9 +15,9 @@ page type:
|
||||
|
||||
| Page | View |
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.php`, forum root | Topic and forum list as cards |
|
||||
| `viewforum.php`, `search.php`, `index.php`, forum root | Topic and forum list as cards |
|
||||
| `viewtopic.php` | Thread as a post stream with a fixed bottom navigation bar |
|
||||
| `ucp.php?mode=login` | Login form, restyled in place |
|
||||
| `ucp.php?mode=login` | Login form, restyled in place; on the same URL after a successful submit, the resulting information page instead |
|
||||
| anything else | Untouched — no styles are injected |
|
||||
|
||||
A `viewforum.php` page is not necessarily a list of topics: a category page
|
||||
@@ -61,19 +61,16 @@ Both views carry a fixed breadcrumb bar at the top, taken from the forum's own
|
||||
`Board index » … » Main Forum` trail. Without it there is no way back out of a
|
||||
thread, because the original page is hidden and phpBB links the parent forum
|
||||
nowhere else. The bar scrolls horizontally if the trail is too long for the
|
||||
screen, and is left out entirely on pages that do not carry a trail. Note that
|
||||
`Board index` leads to `index.php`, which the script does not rebuild — that
|
||||
page arrives in its desktop layout.
|
||||
screen, and is left out entirely on pages that do not carry a trail.
|
||||
|
||||
The breadcrumb bar also carries a login pill, built on every page the script
|
||||
touches, not only the login form itself. Session state is read from the
|
||||
forum's own menu bar: a `mode=login` link means logged out, a `mode=logout`
|
||||
link means logged in, and the pill switches between a "Login" link and the
|
||||
account name accordingly. The name is parsed from the link text with a
|
||||
`Logout [ Name ]` pattern; that pattern is unverified against a real logged-in
|
||||
session, since the repository's fixtures are all captured while logged out —
|
||||
if the pattern does not match, the pill still shows "Logout", just without a
|
||||
name, rather than breaking.
|
||||
`Logout [ Name ]` pattern, confirmed against a real logged-in session's markup;
|
||||
if it ever fails to match — a different language, a different bracket style —
|
||||
the pill still shows "Logout", just without a name, rather than breaking.
|
||||
|
||||
The login form itself is not rebuilt from scratch: the original `<form>`
|
||||
element is moved into the new layout and restyled, table rows collapsed to a
|
||||
@@ -82,6 +79,14 @@ hidden `sid` and `redirect` fields, the `autologin` / `viewonline` checkboxes
|
||||
and the plain server-side POST intact — the script never talks to the forum's
|
||||
session handling directly, it only changes how the existing form looks.
|
||||
|
||||
Submitting the form re-renders the same URL with a generic "Information"
|
||||
template instead of the form — a short confirmation ("You have been
|
||||
successfully logged in.") before phpBB's own `<meta refresh>` moves on to the
|
||||
forum index. The script recognises this template by its shape (a single-cell
|
||||
header followed by a message cell), not by its wording, and restyles it the
|
||||
same way as the form: the original cell — message and link included — is
|
||||
reused in place rather than rebuilt.
|
||||
|
||||
The script runs at `document-start`, injects a mobile viewport meta tag, and
|
||||
carries a `DEBUG` flag. While `DEBUG` is `true`, a green diagnostic overlay is
|
||||
prepended to the page showing which view was chosen and how many rows were
|
||||
@@ -225,9 +230,9 @@ anhand des Seitentyps:
|
||||
|
||||
| Seite | Ansicht |
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.php`, Forumwurzel | Themen- und Forenliste als Karten |
|
||||
| `viewforum.php`, `search.php`, `index.php`, Forumwurzel | Themen- und Forenliste als Karten |
|
||||
| `viewtopic.php` | Thread als Beitragsstrom mit fixierter Navigationsleiste |
|
||||
| `ucp.php?mode=login` | Login-Formular, an Ort und Stelle umgestylt |
|
||||
| `ucp.php?mode=login` | Login-Formular, an Ort und Stelle umgestylt; auf derselben URL nach erfolgreichem Absenden stattdessen die Informationsseite |
|
||||
| alles andere | Unverändert — es werden keine Stile injiziert |
|
||||
|
||||
Eine `viewforum.php`-Seite ist nicht zwangsläufig eine Themenliste: eine
|
||||
@@ -274,18 +279,17 @@ Beide Ansichten haben oben eine fixierte Brotkrumenleiste, übernommen aus dem
|
||||
kein Weg zurück, weil die Originalseite ausgeblendet ist und phpBB das
|
||||
Elternforum nirgends sonst verlinkt. Die Leiste lässt sich waagerecht schieben,
|
||||
wenn der Pfad breiter ist als der Bildschirm, und entfällt auf Seiten ohne
|
||||
Pfadangabe. `Board index` führt auf `index.php` — diese Seite baut das Script
|
||||
nicht um, sie erscheint im Desktop-Layout.
|
||||
Pfadangabe.
|
||||
|
||||
Die Brotkrumenleiste trägt außerdem eine Login-Pille, gebaut auf jeder Seite,
|
||||
die das Script anfasst — nicht nur auf dem Login-Formular selbst. Der
|
||||
Sitzungszustand wird aus dem Menübalken der Originalseite gelesen: ein
|
||||
`mode=login`-Link bedeutet ausgeloggt, ein `mode=logout`-Link eingeloggt, die
|
||||
Pille wechselt entsprechend zwischen einem „Login"-Link und dem Kontonamen.
|
||||
Der Name wird über das Muster `Logout [ Name ]` aus dem Linktext gelesen; das
|
||||
Muster ist gegen keine echte eingeloggte Sitzung geprüft, da alle Fixtures des
|
||||
Repositories ausgeloggt aufgenommen wurden — greift es nicht, bleibt die
|
||||
Pille bei „Logout" stehen, nur ohne Namen, statt zu reißen.
|
||||
Der Name wird über das Muster `Logout [ Name ]` aus dem Linktext gelesen, das
|
||||
gegen das Markup einer echten eingeloggten Sitzung bestätigt ist; greift es
|
||||
einmal nicht — andere Sprache, andere Klammerform — bleibt die Pille bei
|
||||
„Logout" stehen, nur ohne Namen, statt zu reißen.
|
||||
|
||||
Das Login-Formular selbst wird nicht neu gebaut: das Original-`<form>`-Element
|
||||
wandert unverändert in das neue Layout und wird umgestylt, Tabellenzeilen
|
||||
@@ -295,6 +299,15 @@ Checkboxen `autologin` / `viewonline` und den schlichten serverseitigen POST —
|
||||
das Script spricht nie selbst mit der Sitzungsverwaltung des Forums, es ändert
|
||||
nur, wie das vorhandene Formular aussieht.
|
||||
|
||||
Nach dem Absenden liefert dieselbe URL statt des Formulars eine allgemeine
|
||||
„Information"-Vorlage aus — eine kurze Bestätigung („You have been
|
||||
successfully logged in."), bevor phpBBs eigenes `<meta refresh>` zum
|
||||
Forenindex weiterleitet. Das Script erkennt diese Vorlage an ihrer Form, nicht
|
||||
am Wortlaut (eine Kopfzeile mit einer einzelnen Zelle, gefolgt von einer
|
||||
Nachrichtenzelle), und stylt sie wie das Formular um: die Original-Zelle —
|
||||
Nachricht und Link inklusive — wandert unverändert an ihren Platz statt neu
|
||||
gebaut zu werden.
|
||||
|
||||
Das Script läuft bei `document-start`, setzt ein mobiles Viewport-Meta-Tag und
|
||||
hat ein `DEBUG`-Flag. Solange `DEBUG` auf `true` steht, wird ein grünes
|
||||
Diagnose-Overlay über die Seite gelegt, das zeigt, welche Ansicht gewählt wurde
|
||||
|
||||
Reference in New Issue
Block a user