Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

About:Pharmacopedia.ext: Difference between revisions

From Pharmacopedia
[checked revision][checked revision]
0.9.8.7 close-out: star hold-to-expand model, editor enhancements module, vote removal (boss-claude)
0.9.8.7 close-out: hold-to-expand + vote removal + editor tools (boss-claude)
 
Line 378: Line 378:


Server-side aggregates: <code>n</code>, mean of the rating field, and (for interactions) <code>severe = (vmean ≤ −83.0)</code> (rescaled from the original ±3-scale −2.5). Aggregates are recomputed and returned by every report-submit API call so the row re-renders in place without a page reload.
Server-side aggregates: <code>n</code>, mean of the rating field, and (for interactions) <code>severe = (vmean ≤ −83.0)</code> (rescaled from the original ±3-scale −2.5). Aggregates are recomputed and returned by every report-submit API call so the row re-renders in place without a page reload.
=== Hold-to-expand rating interaction ===
All <code>.pcp-rate</code> widgets (Common Uses stars, problem-tag stars, any future star widget) use a hold-to-expand pattern for precise rating. A 300ms press scales the widget toward a 483px target with a spring curve (<code>cubic-bezier(0.34, 1.56, 0.64, 1)</code>); drag while expanded commits on release when BOTH gates pass: pixel-travel >= 16px AND value-delta >= 0.2 on the 0-5 scale. A miss commits nothing; the widget springs back. Keyboard while expanded: arrow keys step +/- 0.2, Enter/Space commits, Escape cancels.
Reduced-motion (<code>prefers-reduced-motion</code>) drops the spring scale; the hold-and-drag gesture is preserved.
Vote-position marker: a third Unicode-star row clipped via <code>clip-path</code> inset, rendered in hot-pink (#ff2d78) stroke, shows the user's own committed vote distinct from the aggregate mean. Updates inline when the user re-rates.
Drag-path performance: <code>requestAnimationFrame</code> throttle plus cached widget bounds eliminate per-pointermove layout reads. Mobile parity: touch events (<code>touchstart</code>/<code>touchmove</code>/<code>touchend</code>) wired alongside pointer events. Companion CSS in <code>resources/ext.pharmacopedia.css</code> (~159 lines).
=== Vote removal ===
Voted state exposes a two-row layout via <code>.pcp-rate-row-top</code> (mean + n) and <code>.pcp-rate-row-bot</code> (voter's own value in hot-pink + 28px remove button). Row-bot hides cleanly when <code>data-voted</code> is absent so unvoted widgets render as a single line.
Clicking remove fires <code>POST action=pharmacopedialikert</code> with <code>vote=remove</code>. On 200: <code>data-voted</code> clears, the clip-path vote-position marker resets, <code>data-agg-n</code> decrements, the <code>localStorage</code> cache key is removed, and an <code>aria-live</code> region announces Your rating has been removed.
Two-row layout mirrors the PCPapp treatment for visual parity across web and mobile.


== Effect bucketing ==
== Effect bucketing ==
Line 753: Line 771:


Scroll position is preserved across the rare reloads (delete operations on diagnoses / medicines / experience reports, and the auto-reload after a new diagnosis or medicine is added) via <code>sessionStorage</code> (the <code>ext.pharmacopedia.bounceback</code> module).
Scroll position is preserved across the rare reloads (delete operations on diagnoses / medicines / experience reports, and the auto-reload after a new diagnosis or medicine is added) via <code>sessionStorage</code> (the <code>ext.pharmacopedia.bounceback</code> module).
== Editor tools ==
Three contributor-facing tools loaded as <code>ext.pharmacopedia.editor</code> on <code>action=edit</code> and <code>action=submit</code> via <code>Hooks::onBeforePageDisplay()</code>.
=== Smart paste ===
When the clipboard contents on paste is a bare PMID (7-8 digits) or DOI (<code>10.xxxx/...</code>), the module intercepts and expands it to a formatted <code>&lt;ref&gt;</code> tag. PubMed eutils resolves PMIDs; CrossRef resolves DOIs. Expansion is structured (author, year, title, journal, vol/issue, pages, doi/pmid). A brief toast confirms the substitution; the original paste is preserved if either API call fails.
=== House-rules linter ===
On form submit, the linter strips <code>&lt;ref&gt;</code> blocks and HTML comments to avoid false positives, then scans the remaining edit body for banned terms (<code>drug</code>, <code>medication</code>, <code>antipsychotic</code>, <code>stimulant</code>) and em-dashes. When matches surface, a non-modal warning panel highlights the offending lines and offers "Save anyway" or "Go back and edit." House rules are advisory, never blocking; the linter is a friction layer that nudges, not a gate.
=== Quick-ref stub ===
<code>Ctrl+Alt+R</code> inserts a <code>&lt;ref name="..."&gt;{{cite journal | author= ... | year= ... | title= ... | journal= ... | volume= ... | pages= ... | pmid= ... | doi= ... }}&lt;/ref&gt;</code> skeleton at the cursor, with the cursor positioned at the <code>author=</code> field for direct typing.


== Special pages ==
== Special pages ==