mirror of
https://github.com/Andre-Bzk/rin-mobile-userscript.git
synced 2026-11-15 09:33:08 +01:00
docs: lead with screenshots and correct outdated documentation
Both documents had drifted away from the repository they describe: they pointed at fixtures and a helper script that are not present, documented a local-server workflow that is no longer used, and filed one page type under the wrong view. Following them meant setting up things that cannot work while trusting claims that no longer held. The README also explained every design decision before showing a single result, so the question a reader asks first — what does this actually look like — took the longest to answer. Screenshots and a short feature list now carry that job. The reasoning stays where it is needed, next to the code. Restricting the dev loader to the live site closes a side effect that only surfaced locally: its patterns matched page names common enough that the stylesheet would have leaked into unrelated local projects. The version number existed in two places and had already drifted apart. Reading it back from the metadata block leaves one place to change it.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
## English
|
||||
|
||||
A single userscript that rebuilds the phpBB2 pages of `cs.rin.ru` into a mobile
|
||||
A single userscript that rebuilds the phpBB3 pages of `cs.rin.ru` into a mobile
|
||||
layout for Safari on iOS. It replaces the original table layout entirely: the
|
||||
existing page content is hidden and a freshly built DOM is appended to `<body>`.
|
||||
|
||||
@@ -15,111 +15,57 @@ page type:
|
||||
|
||||
| Page | View |
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.php`, `index.php`, forum root | Topic and forum list as cards |
|
||||
| `viewforum.php`, `index.php`, forum root | Topic and forum list as cards |
|
||||
| `search.php` | The query form restyled, or — for a submitted search in "Posts" mode — its hits as cards |
|
||||
| `viewtopic.php` | Thread as a post stream with a fixed bottom navigation bar |
|
||||
| `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
|
||||
lists forums instead, and a forum page can carry both. Each table row is
|
||||
therefore classified by its first usable link. Forum rows become cards with
|
||||
name, description, subforum links and counts; topic rows keep their existing
|
||||
card; category headers become section headings. Rows are recognised by phpBB's
|
||||
own `forumlink` / `forumdesc` classes, and failing that by their shape — two
|
||||
purely numeric columns are only ever a forum's topic and post count.
|
||||
### Screenshots
|
||||
|
||||
Forums, global announcements, announcements, stickies and topics all end up in
|
||||
the same stream of cards, which loses the separation the original page draws
|
||||
between them. A header strip naming the section and its card count is therefore
|
||||
inserted wherever the kind changes, and forum cards additionally carry a
|
||||
coloured left edge. The label is taken from the board's own separator row
|
||||
(`Global Announcements`, `Stickies`, `Topics`), so sections this script does not
|
||||
know are named correctly too. Which kind a topic row is comes from the icon in
|
||||
its first column, not from its title. The strip is left out directly below a
|
||||
category heading, which already introduces the forums under it.
|
||||
| Forum list, with the sections above the topics collapsed | Thread, with the in-topic search bar revealed |
|
||||
|---|---|
|
||||
| <img src="docs/Screenshot_mobile_1.png" alt="Forum list as cards: breadcrumb bar with magnifier, an open FOREN section with four forum cards, collapsed GLOBAL ANNOUNCEMENTS, ANNOUNCEMENTS and STICKIES strips, and the page bar showing 1 / 610" width="100%"> | <img src="docs/Screenshot_mobile_2.png" alt="Thread view: breadcrumbs, a second bar with a search field, and a post card with avatar, author, rank and post count above the message" width="100%"> |
|
||||
| **Search form, top: quick links and forum picker** | **Search form, bottom: options and buttons** |
|
||||
| <img src="docs/Screenshot_mobile_3.png" alt="Search form: quick links as chips, the keyword fields and the forum picker with Main Forum preselected" width="100%"> | <img src="docs/Screenshot_mobile_4.png" alt="Search form continued: search subforums set to No, the remaining option groups, and the Search and Reset buttons" width="100%"> |
|
||||
|
||||
Tapping a header collapses its section. Global announcements, announcements and
|
||||
stickies start collapsed: they precede the topics on *every* page of a forum and
|
||||
otherwise fill the first screen. The state is stored per kind in `localStorage`,
|
||||
so collapsing stickies once applies to every forum. `localStorage` is used
|
||||
rather than `GM_setValue` because it needs no `@grant` and behaves the same in
|
||||
Tampermonkey and in the iOS app; the trade-off is that Safari may clear
|
||||
script-writable storage after long inactivity, which resets the sections to
|
||||
their default.
|
||||
### What it does
|
||||
|
||||
Both views share the same fixed navigation bar at the bottom: first / previous /
|
||||
next / last and a page indicator. Tapping the indicator opens a sheet with a
|
||||
number field and a grid of all pages. Targets are computed as
|
||||
`start = (page - 1) × per_page` rather than taken from the rendered page links,
|
||||
because phpBB only ever shows a handful of them. `per_page` is read from the
|
||||
`jumpto()` function the forum embeds in the page; without it, only first page
|
||||
and the original previous/next links remain available. In the list the bar is
|
||||
built only where there is more than one page — forum pages run to hundreds of
|
||||
them, category pages to one.
|
||||
The original page is hidden and a mobile layout is built from the same data,
|
||||
one view per page type:
|
||||
|
||||
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.
|
||||
- **Lists as cards.** Forum and topic rows become cards with title, description,
|
||||
counts and last post; category headers become section headings.
|
||||
- **Section strips.** Forums, announcements, stickies and topics are separated
|
||||
by a header carrying the section name and its card count. Announcements and
|
||||
stickies start collapsed — they repeat above the topics on *every* page of a
|
||||
forum. Tapping a header toggles its section, and the state is remembered per
|
||||
section across forums.
|
||||
- **Fixed page bar.** First / previous / next / last and a page indicator.
|
||||
Tapping the indicator opens a sheet with a number field and every page of the
|
||||
forum or thread, not just the handful phpBB renders.
|
||||
- **Fixed breadcrumb bar** with a login pill showing the account name. Without
|
||||
it there is no way back out of a thread, since the original page is hidden.
|
||||
- **Search from anywhere.** With a session, a magnifier sits next to the pill:
|
||||
it opens `search.php`, or inside a thread reveals a bar that searches the
|
||||
topic.
|
||||
- **Readable posts.** Avatar, author, rank and timestamp above the message;
|
||||
signatures fold into a collapsed box.
|
||||
- **Forms are moved, not rebuilt.** Login, search and the page after a
|
||||
successful login reuse the original elements, so hidden fields and the plain
|
||||
server-side POST stay intact. The search form starts on Main Forum with
|
||||
subforums off, and the board rules on the login page fold away.
|
||||
- **Search hits as cards** in "Posts" display mode, each with a link straight to
|
||||
the post. "Topics" mode falls through to the regular list view.
|
||||
|
||||
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, 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 script's own labels are German; anything taken from the board keeps its
|
||||
original wording — `FOREN` in the first screenshot is the script's name for a
|
||||
group the board does not label, while `STICKIES` and `TOPICS` are the board's
|
||||
own words.
|
||||
|
||||
Once a session exists, the login pill also carries a magnifier button
|
||||
directly to its left, so it does not compete with the breadcrumb trail for
|
||||
space and only shows up where cs.rin.ru's own search is actually reachable.
|
||||
Outside a thread it links straight to `search.php`; inside one it instead
|
||||
reveals a second bar under the crumbs with a search field, reusing the
|
||||
original "Search this topic…" form in place rather than rebuilding it, so the
|
||||
hidden topic-id and scope fields stay intact.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
`search.php` gets its own treatment when it shows the query form rather than
|
||||
results. It is recognised by its forum picker — a `select[name="fid[]"]`
|
||||
multi-select that only exists on this form, not on the small "Search this
|
||||
forum…" / "Search this topic…" widgets embedded elsewhere — and then moved
|
||||
into the new layout the same way the login form is: table rows collapsed to a
|
||||
vertical stack, radio groups and selects restyled for touch, and the quick
|
||||
links above it ("View new posts", "View your posts", …) turned into a row of
|
||||
chips. "Search in forums" defaults to Main Forum and "Search subforums"
|
||||
defaults to No, overriding the server's own blank/Yes defaults, since that is
|
||||
the scope most searches from the mobile view actually want.
|
||||
|
||||
A submitted search lands back on `search.php`, now with results — which, in
|
||||
the "Posts" display mode the in-thread search bar produces, look nothing like
|
||||
a topic list: each hit is a post excerpt with its own author, timestamp, and
|
||||
forum/topic context. Recognised by a `p.topictitle` marker unique to this
|
||||
mode, these get their own cards, built before the regular list view's row
|
||||
scanning would otherwise misread the topic and profile links inside them. The
|
||||
"Topics" display mode is not handled specially — no fixture shows what it
|
||||
looks like, so it still falls through to the regular list view, which may or
|
||||
may not render it sensibly.
|
||||
|
||||
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
|
||||
converted. Set it to `false` before daily use.
|
||||
It runs at `document-start` and injects a mobile viewport meta tag. A `DEBUG`
|
||||
flag in the source, off by default, adds a green diagnostic overlay showing the
|
||||
version, the chosen view and how many rows were converted.
|
||||
|
||||
### Installation on iOS
|
||||
|
||||
@@ -179,26 +125,28 @@ cards and two debug overlays.
|
||||
|
||||
#### Test fixtures
|
||||
|
||||
`cs.rin.ru` requires a login, so save the pages you need once and iterate
|
||||
against local copies:
|
||||
Layout work happens on the live site, with the loader active in Chrome. The
|
||||
saved pages under `dev/` serve a different purpose: `cs.rin.ru` requires a
|
||||
login, and its markup is the only source for what the script has to cope with,
|
||||
so the pages that matter are kept as snapshots — as a reference to read, and as
|
||||
input for a throwaway jsdom harness when a change needs to be checked against
|
||||
several pages at once.
|
||||
|
||||
1. Open the page while logged in, then in DevTools right-click `<html>` →
|
||||
*Copy outerHTML*.
|
||||
2. Save it as `dev/viewtopic.php.html` or `dev/viewforum.php.html`.
|
||||
3. Serve the folder: `python -m http.server 8777 --directory .`
|
||||
2. Save it under the page's own name — `dev/viewtopic.php`, `dev/viewforum.php`,
|
||||
`dev/index.php`, `dev/ucp.php`, `dev/search.php`.
|
||||
|
||||
The file name matters twice over. The `.html` extension makes the server send
|
||||
the file as HTML instead of offering it as a download, and the retained
|
||||
`viewtopic.php` / `viewforum.php` part is what the loader's `@include` rules
|
||||
and the page-type check in `rin-mobile.user.js` match against.
|
||||
The loader deliberately matches `cs.rin.ru` only, so these files are not meant
|
||||
to be opened in the browser. Serving them locally would take `@include` rules
|
||||
for `localhost`, and those match on page names common enough (`index.php`,
|
||||
anything containing `search`) that the script would inject its stylesheet into
|
||||
unrelated local projects.
|
||||
|
||||
Forum images and stylesheets are missing from such a snapshot. That is fine for
|
||||
layout work, because the script rebuilds the DOM anyway — only avatars stay
|
||||
empty, since their `src` is carried over unchanged.
|
||||
|
||||
Note that a snapshot saved while logged out contains `span.link_removed`
|
||||
placeholders instead of links, and may use different markup for author names
|
||||
than the logged-in view.
|
||||
A snapshot saved while logged out contains `span.link_removed` placeholders
|
||||
instead of links, and may use different markup for author names than the
|
||||
logged-in view — worth knowing before puzzling over a fixture that behaves
|
||||
differently from the real page.
|
||||
|
||||
#### Device emulation
|
||||
|
||||
@@ -224,32 +172,35 @@ Windows (`npx playwright install webkit`).
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
Install `dev/tm-test.user.js` — it injects a red bar and nothing else. If the
|
||||
bar does not appear, the problem is Tampermonkey (see setup above), not the
|
||||
script code. If it does appear, check the loader's *Externals* tab in the
|
||||
Tampermonkey dashboard: an empty or failed entry means the `@require` path is
|
||||
wrong.
|
||||
If nothing happens at all, separate the two possible causes before reading any
|
||||
code. Check the loader's *Externals* tab in the Tampermonkey dashboard: an
|
||||
empty or failed entry means the `@require` path is wrong. If the entry is
|
||||
there and the script still does nothing, set `DEBUG = true` in
|
||||
`rin-mobile.user.js` — the green overlay appears on every page the script
|
||||
touches, so its absence means the script never ran, while an overlay reporting
|
||||
`ansicht=keine` means it ran but the URL matched no view.
|
||||
|
||||
If Tampermonkey keeps serving a stale copy despite the update interval, replace
|
||||
the `file://` require with a local HTTP server, which does not cache:
|
||||
|
||||
```js
|
||||
// @require http://localhost:8777/rin-mobile.user.js
|
||||
```
|
||||
If Tampermonkey keeps serving a stale copy despite the update interval, open
|
||||
the loader's *Externals* tab and trigger an update on the `@require` entry by
|
||||
hand, or disable and re-enable the loader — both discard the cached copy.
|
||||
|
||||
### Repository layout
|
||||
|
||||
```
|
||||
rin-mobile.user.js topic list → cards, thread → post stream
|
||||
rin-mobile.user.js all views: lists, thread, login, search
|
||||
CLAUDE.md notes for working on the script
|
||||
dev/
|
||||
rin-mobile.dev.user.js loader, @require with absolute path
|
||||
*.php saved pages, markup reference, not in git
|
||||
docs/
|
||||
Screenshot_mobile_*.png the screenshots above
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deutsch
|
||||
|
||||
Ein Userscript, das die phpBB2-Seiten von `cs.rin.ru` für Safari auf iOS in eine
|
||||
Ein Userscript, das die phpBB3-Seiten von `cs.rin.ru` für Safari auf iOS in eine
|
||||
mobile Ansicht umbaut. Es ersetzt das ursprüngliche Tabellenlayout vollständig:
|
||||
der vorhandene Seiteninhalt wird ausgeblendet und ein neu gebautes DOM an
|
||||
`<body>` gehängt.
|
||||
@@ -259,121 +210,61 @@ anhand des Seitentyps:
|
||||
|
||||
| Seite | Ansicht |
|
||||
|---|---|
|
||||
| `viewforum.php`, `search.php`, `index.php`, Forumwurzel | Themen- und Forenliste als Karten |
|
||||
| `viewforum.php`, `index.php`, Forumwurzel | Themen- und Forenliste als Karten |
|
||||
| `search.php` | Das Suchformular umgestylt oder — bei abgeschickter Suche im Modus „Posts" — die Treffer als Karten |
|
||||
| `viewtopic.php` | Thread als Beitragsstrom mit fixierter Navigationsleiste |
|
||||
| `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
|
||||
Kategorieseite listet Foren auf, eine Forenseite kann beides enthalten. Jede
|
||||
Tabellenzeile wird deshalb anhand ihres ersten verwertbaren Links eingeordnet.
|
||||
Forenzeilen werden zu Karten mit Name, Beschreibung, Unterforen und Zahlen,
|
||||
Themenzeilen behalten ihre bisherige Karte, Kategoriezeilen werden zu
|
||||
Zwischenüberschriften. Erkannt werden die Zeilen an phpBBs eigenen Klassen
|
||||
`forumlink` / `forumdesc` und ersatzweise an ihrer Form — zwei rein numerische
|
||||
Spalten hat nur eine Forenzeile mit Themen- und Beitragszahl.
|
||||
### Screenshots
|
||||
|
||||
Foren, globale Ankündigungen, Ankündigungen, Stickies und Themen landen alle im
|
||||
selben Kartenstrom, womit die Trennung verlorengeht, die die Originalseite
|
||||
zwischen ihnen zieht. Bei jedem Wechsel wird deshalb ein Gruppenkopf mit dem
|
||||
Namen des Abschnitts und der Zahl seiner Karten eingezogen; Forenkarten tragen
|
||||
zusätzlich eine farbige linke Kante. Die Beschriftung stammt aus der Trennzeile
|
||||
der Seite selbst (`Global Announcements`, `Stickies`, `Topics`), damit auch
|
||||
Abschnitte richtig heißen, die dieses Script nicht kennt. Welcher Art eine
|
||||
Themenzeile ist, verrät das Symbol ihrer ersten Spalte, nicht der Titel. Direkt
|
||||
unter einer Kategorieüberschrift entfällt der Gruppenkopf, weil die Überschrift
|
||||
die Foren darunter schon einleitet.
|
||||
| Forenliste, die Abschnitte über den Themen zugeklappt | Thread, mit eingeblendeter Suchleiste |
|
||||
|---|---|
|
||||
| <img src="docs/Screenshot_mobile_1.png" alt="Forenliste als Karten: Brotkrumenleiste mit Lupe, aufgeklappter Abschnitt FOREN mit vier Forenkarten, zugeklappte Streifen für GLOBAL ANNOUNCEMENTS, ANNOUNCEMENTS und STICKIES, unten die Seitenleiste mit 1 / 610" width="100%"> | <img src="docs/Screenshot_mobile_2.png" alt="Thread-Ansicht: Brotkrumen, zweite Leiste mit Suchfeld, darunter eine Beitragskarte mit Avatar, Autor, Rang und Beitragszahl über dem Text" width="100%"> |
|
||||
| **Suchformular, oben: Schnellzugriffe und Forenwähler** | **Suchformular, unten: Optionen und Schaltflächen** |
|
||||
| <img src="docs/Screenshot_mobile_3.png" alt="Suchformular: Schnellzugriffe als Chips, die Feldgruppen für Suchbegriffe und der Forenwähler mit vorausgewähltem Main Forum" width="100%"> | <img src="docs/Screenshot_mobile_4.png" alt="Suchformular, Fortsetzung: Unterforen auf No, die übrigen Optionsgruppen sowie die Schaltflächen Search und Reset" width="100%"> |
|
||||
|
||||
Ein Tipp auf den Kopf klappt seinen Abschnitt zu. Globale Ankündigungen,
|
||||
Ankündigungen und Stickies starten zugeklappt: sie stehen auf *jeder* Seite
|
||||
eines Forums vor den Themen und füllen sonst den ersten Bildschirm. Der Zustand
|
||||
liegt je Art in `localStorage`, einmal zugeklappte Stickies gelten also in jedem
|
||||
Forum. `localStorage` statt `GM_setValue`, weil es ohne `@grant` auskommt und
|
||||
sich in Tampermonkey wie in der iOS-App gleich verhält; dafür kann Safari
|
||||
schreibbaren Speicher nach längerer Nichtnutzung räumen, dann stehen die
|
||||
Abschnitte wieder auf ihrer Voreinstellung.
|
||||
### Was das Script liefert
|
||||
|
||||
Beide Ansichten teilen sich dieselbe fixierte Navigationsleiste am unteren
|
||||
Rand: erste / vorherige / nächste / letzte Seite und eine Positionsanzeige. Ein
|
||||
Tipp darauf öffnet ein Sheet mit Zahlenfeld und einem Raster aller Seiten. Die
|
||||
Ziele werden als `start = (Seite - 1) × per_page` berechnet und nicht aus den
|
||||
gerenderten Seitenlinks übernommen, weil phpBB davon immer nur eine Handvoll
|
||||
anzeigt. `per_page` stammt aus der `jumpto()`-Funktion, die das Forum in die
|
||||
Seite einbettet; fehlt sie, bleiben nur die erste Seite und die ursprünglichen
|
||||
Zurück-/Weiter-Links nutzbar. In der Liste entsteht die Leiste nur, wo es mehr
|
||||
als eine Seite gibt — Forenseiten haben hunderte, Kategorieseiten eine.
|
||||
Die Originalseite wird ausgeblendet und aus denselben Daten eine mobile Ansicht
|
||||
gebaut, je eine pro Seitentyp:
|
||||
|
||||
Beide Ansichten haben oben eine fixierte Brotkrumenleiste, übernommen aus dem
|
||||
`Board index » … » Main Forum`-Pfad des Forums. Ohne sie führt aus einem Thread
|
||||
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.
|
||||
- **Listen als Karten.** Foren- und Themenzeilen werden zu Karten mit Titel,
|
||||
Beschreibung, Zahlen und letztem Beitrag, Kategoriezeilen zu
|
||||
Zwischenüberschriften.
|
||||
- **Gruppenköpfe.** Foren, Ankündigungen, Stickies und Themen trennt jeweils ein
|
||||
Kopf mit dem Namen des Abschnitts und der Zahl seiner Karten. Ankündigungen
|
||||
und Stickies starten zugeklappt — sie stehen auf *jeder* Seite eines Forums
|
||||
über den Themen. Ein Tipp auf den Kopf klappt seinen Abschnitt um, der Zustand
|
||||
gilt je Abschnitt über alle Foren hinweg.
|
||||
- **Fixierte Seitenleiste.** Erste / vorherige / nächste / letzte Seite und eine
|
||||
Positionsanzeige. Ein Tipp darauf öffnet ein Sheet mit Zahlenfeld und allen
|
||||
Seiten des Forums oder Threads, nicht nur der Handvoll, die phpBB rendert.
|
||||
- **Fixierte Brotkrumenleiste** mit einer Login-Pille, die den Kontonamen zeigt.
|
||||
Ohne sie führt aus einem Thread kein Weg zurück, weil die Originalseite
|
||||
ausgeblendet ist.
|
||||
- **Suche von überall.** Besteht eine Sitzung, sitzt neben der Pille eine Lupe:
|
||||
sie öffnet `search.php` oder blendet innerhalb eines Threads eine Leiste ein,
|
||||
die das Thema durchsucht.
|
||||
- **Lesbare Beiträge.** Avatar, Autor, Rang und Zeitstempel über dem Text,
|
||||
Signaturen wandern in einen zugeklappten Kasten.
|
||||
- **Formulare werden verschoben, nicht nachgebaut.** Login, Suche und die Seite
|
||||
nach erfolgreichem Login übernehmen die Original-Elemente, damit versteckte
|
||||
Felder und der schlichte serverseitige POST erhalten bleiben. Das Suchformular
|
||||
startet auf Main Forum ohne Unterforen, die Forenregeln im Login klappen weg.
|
||||
- **Suchtreffer als Karten** im Anzeigemodus „Posts", jeder mit einem Link
|
||||
direkt zum Beitrag. Der Modus „Topics" läuft durch die gewöhnliche
|
||||
Listenansicht.
|
||||
|
||||
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
|
||||
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.
|
||||
Die Beschriftungen des Scripts sind deutsch, alles aus dem Forum Übernommene
|
||||
behält seinen Wortlaut — `FOREN` im ersten Screenshot ist die Bezeichnung des
|
||||
Scripts für eine Gruppe, die die Seite selbst nicht beschriftet, `STICKIES` und
|
||||
`TOPICS` sind ihre eigenen Worte.
|
||||
|
||||
Besteht eine Sitzung, trägt die Login-Pille zusätzlich einen Lupen-Button
|
||||
direkt links neben sich, damit er nicht mit der Brotkrumenleiste um Platz
|
||||
konkurriert, und erscheint nur dort, wo cs.rins eigene Suche überhaupt
|
||||
erreichbar ist. Außerhalb eines Threads führt er direkt zu `search.php`;
|
||||
innerhalb eines Threads blendet er stattdessen eine zweite Leiste unter den
|
||||
Brotkrumen mit einem Suchfeld ein — das ist das Original-Formular „Search this
|
||||
topic…", unverändert an Ort und Stelle wiederverwendet statt neu gebaut, damit
|
||||
die versteckten Felder für Themen-Id und Suchbereich erhalten bleiben.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
`search.php` bekommt eine eigene Behandlung, wenn es das Suchformular statt
|
||||
Treffern zeigt. Erkannt wird das am Forenwähler — einem Mehrfachauswahlfeld
|
||||
`select[name="fid[]"]`, das es nur in diesem Formular gibt, nicht in den
|
||||
kleinen „Search this forum…" / „Search this topic…"-Widgets an anderer
|
||||
Stelle — und dann wie das Login-Formular in das neue Layout verschoben:
|
||||
Tabellenzeilen zu einer senkrechten Abfolge zusammengeklappt, Radio-Gruppen
|
||||
und Auswahlfelder für Touch umgestylt, die Schnellzugriffe darüber („View new
|
||||
posts", „View your posts", …) zu einer Reihe aus Chips. „Search in forums"
|
||||
ist dabei standardmäßig auf Main Forum vorausgewählt, „Search subforums" auf
|
||||
No — statt der leeren/„Yes"-Vorgabe des Servers, weil das dem Suchumfang
|
||||
entspricht, der von der mobilen Ansicht aus meistens gewollt ist.
|
||||
|
||||
Eine abgeschickte Suche landet wieder auf `search.php`, diesmal mit Treffern —
|
||||
die im Anzeigemodus „Posts", den die Suchleiste im Thread erzeugt, aber
|
||||
überhaupt nicht wie eine Themenliste aussehen: jeder Treffer ist ein
|
||||
Beitragsauszug mit eigenem Autor, Zeitstempel und Forum-/Thema-Kontext.
|
||||
Erkannt an einem Merkmal (`p.topictitle`), das es nur in diesem Modus gibt,
|
||||
bekommen sie eigene Karten, gebaut bevor das Zeileneinsammeln der gewöhnlichen
|
||||
Listenansicht die enthaltenen Themen- und Profillinks falsch deuten würde.
|
||||
Der Anzeigemodus „Topics" bekommt keine eigene Behandlung — keine Fixture
|
||||
zeigt, wie er aussieht, er läuft also weiterhin durch die gewöhnliche
|
||||
Listenansicht, was passend sein kann oder auch nicht.
|
||||
|
||||
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
|
||||
und wie viele Zeilen umgewandelt wurden. Für den täglichen Gebrauch auf `false`
|
||||
setzen.
|
||||
Das Script läuft bei `document-start` und setzt ein mobiles Viewport-Meta-Tag.
|
||||
Ein `DEBUG`-Flag im Quelltext, standardmäßig aus, legt ein grünes
|
||||
Diagnose-Overlay über die Seite: Version, gewählte Ansicht und Zahl der
|
||||
umgewandelten Zeilen.
|
||||
|
||||
### Installation unter iOS
|
||||
|
||||
@@ -433,6 +324,31 @@ Den Loader nicht parallel zum unveränderten Script betreiben. Sind beide in
|
||||
Tampermonkey aktiv, läuft der Code doppelt auf derselben Seite, mit doppelten
|
||||
Karten und zwei Debug-Overlays als Folge.
|
||||
|
||||
#### Testfixtures
|
||||
|
||||
Die Layoutarbeit findet auf der echten Seite statt, mit dem Loader aktiv in
|
||||
Chrome. Die gespeicherten Seiten unter `dev/` dienen etwas anderem: `cs.rin.ru`
|
||||
verlangt einen Login, und sein Markup ist die einzige Quelle dafür, womit das
|
||||
Script zurechtkommen muss. Die relevanten Seiten liegen deshalb als Mitschnitt
|
||||
vor — zum Nachlesen und als Eingabe für ein Wegwerf-Harness mit jsdom, wenn
|
||||
eine Änderung gegen mehrere Seiten auf einmal zu prüfen ist.
|
||||
|
||||
1. Die Seite eingeloggt öffnen, in den DevTools mit der rechten Maustaste auf
|
||||
`<html>` → *Copy outerHTML*.
|
||||
2. Unter dem Namen der Seite ablegen — `dev/viewtopic.php`,
|
||||
`dev/viewforum.php`, `dev/index.php`, `dev/ucp.php`, `dev/search.php`.
|
||||
|
||||
Der Loader greift bewusst nur auf `cs.rin.ru`, diese Dateien sind also nicht
|
||||
zum Öffnen im Browser gedacht. Sie lokal auszuliefern verlangte
|
||||
`@include`-Regeln für `localhost`, und die passen auf Seitennamen, die dort
|
||||
häufig genug vorkommen (`index.php`, alles mit „search" darin), dass das Script
|
||||
sein Stylesheet in fremde lokale Projekte injizieren würde.
|
||||
|
||||
Ein ausgeloggt gespeicherter Mitschnitt enthält statt der Links
|
||||
`span.link_removed`-Platzhalter und kann Autorennamen anders auszeichnen als
|
||||
die eingeloggte Ansicht — gut zu wissen, bevor man über eine Fixture rätselt,
|
||||
die sich anders verhält als die echte Seite.
|
||||
|
||||
#### Geräte-Emulation
|
||||
|
||||
DevTools → *Device Toolbar* (`Strg+Umschalt+M`) → *Edit…* → eigenes Gerät mit
|
||||
@@ -458,24 +374,27 @@ Windows mit (`npx playwright install webkit`).
|
||||
|
||||
#### Fehlersuche
|
||||
|
||||
`dev/tm-test.user.js` installieren — das Script blendet nur einen roten Balken
|
||||
ein, sonst nichts. Erscheint der Balken nicht, liegt das Problem bei
|
||||
Tampermonkey (siehe Einrichtung oben) und nicht am Script-Code. Erscheint er,
|
||||
im Tampermonkey-Dashboard den Tab *Externals* des Loaders prüfen: ein leerer
|
||||
oder fehlgeschlagener Eintrag bedeutet, dass der `@require`-Pfad falsch ist.
|
||||
Passiert überhaupt nichts, zuerst die beiden möglichen Ursachen trennen, bevor
|
||||
Code gelesen wird. Im Tampermonkey-Dashboard den Tab *Externals* des Loaders
|
||||
prüfen: ein leerer oder fehlgeschlagener Eintrag bedeutet, dass der
|
||||
`@require`-Pfad falsch ist. Ist der Eintrag da und trotzdem passiert nichts, in
|
||||
`rin-mobile.user.js` `DEBUG = true` setzen — das grüne Overlay erscheint auf
|
||||
jeder Seite, die das Script anfasst. Bleibt es aus, lief das Script gar nicht;
|
||||
meldet es `ansicht=keine`, lief es, aber die URL passte auf keine Ansicht.
|
||||
|
||||
Liefert Tampermonkey trotz Update-Intervall weiterhin einen veralteten Stand
|
||||
aus, das `file://`-Require durch einen lokalen HTTP-Server ersetzen, der nicht
|
||||
zwischenspeichert:
|
||||
|
||||
```js
|
||||
// @require http://localhost:8777/rin-mobile.user.js
|
||||
```
|
||||
aus, im Tab *Externals* des Loaders den `@require`-Eintrag von Hand
|
||||
aktualisieren oder den Loader einmal deaktivieren und wieder aktivieren —
|
||||
beides verwirft die zwischengespeicherte Fassung.
|
||||
|
||||
### Aufbau des Repositories
|
||||
|
||||
```
|
||||
rin-mobile.user.js Themenliste → Karten, Thread → Beitragsstrom
|
||||
rin-mobile.user.js alle Ansichten: Listen, Thread, Login, Suche
|
||||
CLAUDE.md Notizen zur Arbeit am Script
|
||||
dev/
|
||||
rin-mobile.dev.user.js Loader, @require mit absolutem Pfad
|
||||
*.php gespeicherte Seiten, Markup-Vorlage, nicht in git
|
||||
docs/
|
||||
Screenshot_mobile_*.png die Screenshots oben
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user