mirror of
https://github.com/Andre-Bzk/rin-mobile-userscript.git
synced 2026-11-15 09:33:08 +01:00
feat: add a mobile login view and a login/logout status pill
The script previously had no way to log in or tell whether a session was already active, since ucp.php fell outside the view switch and rendered in the desktop layout. Session state is only visible in the forum's own menu bar link (mode=login vs mode=logout), so every view now surfaces it as a pill in the breadcrumb bar instead of leaving the user to dig for it. The login form itself is moved into the new layout rather than rebuilt from scratch, keeping the hidden sid/redirect fields and the autologin/viewonline checkboxes intact without the script having to reimplement the session handshake. As the first short, unscrollable view in the project, it also exposed a WebKit quirk that longer views never triggered: without enough scroll headroom, Safari's own partially-retracted toolbar has nothing to scroll away and permanently covers the submit button. The generous bottom padding on the form works around that, separately from the safe-area inset that only accounts for the home indicator.
This commit is contained in:
@@ -17,6 +17,7 @@ page type:
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.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 |
|
||||
| anything else | Untouched — no styles are injected |
|
||||
|
||||
A `viewforum.php` page is not necessarily a list of topics: a category page
|
||||
@@ -64,6 +65,23 @@ 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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
vertical stack. Reusing the element rather than reconstructing it keeps the
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -209,6 +227,7 @@ anhand des Seitentyps:
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.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 |
|
||||
| alles andere | Unverändert — es werden keine Stile injiziert |
|
||||
|
||||
Eine `viewforum.php`-Seite ist nicht zwangsläufig eine Themenliste: eine
|
||||
@@ -258,6 +277,24 @@ 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.
|
||||
|
||||
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.
|
||||
|
||||
Das Login-Formular selbst wird nicht neu gebaut: das Original-`<form>`-Element
|
||||
wandert unverändert in das neue Layout und wird umgestylt, Tabellenzeilen
|
||||
werden zu einer senkrechten Abfolge zusammengeklappt. Die Wiederverwendung
|
||||
statt Neubau erhält die versteckten Felder `sid` und `redirect`, die
|
||||
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.
|
||||
|
||||
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