feat: optimize search.php for the mobile view

search.php had no mobile treatment: the query form rendered as an
unstyled desktop table, and a submitted search fell back to the regular
forum-listing view on the untested assumption that results looked like
topic rows.

The query form is now recognised by its forum-picker select, the one
element the small "search this forum/topic" widgets embedded on other
pages don't share — they reuse the same form action and keyword field
name and would otherwise be picked up by mistake. Results in the "Posts"
display mode the in-thread search bar produces turned out to carry post
excerpts, not topic rows, and needed their own card layout instead of
running through the list view, which would have misread the topic and
profile links inside each hit.

Submit/reset controls kept native iOS Safari chrome even under
-webkit-appearance:none once restyled, clipping their labels — only
visible on device, not in the emulator this project is developed
against. Replacing them with real <button> elements (same name/value,
so the submitted form data is unchanged) fixed it where the CSS-only
attempt didn't; touch targets were sized up to match.
This commit is contained in:
Andre
2026-08-03 09:03:27 +02:00
parent 21820b88d0
commit a8ca211805
3 changed files with 471 additions and 8 deletions
+56
View File
@@ -72,6 +72,14 @@ account name accordingly. The name is parsed from the link text with a
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.
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
@@ -87,6 +95,25 @@ 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.
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
@@ -291,6 +318,15 @@ 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.
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
@@ -308,6 +344,26 @@ 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.
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