annotepage-client 2.27.0 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,11 +13,45 @@ tag loads, byte for byte — and `labels/fr.json`.
13
13
  **[The install page](https://annotepage.com/how-to-install-it.html) builds the
14
14
  tag**, with your address, your key and the digest for the version you take.
15
15
 
16
- ## It has to stay a classic script tag
16
+ ## The tag has to stay a classic script tag
17
17
 
18
18
  The tool reads its own attributes through `document.currentScript`, which is
19
- `null` inside a module. Loaded as a module it stops, silently, with one line in
20
- the console. No `type="module"`, no bundler, no import.
19
+ `null` inside a module — and just as null once a “combine JS” option, an asset
20
+ pipeline or a bundler has concatenated this file with others. There is then no
21
+ tag to read: the client writes one line in the console and stands down, having
22
+ drawn nothing and sent nothing.
23
+
24
+ ## Declaring the settings without a tag
25
+
26
+ For those pages, the same settings go in one object, declared **before** the
27
+ client is loaded:
28
+
29
+ ```html
30
+ <script>
31
+ window.annotepageConfig = {
32
+ server: 'https://example.com/annotepage/api.php',
33
+ key: '<43 characters>'
34
+ };
35
+ </script>
36
+ ```
37
+
38
+ The names are the ones in the table below, without `data-`. Three differences,
39
+ each of them deliberate:
40
+
41
+ - **`server` is required here.** On a tag, a client served by the site itself
42
+ falls back on `../api.php` *relative to its own file*; with no tag there is
43
+ no file address to deduce one from, and an address guessed wrong sends the
44
+ remarks nowhere at all. Missing, it is refused and said.
45
+ - **`setup` is a value**, `true` or `false`, where the attribute is presence.
46
+ - **`domains`** takes an array as well as the comma-separated string.
47
+
48
+ A page may carry both. They must then say the same thing: every setting the
49
+ object writes has to be written on the tag, with the same value. Anything else
50
+ is refused and named — nothing sent, nothing decrypted, no winner picked, for
51
+ the same reason a tag whose key and id disagree is refused. The tag is the
52
+ standard way and stays the one the install page hands out;
53
+ [the question this answers](https://annotepage.com/questions.html#config) is on
54
+ the site.
21
55
 
22
56
  ## The attributes
23
57
 
package/dist/HASHES.txt CHANGED
@@ -1,4 +1,5 @@
1
- 2.27.0 sha384-kp77NrEp+RsMez3vGrG2I3dsjKhwBPVc1QEag4JhJo5tE+JUZMhEpGIgoneJaROi 252719 bytes
1
+ 2.28.0 sha384-aiEeBEhxLgIP0cyZB6FNFRVqATgROwtxEtAmOU3amaBhO06B5IE13Hms8U+dORXp 269981 bytes
2
+ 2.27.0 sha384-aftW4rcvAamPZXxmbvollL8hu9of9Nd17h5XeQY1tjbUf2FEg3a+eAGAw0PQcQ0q 269794 bytes
2
3
  2.26.0 sha384-XepZjJvyM/pXAvgnn+lWKNTpUXZwkix544N2eWFHS5XlkU76LqbFdVdywqkqXu/G 252719 bytes
3
4
  2.25.0 sha384-GW0jyeWtRgUL3QIicNPDJBsvohYliZqUoEDfoCEf+3SEpMnXkq/BrvDoNwsVfFvE 252719 bytes
4
5
  2.24.0 sha384-G9KDMFzwMb9ctAA0bvWFqwpl6Nz8dvY7AgP19gNnZ9fNKp2iX9gparnUN5AsJ1lL 250835 bytes
@@ -1,7 +1,7 @@
1
1
  /* ============================================================================
2
2
  annotepage -- the annotation layer, browser side.
3
3
 
4
- Package version : 2.27.0
4
+ Package version : 2.28.0
5
5
  Format version : 2 (see FORMAT.md)
6
6
  Licence : MIT
7
7
 
@@ -16,44 +16,248 @@
16
16
  /* Injected by the build: they come from package.json and from
17
17
  src/styles.css, so that no value is written in two places and can
18
18
  therefore diverge. */
19
- const TOOL_VERSION = "2.27.0";
19
+ const TOOL_VERSION = "2.28.0";
20
20
  const FORMAT = 2;
21
21
  const STYLES = "/* ============================================================================\n styles.css -- THE STYLES OF THE TOOL, AND OF NO OTHER ELEMENT.\n\n This sheet is INLINED into the served file by the build, then put into the\n tool's shadow root -- as a constructed sheet when the browser can do it, in\n a <style> otherwise. It was loaded by a <link> in the original tool; the\n move to a CDN under SRI brought it inside the file, so that there is only\n one digest to keep up to date. The containment itself has not changed, and\n is still twofold:\n\n - from the tool towards the site: no rule from here can reach an element\n of the host site, the browser sees to that. That is what makes the\n claim \"the layer touches nothing\" checkable rather than promised;\n - from the site towards the tool: no rule of the site can reach an\n element here. A redesign of the site's stylesheet therefore cannot\n distort the tool, nor the other way round.\n\n The \"ap-\" prefix on every class is the third safeguard: the day somebody\n loads these styles WITHOUT a shadow root -- by mistake, or to debug --\n nothing would answer a selector of the site.\n\n NO RULE TARGETS html, body, * OR ANY SELECTOR OF THE SITE. That is the one\n absolute prohibition of this file.\n\n COLOURS: the tool has its OWN palette, defined on the shadow root. It\n reads neither the site's variables nor its theme attribute: it has no\n reason to know how the site names its colours, and it must stay readable\n on a light site as on a dark one. The switch follows the system\n preference, the only information the tool has without asking anyone.\n ============================================================================ */\n\n\n:host {\n --ap-bg: #ffffff;\n --ap-bg-soft: #f4f6f8;\n --ap-bg-raised: #e9edf2;\n --ap-text: #1a1d21;\n --ap-text-soft: #5b6570;\n --ap-border: #d5dbe2;\n --ap-accent: #2f6fed;\n --ap-accent-dark: #1d55c8;\n --ap-accent-text: #ffffff;\n --ap-accent-veil: rgba(47, 111, 237, 0.14);\n --ap-alert-bg: #fdeceb;\n --ap-alert-border: #e3a9a4;\n --ap-alert-text: #8a1f16;\n /* THE TWO STATES A REMARK CAN BE IN ONCE IT IS ANSWERED, as tokens rather\n than as literals. They were literals, written once inside the card's\n state mark -- which meant the dark theme drew them at the LIGHT theme's\n ink: measured, 2.42:1 for \"resolved\" and 2.02:1 against the veil they\n sit on, where WCAG 1.4.3 asks 4.5. Below they are 4.68 and 5.23 in the\n light theme, 6.43 and 6.64 in the dark one, on the same composite.\n\n `pending` is the state that must never be mistaken for done: resolved,\n but not deployed -- the defect is still on the reader's screen. `fill`\n is the same colour asked to carry --ap-accent-text on top of it, for the\n badge on the page: 5.93:1 in light, 10.14:1 in dark. */\n --ap-done-ink: #0f7a52;\n --ap-done-veil: rgba(16, 185, 129, 0.14);\n --ap-pending-ink: #8a5a00;\n --ap-pending-veil: rgba(245, 158, 11, 0.16);\n --ap-pending-fill: #8a5a00;\n --ap-shadow: 0 6px 24px rgba(16, 24, 40, 0.18);\n --ap-radius: 10px;\n --ap-font: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\",\n Arial, sans-serif;\n}\n\n@media (prefers-color-scheme: dark) {\n :host {\n --ap-bg: #1d2126;\n --ap-bg-soft: #262b32;\n --ap-bg-raised: #323942;\n --ap-text: #e9ecf0;\n --ap-text-soft: #a4adb8;\n --ap-border: #3a424c;\n --ap-accent: #6d9bff;\n --ap-accent-dark: #8fb4ff;\n --ap-accent-text: #10151c;\n --ap-accent-veil: rgba(109, 155, 255, 0.18);\n --ap-alert-bg: #3a1f1c;\n --ap-alert-border: #7c3a33;\n --ap-alert-text: #ffb9b1;\n --ap-done-ink: #56d3a0;\n --ap-done-veil: rgba(16, 185, 129, 0.18);\n --ap-pending-ink: #f0b757;\n --ap-pending-veil: rgba(245, 158, 11, 0.16);\n --ap-pending-fill: #f0b757;\n --ap-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);\n }\n}\n\n/* ----------------------------------------------------------------------------\n The layer.\n\n It covers the viewport and receives NO click: that is what lets the page\n behave exactly as usual as long as the tool is not in annotation mode.\n Each widget re-enables clicks for itself alone.\n ---------------------------------------------------------------------------- */\n\n.ap-layer {\n position: absolute;\n inset: 0;\n pointer-events: none;\n font-family: var(--ap-font);\n font-size: 14px;\n line-height: 1.45;\n color: var(--ap-text);\n text-align: left;\n -webkit-font-smoothing: antialiased;\n}\n\n.ap-layer button,\n.ap-layer input,\n.ap-layer textarea {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n box-sizing: border-box;\n}\n\n/* ----------------------------------------------------------------------------\n The button: the only thing visible when the tool is at rest.\n ---------------------------------------------------------------------------- */\n\n.ap-button {\n position: fixed;\n right: 16px;\n bottom: 16px;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 9px 14px;\n border: 1px solid var(--ap-border);\n border-radius: 999px;\n background: var(--ap-bg);\n color: var(--ap-text);\n box-shadow: var(--ap-shadow);\n cursor: pointer;\n pointer-events: auto;\n opacity: 0.92;\n transition: opacity 0.15s ease, transform 0.15s ease;\n}\n\n.ap-button:hover,\n.ap-button:focus-visible {\n opacity: 1;\n transform: translateY(-1px);\n}\n\n.ap-button:focus-visible {\n outline: 2px solid var(--ap-accent);\n outline-offset: 2px;\n}\n\n.ap-button[aria-pressed=\"true\"] {\n background: var(--ap-accent);\n border-color: var(--ap-accent);\n color: var(--ap-accent-text);\n opacity: 1;\n}\n\n.ap-button-dot {\n display: inline-block;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--ap-accent);\n flex: none;\n}\n\n.ap-button[aria-pressed=\"true\"] .ap-button-dot {\n background: var(--ap-accent-text);\n}\n\n.ap-button-count {\n padding: 1px 7px;\n border-radius: 999px;\n background: var(--ap-bg-raised);\n color: var(--ap-text-soft);\n font-size: 12px;\n}\n\n.ap-button[aria-pressed=\"true\"] .ap-button-count {\n background: rgba(255, 255, 255, 0.22);\n color: var(--ap-accent-text);\n}\n\n/* ----------------------------------------------------------------------------\n The pointing highlight.\n\n It is DRAWN HERE, from the coordinates of the element being pointed at.\n Nothing is put on the element itself: no class, no attribute, no style. So\n the site cannot move by a single pixel because of the pointing.\n ---------------------------------------------------------------------------- */\n\n.ap-highlight {\n position: fixed;\n border: 2px solid var(--ap-accent);\n border-radius: 3px;\n background: var(--ap-accent-veil);\n pointer-events: none;\n display: none;\n}\n\n.ap-highlight-label {\n position: fixed;\n max-width: 320px;\n padding: 4px 8px;\n border-radius: 6px;\n background: var(--ap-accent);\n color: var(--ap-accent-text);\n font-size: 12px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n display: none;\n box-shadow: var(--ap-shadow);\n}\n\n/* ----------------------------------------------------------------------------\n The markers: \"there are already notes here\".\n ---------------------------------------------------------------------------- */\n\n.ap-marker {\n position: fixed;\n min-width: 22px;\n height: 22px;\n padding: 0 6px;\n border: 2px solid var(--ap-bg);\n border-radius: 999px;\n background: var(--ap-accent);\n color: var(--ap-accent-text);\n font-size: 12px;\n font-weight: 700;\n line-height: 18px;\n text-align: center;\n cursor: pointer;\n pointer-events: auto;\n box-shadow: var(--ap-shadow);\n}\n\n/* THE STATE, IN THE BADGE ITSELF. The rule above is the OPEN state -- work to\n do -- and it stays the tool's accent, because that is what a badge on a page\n has always meant here. The other two are read against it:\n\n pending filled amber. Resolved, not deployed: the defect is still on the\n screen the reader is looking at, and it is the one state worth\n catching an eye that was not looking for it.\n done hollow, in the soft ink. History: there, countable, and not\n asking for anything.\n\n THE COLOUR IS NEVER ALONE. The count is written in the badge and the state\n is spelled out in its accessible name -- a badge that said \"still to fix\"\n by hue only would say nothing at all to a good part of its readers. */\n.ap-marker-pending {\n background: var(--ap-pending-fill);\n}\n.ap-marker-done {\n background: var(--ap-bg-soft);\n color: var(--ap-text-soft);\n font-weight: 600;\n /* The 2px border is the halo against the page and cannot be spent on the\n outline, so the outline is drawn inside. */\n box-shadow: var(--ap-shadow), inset 0 0 0 1px var(--ap-border);\n}\n\n.ap-marker:focus-visible {\n outline: 2px solid var(--ap-accent-dark);\n outline-offset: 2px;\n}\n\n/* ----------------------------------------------------------------------------\n The panel.\n ---------------------------------------------------------------------------- */\n\n.ap-panel {\n position: fixed;\n top: 12px;\n right: 12px;\n bottom: 72px;\n width: 360px;\n max-width: calc(100vw - 24px);\n display: none;\n flex-direction: column;\n border: 1px solid var(--ap-border);\n border-radius: var(--ap-radius);\n background: var(--ap-bg);\n box-shadow: var(--ap-shadow);\n pointer-events: auto;\n overflow: hidden;\n}\n\n.ap-panel.ap-open {\n display: flex;\n}\n\n/* The other side. Two positions, right and left, and no third one: in\n annotation mode the layer takes every click, so every pixel of panel is a\n pixel of page that can no longer be pointed at. A floating panel would\n only move that loss around.\n\n \"bottom\" IS NOT REDECLARED, on purpose: the panel keeps the same 72 px of\n clearance above the floating button either way, and that clearance is the\n same on both sides because the button moves WITH it.\n\n AND THE BUTTON MOVES WITH IT, which was decided the other way first. The\n argument for leaving it was that it is the tool's only visible trace at\n rest, so an anchor that moved would stop being one. The owner's answer,\n and it is the better one: \"move left\" is asked of the TOOL, not of half of\n it. A panel on one edge and the control that opens it on the other makes\n the eye cross the whole window for one gesture, and somebody who set the\n side set it for the tool.\n\n TWO THINGS THIS RULE DEPENDS ON, both fragile:\n - it is written with ONE class, so it weighs exactly what \".ap-panel\"\n weighs;\n - it is written BEFORE the narrow block below.\n Reverse either and it wins under 560 px, where the panel is a bottom band\n spanning the width -- and a panel pinned to the left there is the full-\n height panel whose defect at 375 px is described in that block. */\n.ap-left {\n right: auto;\n left: 12px;\n}\n/* The button follows, and it is put on the LAYER and not on the panel: the\n button is not inside the panel, so the side has to be readable from a\n common ancestor. Same offset mirrored, same bottom -- only the edge\n changes. */\n.ap-layer.ap-left-side .ap-button {\n right: auto;\n left: 16px;\n}\n\n.ap-panel-header {\n display: flex;\n align-items: baseline;\n gap: 8px;\n padding: 12px 14px;\n border-bottom: 1px solid var(--ap-border);\n background: var(--ap-bg-soft);\n}\n\n.ap-panel-title {\n font-size: 15px;\n font-weight: 600;\n flex: 1 1 auto;\n}\n\n/* -- what the whole project holds ---------------------------------------\n THE FIRST LINE OF THE FOOTER, on its own row. The footer is a flex row of\n short things -- a name, two buttons -- so this takes the whole width and the\n rest wraps under it. No ground and no border of its own: it is IN the footer,\n not beside it. */\n/* The retention line, when there is one. `:empty` rather than a class the\n script has to add and remove: the element is always there, and CSS decides\n whether it takes any room -- so a server that deletes nothing costs the\n panel exactly nothing. */\n.ap-panel-keeps { margin-top: 6px; color: var(--ap-text-soft); }\n.ap-panel-keeps:empty { display: none; }\n\n.ap-panel-footer { flex-wrap: wrap; }\n\n/* WHO YOU ARE SIGNING AS, ON A LINE OF ITS OWN. `flex-basis: 100%` is the same\n device the block above uses, and for the same reason: the footer is one\n wrapping row and everything in it was being strung end to end. */\n.ap-foot-who {\n flex-basis: 100%;\n display: flex; align-items: baseline; gap: 8px;\n}\n\n/* -- the list of remarks -------------------------------------------------\n A ROW, AND EVERY ROW IS A BUTTON. Not a card with a link in it: the whole\n line is the target, which is what a list of things to open should be, and it\n is reachable with a keyboard for free.\n\n THE EXCERPT TAKES THE ROOM AND FOLDS TO ONE LINE. What a remark is about can\n be a paragraph; what a list can show is a line. The author keeps a fixed\n place at the end so the eye can run down it. */\n.ap-row {\n display: flex; align-items: baseline; gap: 8px;\n width: 100%; margin: 0 0 4px; padding: 8px 10px;\n border: 1px solid var(--ap-border); border-radius: 8px;\n background: var(--ap-bg); color: var(--ap-text);\n font: inherit; text-align: left; cursor: pointer;\n transition: border-color .15s ease, background-color .15s ease;\n}\n.ap-row:hover { background: var(--ap-bg-soft); border-color: var(--ap-accent); }\n.ap-row:focus-visible { outline: 2px solid var(--ap-accent); outline-offset: 2px; }\n.ap-row-about {\n flex: 1; min-width: 0;\n overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n}\n.ap-row-who { flex: none; font-size: 12px; color: var(--ap-text-soft); }\n/* THE STATE, AS A DOT. Three of them, and the middle one is the one that must\n not read as done: resolved but not deployed is a defect still on screen. The\n accessible name spells all three out -- a colour is not a fact for\n everybody. */\n.ap-row-dot {\n flex: none; width: 8px; height: 8px; border-radius: 999px;\n background: var(--ap-accent); align-self: center;\n}\n.ap-row-pending .ap-row-dot { background: var(--ap-text-soft); }\n.ap-row-done .ap-row-dot { background: transparent; border: 1px solid var(--ap-border); }\n.ap-row-done .ap-row-about { color: var(--ap-text-soft); }\n@media (prefers-reduced-motion: reduce) { .ap-row { transition: none; } }\n\n/* -- a window that is not the panel --------------------------------------\n IT FLOATS OVER THE PAGE, and that is the point: the panel is a band down one\n edge, and what goes in here is not about the page beside it. Fixed rather\n than absolute -- the reader scrolls the page under it, and a window that\n scrolled away with the article would have to be chased.\n\n ABOVE THE PANEL AND BELOW NOTHING. It is opened from the panel's footer, so\n it must cover it; the tool's own layer already sits above the site.\n\n WIDTH: it is read, not filled in. 26rem is a paragraph, and min() keeps it\n inside a phone without a media query. */\n.ap-pop {\n position: fixed; z-index: 3;\n /* THE LAYER IS `pointer-events: none` so the site underneath keeps working,\n and every piece that must be reachable turns it back on. Without this\n line the window is a picture: no click on its buttons, and no drag on its\n bar -- which is exactly how it behaved when first measured. */\n pointer-events: auto;\n width: min(26rem, calc(100vw - 24px));\n max-height: calc(100vh - 24px);\n display: flex; flex-direction: column;\n border: 1px solid var(--ap-border); border-radius: 12px;\n background: var(--ap-bg); color: var(--ap-text);\n box-shadow: 0 18px 48px rgba(0, 0, 0, .22);\n overflow: hidden;\n}\n/* THE HANDLE. `touch-action: none` is what makes a finger drag the window\n instead of scrolling the page under it -- without it the browser claims the\n gesture before the first pointermove arrives. */\n.ap-pop-bar {\n display: flex; align-items: center; gap: 8px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--ap-border);\n background: var(--ap-bg-soft);\n cursor: grab; touch-action: none; user-select: none;\n}\n.ap-pop-moving .ap-pop-bar { cursor: grabbing; }\n.ap-pop-title { flex: 1; font-size: 13px; font-weight: 650; }\n/* `min-height: 0` is what makes the scroll happen INSIDE the window rather\n than the window growing past its own height: a flex item does not shrink\n below its content without it, and the end of a long remark would be behind\n the bottom edge with nothing to scroll. */\n.ap-pop-body { flex: 1 1 auto; min-height: 0; padding: 12px; overflow: auto; }\n/* The one line that says why the page stayed where it was. Drawn as the panel\n draws its own help text, not as an alert: nothing has gone wrong. */\n.ap-why {\n margin: 0 0 10px; padding: 8px 10px;\n border-radius: 8px; background: var(--ap-bg-soft);\n color: var(--ap-text-soft); font-size: 12.5px;\n}\n/* THE CORNER, AND IT IS DRAWN RATHER THAN LEFT TO THE BROWSER. `resize: both`\n would have done this in one line and does nothing under a finger on iOS; the\n window is moved with pointer events for exactly that reason, and it is\n resized with them too. Two hairlines, the shape everybody already reads as a\n grip, in the same ink as the borders around it. */\n.ap-pop-grip {\n position: absolute; right: 0; bottom: 0;\n width: 18px; height: 18px;\n cursor: nwse-resize; touch-action: none;\n background:\n linear-gradient(135deg, transparent 42%, var(--ap-border) 42%,\n var(--ap-border) 54%, transparent 54%),\n linear-gradient(135deg, transparent 66%, var(--ap-border) 66%,\n var(--ap-border) 78%, transparent 78%);\n}\n.ap-pop-sizing { user-select: none; }\n.ap-pop-sizing .ap-pop-grip { cursor: nwse-resize; }\n/* Inside a window, the block is the window: no second frame around it. */\n.ap-pop-body .ap-config { margin: 0; padding: 0; border: 0; background: none; }\n.ap-pop-body .ap-forget { margin: 0; }\n.ap-pop-body .ap-panel-stats { margin: 0; }\n.ap-pop-body .ap-stats { margin: 0; }\n/* A WINDOW HAS ROOM, SO THE FILE GETS IT. In the panel this field was two or\n four lines because the column had nothing to spare; here it can show the\n whole thing without being scrolled. */\n.ap-pop-body .ap-code { min-height: 9.5em; }\n\n/* -- the file the assistant needs ---------------------------------------\n Drawn like the other block the panel opens in its body -- a title, a\n sentence, the thing itself, two buttons -- so nothing here is a new shape to\n learn. The last line is the warning, and it is a line and not a dialog: the\n reviewer asked for this file. */\n.ap-config {\n margin: 10px 0 0; padding: 12px;\n border: 1px solid var(--ap-border); border-radius: 10px;\n background: var(--ap-bg-soft);\n}\n/* The warning is a line at the tool's own soft ink, not in an alert colour:\n the reviewer asked for this file, they are not being warned off it. There is\n no --ap-warn token and this does not invent one. */\n.ap-config .ap-warn { margin-top: 10px; }\n.ap-panel-stats {\n flex-basis: 100%;\n display: flex; flex-wrap: wrap; gap: 4px 18px;\n margin-bottom: 4px;\n}\n.ap-stat { display: inline-flex; align-items: baseline; gap: 5px; }\n/* The row says what it counts, once, and the three figures follow it. Without\n it, \"3 / 2 / 1\" beside a panel about one page reads as being about that\n page. */\n.ap-stat-label {\n flex-basis: 100%; margin-bottom: 2px;\n font-size: 11px; font-weight: 650; letter-spacing: .02em;\n text-transform: uppercase; color: var(--ap-text-soft);\n}\n.ap-stat-n { font-size: 15px; font-weight: 650; color: var(--ap-text); }\n.ap-stat-w { font-size: 12px; color: var(--ap-text-soft); }\n/* TWO BLOCKS, THIS SITE THEN THE WHOLE SERVER, and the second is absent on\n nearly every server. Each block is a label, the figures it holds, and -- when\n age takes anything here -- a second row for what it took. */\n.ap-stats { display: flex; flex-direction: column; gap: 16px; }\n.ap-stats-block { display: flex; flex-direction: column; gap: 4px; }\n.ap-stats .ap-panel-stats { margin-bottom: 0; }\n/* WHAT WAS REMOVED READS AS A FOOTNOTE TO THE ROW ABOVE, not as a second set of\n figures competing with it: same shapes, one step quieter, and indented under\n the count it belongs to. */\n.ap-stat-gone { padding-left: 10px; border-left: 2px solid var(--ap-border); }\n.ap-stat-gone .ap-stat-n { font-size: 13px; font-weight: 600; color: var(--ap-text-soft); }\n.ap-stat-since {\n font-size: 11px; font-weight: 650; letter-spacing: .02em;\n text-transform: uppercase; color: var(--ap-text-soft); align-self: baseline;\n}\n/* The date of the last sweep is context for the figures beside it, not another\n figure: soft ink, smaller, and it wraps under them rather than stretching\n the row. */\n.ap-stat-when { font-size: 12px; color: var(--ap-text-soft); align-self: baseline; }\n.ap-panel-instructions {\n padding: 10px 14px;\n border-bottom: 1px solid var(--ap-border);\n color: var(--ap-text-soft);\n font-size: 13px;\n}\n\n.ap-panel-body {\n flex: 1 1 auto;\n overflow-y: auto;\n overscroll-behavior: contain;\n padding: 4px 14px 14px;\n}\n\n.ap-panel-footer {\n padding: 8px 14px;\n border-top: 1px solid var(--ap-border);\n background: var(--ap-bg-soft);\n color: var(--ap-text-soft);\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.ap-section-title {\n margin: 14px 0 6px;\n color: var(--ap-text-soft);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n\n.ap-section-help {\n margin: 0 0 8px;\n color: var(--ap-text-soft);\n font-size: 12px;\n}\n\n.ap-empty {\n margin: 16px 0;\n color: var(--ap-text-soft);\n}\n\n/* ----------------------------------------------------------------------------\n THE MODE BADGE: one word, drawn in both modes, at the top of every draw.\n\n It replaced a paragraph that only the public mode ever drew. Two things\n were wrong with that: secure mode said nothing, so the panel never told a\n reviewer which of the two they were in; and a paragraph pinned to the top\n for ever is skipped after the second reading, while a single word is not.\n\n IT IS NOT A BUTTON AND MUST NOT LOOK LIKE ONE. No shadow, no pressed\n state, cursor stays default: there is nothing to press. What it does have\n is a focus ring, because it takes focus -- the description below has to be\n reachable without a pointer, and that is the only reason it is focusable.\n ---------------------------------------------------------------------------- */\n\n.ap-mode {\n /* The frame the description is positioned against. It spans the width of\n the panel body, so a description pinned to its two edges cannot spill\n sideways out of a body that scrolls -- and a scrolling body clips both\n axes, not just the one it scrolls. */\n position: relative;\n margin: 4px 0 10px;\n}\n\n.ap-mode-chip {\n display: inline-block;\n padding: 2px 9px 3px;\n border: 1px solid var(--ap-border);\n border-radius: 999px;\n background: var(--ap-bg-soft);\n color: var(--ap-text-soft);\n font-size: 11px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n cursor: default;\n}\n\n/* The public badge is the one that carries a consequence, so it is the one\n that is coloured -- in the tool's own accent, not in the alert colours: a\n public key is a choice somebody made on purpose, not an incident. Secure\n keeps the quiet frame: it is the case where nothing is being said. */\n/* The same ring as every other focusable thing in the panel. It is the only\n visual proof, for somebody arriving by Tab, that this word is where their\n focus went. */\n.ap-mode-chip:focus-visible {\n outline: 2px solid var(--ap-accent);\n outline-offset: 2px;\n}\n\n/* Plain wears the same coat as public, and for the same reason: both are a\n choice somebody made on purpose, and both carry a consequence for whoever\n is about to write. Neither is an incident, so neither takes an alert\n colour. They cannot both be true at once. */\n.ap-mode-public .ap-mode-chip,\n.ap-mode-plain .ap-mode-chip {\n border-color: var(--ap-accent);\n background: var(--ap-accent-veil);\n color: var(--ap-accent-dark);\n}\n\n/* The description. Hidden by DEFAULT and shown on demand, and hidden in a way\n that leaves it readable to a screen reader: it is the badge's\n aria-describedby target, and an accessible description is computed from the\n referenced element whether or not it is painted. It is taken out of the\n layout entirely (absolute) so that showing it moves not one pixel of the\n list underneath -- a tooltip that pushes the notes down is a tooltip that\n makes people lose their place. */\n.ap-mode-tip {\n position: absolute;\n z-index: 2;\n top: calc(100% + 6px);\n left: 0;\n right: 0;\n padding: 8px 10px;\n border: 1px solid var(--ap-border);\n border-radius: var(--ap-radius);\n background: var(--ap-bg-raised);\n color: var(--ap-text);\n box-shadow: var(--ap-shadow);\n font-size: 12px;\n font-weight: 400;\n letter-spacing: normal;\n text-transform: none;\n line-height: 1.45;\n opacity: 0;\n visibility: hidden;\n transform: translateY(-3px);\n transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;\n pointer-events: none;\n}\n\n/* BOTH, and the keyboard one is not the afterthought: :focus-visible is what\n makes the sentence reachable by somebody who never touches a pointer. */\n.ap-mode-chip:hover ~ .ap-mode-tip,\n.ap-mode-chip:focus-visible ~ .ap-mode-tip {\n opacity: 1;\n visibility: visible;\n transform: none;\n transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ap-mode-tip {\n transform: none;\n transition: none;\n }\n .ap-mode-chip:hover ~ .ap-mode-tip,\n .ap-mode-chip:focus-visible ~ .ap-mode-tip {\n transition: none;\n }\n}\n\n/* The \"a newer client exists\" line and the \"this server speaks another\n format\" line are the same object on screen: a standing statement about what\n one is looking at, above the notes and above the failures. One rule, so\n they cannot drift apart -- and the second one joins it rather than\n inventing a colour, precisely because a protocol disagreement is a fact\n about the project, not an incident.\n\n Deliberately NOT the alert colours: neither is a failure, and an alarm that\n never goes away stops being read. */\n.ap-upgrade,\n.ap-format {\n margin: 0 0 10px;\n padding: 8px 10px;\n border: 1px solid var(--ap-border);\n border-radius: var(--ap-radius);\n background: var(--ap-bg-soft);\n color: var(--ap-text-soft);\n font-size: 12px;\n line-height: 1.45;\n}\n\n/* ----------------------------------------------------------------------------\n A note, and its replies.\n ---------------------------------------------------------------------------- */\n\n.ap-note {\n margin: 8px 0;\n padding: 10px 12px;\n border: 1px solid var(--ap-border);\n border-radius: var(--ap-radius);\n background: var(--ap-bg);\n}\n\n.ap-note.ap-orphan {\n background: var(--ap-bg-soft);\n}\n\n\n.ap-note-header {\n display: flex;\n align-items: baseline;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.ap-note-author {\n font-weight: 600;\n}\n\n.ap-note-date {\n color: var(--ap-text-soft);\n font-size: 12px;\n}\n\n.ap-note-target {\n margin: 4px 0 0;\n color: var(--ap-text-soft);\n font-size: 12px;\n font-style: italic;\n overflow-wrap: anywhere;\n}\n\n.ap-note-text {\n margin: 6px 0 0;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.ap-note-actions {\n margin-top: 8px;\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.ap-replies {\n margin: 8px 0 0;\n padding-left: 10px;\n border-left: 2px solid var(--ap-border);\n}\n\n.ap-reply {\n margin: 8px 0 0;\n}\n\n/* ----------------------------------------------------------------------------\n The form, anchored near the element pointed at.\n ---------------------------------------------------------------------------- */\n\n.ap-form {\n position: fixed;\n width: 340px;\n max-width: calc(100vw - 24px);\n display: none;\n flex-direction: column;\n gap: 8px;\n padding: 14px;\n border: 1px solid var(--ap-border);\n border-radius: var(--ap-radius);\n background: var(--ap-bg);\n box-shadow: var(--ap-shadow);\n pointer-events: auto;\n}\n\n.ap-form.ap-open {\n display: flex;\n}\n\n.ap-form-title {\n font-size: 15px;\n font-weight: 600;\n}\n\n.ap-form-target {\n color: var(--ap-text-soft);\n font-size: 12px;\n font-style: italic;\n overflow-wrap: anywhere;\n}\n\n.ap-label {\n display: block;\n margin-bottom: 3px;\n font-size: 12px;\n font-weight: 600;\n color: var(--ap-text-soft);\n}\n\n.ap-help {\n margin: 3px 0 0;\n font-size: 12px;\n color: var(--ap-text-soft);\n}\n\n.ap-field,\n.ap-area {\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--ap-border);\n border-radius: 8px;\n background: var(--ap-bg-soft);\n color: var(--ap-text);\n}\n\n.ap-field:focus,\n.ap-area:focus {\n outline: 2px solid var(--ap-accent);\n outline-offset: 1px;\n}\n\n.ap-area {\n min-height: 92px;\n resize: vertical;\n}\n\n.ap-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.ap-counter {\n margin-left: auto;\n font-size: 12px;\n color: var(--ap-text-soft);\n}\n\n/* ----------------------------------------------------------------------------\n Buttons.\n ---------------------------------------------------------------------------- */\n\n.ap-primary,\n.ap-secondary,\n.ap-link {\n border-radius: 8px;\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ap-primary {\n padding: 8px 14px;\n border: 1px solid var(--ap-accent);\n background: var(--ap-accent);\n color: var(--ap-accent-text);\n font-weight: 600;\n}\n\n.ap-primary:hover {\n background: var(--ap-accent-dark);\n border-color: var(--ap-accent-dark);\n}\n\n.ap-secondary {\n padding: 8px 14px;\n border: 1px solid var(--ap-border);\n background: var(--ap-bg);\n color: var(--ap-text);\n}\n\n.ap-secondary:hover {\n background: var(--ap-bg-raised);\n}\n\n.ap-link {\n padding: 2px 4px;\n border: 0;\n background: none;\n color: var(--ap-accent);\n text-decoration: underline;\n font-size: 13px;\n}\n\n.ap-primary:disabled,\n.ap-secondary:disabled,\n.ap-link:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.ap-primary:focus-visible,\n.ap-secondary:focus-visible,\n.ap-link:focus-visible {\n outline: 2px solid var(--ap-accent);\n outline-offset: 2px;\n}\n\n/* ----------------------------------------------------------------------------\n The failures.\n\n They are RED, at the top of the block concerned, and carry the message the\n server returned as it stands: that is how a non-technical team learns that\n its remark is not saved, instead of believing it is.\n ---------------------------------------------------------------------------- */\n\n.ap-error {\n margin: 8px 0;\n padding: 10px 12px;\n border: 1px solid var(--ap-alert-border);\n border-radius: var(--ap-radius);\n background: var(--ap-alert-bg);\n color: var(--ap-alert-text);\n}\n\n.ap-error-title {\n font-weight: 700;\n margin-bottom: 4px;\n}\n\n.ap-error-detail {\n margin: 6px 0 0;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 13px;\n}\n\n.ap-error .ap-link {\n color: var(--ap-alert-text);\n}\n\n/* ----------------------------------------------------------------------------\n Narrow: the panel takes the full width, and so does the form.\n ---------------------------------------------------------------------------- */\n\n/* ----------------------------------------------------------------------------\n Narrow.\n\n DEFECT OBSERVED at 375 px wide: a panel taking the full height covers the\n whole page, and no element can be pointed at any more -- every click lands\n on the panel. So it becomes a bottom band, which leaves the top half of\n the viewport free; one scrolls the page there to bring the wanted element\n into view. The form, for its part, hides the panel while typing (see\n notes.js): on a screen that size, writing and reading the list at the same\n time does not hold.\n ---------------------------------------------------------------------------- */\n\n/* On a narrow screen the panel becomes a bottom band and the form takes the\n full width.\n\n THE WIDTH CEILING IS KEPT, and it comes from a measured defect: \"left: 8;\n right: 8\" sizes the element against its CONTAINING BLOCK, which the host\n site's horizontal overflow can make wider than the visible window.\n Measured, in mobile emulation at 390 px: the site overflows to 407 px\n (with the tool and without it), and the panel came out 391 px wide\n starting at 8, that is 9 px off screen. \"100vw\" is the window, not the\n containing block: the ceiling therefore does nothing when the site does\n not overflow, and pulls the width back when it does. */\n@media (max-width: 560px) {\n .ap-panel {\n top: auto;\n right: 8px;\n left: 8px;\n bottom: 66px;\n height: 52vh;\n width: auto;\n max-width: calc(100vw - 16px);\n }\n\n /* A band spanning the width has no side, so the choice is inert here and\n the button says so by not being there. Offering a control that visibly\n does nothing is worse than offering none. The stored side is untouched:\n it is waiting for the wide screen it was chosen on. */\n .ap-side-toggle {\n display: none;\n }\n\n .ap-form {\n left: 8px;\n right: 8px;\n width: auto;\n max-width: calc(100vw - 16px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ap-button {\n transition: none;\n }\n}\n\n/* The failure shows without opening the panel: the button's dot changes\n colour. A team that does not click must be able to see that something is\n wrong. */\n.ap-button.ap-failed .ap-button-dot {\n background: var(--ap-alert-text);\n}\n\n.ap-button.ap-failed {\n border-color: var(--ap-alert-border);\n}\n\n/* Signature reminder, in the note form.\n The name was shown at the foot of the panel only: invisible at the moment\n one writes. A user reported not knowing which name they were writing\n under. */\n.ap-form-signature {\n display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;\n margin: 0 0 .6rem; font-size: .85rem; opacity: .8;\n}\n\n/* Resolution state, said on the card.\n Two cases NOT to be confused: resolved and online, resolved but not\n deployed yet. The second keeps the defect on the reviewer's screen; hiding\n it or announcing it as fixed would cost them their trust in the tool. */\n.ap-state-mark {\n display: inline-block; margin: 0 0 .5rem;\n padding: .15rem .55rem; border-radius: 4px;\n font-size: .75rem; font-weight: 600; letter-spacing: .02em;\n}\n.ap-note.ap-resolved { opacity: .72; }\n.ap-note.ap-resolved .ap-state-mark {\n color: var(--ap-done-ink); background: var(--ap-done-veil);\n}\n.ap-note.ap-resolved-pending .ap-state-mark {\n color: var(--ap-pending-ink); background: var(--ap-pending-veil);\n}\n/* The \"it is fixed\" / \"reopen\" block, opened under the card. Same shape as\n the reply block: it is the same gesture, one answers a remark. */\n.ap-resolve,\n.ap-reply-form {\n margin-top: .6rem;\n padding-top: .6rem;\n border-top: 1px solid var(--ap-border);\n}\n\n/* The question asked before the key is dropped, at the foot of the list.\n Framed like the resolution block -- it is the same shape of gesture, one\n answers before something changes -- and set apart from the notes above it,\n because it is not about a note. */\n.ap-forget {\n margin-top: 1rem;\n padding-top: .6rem;\n border-top: 1px solid var(--ap-border);\n}\n\n.ap-forget .ap-actions {\n margin-top: .5rem;\n}\n\n.ap-history-toggle {\n display: block; width: 100%; margin: 1rem 0 .25rem;\n padding: .5rem .75rem; border: 1px dashed currentColor; border-radius: 6px;\n background: none; color: inherit; font: inherit; opacity: .7; cursor: pointer;\n}\n.ap-history-toggle:hover { opacity: 1; }\n\n\n/* ----------------------------------------------------------------------------\n Setup and pasting the salt.\n\n These are the only screens where something is copied by hand. Everything\n there is SELECTABLE and monospaced: a 43-character salt copied wrong\n cannot be recovered, and nothing helps less than a font that confuses I, l\n and 1.\n ---------------------------------------------------------------------------- */\n\n.ap-panel-wide {\n width: 560px;\n}\n\n.ap-copy {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n margin: 0 0 12px;\n}\n\n.ap-code {\n flex: 1 1 auto;\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--ap-border);\n border-radius: 8px;\n background: var(--ap-bg-soft);\n color: var(--ap-text);\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\",\n monospace;\n font-size: 12.5px;\n line-height: 1.5;\n resize: vertical;\n white-space: pre;\n overflow-x: auto;\n}\n\n.ap-code:focus-visible {\n outline: 2px solid var(--ap-accent);\n outline-offset: 1px;\n}\n\n@media (max-width: 560px) {\n .ap-panel-wide {\n width: auto;\n }\n\n .ap-copy {\n flex-direction: column;\n }\n}\n";
22
22
 
23
23
  /* ==== 00-preamble.js ==== */
24
24
 
25
25
  /* -- 0. Where am I, which project, and therefore where is the API --------
26
- Nothing below is guessed. Everything is DECLARED on the tag, because a
27
- client served by a CDN can no longer deduce anything from its own
28
- address: that address says nothing about the site under review. */
29
-
30
- const script = document.currentScript;
31
- if (!script || !script.src) {
32
- /* Loaded some other way than <script src>: we do not guess an API
33
- address, we stay out. Careful, this also covers type="module" --
34
- document.currentScript is null there. The tag must stay a classic
35
- tag, and the README says so. */
26
+ Nothing below is guessed. Everything is DECLARED, because a client served
27
+ by a CDN can no longer deduce anything from its own address: that address
28
+ says nothing about the site under review.
29
+
30
+ TWO SOURCES CAN CARRY THAT DECLARATION, and the tag is the standard one:
31
+
32
+ the tag <script src="..." data-server="..." data-key="...">, read
33
+ through document.currentScript. Everything in this repository
34
+ that hands out a configuration hands out a tag.
35
+
36
+ the page window.annotepageConfig = { server: '...', key: '...' },
37
+ declared before the client is loaded.
38
+
39
+ WHY THE SECOND ONE EXISTS. document.currentScript is null whenever this
40
+ file was not loaded by a classic <script src>: a "combine JS" option, an
41
+ asset pipeline that concatenates, a bundler, type="module". Until this
42
+ existed the client returned here and did nothing, WITH NOTHING SAID
43
+ ANYWHERE -- which from the outside cannot be told apart from a tool nobody
44
+ installed. That silence is the defect being fixed here.
45
+
46
+ The rule of silence itself is kept, because it is a principle and not the
47
+ bug: this client never throws inside a host page, never draws anything it
48
+ was not asked for, and never writes over somebody else's console. What it
49
+ does now is say ONE line, ONCE, when neither source is usable -- the one
50
+ case where saying nothing leaves nobody anything to look at.
51
+
52
+ THE NAME. window.annotepage IS ALREADY TAKEN: annotepage.com uses it for
53
+ the console command that switches its own copy on and off. window.Annotepage
54
+ is the label namespace (15-labels). annotepageConfig is neither of those.
55
+
56
+ WHICH SOURCE WINS, AND WHY IT IS NEVER A MERGE. One of the two configures
57
+ this copy WHOLE. Merging them setting by setting would produce a
58
+ configuration that exists nowhere in one piece -- nobody reading the page
59
+ could say what the tool is doing -- and it is exactly how a forgotten
60
+ object silently changes the project of a tag somebody has just corrected.
61
+ So:
62
+
63
+ a tag, no object the tag configures. This is every page that works
64
+ today, unchanged, down to the ../api.php fallback.
65
+ an object, no tag the object configures, and `server` is then required
66
+ (see THE SERVER ADDRESS).
67
+ both the tag configures, and the object MUST SAY THE SAME
68
+ THING: every setting it writes has to be written on
69
+ the tag, with the same value. Anything else is
70
+ refused and named. Two declarations that disagree are
71
+ two people who each believe they configured the tool,
72
+ and picking a winner buries one of them in a project
73
+ whose notes nobody will ever read -- the same reason
74
+ a tag carrying a key and a mismatched id is refused
75
+ rather than resolved (FORMAT.md section 1.5).
76
+ neither we stay out, and we say so once in the console. */
77
+
78
+ /* THE SETTINGS, AND THE WHOLE LIST OF THEM. `data-` plus the name on a tag,
79
+ the name alone in the object. Documented in the client's README, and
80
+ client/tools/check.mjs refuses a list that has drifted from it.
81
+
82
+ An unknown name is refused IN THE OBJECT ONLY, and the asymmetry is the
83
+ point: a data- attribute is shared space -- the site's own scripts write
84
+ there, annotepage.com marks its live tag with data-annotepage-on -- while
85
+ window.annotepageConfig is ours alone, so a name we do not know there is a
86
+ typo, and a typo that is ignored is a setting somebody believes they set. */
87
+ const SETTINGS = ['server', 'project', 'key', 'setup', 'mode', 'path',
88
+ 'domains', 'version', 'environment', 'labels'];
89
+
90
+ /* Not "written": 60-ui already holds a local of that name, and a helper of the
91
+ whole file shadowed inside one function is a reader's trap for nothing. */
92
+ const declaredIn = (map, name) => Object.prototype.hasOwnProperty.call(map, name);
93
+
94
+ /* WHAT THIS COPY STANDS DOWN FOR.
95
+
96
+ The sentence goes to the console in English, for whoever has the developer
97
+ tools open; the same fact is said on screen, in the page's language, by the
98
+ screen 90-boot opens -- so the label is NAMED here and resolved there,
99
+ because 15-labels has not been evaluated yet at this point in the file.
100
+
101
+ Never an exception, in either half: a client that throws inside somebody
102
+ else's page has broken that page, whatever it was right about. */
103
+ let CONFIG_FAILURE = null;
104
+
105
+ const complain = (sentence) => {
106
+ try {
107
+ if (window.console && window.console.warn) {
108
+ window.console.warn('annotepage: ' + sentence);
109
+ }
110
+ } catch (e) { /* a console that refuses to be called is not our business */ }
111
+ };
112
+
113
+ const refuse = (label, values, sentence) => {
114
+ // The FIRST cause, not the tenth: one broken setting usually makes the
115
+ // next three look broken too, and a screen listing four problems sends
116
+ // somebody fixing the three that were only consequences.
117
+ if (CONFIG_FAILURE) return;
118
+ CONFIG_FAILURE = { label: label, values: values };
119
+ complain(sentence);
120
+ };
121
+
122
+ /* -- The two sources, read separately ----------------------------------- */
123
+
124
+ /* A tag with no src carries no attributes worth reading either, and it is the
125
+ same non-answer as no tag at all: an inline <script> that happens to be
126
+ running is not where this client's settings live. */
127
+ const script = (document.currentScript && document.currentScript.src)
128
+ ? document.currentScript : null;
129
+ const SCRIPT_SRC = script ? script.src : '';
130
+
131
+ const declaredConfig = window.annotepageConfig;
132
+ const HAS_CONFIG = declaredConfig !== undefined && declaredConfig !== null;
133
+ if (HAS_CONFIG && (typeof declaredConfig !== 'object' || Array.isArray(declaredConfig))) {
134
+ refuse('tag.config_shape', null,
135
+ 'window.annotepageConfig is not an object, so nothing could be read from '
136
+ + 'it. It is written { server: "...", project: "..." }.');
137
+ }
138
+
139
+ const isTextList = (value) => {
140
+ if (!Array.isArray(value)) return false;
141
+ for (let i = 0; i < value.length; i += 1) {
142
+ if (typeof value[i] !== 'string') return false;
143
+ }
144
+ return true;
145
+ };
146
+
147
+ /* What each source declares, as text, and whether it declares it AT ALL -- an
148
+ empty data-key is not the same fact as no data-key (see THE KEY below). */
149
+ const fromTag = {};
150
+ const data = (script && script.dataset) || {};
151
+ for (let i = 0; i < SETTINGS.length; i += 1) {
152
+ const name = SETTINGS[i];
153
+ if (declaredIn(data, name)) fromTag[name] = String(data[name]).trim();
154
+ }
155
+ /* An attribute is PRESENCE and never a value: <script data-setup> has none to
156
+ read. A property is a value, and `setup: false` reads as "no" to anybody
157
+ who writes JavaScript. Both end up as the same two words so that the two
158
+ sources can be compared at all. */
159
+ if (declaredIn(data, 'setup')) fromTag.setup = 'yes';
160
+
161
+ const fromPage = {};
162
+ if (HAS_CONFIG && !CONFIG_FAILURE) {
163
+ const names = Object.keys(declaredConfig);
164
+ for (let i = 0; i < names.length; i += 1) {
165
+ const name = names[i];
166
+ const value = declaredConfig[name];
167
+ if (SETTINGS.indexOf(name) === -1) {
168
+ refuse('tag.config_setting', { name: name },
169
+ 'window.annotepageConfig carries "' + name + '", which is not a '
170
+ + 'setting of this client. Nothing was read from it.');
171
+ } else if (name === 'setup') {
172
+ fromPage.setup = value ? 'yes' : 'no';
173
+ } else if (typeof value === 'string') {
174
+ fromPage[name] = value.trim();
175
+ } else if (name === 'domains' && isTextList(value)) {
176
+ /* The tag has one string and commas, because an attribute cannot
177
+ hold a list. An object can, and an array is what anybody writing
178
+ one writes. Both are read; nothing else is. */
179
+ fromPage.domains = value.join(',');
180
+ } else {
181
+ refuse('tag.config_value', { name: name },
182
+ '"' + name + '" in window.annotepageConfig has to be text between '
183
+ + 'quotes. Nothing was read from it.');
184
+ }
185
+ }
186
+ }
187
+
188
+ /* -- And the one that configures this copy ------------------------------- */
189
+
190
+ let config = {};
191
+ if (script) {
192
+ config = fromTag;
193
+ const names = Object.keys(fromPage);
194
+ for (let i = 0; i < names.length; i += 1) {
195
+ const name = names[i];
196
+ /* `setup: false` beside a tag with no data-setup states the same fact
197
+ -- no setup screen -- so it is not a disagreement. It is the only
198
+ case where silence on one side equals a value on the other. */
199
+ if (name === 'setup' && fromPage.setup === 'no' && !declaredIn(fromTag, 'setup')) continue;
200
+ if (declaredIn(fromTag, name) && fromTag[name] === fromPage[name]) continue;
201
+ refuse('tag.two_sources', { name: name },
202
+ 'the tag on this page and window.annotepageConfig disagree about "'
203
+ + name + '". Nothing was adopted from either: correct one of the two.');
204
+ }
205
+ } else if (HAS_CONFIG) {
206
+ config = fromPage;
207
+ /* WITHOUT A TAG THE ADDRESS IS NOT DEDUCED, IT IS REQUIRED -- and this is
208
+ where that has to be said, before anything is adopted. The old
209
+ "../api.php" deduction is relative to THE FILE, and the tag's src is
210
+ what made it possible; the document's own address says nothing, since
211
+ this file may have been concatenated into a bundle that lives anywhere
212
+ on the site. A remark that leaves for an address nobody chose is worse
213
+ than a remark that was never written: the reviewer watched it go. */
214
+ if (!fromPage.server) {
215
+ refuse('tag.config_no_server', null,
216
+ 'window.annotepageConfig declares no "server", and without a tag there '
217
+ + 'is no file address to deduce one from. Nothing was sent. Add '
218
+ + 'server: "https://.../api.php" to it.');
219
+ }
220
+ } else {
221
+ /* NEITHER SOURCE. The one case where this file used to return in complete
222
+ silence, and the one nobody could diagnose: a page where the tool was
223
+ never installed and a page where a concatenation ate the tag look
224
+ identical from the outside. One line, once -- this file is evaluated
225
+ once per copy loaded -- and no exception. */
226
+ complain('this page carries no <script> tag this client can read its settings '
227
+ + 'from, and no window.annotepageConfig. document.currentScript is null '
228
+ + 'when the file is concatenated with others, inlined, or loaded as a '
229
+ + 'module. Nothing was drawn and nothing was sent. See '
230
+ + 'https://annotepage.com/questions.html#config');
36
231
  return;
37
232
  }
38
233
 
39
- const data = script.dataset || {};
40
- const read = (name) => String((data[name] === undefined ? '' : data[name])).trim();
234
+ /* A refusal adopts NOTHING. Half a configuration would start the tool on
235
+ whichever half happened to be readable, which is the guess this whole file
236
+ exists to avoid. 90-boot shows the reason instead. */
237
+ if (CONFIG_FAILURE) config = {};
238
+
239
+ const read = (name) => (declaredIn(config, name) ? config[name] : '');
41
240
 
42
- /* The server address.
241
+ /* THE SERVER ADDRESS.
43
242
 
44
- Self-hosted, the client is served by the site itself and the old
45
- "../api.php" deduction is still enough: it worked for the whole life of
46
- format 1, we are not removing it.
243
+ Self-hosted WITH A TAG, the old "../api.php" deduction is still enough: it
244
+ worked for the whole life of format 1, we are not removing it. As soon as
245
+ the client goes to a CDN it becomes wrong -- the API is not at the CDN --
246
+ and it has to be declared. Without a tag it is required outright, which is
247
+ settled above, where the object is adopted.
47
248
 
48
- As soon as the client goes to a CDN it becomes wrong -- the API is not at
49
- the CDN -- and it has to be declared. We do not try to recover: an API
50
- address guessed wrong would send the remarks nowhere. */
249
+ A REFUSED CONFIGURATION BUILDS NO ADDRESS AT ALL, and the fallback is
250
+ inside the guard for that reason: a tag served by the site would otherwise
251
+ still produce ../api.php while the rest of the settings were being thrown
252
+ away, which is the half-configured start this file exists to prevent. */
51
253
  const DECLARED_SERVER = read('server');
52
254
  let API = '';
53
- if (DECLARED_SERVER) {
54
- API = new URL(DECLARED_SERVER, document.baseURI).href;
55
- } else if (new URL(script.src).origin === location.origin) {
56
- API = new URL('../api.php', script.src).href;
255
+ if (!CONFIG_FAILURE) {
256
+ if (DECLARED_SERVER) {
257
+ API = new URL(DECLARED_SERVER, document.baseURI).href;
258
+ } else if (script && new URL(SCRIPT_SRC).origin === location.origin) {
259
+ API = new URL('../api.php', SCRIPT_SRC).href;
260
+ }
57
261
  }
58
262
 
59
263
  /* The project id, generated at setup (see 70-setup). 22 base64url
@@ -62,24 +266,26 @@
62
266
  and a page that never shows a single note. */
63
267
  const DECLARED_PROJECT = read('project');
64
268
  const PROJECT_WELL_FORMED = /^[A-Za-z0-9_-]{22}$/.test(DECLARED_PROJECT);
65
- /* NOT a const: with data-key the id is DERIVED rather than declared, and
269
+ /* NOT a const: with a declared key the id is DERIVED rather than declared, and
66
270
  90-boot writes it here once derive() has produced it. There is one PROJECT
67
271
  in this scope and everything downstream reads it -- two would have
68
272
  diverged. */
69
273
  let PROJECT = PROJECT_WELL_FORMED ? DECLARED_PROJECT : '';
70
274
 
71
- /* THE KEY, WRITTEN IN THE TAG -- and that attribute IS the mode.
275
+ /* THE KEY, WRITTEN IN THE PAGE -- and that setting IS the mode. It reads the
276
+ same in both sources, because it is the same fact: `data-key` on the tag,
277
+ `key` in the object.
72
278
 
73
- data-key the key itself: the project is PUBLIC. Whoever can load the
279
+ key the key itself: the project is PUBLIC. Whoever can load the
74
280
  page can read the notes and write them. Nothing is asked for,
75
281
  nothing is stored, and no id is declared: derive() already
76
282
  produces it from the key (HKDF label "id"), so writing both
77
- would be writing the same fact twice in a tag people copy by
78
- hand -- where the two can disagree.
79
- data-project the id alone: confidential. The key is asked for once per
283
+ would be writing the same fact twice in something people copy
284
+ by hand -- where the two can disagree.
285
+ project the id alone: confidential. The key is asked for once per
80
286
  browser, and until it is there nothing is fetched and nothing
81
287
  is decrypted. That is the behaviour of every version so far.
82
- data-setup neither, temporarily.
288
+ setup neither, temporarily.
83
289
 
84
290
  THE KEY IS NOT DERIVED FROM THE DOMAIN, and it never will be. The browser
85
291
  hands the relay an Origin header on every request (FORMAT.md section 6.2),
@@ -91,13 +297,13 @@
91
297
 
92
298
  The SHAPE is not checked here: keyFromText() in 20-crypto is the single
93
299
  judge of what a key looks like, and it lives in the section that owns the
94
- format. What is recorded here is whether the attribute was WRITTEN at all
95
- -- an empty data-key is a tag somebody meant to fill in, and it gets said
96
- rather than ignored. */
300
+ format. What is recorded here is whether the key was WRITTEN at all -- an
301
+ empty one is something somebody meant to fill in, and it gets said rather
302
+ than ignored. */
97
303
  const DECLARED_KEY = read('key');
98
- const KEY_DECLARED = Object.prototype.hasOwnProperty.call(data, 'key');
304
+ const KEY_DECLARED = declaredIn(config, 'key');
99
305
 
100
- /* True once the key in the tag has been checked and adopted. It is what the
306
+ /* True once the key in the page has been checked and adopted. It is what the
101
307
  interface says out loud, at every draw: see PUBLIC_KEY in 60-ui. */
102
308
  let PUBLIC_KEY = false;
103
309
 
@@ -114,28 +320,28 @@
114
320
 
115
321
  The path prefix is checked HERE, before anything else, and this is the
116
322
  only place where it can be: the server does not see paths (blind index,
117
- FORMAT.md section 4). So it is TIDINESS -- the tag can stay at the foot of
118
- every page of the site without the online documentation collecting the
119
- staging notes -- and NOT a security boundary: whoever has the project id
323
+ FORMAT.md section 4). So it is TIDINESS -- the declaration can stay at the
324
+ foot of every page of the site without the online documentation collecting
325
+ the staging notes -- and NOT a security boundary: whoever has the project id
120
326
  and the key writes wherever they like. */
121
327
  const PATH_PREFIX = read('path');
122
328
 
123
329
  /* The project origins. The real lock is the server's (FORMAT.md section
124
330
  6.2); this one only avoids talking to a server that is going to say no,
125
- for instance when the tag was copied onto another site along with the
126
- rest of a template. It protects nothing: a hand-made client does not read
127
- it. */
331
+ for instance when the declaration was copied onto another site along with
332
+ the rest of a template. It protects nothing: a hand-made client does not
333
+ read it. */
128
334
  const DOMAINS = read('domains').split(',').map((d) => d.trim()).filter(Boolean);
129
335
 
130
- /* Setup screen. It opens ONLY when asked for by an attribute: without it, a
131
- tag with no project does strictly nothing, like a directory copied there
132
- by mistake. That is the rule of silence, applied to setup. */
133
- const SETUP_REQUESTED = Object.prototype.hasOwnProperty.call(data, 'setup');
336
+ /* Setup screen. It opens ONLY when asked for: without it, a page with no
337
+ project does strictly nothing, like a directory copied there by mistake.
338
+ That is the rule of silence, applied to setup. */
339
+ const SETUP_REQUESTED = read('setup') === 'yes';
134
340
 
135
341
  /* Note-taking context, DECLARED by the host site, never guessed. A
136
342
  standalone tool cannot know how the site names its version; the site
137
- does. Without these attributes the fields stay empty: an invented version
138
- would send someone hunting for a defect in a build that never existed.
343
+ does. Without these the fields stay empty: an invented version would send
344
+ someone hunting for a defect in a build that never existed.
139
345
 
140
346
  The viewport size is read AT SEND TIME and not here: the person may have
141
347
  resized, or flipped their phone, between the page load and the remark.
@@ -754,6 +960,38 @@
754
960
  + 'from it -- so remove data-project, or correct whichever of the two '
755
961
  + 'is wrong.',
756
962
 
963
+ /* -- A configuration that cannot be used, wherever it was written --
964
+ The settings can also be declared in window.annotepageConfig, for the
965
+ pages where a tag cannot carry them -- concatenated scripts, a module,
966
+ an asset pipeline (00-preamble). These five say what is wrong with one,
967
+ and they never name a tag: whoever reads them may not have one. */
968
+ 'tag.title_config': 'This annotepage configuration cannot be used',
969
+ 'tag.two_sources':
970
+ 'This page declares annotepage twice -- on the tag and in '
971
+ + 'window.annotepageConfig -- and the two disagree about "{name}". '
972
+ + 'Nothing was sent and nothing was decrypted, and the tool does not '
973
+ + 'pick a winner: whichever it took, somebody would have configured '
974
+ + 'the tool and never known it was ignored. Correct one of the two, or '
975
+ + 'remove it.',
976
+ 'tag.config_no_server':
977
+ 'The annotepage configuration on this page (window.annotepageConfig) '
978
+ + 'names no server address, and there is no tag to deduce one from. '
979
+ + 'Nothing was sent: an address guessed wrong would send the remarks '
980
+ + 'nowhere at all. Add server: "https://.../api.php" to it.',
981
+ 'tag.config_setting':
982
+ 'The annotepage configuration on this page (window.annotepageConfig) '
983
+ + 'carries "{name}", which is not a setting of this tool. Nothing was '
984
+ + 'read from it -- a setting whose name is wrong is a setting nobody '
985
+ + 'set. The names are the ones written on the tag, without data-.',
986
+ 'tag.config_value':
987
+ 'The setting "{name}" of the annotepage configuration on this page '
988
+ + '(window.annotepageConfig) has to be written as text, between '
989
+ + 'quotes. Nothing was read from it.',
990
+ 'tag.config_shape':
991
+ 'window.annotepageConfig on this page is not an object. It is written '
992
+ + 'window.annotepageConfig = { server: "...", key: "..." }, before the '
993
+ + 'client is loaded. Nothing was read from it.',
994
+
757
995
  /* -- Setup --------------------------------------------------------- */
758
996
  'setup.title': 'Install annotepage on this site',
759
997
  'setup.generate': 'Generate a key and create the project',
@@ -766,6 +1004,8 @@
766
1004
  'setup.key': 'The project key -- keep it',
767
1005
  'setup.project': 'The project id -- public, it goes into the page',
768
1006
  'setup.tag': 'The tag to paste at the end of <body>, on the pages to annotate',
1007
+ 'setup.config': 'The configuration to declare before the client is loaded, '
1008
+ + 'on the pages to annotate',
769
1009
  'setup.server': 'To declare in the server configuration',
770
1010
  'setup.copy': 'Copy',
771
1011
  'setup.copied': 'Copied',
@@ -3787,6 +4027,29 @@
3787
4027
  return area;
3788
4028
  };
3789
4029
 
4030
+ /* THE SAME FACTS, IN THE SHAPE THE PAGE ALREADY USES. A copy configured by
4031
+ window.annotepageConfig (00-preamble) has no tag to copy: its address, its
4032
+ integrity and its crossorigin belong to whatever concatenated this file, and
4033
+ handing out a tag it did not ask for would tell the installer to undo the
4034
+ build they deliberately have. What is handed over is the object, which is
4035
+ the part they do own.
4036
+
4037
+ The key is NOT in it, exactly as it is not in the tag this screen hands out:
4038
+ the setup screen creates a confidential project, and the key goes into the
4039
+ block above, to be put away. */
4040
+ const configToPaste = (id) => {
4041
+ const lines = [];
4042
+ if (DECLARED_SERVER) lines.push(" server: '" + DECLARED_SERVER + "'");
4043
+ lines.push(" project: '" + id + "'");
4044
+ if (MODE === 'plain') lines.push(" mode: 'plain'");
4045
+ if (PATH_PREFIX) lines.push(" path: '" + PATH_PREFIX + "'");
4046
+ return '<script>\n'
4047
+ + ' window.annotepageConfig = {\n'
4048
+ + lines.join(',\n') + '\n'
4049
+ + ' };\n'
4050
+ + '</' + 'script>';
4051
+ };
4052
+
3790
4053
  /** The exact tag to paste, with the SRI digest ACTUALLY being served. */
3791
4054
  const tagToPaste = (id) => {
3792
4055
  let t = '<script src="' + script.src + '"';
@@ -3917,7 +4180,12 @@
3917
4180
 
3918
4181
  copyBlock(screen.body, T('setup.key'), fresh);
3919
4182
  copyBlock(screen.body, T('setup.project'), derived.id);
3920
- copyBlock(screen.body, T('setup.tag'), tagToPaste(derived.id));
4183
+ // Whichever way THIS copy was configured is the way the next
4184
+ // pages will be: handing out the other one would be handing out
4185
+ // an installation the reader has just been shown does not apply.
4186
+ copyBlock(screen.body,
4187
+ script ? T('setup.tag') : T('setup.config'),
4188
+ script ? tagToPaste(derived.id) : configToPaste(derived.id));
3921
4189
  copyBlock(screen.body, T('setup.server'), serverConfig(derived.id));
3922
4190
 
3923
4191
  /* Only on a local machine, and only here. Not a runtime badge: a
@@ -3955,10 +4223,15 @@
3955
4223
 
3956
4224
  There is no field to correct here, and that is the difference with the
3957
4225
  key screen: the mistake is in the page's source, not in this browser. So
3958
- the screen names what has to change in the tag, and stops. */
4226
+ the screen names what has to change, and stops.
4227
+
4228
+ THE TITLE IS A PARAMETER because the mistake is not always in a tag: a page
4229
+ can declare the same settings in window.annotepageConfig (00-preamble), and
4230
+ telling somebody their tag is unusable when they have none sends them
4231
+ looking for a tag to fix. */
3959
4232
 
3960
- const openTagScreen = (detail) => {
3961
- const screen = blockingScreen(T('tag.title'), false);
4233
+ const openTagScreen = (detail, title) => {
4234
+ const screen = blockingScreen(title || T('tag.title'), false);
3962
4235
  const block = create('div', 'ap-error');
3963
4236
  block.setAttribute('role', 'alert');
3964
4237
  block.appendChild(create('p', 'ap-error-detail', detail));
@@ -4121,7 +4394,12 @@
4121
4394
  */
4122
4395
  const handOverTo = (cdn, version, onFailure) => {
4123
4396
  const url = officialUrl(cdn, version);
4124
- if (!url || handingOver) return false;
4397
+ /* No tag, nothing to hand over: the replacement copy reads the data-
4398
+ attributes of this one, and a copy configured by window.annotepageConfig
4399
+ has none. The caller cannot get here -- cdnServing('') says no -- and it
4400
+ is written anyway, because what this function does when `script` is null
4401
+ is dereference it. */
4402
+ if (!url || !script || handingOver) return false;
4125
4403
  handingOver = true;
4126
4404
 
4127
4405
  // BEFORE the new copy builds anything: its element and its listeners go
@@ -4292,7 +4570,13 @@
4292
4570
  would add the dependency they deliberately removed. We say
4293
4571
  it in the panel and we load nothing. */
4294
4572
  const newer = first.ok ? announcedVersion(first.data) : null;
4295
- const cdn = newer ? cdnServing(script.src) : null;
4573
+ /* SCRIPT_SRC is empty when this copy was configured by the page
4574
+ rather than by a tag (00-preamble): there is then no address to
4575
+ recognise, cdnServing says no, and we fall to the branch below
4576
+ -- which is right. Whatever concatenated this file chose where
4577
+ it comes from, and replacing ourselves from a CDN would undo
4578
+ that choice behind their back. */
4579
+ const cdn = newer ? cdnServing(SCRIPT_SRC) : null;
4296
4580
  if (cdn && handOverTo(cdn, newer, () => { proceed(first); })) return null;
4297
4581
  if (newer) upgradeAvailable = newer;
4298
4582
 
@@ -4371,7 +4655,22 @@
4371
4655
  // startup like the name, not at every draw.
4372
4656
  side = readSide();
4373
4657
 
4374
- // Outside the project's scope: silence. So the tag can live in a
4658
+ /* THE CONFIGURATION ITSELF IS BROKEN, and that comes before everything
4659
+ else -- including the scope, which is one of the settings in dispute.
4660
+ 00-preamble adopted nothing, so there is no project, no key and no
4661
+ address to act on; what there is, is a page whose source says two
4662
+ things at once, or says one thing wrongly. It gets said out loud, on
4663
+ the page that carries it, for the same reason a tag with a malformed
4664
+ key does: somebody wrote that declaration on purpose, and a tool that
4665
+ quietly does not appear is the failure nobody finds. The console
4666
+ already has the same sentence in English (00-preamble). */
4667
+ if (CONFIG_FAILURE) {
4668
+ showScreen(() => openTagScreen(
4669
+ T(CONFIG_FAILURE.label, CONFIG_FAILURE.values), T('tag.title_config')));
4670
+ return;
4671
+ }
4672
+
4673
+ // Outside the project's scope: silence. So the declaration can live in a
4375
4674
  // template shared by the whole site.
4376
4675
  if (!inScope()) return;
4377
4676
 
package/labels/fr.js CHANGED
@@ -135,6 +135,12 @@
135
135
  "tag.title": "Cette balise annotepage est inutilisable telle quelle",
136
136
  "tag.key_shape": "L’attribut data-key de la balise de cette page n’est pas une clé : 43 caractères sont attendus, parmi A-Z a-z 0-9 - _, sans espace et sans tiret décoratif. Rien n’a été envoyé, rien n’a été déchiffré. La personne qui a installé l’outil doit recopier la clé, d’un seul bloc.",
137
137
  "tag.key_mismatch": "La balise de cette page porte une clé et un identifiant de projet qui ne vont pas ensemble : la clé ne dérive pas cet identifiant. Rien n’a été envoyé, rien n’a été déchiffré, et l’outil ne devine pas lequel des deux a raison. Une balise publique se suffit de la clé — l’identifiant en est dérivé — donc retirez data-project, ou corrigez celui des deux qui est faux.",
138
+ "tag.title_config": "Cette configuration annotepage est inutilisable telle quelle",
139
+ "tag.two_sources": "Cette page déclare annotepage deux fois — sur la balise et dans window.annotepageConfig — et les deux ne disent pas la même chose au sujet de « {name} ». Rien n’a été envoyé, rien n’a été déchiffré, et l’outil ne choisit pas un gagnant : quel qu’il soit, quelqu’un aurait configuré l’outil sans jamais savoir que sa déclaration était ignorée. Corrigez l’une des deux, ou retirez-la.",
140
+ "tag.config_no_server": "La configuration annotepage de cette page (window.annotepageConfig) ne nomme aucune adresse de serveur, et il n’y a pas de balise d’où la déduire. Rien n’a été envoyé : une adresse devinée de travers enverrait les remarques nulle part. Ajoutez-y server: \"https://.../api.php\".",
141
+ "tag.config_setting": "La configuration annotepage de cette page (window.annotepageConfig) porte « {name} », qui n’est pas un réglage de cet outil. Rien n’en a été lu — un réglage dont le nom est faux est un réglage que personne n’a réglé. Les noms sont ceux écrits sur la balise, sans data-.",
142
+ "tag.config_value": "Le réglage « {name} » de la configuration annotepage de cette page (window.annotepageConfig) doit être écrit en texte, entre guillemets. Rien n’en a été lu.",
143
+ "tag.config_shape": "window.annotepageConfig, sur cette page, n’est pas un objet. Il s’écrit window.annotepageConfig = { server: \"...\", key: \"...\" }, avant le chargement du client. Rien n’en a été lu.",
138
144
  "setup.title": "Installer annotepage sur ce site",
139
145
  "setup.generate": "Engendrer une clé et créer le projet",
140
146
  "setup.warning_title": "À lire avant de continuer",
@@ -142,6 +148,7 @@
142
148
  "setup.key": "La clé du projet — à conserver",
143
149
  "setup.project": "L’identifiant du projet — public, il va dans la page",
144
150
  "setup.tag": "La balise à coller en fin de <body>, sur les pages à annoter",
151
+ "setup.config": "La configuration à déclarer avant le chargement du client, sur les pages à annoter",
145
152
  "setup.server": "À déclarer dans la configuration du serveur",
146
153
  "setup.copy": "Copier",
147
154
  "setup.copied": "Copié",
package/labels/fr.json CHANGED
@@ -131,6 +131,12 @@
131
131
  "tag.title": "Cette balise annotepage est inutilisable telle quelle",
132
132
  "tag.key_shape": "L’attribut data-key de la balise de cette page n’est pas une clé : 43 caractères sont attendus, parmi A-Z a-z 0-9 - _, sans espace et sans tiret décoratif. Rien n’a été envoyé, rien n’a été déchiffré. La personne qui a installé l’outil doit recopier la clé, d’un seul bloc.",
133
133
  "tag.key_mismatch": "La balise de cette page porte une clé et un identifiant de projet qui ne vont pas ensemble : la clé ne dérive pas cet identifiant. Rien n’a été envoyé, rien n’a été déchiffré, et l’outil ne devine pas lequel des deux a raison. Une balise publique se suffit de la clé — l’identifiant en est dérivé — donc retirez data-project, ou corrigez celui des deux qui est faux.",
134
+ "tag.title_config": "Cette configuration annotepage est inutilisable telle quelle",
135
+ "tag.two_sources": "Cette page déclare annotepage deux fois — sur la balise et dans window.annotepageConfig — et les deux ne disent pas la même chose au sujet de « {name} ». Rien n’a été envoyé, rien n’a été déchiffré, et l’outil ne choisit pas un gagnant : quel qu’il soit, quelqu’un aurait configuré l’outil sans jamais savoir que sa déclaration était ignorée. Corrigez l’une des deux, ou retirez-la.",
136
+ "tag.config_no_server": "La configuration annotepage de cette page (window.annotepageConfig) ne nomme aucune adresse de serveur, et il n’y a pas de balise d’où la déduire. Rien n’a été envoyé : une adresse devinée de travers enverrait les remarques nulle part. Ajoutez-y server: \"https://.../api.php\".",
137
+ "tag.config_setting": "La configuration annotepage de cette page (window.annotepageConfig) porte « {name} », qui n’est pas un réglage de cet outil. Rien n’en a été lu — un réglage dont le nom est faux est un réglage que personne n’a réglé. Les noms sont ceux écrits sur la balise, sans data-.",
138
+ "tag.config_value": "Le réglage « {name} » de la configuration annotepage de cette page (window.annotepageConfig) doit être écrit en texte, entre guillemets. Rien n’en a été lu.",
139
+ "tag.config_shape": "window.annotepageConfig, sur cette page, n’est pas un objet. Il s’écrit window.annotepageConfig = { server: \"...\", key: \"...\" }, avant le chargement du client. Rien n’en a été lu.",
134
140
  "setup.title": "Installer annotepage sur ce site",
135
141
  "setup.generate": "Engendrer une clé et créer le projet",
136
142
  "setup.warning_title": "À lire avant de continuer",
@@ -138,6 +144,7 @@
138
144
  "setup.key": "La clé du projet — à conserver",
139
145
  "setup.project": "L’identifiant du projet — public, il va dans la page",
140
146
  "setup.tag": "La balise à coller en fin de <body>, sur les pages à annoter",
147
+ "setup.config": "La configuration à déclarer avant le chargement du client, sur les pages à annoter",
141
148
  "setup.server": "À déclarer dans la configuration du serveur",
142
149
  "setup.copy": "Copier",
143
150
  "setup.copied": "Copié",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "annotepage-client",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "description": "The annotepage annotation layer: click an element of a page, leave a remark on it, it is encrypted in the browser.",
5
5
  "license": "MIT",
6
6
  "repository": {