Open beside

Purpose: Let a reader on a wide screen keep one page open while reading another, in the empty space beside the content column. Scenario: With FORUM_OPEN_BESIDE_ENABLED on, a reader on a desktop presses Beside at the end of the reading-margins ruler, or turns on "Open links beside" in Preferences. They click a thread on the board; it opens in a pane to the right and the board stays where it was. Links inside the pane load in the pane, and they can like and reply there. They click Recent in the header; the main page changes and the pane is still there, scrolled where they left it. Open alone makes the pane's page the main page. Close removes the pane. Sources: pane script (source unavailable), toggle and pane styles (source unavailable), before-paint mode and framed-page mark (source unavailable) (data-open-beside, data-open-beside-framed), ruler toggle (source unavailable), storage keys (source unavailable) (openBesideStorageKey, openBesidePaneStorageKey), flag (source unavailable), Preferences row (source unavailable) and its saving (source unavailable), browser test (source unavailable).

The pane is a frame named forum-open-beside showing the real page. A page loaded in a same-site frame of that name hides its own site header, ruler and status bar from the head script, because pages are static files and cannot be asked for a bare version (static publication). The pane is fixed to the window between the column's right edge and the window's, no wider than the normal page, and appears only with 20rem of room; it never moves the main column. Only plain left clicks on same-site page links inside .main are taken: header links, Ctrl-click, new-tab, download and same-page links behave as always, and a link another script already handles is left alone. A link to another site clicked in the pane takes the whole tab. A pane never opens a pane. The mode, the pane's page and its scroll position are kept per browser; a saved page is used only if it is a path on this site. The pane reloads when the main page's theme changes. Window controls work inside the pane as on any page. With JavaScript off, the mode off, no room or a phone, nothing changes (no-script presentation).

Offline it works the same way: the pane's request is answered by the service worker with the offline reader, which draws the thread or tag in the pane. The reader's own thread titles call window.forumOpenBeside.take(event) before handling a click themselves, so they open in the pane too (offline reader (source unavailable), offline browser test (source unavailable)). A page that fails to load, such as one with no offline copy, shows a line of text in the pane in place of the browser's error page.

With visit history on, open_beside.js tells the recorder whether each pane load is a reader's click or the pane restored on the next main page, and when Open alone is pressed, so pane pages join the visit tree under the page they were opened from.

Not covered: the main page is not refreshed by a post made in the pane; there is one pane, not a trail of them. Later directions are in the design notes.