create-heresay 0.2.49 → 0.2.51
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/package.json +1 -1
- package/release/VERSION +1 -1
- package/release/functions/lib/core/version.js +1 -1
- package/release/public/dashboard.css +0 -3
- package/release/public/dashboard.js +74 -64
- package/release/public/demo.html +1 -1
- package/release/public/docs.html +22 -24
- package/release/public/guides/changes.json +98 -1
- package/release/public/guides/customize-apple.md +109 -86
- package/release/public/guides/customize-web.md +129 -93
- package/release/public/guides/index.json +3 -3
- package/release/public/guides/install-apple.md +39 -23
- package/release/public/guides/install-web.md +94 -41
- package/release/public/guides/releases.json +166 -0
- package/release/public/guides/start.md +29 -43
- package/release/public/guides/whats-new.md +71 -32
- package/release/public/llms.txt +1 -1
- package/release/public/sdk.js +820 -399
package/release/public/sdk.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* what each is for, is public/guides/customize-web.md.
|
|
8
8
|
*
|
|
9
9
|
* Who and what: data-version, data-user-id, data-user-label, data-user-email
|
|
10
|
-
* Button: data-position right (default) | left | top-right | top-left | center
|
|
10
|
+
* Button: data-position bottom-right (default) | bottom-left | top-right | top-left | bottom-center
|
|
11
|
+
* | left-tab | right-tab (a tab on the side edge) | none (no button; call Heresay.open())
|
|
12
|
+
* (older right, left, center still work)
|
|
11
13
|
* data-offset "20" or "x,y" in px from the edges
|
|
12
14
|
* data-button always (default) | none (open it from the app's own menu)
|
|
13
15
|
* | desktop (not on phones) | scroll (after the first scroll)
|
|
@@ -23,10 +25,14 @@
|
|
|
23
25
|
* data-font system (default) | inherit (the page's font)
|
|
24
26
|
* Words: data-lang the page's <html lang> (default) | auto (the browser) | en | fr | ta | hi
|
|
25
27
|
* data-placeholder, data-thanks, data-types ("broken,confusing,improvement,idea")
|
|
26
|
-
*
|
|
28
|
+
* Layout: data-layout composer (default: type pills and a text box) | steps (pick what it is,
|
|
29
|
+
* then say it) | bar (a compact floating composer beside the button)
|
|
30
|
+
* Panel: data-panel corner (default beside the floating button) | sheet | center | beside
|
|
31
|
+
* (beside: next to the app's own button; without it an app's own
|
|
32
|
+
* button opens a centred window, or a docked bar. bar ignores the rest)
|
|
27
33
|
* data-width regular (default) | narrow | wide
|
|
28
34
|
* data-backdrop dim (default) | clear | blur
|
|
29
|
-
* data-preferences show (default) | hide
|
|
35
|
+
* data-preferences show (default) | hide ("Your name and email" in Your reports)
|
|
30
36
|
* data-intro "auto": introduce the button a few seconds after the first load
|
|
31
37
|
* Trail: data-trail on (default) | off | the parts to keep, e.g. "pages errors requests"
|
|
32
38
|
* (pages, clicks, requests, errors). What happened in the app before
|
|
@@ -45,15 +51,17 @@
|
|
|
45
51
|
* Feedback.introduce({ title, body }) once per device: a bubble saying the button is there
|
|
46
52
|
* Feedback.nudge({ stuck }) the app saw trouble itself: offer to report it, as data-nudge does
|
|
47
53
|
* data-preview for the dashboard's designer: nothing is sent or stored
|
|
48
|
-
* Feedback.openPreferences()
|
|
54
|
+
* Feedback.openPreferences() opens Your reports with "Your name and email" expanded (if not signed in)
|
|
49
55
|
*
|
|
50
56
|
* Not configurable, on purpose: the Heresay mark on the button, the report types' names (they set
|
|
51
|
-
* the priority), the "Your reports"
|
|
57
|
+
* the priority), the "Your reports" view (reporters read why a report was declined), and the
|
|
52
58
|
* "Powered by Heresay" line, so people can tell the app uses an outside tool.
|
|
53
59
|
*
|
|
54
60
|
* No account, no cookies. The reporter is a random per-device id kept in localStorage, and
|
|
55
61
|
* that id is also what lets them see what happened to their own reports. Their preferences are
|
|
56
62
|
* kept on the device too, and sent with each report only if they filled them in.
|
|
63
|
+
* The panel is quiet: no tabs and no trail on show. The trail is collected for the team and the
|
|
64
|
+
* reporter is not asked about it; the developer controls it (data-trail, data-heresay-private).
|
|
57
65
|
*/
|
|
58
66
|
(function () {
|
|
59
67
|
'use strict';
|
|
@@ -84,162 +92,110 @@
|
|
|
84
92
|
en: {
|
|
85
93
|
report: 'Report', reportAria: 'Report a problem',
|
|
86
94
|
update: 'Report a problem. {n} of your reports have an update',
|
|
87
|
-
close: 'Close', dialog: 'Feedback',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
send: 'Send', sending: 'Sending…',
|
|
91
|
-
|
|
92
|
-
attachedPrefs: 'This page, the app version, device details and your preferences are attached.',
|
|
93
|
-
attached: 'This page, the app version and device details are attached.',
|
|
95
|
+
close: 'Close', dialog: 'Feedback', back: 'Back to Report',
|
|
96
|
+
mine: 'Your reports', mineAria: 'Your reports, {n} with an update', kindAria: 'What kind of report is this?', reportLabel: 'Your report',
|
|
97
|
+
phNone: 'What’s on your mind?',
|
|
98
|
+
send: 'Send', sending: 'Sending…', cantSend: 'Could not send. Try again.',
|
|
99
|
+
sentMsg: 'Sent. You’ll see the reply under Your reports.', done: 'Done',
|
|
94
100
|
types: {
|
|
95
|
-
broken: ['Broken', '
|
|
96
|
-
confusing: ['Confusing', '
|
|
97
|
-
improvement: ['Could be better', '
|
|
98
|
-
idea: ['Idea', '
|
|
101
|
+
broken: ['Broken', 'What went wrong?'],
|
|
102
|
+
confusing: ['Confusing', 'What were you trying to do?'],
|
|
103
|
+
improvement: ['Could be better', 'What would make it better?'],
|
|
104
|
+
idea: ['Idea', 'What would you like?'],
|
|
99
105
|
},
|
|
100
106
|
status: { open: 'Waiting for the developer', accepted: 'Accepted, being worked on', fixed: 'Fixed', declined: 'Declined', withdrawn: 'You took this back' },
|
|
101
107
|
takeBack: 'Take back', takeBackAsk: 'Take this back? It isn’t deleted: the team sees you withdrew it.', takeBackWhy: 'Why? (optional)', takeBackYes: 'Take it back', keep: 'Keep it', yourWhy: 'Your reason: ',
|
|
102
|
-
|
|
103
|
-
emailHint: 'Only if you are happy for the team to reply to you.',
|
|
104
|
-
setup: 'About your setup', setupHint: 'Sent with every report, so you only say it once.',
|
|
105
|
-
setupPh: 'For example: I use a screen reader, or I am usually on slow Wi-Fi.',
|
|
108
|
+
fresh: 'New update', nameEmail: 'Your name and email', nameOpt: 'Name (optional)', emailOpt: 'Email (optional)',
|
|
106
109
|
signedAs: 'Signed in as {who}', yourAccount: 'your account',
|
|
107
|
-
seesReply: '{email}. The team sees this with each report and can reply.',
|
|
108
|
-
sees: 'The team sees this with each report.',
|
|
109
110
|
badEmail: 'That email does not look right.', saved: 'Saved on this device.',
|
|
110
|
-
clear: 'Clear all', save: 'Save',
|
|
111
|
-
kept: 'Kept in this browser and sent only with reports you choose to send.',
|
|
112
111
|
none: 'Nothing sent from this device yet.', why: 'Why: ',
|
|
113
|
-
introAria: 'About the Report button', introTitle: '
|
|
114
|
-
|
|
115
|
-
got: 'Got it', tryIt: 'Try it',
|
|
116
|
-
attachTrail: 'Attach what happened',
|
|
117
|
-
trailHint: 'Recent pages, clicks and errors in this app. Never what you typed.',
|
|
118
|
-
seeTrail: 'See it', alsoSent: 'Also sent: ',
|
|
119
|
-
trail: { page: ['page', 'pages'], click: ['click', 'clicks'], request: ['failed request', 'failed requests'], error: ['error', 'errors'], warn: ['warning', 'warnings'], state: ['device event', 'device events'] },
|
|
112
|
+
introAria: 'About the Report button', introTitle: 'Spotted something off?', introBody: 'Tell the team here.',
|
|
113
|
+
got: 'Got it',
|
|
120
114
|
nudgeStuckTitle: 'Stuck on something?', nudgeStuckBody: 'If something here isn’t clear, tell the team. A real person reads it.', nudgeAria: 'Offer to report a problem', nudgeTitle: 'Something not working?', nudgeBody: 'Tell the team what happened. A real person reads it.', nudgeYes: 'Tell the team', nudgeNo: 'Not now',
|
|
121
115
|
fixedIn: 'Fixed in version {v}.', updateTo: 'Update to {v} to get it.',
|
|
122
116
|
sentTo: 'Sent to this app’s team', powered: 'Powered by Heresay',
|
|
117
|
+
whatsGoing: 'What’s going on?', typeChip: 'Type', tellTeam: 'Tell the team…', sentBar: 'Sent. Replies show under Your reports.', backType: 'Back to choose a type',
|
|
123
118
|
},
|
|
124
119
|
fr: {
|
|
125
120
|
report: 'Signaler', reportAria: 'Signaler un problème',
|
|
126
121
|
update: 'Signaler un problème. {n} de vos signalements ont du nouveau',
|
|
127
|
-
close: 'Fermer', dialog: 'Signalement',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
send: 'Envoyer', sending: 'Envoi…',
|
|
131
|
-
|
|
132
|
-
attachedPrefs: 'Cette page, la version de l’app, les détails de l’appareil et vos préférences sont joints.',
|
|
133
|
-
attached: 'Cette page, la version de l’app et les détails de l’appareil sont joints.',
|
|
122
|
+
close: 'Fermer', dialog: 'Signalement', back: 'Retour à Signaler',
|
|
123
|
+
mine: 'Vos signalements', mineAria: 'Vos signalements, {n} avec du nouveau', kindAria: 'De quel type de signalement s’agit-il ?', reportLabel: 'Votre signalement',
|
|
124
|
+
phNone: 'Qu’avez-vous en tête ?',
|
|
125
|
+
send: 'Envoyer', sending: 'Envoi…', cantSend: 'Envoi impossible. Réessayez.',
|
|
126
|
+
sentMsg: 'Envoyé. Vous verrez la réponse dans Vos signalements.', done: 'Terminé',
|
|
134
127
|
types: {
|
|
135
|
-
broken: ['Cassé', '
|
|
136
|
-
confusing: ['Déroutant', '
|
|
137
|
-
improvement: ['
|
|
138
|
-
idea: ['Idée', '
|
|
128
|
+
broken: ['Cassé', 'Que s’est-il passé ?'],
|
|
129
|
+
confusing: ['Déroutant', 'Que cherchiez-vous à faire ?'],
|
|
130
|
+
improvement: ['À améliorer', 'Qu’est-ce qui serait mieux ?'],
|
|
131
|
+
idea: ['Idée', 'Que souhaiteriez-vous ?'],
|
|
139
132
|
},
|
|
140
133
|
status: { open: 'En attente de l’équipe', accepted: 'Accepté, en cours', fixed: 'Corrigé', declined: 'Refusé', withdrawn: 'Vous l’avez retiré' },
|
|
141
134
|
takeBack: 'Retirer', takeBackAsk: 'Retirer ce signalement ? Il n’est pas supprimé : l’équipe voit que vous l’avez retiré.', takeBackWhy: 'Pourquoi ? (facultatif)', takeBackYes: 'Le retirer', keep: 'Le garder', yourWhy: 'Votre raison : ',
|
|
142
|
-
|
|
143
|
-
emailHint: 'Seulement si vous acceptez que l’équipe vous réponde.',
|
|
144
|
-
setup: 'Votre configuration', setupHint: 'Envoyé avec chaque signalement, pour ne le dire qu’une fois.',
|
|
145
|
-
setupPh: 'Par exemple : j’utilise un lecteur d’écran, ou mon Wi-Fi est souvent lent.',
|
|
135
|
+
fresh: 'Nouveauté', nameEmail: 'Votre nom et e-mail', nameOpt: 'Nom (facultatif)', emailOpt: 'E-mail (facultatif)',
|
|
146
136
|
signedAs: 'Connecté en tant que {who}', yourAccount: 'votre compte',
|
|
147
|
-
seesReply: '{email}. L’équipe le voit avec chaque signalement et peut vous répondre.',
|
|
148
|
-
sees: 'L’équipe le voit avec chaque signalement.',
|
|
149
137
|
badEmail: 'Cette adresse e-mail ne semble pas correcte.', saved: 'Enregistré sur cet appareil.',
|
|
150
|
-
clear: 'Tout effacer', save: 'Enregistrer',
|
|
151
|
-
kept: 'Conservé dans ce navigateur, et envoyé seulement avec les signalements que vous envoyez.',
|
|
152
138
|
none: 'Aucun signalement envoyé depuis cet appareil.', why: 'Pourquoi : ',
|
|
153
|
-
introAria: 'À propos du bouton Signaler', introTitle: '
|
|
154
|
-
|
|
155
|
-
got: 'Compris', tryIt: 'Essayer',
|
|
156
|
-
attachTrail: 'Joindre ce qui s’est passé',
|
|
157
|
-
trailHint: 'Pages, clics et erreurs récents dans cette app. Jamais ce que vous avez saisi.',
|
|
158
|
-
seeTrail: 'Voir', alsoSent: 'Aussi envoyé : ',
|
|
159
|
-
trail: { page: ['page', 'pages'], click: ['clic', 'clics'], request: ['requête échouée', 'requêtes échouées'], error: ['erreur', 'erreurs'], warn: ['avertissement', 'avertissements'], state: ['événement de l’appareil', 'événements de l’appareil'] },
|
|
139
|
+
introAria: 'À propos du bouton Signaler', introTitle: 'Vous avez repéré un souci ?', introBody: 'Dites-le à l’équipe ici.',
|
|
140
|
+
got: 'Compris',
|
|
160
141
|
nudgeStuckTitle: 'Bloqué quelque part ?', nudgeStuckBody: 'Si quelque chose n’est pas clair ici, dites-le à l’équipe. Une vraie personne le lit.', nudgeAria: 'Proposition de signaler un problème', nudgeTitle: 'Quelque chose ne marche pas ?', nudgeBody: 'Dites à l’équipe ce qui s’est passé. Une vraie personne le lit.', nudgeYes: 'Signaler', nudgeNo: 'Pas maintenant',
|
|
161
142
|
fixedIn: 'Corrigé dans la version {v}.', updateTo: 'Passez à la {v} pour en profiter.',
|
|
162
143
|
sentTo: 'Envoyé à l’équipe de cette app', powered: 'Propulsé par Heresay',
|
|
144
|
+
whatsGoing: 'Que se passe-t-il ?', typeChip: 'Type', tellTeam: 'Dites-le à l’équipe…', sentBar: 'Envoyé. Les réponses s’affichent dans Vos signalements.', backType: 'Retour au choix du type',
|
|
163
145
|
},
|
|
164
146
|
ta: {
|
|
165
147
|
report: 'தெரிவி', reportAria: 'சிக்கலைத் தெரிவிக்கவும்',
|
|
166
148
|
update: 'சிக்கலைத் தெரிவிக்கவும். உங்கள் {n} புகார்களில் புதிய தகவல் உள்ளது',
|
|
167
|
-
close: 'மூடு', dialog: 'கருத்து',
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
send: 'அனுப்பு', sending: 'அனுப்புகிறது…',
|
|
171
|
-
|
|
172
|
-
attachedPrefs: 'இந்தப் பக்கம், ஆப் பதிப்பு, சாதன விவரங்கள் மற்றும் உங்கள் விருப்பங்கள் இணைக்கப்படும்.',
|
|
173
|
-
attached: 'இந்தப் பக்கம், ஆப் பதிப்பு மற்றும் சாதன விவரங்கள் இணைக்கப்படும்.',
|
|
149
|
+
close: 'மூடு', dialog: 'கருத்து', back: 'தெரிவி பக்கத்துக்குத் திரும்பு',
|
|
150
|
+
mine: 'உங்கள் புகார்கள்', mineAria: 'உங்கள் புகார்கள், {n} இல் புதிய தகவல் உள்ளது', kindAria: 'இது எந்த வகைப் புகார்?', reportLabel: 'உங்கள் புகார்',
|
|
151
|
+
phNone: 'உங்கள் மனதில் என்ன இருக்கிறது?',
|
|
152
|
+
send: 'அனுப்பு', sending: 'அனுப்புகிறது…', cantSend: 'அனுப்ப முடியவில்லை. மீண்டும் முயலவும்.',
|
|
153
|
+
sentMsg: 'அனுப்பப்பட்டது. பதிலை “உங்கள் புகார்கள்” பகுதியில் பார்க்கலாம்.', done: 'முடிந்தது',
|
|
174
154
|
types: {
|
|
175
|
-
broken: ['
|
|
176
|
-
confusing: ['
|
|
177
|
-
improvement: ['
|
|
178
|
-
idea: ['யோசனை', '
|
|
155
|
+
broken: ['பழுது', 'என்ன தவறு நடந்தது?'],
|
|
156
|
+
confusing: ['குழப்பம்', 'என்ன செய்ய முயன்றீர்கள்?'],
|
|
157
|
+
improvement: ['மேம்படுத்த', 'எப்படி மேம்படுத்தலாம்?'],
|
|
158
|
+
idea: ['யோசனை', 'உங்களுக்கு என்ன வேண்டும்?'],
|
|
179
159
|
},
|
|
180
160
|
status: { open: 'டெவலப்பருக்காகக் காத்திருக்கிறது', accepted: 'ஏற்கப்பட்டது, வேலை நடக்கிறது', fixed: 'சரிசெய்யப்பட்டது', declined: 'நிராகரிக்கப்பட்டது', withdrawn: 'நீங்கள் திரும்பப் பெற்றீர்கள்' },
|
|
181
161
|
takeBack: 'திரும்பப் பெறு', takeBackAsk: 'இதைத் திரும்பப் பெறவா? இது நீக்கப்படாது: நீங்கள் திரும்பப் பெற்றதைக் குழு பார்க்கும்.', takeBackWhy: 'ஏன்? (விருப்பத்தேர்வு)', takeBackYes: 'திரும்பப் பெறு', keep: 'வைத்திரு', yourWhy: 'உங்கள் காரணம்: ',
|
|
182
|
-
|
|
183
|
-
emailHint: 'குழு உங்களுக்குப் பதில் அனுப்பலாம் என்றால் மட்டும்.',
|
|
184
|
-
setup: 'உங்கள் அமைப்பு பற்றி', setupHint: 'ஒவ்வொரு புகாருடனும் அனுப்பப்படும், எனவே ஒருமுறை சொன்னால் போதும்.',
|
|
185
|
-
setupPh: 'உதாரணமாக: நான் ஸ்கிரீன் ரீடர் பயன்படுத்துகிறேன், அல்லது என் Wi-Fi பெரும்பாலும் மெதுவாக இருக்கும்.',
|
|
162
|
+
fresh: 'புதிய தகவல்', nameEmail: 'உங்கள் பெயர் மற்றும் மின்னஞ்சல்', nameOpt: 'பெயர் (விருப்பத்தேர்வு)', emailOpt: 'மின்னஞ்சல் (விருப்பத்தேர்வு)',
|
|
186
163
|
signedAs: '{who} ஆக உள்நுழைந்துள்ளீர்கள்', yourAccount: 'உங்கள் கணக்கு',
|
|
187
|
-
seesReply: '{email}. ஒவ்வொரு புகாருடனும் குழு இதைப் பார்க்கும், பதிலும் அனுப்பலாம்.',
|
|
188
|
-
sees: 'ஒவ்வொரு புகாருடனும் குழு இதைப் பார்க்கும்.',
|
|
189
164
|
badEmail: 'இந்த மின்னஞ்சல் சரியாகத் தெரியவில்லை.', saved: 'இந்தச் சாதனத்தில் சேமிக்கப்பட்டது.',
|
|
190
|
-
clear: 'அனைத்தையும் அழி', save: 'சேமி',
|
|
191
|
-
kept: 'இந்த உலாவியில் வைக்கப்படும்; நீங்கள் அனுப்பும் புகார்களுடன் மட்டுமே அனுப்பப்படும்.',
|
|
192
165
|
none: 'இந்தச் சாதனத்திலிருந்து இன்னும் எதுவும் அனுப்பப்படவில்லை.', why: 'காரணம்: ',
|
|
193
|
-
introAria: 'தெரிவி பொத்தான் பற்றி', introTitle: '
|
|
194
|
-
|
|
195
|
-
got: 'சரி', tryIt: 'முயன்று பாருங்கள்',
|
|
196
|
-
attachTrail: 'என்ன நடந்தது என்பதையும் இணை',
|
|
197
|
-
trailHint: 'இந்த ஆப்பில் சமீபத்திய பக்கங்கள், கிளிக்குகள், பிழைகள். நீங்கள் தட்டச்சு செய்தது ஒருபோதும் இல்லை.',
|
|
198
|
-
seeTrail: 'பார்', alsoSent: 'இவையும் அனுப்பப்படும்: ',
|
|
199
|
-
trail: { page: ['பக்கம்', 'பக்கங்கள்'], click: ['கிளிக்', 'கிளிக்குகள்'], request: ['தோல்வியடைந்த கோரிக்கை', 'தோல்வியடைந்த கோரிக்கைகள்'], error: ['பிழை', 'பிழைகள்'], warn: ['எச்சரிக்கை', 'எச்சரிக்கைகள்'], state: ['சாதன நிகழ்வு', 'சாதன நிகழ்வுகள்'] },
|
|
166
|
+
introAria: 'தெரிவி பொத்தான் பற்றி', introTitle: 'ஏதாவது சரியில்லையா?', introBody: 'குழுவிடம் இங்கேயே சொல்லுங்கள்.',
|
|
167
|
+
got: 'சரி',
|
|
200
168
|
nudgeStuckTitle: 'எங்காவது சிக்கிக்கொண்டீர்களா?', nudgeStuckBody: 'இங்கே ஏதாவது புரியவில்லை என்றால், குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeAria: 'சிக்கலைத் தெரிவிக்க ஒரு அழைப்பு', nudgeTitle: 'ஏதாவது வேலை செய்யவில்லையா?', nudgeBody: 'என்ன நடந்தது என்று குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeYes: 'குழுவிடம் சொல்', nudgeNo: 'இப்போது வேண்டாம்',
|
|
201
169
|
fixedIn: 'பதிப்பு {v} இல் சரிசெய்யப்பட்டது.', updateTo: 'இதைப் பெற {v} க்குப் புதுப்பிக்கவும்.',
|
|
202
170
|
sentTo: 'இந்த ஆப்பின் குழுவுக்கு அனுப்பப்படும்', powered: 'Heresay மூலம் இயங்குகிறது',
|
|
171
|
+
whatsGoing: 'என்ன நடக்கிறது?', typeChip: 'வகை', tellTeam: 'குழுவிடம் சொல்லுங்கள்…', sentBar: 'அனுப்பப்பட்டது. பதில்கள் “உங்கள் புகார்கள்” பகுதியில் தெரியும்.', backType: 'வகையைத் தேர்வுசெய்ய திரும்பு',
|
|
203
172
|
},
|
|
204
173
|
hi: {
|
|
205
174
|
report: 'रिपोर्ट करें', reportAria: 'समस्या की रिपोर्ट करें',
|
|
206
175
|
update: 'समस्या की रिपोर्ट करें। आपकी {n} रिपोर्ट में नई जानकारी है',
|
|
207
|
-
close: 'बंद करें', dialog: 'फ़ीडबैक',
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
send: 'भेजें', sending: 'भेजा जा रहा है…',
|
|
211
|
-
|
|
212
|
-
attachedPrefs: 'यह पेज, ऐप का वर्शन, डिवाइस की जानकारी और आपकी प्राथमिकताएँ साथ भेजी जाती हैं।',
|
|
213
|
-
attached: 'यह पेज, ऐप का वर्शन और डिवाइस की जानकारी साथ भेजी जाती है।',
|
|
176
|
+
close: 'बंद करें', dialog: 'फ़ीडबैक', back: 'रिपोर्ट पर वापस जाएँ',
|
|
177
|
+
mine: 'आपकी रिपोर्ट', mineAria: 'आपकी रिपोर्ट, {n} में नई जानकारी है', kindAria: 'यह किस तरह की रिपोर्ट है?', reportLabel: 'आपकी रिपोर्ट',
|
|
178
|
+
phNone: 'आपके मन में क्या है?',
|
|
179
|
+
send: 'भेजें', sending: 'भेजा जा रहा है…', cantSend: 'भेजा नहीं जा सका। फिर से कोशिश करें।',
|
|
180
|
+
sentMsg: 'भेज दिया गया। जवाब आपको “आपकी रिपोर्ट” में दिखेगा।', done: 'हो गया',
|
|
214
181
|
types: {
|
|
215
|
-
broken: ['टूटा हुआ', '
|
|
216
|
-
confusing: ['उलझन
|
|
217
|
-
improvement: ['बेहतर हो
|
|
218
|
-
idea: ['सुझाव', '
|
|
182
|
+
broken: ['टूटा हुआ', 'क्या गड़बड़ हुई?'],
|
|
183
|
+
confusing: ['उलझन', 'आप क्या करने की कोशिश कर रहे थे?'],
|
|
184
|
+
improvement: ['बेहतर हो', 'क्या बेहतर हो सकता है?'],
|
|
185
|
+
idea: ['सुझाव', 'आप क्या चाहेंगे?'],
|
|
219
186
|
},
|
|
220
187
|
status: { open: 'डेवलपर का इंतज़ार', accepted: 'स्वीकार, इस पर काम चल रहा है', fixed: 'ठीक हो गया', declined: 'अस्वीकार', withdrawn: 'आपने इसे वापस ले लिया' },
|
|
221
188
|
takeBack: 'वापस लें', takeBackAsk: 'इसे वापस लें? यह हटाया नहीं जाएगा: टीम देखेगी कि आपने इसे वापस लिया।', takeBackWhy: 'क्यों? (वैकल्पिक)', takeBackYes: 'वापस लें', keep: 'रहने दें', yourWhy: 'आपकी वजह: ',
|
|
222
|
-
|
|
223
|
-
emailHint: 'सिर्फ़ तब, जब आप चाहते हैं कि टीम आपको जवाब दे।',
|
|
224
|
-
setup: 'आपके सेटअप के बारे में', setupHint: 'हर रिपोर्ट के साथ भेजा जाता है, ताकि आपको एक ही बार बताना पड़े।',
|
|
225
|
-
setupPh: 'जैसे: स्क्रीन रीडर के साथ इस्तेमाल, या अक्सर धीमा Wi-Fi।',
|
|
189
|
+
fresh: 'नई जानकारी', nameEmail: 'आपका नाम और ईमेल', nameOpt: 'नाम (वैकल्पिक)', emailOpt: 'ईमेल (वैकल्पिक)',
|
|
226
190
|
signedAs: '{who} के रूप में साइन इन', yourAccount: 'आपका खाता',
|
|
227
|
-
seesReply: '{email}. टीम हर रिपोर्ट के साथ इसे देखती है और जवाब दे सकती है।',
|
|
228
|
-
sees: 'टीम हर रिपोर्ट के साथ इसे देखती है।',
|
|
229
191
|
badEmail: 'यह ईमेल सही नहीं लग रहा।', saved: 'इस डिवाइस पर सेव हो गया।',
|
|
230
|
-
clear: 'सब हटाएँ', save: 'सेव करें',
|
|
231
|
-
kept: 'इसी ब्राउज़र में रखा जाता है, और सिर्फ़ आपकी भेजी रिपोर्ट के साथ जाता है।',
|
|
232
192
|
none: 'इस डिवाइस से अभी तक कुछ नहीं भेजा गया।', why: 'वजह: ',
|
|
233
|
-
introAria: 'रिपोर्ट बटन के बारे में', introTitle: '
|
|
234
|
-
|
|
235
|
-
got: 'ठीक है', tryIt: 'आज़माएँ',
|
|
236
|
-
attachTrail: 'क्या हुआ, वह भी भेजें',
|
|
237
|
-
trailHint: 'इस ऐप में हाल के पेज, क्लिक और त्रुटियाँ। आपने जो टाइप किया, वह कभी नहीं।',
|
|
238
|
-
seeTrail: 'देखें', alsoSent: 'यह भी भेजा जाता है: ',
|
|
239
|
-
trail: { page: ['पेज', 'पेज'], click: ['क्लिक', 'क्लिक'], request: ['विफल अनुरोध', 'विफल अनुरोध'], error: ['त्रुटि', 'त्रुटियाँ'], warn: ['चेतावनी', 'चेतावनियाँ'], state: ['डिवाइस घटना', 'डिवाइस घटनाएँ'] },
|
|
193
|
+
introAria: 'रिपोर्ट बटन के बारे में', introTitle: 'कुछ गड़बड़ दिखी?', introBody: 'टीम को यहीं बताइए।',
|
|
194
|
+
got: 'ठीक है',
|
|
240
195
|
nudgeStuckTitle: 'कहीं अटक गए?', nudgeStuckBody: 'अगर यहाँ कुछ साफ़ नहीं है, तो टीम को बताइए। इसे कोई इंसान पढ़ता है।', nudgeAria: 'समस्या बताने का सुझाव', nudgeTitle: 'कुछ काम नहीं कर रहा?', nudgeBody: 'टीम को बताइए क्या हुआ। इसे कोई इंसान पढ़ता है।', nudgeYes: 'टीम को बताएँ', nudgeNo: 'अभी नहीं',
|
|
241
196
|
fixedIn: 'वर्शन {v} में ठीक किया गया।', updateTo: 'इसे पाने के लिए {v} पर अपडेट करें।',
|
|
242
197
|
sentTo: 'इस ऐप की टीम को भेजा जाता है', powered: 'Heresay द्वारा संचालित',
|
|
198
|
+
whatsGoing: 'क्या हो रहा है?', typeChip: 'प्रकार', tellTeam: 'टीम को बताइए…', sentBar: 'भेज दिया गया। जवाब “आपकी रिपोर्ट” में दिखेंगे।', backType: 'प्रकार चुनने पर वापस जाएँ',
|
|
243
199
|
},
|
|
244
200
|
};
|
|
245
201
|
/** The page's own language by default, so the widget speaks like the app around it. */
|
|
@@ -259,12 +215,18 @@
|
|
|
259
215
|
|
|
260
216
|
// ---- the developer's choices -----------------------------------------------------------
|
|
261
217
|
|
|
262
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Where the button sits is the developer's choice (data-position), not the reporter's:
|
|
220
|
+
* bottom-right (default) | bottom-left | top-right | top-left | bottom-center
|
|
221
|
+
* | left-tab | right-tab (a tab on the side edge) | none (no button; call Heresay.open()).
|
|
222
|
+
* The older right, left and center still work. An explicit data-style or data-button wins.
|
|
223
|
+
*/
|
|
224
|
+
var POSITION = attr('position').toLowerCase().trim();
|
|
263
225
|
var POS = ({
|
|
264
226
|
left: ['l', 'b'], 'bottom-left': ['l', 'b'], 'top-right': ['r', 't'], 'top-left': ['l', 't'],
|
|
265
|
-
center: ['c', 'b'], 'bottom-center': ['c', 'b'],
|
|
266
|
-
})[
|
|
267
|
-
var STYLE = pick('style', ['pill', 'icon', 'tab'], 'pill');
|
|
227
|
+
center: ['c', 'b'], 'bottom-center': ['c', 'b'], 'left-tab': ['l', 'b'], 'right-tab': ['r', 'b'],
|
|
228
|
+
})[POSITION] || ['r', 'b'];
|
|
229
|
+
var STYLE = pick('style', ['pill', 'icon', 'tab'], POSITION === 'left-tab' || POSITION === 'right-tab' ? 'tab' : 'pill');
|
|
268
230
|
if (STYLE === 'tab' && POS[0] === 'c') POS = ['r', 'b'];
|
|
269
231
|
var LEFT = POS[0] === 'l';
|
|
270
232
|
var OFFSET = (function () {
|
|
@@ -272,20 +234,22 @@
|
|
|
272
234
|
var clamp = function (n) { return Math.min(400, +n); };
|
|
273
235
|
return m ? [clamp(m[1]), clamp(m[2] != null ? m[2] : m[1])] : [20, 20];
|
|
274
236
|
})();
|
|
275
|
-
var BUTTON = pick('button', ['always', 'none', 'desktop', 'scroll'], 'always');
|
|
237
|
+
var BUTTON = pick('button', ['always', 'none', 'desktop', 'scroll'], POSITION === 'none' ? 'none' : 'always');
|
|
276
238
|
var SIZE = pick('size', ['regular', 'small', 'large'], 'regular');
|
|
277
239
|
var LABEL = words(attr('label'), 40) || S.report;
|
|
278
240
|
var HIDE_ON = attr('hide-on').split(',').map(function (p) { return p.trim().replace(/\/+$/, ''); })
|
|
279
241
|
.filter(function (p) { return p.charAt(0) === '/'; });
|
|
280
|
-
var
|
|
281
|
-
var
|
|
242
|
+
var LAYOUT = pick('layout', ['composer', 'steps', 'bar'], 'composer');
|
|
243
|
+
var PANEL = pick('panel', ['corner', 'sheet', 'center', 'beside'], '');
|
|
244
|
+
var WIDTH = ({ narrow: 320, wide: 460 })[attr('width').toLowerCase()] || 360;
|
|
282
245
|
var BACKDROP = pick('backdrop', ['dim', 'clear', 'blur'], 'dim');
|
|
283
|
-
var
|
|
284
|
-
|
|
246
|
+
var PREFS_ROW = pick('preferences', ['show', 'hide'], 'show') === 'show';
|
|
247
|
+
// data-placeholder, if set, replaces the line that follows the type.
|
|
248
|
+
var PLACEHOLDER = words(attr('placeholder'), 120);
|
|
285
249
|
var THANKS = words(attr('thanks'), 160);
|
|
286
250
|
|
|
287
251
|
var TYPES = ['broken', 'confusing', 'improvement', 'idea'].map(function (id) {
|
|
288
|
-
return { id: id, label: S.types[id][0],
|
|
252
|
+
return { id: id, label: S.types[id][0], ph: S.types[id][1] };
|
|
289
253
|
});
|
|
290
254
|
/** The types the reporter can pick. Names and priorities never change; a developer can only leave some out. */
|
|
291
255
|
var OFFERED = (function () {
|
|
@@ -304,9 +268,6 @@
|
|
|
304
268
|
draft: '',
|
|
305
269
|
justSent: false,
|
|
306
270
|
reports: [],
|
|
307
|
-
// The reporter's say over the trail: all of it off, or some kinds left out.
|
|
308
|
-
trailOff: false,
|
|
309
|
-
trailSkip: {},
|
|
310
271
|
};
|
|
311
272
|
var listeners = [];
|
|
312
273
|
|
|
@@ -368,8 +329,8 @@
|
|
|
368
329
|
function reporter() {
|
|
369
330
|
var p = prefs();
|
|
370
331
|
var mine = !identified();
|
|
371
|
-
var r = { name: mine && p.name || null, email: mine && p.email || null
|
|
372
|
-
return r.name || r.email
|
|
332
|
+
var r = { name: mine && p.name || null, email: mine && p.email || null };
|
|
333
|
+
return r.name || r.email ? r : null;
|
|
373
334
|
}
|
|
374
335
|
|
|
375
336
|
// ---- context ---------------------------------------------------------------------------
|
|
@@ -471,7 +432,8 @@
|
|
|
471
432
|
/**
|
|
472
433
|
* What happened in the app before a report: pages, clicks, requests that failed, errors. Kept
|
|
473
434
|
* on this device only, in memory and this tab's sessionStorage (the newest 50, for 5 minutes),
|
|
474
|
-
* and sent
|
|
435
|
+
* and sent with every report; the reporter is not shown it, and the developer controls it (data-trail,
|
|
436
|
+
* data-heresay-private). Never what anyone typed, never request
|
|
475
437
|
* or response bodies or headers, never query strings. Nothing is recorded inside the widget.
|
|
476
438
|
*/
|
|
477
439
|
var TRAIL_PARTS = { pages: 'page', clicks: 'click', requests: 'request', errors: 'error' };
|
|
@@ -570,11 +532,10 @@
|
|
|
570
532
|
var cut = Date.now() - TRAIL_AGE;
|
|
571
533
|
return trail.filter(function (e) { return e.at >= cut; });
|
|
572
534
|
}
|
|
573
|
-
/** What goes with the report:
|
|
535
|
+
/** What goes with the report: ages in seconds before now. */
|
|
574
536
|
function trailToSend() {
|
|
575
|
-
if (state.trailOff) return null;
|
|
576
537
|
var now = Date.now();
|
|
577
|
-
var t = recentTrail().
|
|
538
|
+
var t = recentTrail().map(function (e) {
|
|
578
539
|
return { kind: e.kind, ago: Math.round((now - e.at) / 1000), text: e.text, detail: e.detail, n: e.n };
|
|
579
540
|
});
|
|
580
541
|
return t.length ? t : null;
|
|
@@ -1077,12 +1038,12 @@
|
|
|
1077
1038
|
|
|
1078
1039
|
// ---- ui --------------------------------------------------------------------------------
|
|
1079
1040
|
|
|
1080
|
-
var DARK = '--fb-bg:#16181d;--fb-fg:#eceef1;--fb-mute:#9aa1ad;--fb-line:#2c313a;--fb-acc:#2dd4bf;--fb-acc-fg:#0b1f1d;--fb-bad:#f2b8b5;--fb-mark:#2dd4bf';
|
|
1041
|
+
var DARK = '--fb-bg:#16181d;--fb-fg:#eceef1;--fb-mute:#9aa1ad;--fb-line:#2c313a;--fb-acc:#2dd4bf;--fb-acc-fg:#0b1f1d;--fb-bad:#f2b8b5;--fb-mark:#2dd4bf;--fb-soft:#22262d;--fb-on:#343a45;--fb-ph:#7d8591;--fb-ring:rgba(255,255,255,.1)';
|
|
1081
1042
|
var THEME = pick('theme', ['auto', 'light', 'dark'], 'auto');
|
|
1082
1043
|
var FAB_H = { small: 40, regular: 48, large: 58 }[SIZE];
|
|
1083
1044
|
|
|
1084
1045
|
var CSS = [
|
|
1085
|
-
':host{all:initial;--fb-bg:#fff;--fb-fg:#15171c;--fb-mute:#5b6472;--fb-line:#e3e6ea;--fb-acc:#0f766e;--fb-acc-fg:#fff;--fb-bad:#b42318;--fb-mark:#0b5e57;--fb-eye:#fff;',
|
|
1046
|
+
':host{all:initial;--fb-bg:#fff;--fb-fg:#15171c;--fb-mute:#5b6472;--fb-line:#e3e6ea;--fb-acc:#0f766e;--fb-acc-fg:#fff;--fb-bad:#b42318;--fb-mark:#0b5e57;--fb-eye:#fff;--fb-soft:#f4f5f6;--fb-on:#fff;--fb-pick:var(--fb-acc);--fb-ph:#78818e;--fb-ring:rgba(16,24,40,.06);--fb-dot:#14b8a6;',
|
|
1086
1047
|
'--fb-x:' + OFFSET[0] + 'px;--fb-y:' + OFFSET[1] + 'px;--fb-h:' + FAB_H + 'px;--fb-w:' + WIDTH + 'px;',
|
|
1087
1048
|
'font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--fb-fg)}',
|
|
1088
1049
|
THEME === 'dark' ? ':host{' + DARK + '}' : THEME === 'light' ? '' : '@media (prefers-color-scheme:dark){:host{' + DARK + '}}',
|
|
@@ -1110,7 +1071,7 @@
|
|
|
1110
1071
|
|
|
1111
1072
|
// the introduction
|
|
1112
1073
|
'.intro{position:fixed;z-index:2147483000;width:min(300px,calc(100vw - 40px));padding:14px 16px;',
|
|
1113
|
-
'background:var(--fb-bg);border:1px solid var(--fb-line);border-radius:
|
|
1074
|
+
'background:var(--fb-bg);border:1px solid var(--fb-line);border-radius:16px;box-shadow:0 12px 40px rgba(16,24,40,.22);animation:fb-in .25s ease-out}',
|
|
1114
1075
|
'.intro.r{right:var(--fb-x)}.intro.l{left:var(--fb-x)}.intro.c{left:50%;margin-left:min(-150px,calc(20px - 50vw))}',
|
|
1115
1076
|
'.intro.b{bottom:calc(var(--fb-y) + var(--fb-h) + 8px)}.intro.t{top:calc(var(--fb-y) + var(--fb-h) + 8px)}',
|
|
1116
1077
|
'.intro:after{content:"";position:absolute;bottom:-7px;right:36px;width:12px;height:12px;background:var(--fb-bg);',
|
|
@@ -1121,7 +1082,7 @@
|
|
|
1121
1082
|
'.intro b{display:block;margin-bottom:4px;font-weight:700}',
|
|
1122
1083
|
'.intro p{margin:0 0 12px;color:var(--fb-mute);font-size:13px}',
|
|
1123
1084
|
'.intro .row{margin-top:0;justify-content:flex-end}',
|
|
1124
|
-
'.intro .
|
|
1085
|
+
'.intro .foot{margin-top:12px;padding:8px 0 0;border-top:1px solid var(--fb-line);text-align:left}',
|
|
1125
1086
|
'@keyframes fb-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}',
|
|
1126
1087
|
'@media (prefers-reduced-motion:reduce){.intro{animation:none}}',
|
|
1127
1088
|
// offering help: the introduction's bubble; with no button to point at, it sits in its place
|
|
@@ -1130,82 +1091,120 @@
|
|
|
1130
1091
|
'.dot{width:8px;height:8px;border-radius:50%;background:var(--fb-acc)}',
|
|
1131
1092
|
|
|
1132
1093
|
// the panel
|
|
1133
|
-
'.scrim{position:fixed;inset:0;z-index:2147483001;background:rgba(0,0,0,.35);display:flex;align-items:flex-end;justify-content:flex-end;padding:16px}',
|
|
1094
|
+
'.scrim{position:fixed;inset:0;z-index:2147483001;background:rgba(0,0,0,.35);display:flex;align-items:flex-end;justify-content:flex-end;padding:var(--fb-pad,16px)}',
|
|
1134
1095
|
'.scrim.l{justify-content:flex-start}.scrim.c{justify-content:center}.scrim.t{align-items:flex-start}.scrim.side{align-items:center}',
|
|
1135
|
-
'.scrim.center{align-items:center;justify-content:center}',
|
|
1096
|
+
'.scrim.center{align-items:center;justify-content:center;padding:16px}',
|
|
1136
1097
|
'.scrim.sheet{padding:0;align-items:stretch}',
|
|
1098
|
+
'.panel{animation:fb-rise .2s ease-out}.scrim.t .panel{animation-name:fb-drop}.scrim.center .panel,.scrim.side .panel{animation-name:fb-fade}',
|
|
1099
|
+
'@keyframes fb-rise{from{opacity:0;transform:translateY(8px)}}@keyframes fb-drop{from{opacity:0;transform:translateY(-8px)}}',
|
|
1137
1100
|
'.scrim.clear{background:none}',
|
|
1101
|
+
'.scrim.anch{padding:0!important;display:block}.scrim.anch>.panel,.scrim.anch>.barbox{position:fixed;left:0;top:0}',
|
|
1102
|
+
'.scrim.bar.center{pointer-events:auto;background:rgba(0,0,0,.35)}.scrim.bar.center.clear{background:none}',
|
|
1103
|
+
'.scrim.bar.center.blur{background:rgba(0,0,0,.18);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}',
|
|
1138
1104
|
'.scrim.blur{background:rgba(0,0,0,.18);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}',
|
|
1139
|
-
'.panel{width:min(var(--fb-w),100%);max-height:min(600px,calc(100vh - 32px));overflow:
|
|
1140
|
-
'border
|
|
1141
|
-
'.sheet .panel{max-height:none;height:100%;border-radius:0
|
|
1142
|
-
'.
|
|
1143
|
-
'.
|
|
1144
|
-
'
|
|
1145
|
-
'.
|
|
1146
|
-
'.
|
|
1147
|
-
'.
|
|
1148
|
-
'.
|
|
1149
|
-
'
|
|
1150
|
-
'
|
|
1151
|
-
'.
|
|
1152
|
-
'.
|
|
1153
|
-
'.
|
|
1154
|
-
'.
|
|
1155
|
-
'
|
|
1156
|
-
'
|
|
1157
|
-
'
|
|
1158
|
-
'
|
|
1159
|
-
'
|
|
1160
|
-
'
|
|
1161
|
-
'.
|
|
1162
|
-
'
|
|
1163
|
-
'
|
|
1164
|
-
'.
|
|
1165
|
-
'.
|
|
1166
|
-
'.
|
|
1167
|
-
'.
|
|
1168
|
-
'.
|
|
1169
|
-
'.send{
|
|
1170
|
-
'.send[disabled]{opacity:.5;cursor:default}',
|
|
1171
|
-
'.send.busy{opacity:1;display:inline-flex;align-items:center;gap:7px}.send .mark{color:var(--fb-acc-fg)}.send .mark svg{width:20px;height:20px}.send .eye{fill:var(--fb-acc)}',
|
|
1105
|
+
'.panel{width:min(var(--fb-w),100%);max-height:min(600px,calc(100vh - 32px));display:flex;flex-direction:column;overflow:hidden;background:var(--fb-bg);',
|
|
1106
|
+
'border-radius:16px;box-shadow:0 12px 40px rgba(16,24,40,.16),0 0 0 1px var(--fb-ring)}',
|
|
1107
|
+
'.sheet .panel{max-height:none;height:100%;border-radius:0}',
|
|
1108
|
+
'.grab{display:none;flex:none;height:22px}.grab i{display:block;width:40px;height:5px;border-radius:3px;background:var(--fb-line);margin:10px auto 0}',
|
|
1109
|
+
'@media (max-width:599px){.scrim.corner{padding:0!important;align-items:flex-end}.scrim.corner .panel{width:100%;max-height:92%;border-radius:22px 22px 0 0;animation-name:fb-sheet}.scrim.corner .grab{display:block}.scrim.sheet .panel{width:100%}}',
|
|
1110
|
+
'@keyframes fb-sheet{from{transform:translateY(40px)}}',
|
|
1111
|
+
'.view{display:flex;flex-direction:column;min-height:0;animation:fb-fade .16s}@keyframes fb-fade{from{opacity:0}}',
|
|
1112
|
+
'.hd{display:flex;align-items:center;flex:none;gap:8px;padding:14px 12px 8px 18px;min-height:56px}.hd.back{padding-left:8px}',
|
|
1113
|
+
'.hd h2{margin:0;font-size:16px;font-weight:650}.hd .mark svg{width:24px;height:24px}.sp{flex:1}',
|
|
1114
|
+
'.ib{flex:none;width:32px;height:32px;border:0;padding:0;border-radius:10px;display:grid;place-items:center;background:none;color:var(--fb-mute);cursor:pointer}',
|
|
1115
|
+
'.ib:hover,.quiet:hover{background:var(--fb-soft)}',
|
|
1116
|
+
'.quiet{display:flex;align-items:center;gap:6px;border:0;background:none;font-size:13px;font-weight:550;color:var(--fb-mute);padding:6px 9px;border-radius:9px;cursor:pointer}',
|
|
1117
|
+
'.ic{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;display:block}',
|
|
1118
|
+
'.udot{width:7px;height:7px;border-radius:50%;background:var(--fb-dot);flex:none}',
|
|
1119
|
+
'form.pad{padding:4px 18px;min-height:0;overflow-y:auto}',
|
|
1120
|
+
'.seg{display:flex;gap:2px;padding:3px;background:var(--fb-soft);border-radius:12px;margin-bottom:12px;overflow-x:auto;scrollbar-width:none}.seg::-webkit-scrollbar{display:none}',
|
|
1121
|
+
'.seg button{flex:1 0 auto;white-space:nowrap;border:0;background:none;cursor:pointer;font-size:13px;font-weight:550;color:var(--fb-mute);padding:8px 9px;border-radius:9px}',
|
|
1122
|
+
'.seg button[aria-checked=true]{background:var(--fb-on);color:var(--fb-pick);font-weight:650;box-shadow:0 1px 3px rgba(16,24,40,.14)}',
|
|
1123
|
+
'@media (max-width:440px){.seg button{padding:8px 6px;font-size:12.5px}}',
|
|
1124
|
+
'textarea{display:block;width:100%;min-height:112px;resize:none;border:1px solid var(--fb-line);border-radius:12px;padding:12px 14px;font-size:15px;line-height:1.45;background:none}',
|
|
1125
|
+
'textarea::placeholder,input::placeholder{color:var(--fb-ph);opacity:1}',
|
|
1126
|
+
'textarea:focus,input:focus{outline:0;border-color:var(--fb-acc);box-shadow:0 0 0 3px rgba(15,118,110,.14);box-shadow:0 0 0 3px color-mix(in srgb,var(--fb-acc) 16%,transparent)}',
|
|
1127
|
+
'.panel:focus{outline:0}',
|
|
1128
|
+
'button:focus:not(:focus-visible){outline:0}',
|
|
1129
|
+
'button:focus-visible,a:focus-visible{outline:2px solid var(--fb-acc);outline-offset:2px}',
|
|
1130
|
+
'.seg button:focus-visible{outline-offset:-2px}',
|
|
1131
|
+
'.send{display:grid;place-items:center;width:100%;height:46px;margin-top:12px;border:0;border-radius:12px;background:var(--fb-acc);color:var(--fb-acc-fg);font-weight:600;font-size:15px;cursor:pointer}',
|
|
1132
|
+
'.send:disabled{background:var(--fb-soft);color:var(--fb-ph);cursor:not-allowed}',
|
|
1133
|
+
'.send.busy{display:flex;align-items:center;justify-content:center;gap:7px;background:var(--fb-acc);color:var(--fb-acc-fg);cursor:default}',
|
|
1134
|
+
'.send .mark{color:var(--fb-acc-fg)}.send .mark svg{width:20px;height:20px}.send .eye{fill:var(--fb-acc)}',
|
|
1135
|
+
'.send.sm{display:inline-block;width:auto;height:auto;margin:0;padding:8px 14px;font-size:13px;border-radius:10px}',
|
|
1172
1136
|
// The loader: the mark's eyes look left, look right, blink (brand/svg/loaders/heresay-loader-glance.svg, faster).
|
|
1173
1137
|
'.glance svg *{transform-box:view-box}.glance .eyes{animation:fb-look 1.6s ease-in-out infinite}.glance .e{animation:fb-blink 1.6s infinite}',
|
|
1174
1138
|
'@keyframes fb-look{0%,10%{transform:none}25%,40%{transform:translate(-9px,1px)}55%,70%{transform:translate(9px,-1px)}85%,100%{transform:none}}',
|
|
1175
1139
|
'@keyframes fb-blink{0%,88%,96%,100%{transform:none}92%{transform:scaleY(.1)}}',
|
|
1176
|
-
'
|
|
1177
|
-
'.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
'.
|
|
1181
|
-
'.
|
|
1182
|
-
'.
|
|
1183
|
-
'.
|
|
1184
|
-
'
|
|
1185
|
-
'.
|
|
1186
|
-
'.
|
|
1187
|
-
'.
|
|
1188
|
-
|
|
1189
|
-
'.
|
|
1190
|
-
'.
|
|
1191
|
-
'.
|
|
1192
|
-
'.
|
|
1193
|
-
'
|
|
1194
|
-
'.
|
|
1195
|
-
'.
|
|
1196
|
-
'.
|
|
1197
|
-
'.take-back{margin-top:
|
|
1198
|
-
'.take-back .row{margin-top:4px
|
|
1199
|
-
'.
|
|
1200
|
-
'.
|
|
1201
|
-
'.
|
|
1202
|
-
'.
|
|
1203
|
-
'.
|
|
1204
|
-
|
|
1205
|
-
'.
|
|
1206
|
-
'
|
|
1207
|
-
'.
|
|
1208
|
-
'.
|
|
1140
|
+
'.err{color:var(--fb-bad);font-size:13px;margin-top:8px}.err:empty{display:none}',
|
|
1141
|
+
'.foot{flex:none;text-align:center;font-size:12px;color:var(--fb-mute);padding:12px 18px 14px}',
|
|
1142
|
+
'.foot a{color:inherit;text-decoration:none;font-weight:600}.foot a:hover{text-decoration:underline}',
|
|
1143
|
+
// sent
|
|
1144
|
+
'.sent{align-items:center;text-align:center;padding:10px 28px 6px}',
|
|
1145
|
+
'.chk{width:68px;height:68px;border-radius:50%;background:var(--fb-acc);display:grid;place-items:center;animation:fb-pop .35s cubic-bezier(.2,1.3,.4,1) both}',
|
|
1146
|
+
'.chk svg{width:36px;height:36px;fill:none;stroke:var(--fb-acc-fg);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}',
|
|
1147
|
+
'.chk path{stroke-dasharray:30;stroke-dashoffset:30;animation:fb-draw .3s .22s forwards}',
|
|
1148
|
+
'@keyframes fb-pop{from{transform:scale(.6);opacity:0}}@keyframes fb-draw{to{stroke-dashoffset:0}}',
|
|
1149
|
+
'.sent p{margin:18px 0 0;font-size:17px;font-weight:550;max-width:250px}',
|
|
1150
|
+
'.sent p.thanks{margin-top:8px;font-size:14px;font-weight:400;color:var(--fb-mute)}',
|
|
1151
|
+
'.sent .send{margin:20px 0 0}',
|
|
1152
|
+
// your reports
|
|
1153
|
+
'.cards{display:grid;gap:10px;padding:6px 18px;overflow-y:auto;min-height:0;align-content:start}',
|
|
1154
|
+
'.card{border:1px solid var(--fb-line);border-radius:14px;padding:13px 14px}',
|
|
1155
|
+
'.top{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--fb-mute);margin-bottom:6px}.top b{color:var(--fb-fg)}.top .udot{margin-left:auto}',
|
|
1156
|
+
'.card .t{margin:0;font-size:14px;white-space:pre-wrap;word-break:break-word}',
|
|
1157
|
+
'.chip{display:inline-flex;align-items:center;gap:5px;margin-top:10px;font-size:12px;font-weight:600;padding:4px 9px 4px 7px;border-radius:999px;background:var(--fb-soft);color:var(--fb-mute)}',
|
|
1158
|
+
'.chip .ic{width:13px;height:13px}.chip.fx{background:rgba(15,118,110,.1);background:color-mix(in srgb,var(--fb-acc) 12%,transparent);color:var(--fb-pick)}',
|
|
1159
|
+
'.n2{margin:8px 0 0;font-size:13px;color:var(--fb-mute)}.n2 b{color:var(--fb-fg)}',
|
|
1160
|
+
'.empty{color:var(--fb-mute);padding:12px 2px}',
|
|
1161
|
+
'.take-back{margin-top:8px}.take-back input{width:100%;height:36px;padding:0 10px;border:1px solid var(--fb-line);border-radius:10px;background:none;margin:4px 0}',
|
|
1162
|
+
'.take-back .row{margin-top:4px}',
|
|
1163
|
+
'.link{border:0;background:none;padding:0;cursor:pointer;color:var(--fb-mute);text-decoration:underline;font-size:12px}',
|
|
1164
|
+
'.row{display:flex;justify-content:space-between;align-items:center;margin-top:10px;gap:8px}',
|
|
1165
|
+
'.small{font-size:12px;color:var(--fb-mute);margin:0}',
|
|
1166
|
+
'.prefs{flex:none;margin:8px 18px 0;border-top:1px solid var(--fb-line)}',
|
|
1167
|
+
'.prefs>button{display:flex;align-items:center;width:100%;border:0;background:none;cursor:pointer;padding:12px 2px;font-size:13px;font-weight:550;color:var(--fb-mute)}',
|
|
1168
|
+
'.prefs>button .ic{width:15px;height:15px;margin-left:auto;transition:transform .2s}.prefs>button[aria-expanded=true] .ic{transform:rotate(180deg)}',
|
|
1169
|
+
'.prefs>.signed{padding:12px 2px;font-size:13px;font-weight:550;color:var(--fb-mute)}',
|
|
1170
|
+
'.pb{padding-bottom:4px}',
|
|
1171
|
+
'.pb label{display:block;font-size:12px;color:var(--fb-mute);margin:0 0 4px 2px}',
|
|
1172
|
+
'.pb input{display:block;width:100%;height:40px;border:1px solid var(--fb-line);border-radius:10px;padding:0 12px;margin-bottom:10px;background:none}',
|
|
1173
|
+
'.pb .err{margin:-4px 0 8px}.pb .small{margin:-4px 0 8px 2px}',
|
|
1174
|
+
// layout: steps (what's going on? rows, then the text)
|
|
1175
|
+
'.ibd{position:relative}.ibd .udot{position:absolute;top:3px;right:3px;width:9px;height:9px;box-shadow:0 0 0 2px var(--fb-bg)}',
|
|
1176
|
+
'.hd h2.q{font-size:17px}',
|
|
1177
|
+
'.rows{list-style:none;margin:0;padding:4px 18px 2px;display:grid;gap:10px;overflow-y:auto;min-height:0}',
|
|
1178
|
+
'.pick{display:flex;align-items:center;gap:14px;width:100%;padding:9px 14px 9px 9px;border:1px solid var(--fb-line);border-radius:16px;background:none;cursor:pointer;font-size:16px;font-weight:600;text-align:left}',
|
|
1179
|
+
'@media (hover:hover){.pick:hover{background:var(--fb-soft)}}',
|
|
1180
|
+
'.pick .tile{flex:none;width:42px;height:42px;border-radius:12px;background:var(--fb-soft);display:grid;place-items:center}',
|
|
1181
|
+
'.pick .tile .ic{width:22px;height:22px}.pick .nm{flex:1;min-width:0}.pick .chev{color:var(--fb-mute);display:flex}.pick .chev .ic{width:18px;height:18px}',
|
|
1182
|
+
'.tpill{display:inline-flex;align-items:center;gap:6px;padding:6px 12px 6px 9px;border-radius:999px;background:var(--fb-soft);font-size:13px;font-weight:650}.tpill .ic{width:16px;height:16px}',
|
|
1183
|
+
'form.big textarea{min-height:132px}',
|
|
1184
|
+
// layout: bar (a compact composer beside the button; a docked bar on phones)
|
|
1185
|
+
'.scrim.bar{background:none;pointer-events:none;inset:0 0 var(--fb-kb,0px) 0}.scrim.bar>*{pointer-events:auto}',
|
|
1186
|
+
'.barbox{position:relative;width:min(var(--fb-w),100%);background:var(--fb-bg);border-radius:22px;padding:8px 8px 4px;box-shadow:0 12px 40px rgba(16,24,40,.18),0 0 0 1px var(--fb-ring);animation:fb-rise .2s ease-out}',
|
|
1187
|
+
'.barbox:focus{outline:0}.scrim.t .barbox{animation-name:fb-drop}',
|
|
1188
|
+
'.bin{display:flex;align-items:flex-end;gap:8px;margin:0}',
|
|
1189
|
+
'.tchip{display:flex;align-items:center;gap:6px;flex:none;max-width:52%;height:40px;padding:0 9px 0 12px;border:0;border-radius:14px;background:var(--fb-soft);font-size:14px;font-weight:650;cursor:pointer;white-space:nowrap}',
|
|
1190
|
+
'.tchip span{overflow:hidden;text-overflow:ellipsis}.tchip .ic{width:16px;height:16px;flex:none}.tchip .caret{color:var(--fb-mute)}',
|
|
1191
|
+
'.bin textarea{flex:1;min-width:0;height:40px;min-height:40px;max-height:120px;border:0;border-radius:0;padding:9px 2px;font-size:15px;line-height:22px;overflow-y:auto}',
|
|
1192
|
+
'.bin textarea:focus{box-shadow:none;border:0}',
|
|
1193
|
+
'.bsend{flex:none;display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:50%;background:var(--fb-acc);color:var(--fb-acc-fg);cursor:pointer}',
|
|
1194
|
+
'.bsend:disabled{background:var(--fb-soft);color:var(--fb-ph);cursor:not-allowed}.bsend.busy{cursor:default}.bsend .ic{width:20px;height:20px;stroke-width:2.2}',
|
|
1195
|
+
'.bsend .mark{color:var(--fb-acc-fg)}.bsend .mark svg{width:22px;height:22px}.bsend .eye{fill:var(--fb-acc)}',
|
|
1196
|
+
'.bmeta{display:flex;align-items:center;gap:4px;padding:2px 0 0}.bmeta .ib{width:32px;height:32px}.bmeta .foot2{font-size:12px;color:var(--fb-mute);padding-right:4px}',
|
|
1197
|
+
'.bmeta .foot2 a{color:inherit;text-decoration:none;font-weight:600}.bmeta .foot2 a:hover{text-decoration:underline}',
|
|
1198
|
+
'.barbox .err{margin:2px 4px 0}',
|
|
1199
|
+
'.bmenu{position:absolute;left:0;bottom:calc(100% + 8px);min-width:210px;max-width:100%;padding:6px;background:var(--fb-bg);border-radius:18px;box-shadow:0 12px 40px rgba(16,24,40,.18),0 0 0 1px var(--fb-ring);animation:fb-fade .12s}',
|
|
1200
|
+
'.scrim.t .bmenu{bottom:auto;top:calc(100% + 8px)}',
|
|
1201
|
+
'.bmenu button{display:flex;align-items:center;gap:12px;width:100%;border:0;background:none;padding:10px 12px;border-radius:12px;font-size:15px;font-weight:550;text-align:left;cursor:pointer}',
|
|
1202
|
+
'@media (hover:hover){.bmenu button:hover{background:var(--fb-soft)}}',
|
|
1203
|
+
'.bmenu button:focus-visible{outline:0;background:var(--fb-soft);box-shadow:inset 0 0 0 2px var(--fb-acc)}.bmenu button[aria-checked=true]{font-weight:700}.bmenu .ic{width:20px;height:20px}',
|
|
1204
|
+
'.bsent{display:flex;align-items:center;gap:12px;padding:6px 6px 6px 8px}.bsent .chk{width:36px;height:36px;flex:none}.bsent .chk svg{width:20px;height:20px}',
|
|
1205
|
+
'.bsent p{flex:1;margin:0;font-size:14px;font-weight:550;min-width:0}.bsent .send.sm{flex:none}',
|
|
1206
|
+
'@media (max-width:599px){.scrim.bar{padding:0!important;align-items:flex-end}.scrim.bar .barbox{width:100%;border-radius:22px 22px 0 0;padding-bottom:calc(6px + env(safe-area-inset-bottom));animation-name:fb-sheet}.scrim.t.bar .bmenu{top:auto;bottom:calc(100% + 8px)}}',
|
|
1207
|
+
'@media (prefers-reduced-motion:reduce){.panel,.barbox,.bmenu,.view,.chk,.chk path,.glance .eyes,.glance .e,.intro{animation:none!important}.chk path{stroke-dashoffset:0}.prefs>button .ic{transition:none}}',
|
|
1209
1208
|
].join('');
|
|
1210
1209
|
|
|
1211
1210
|
/**
|
|
@@ -1253,22 +1252,53 @@
|
|
|
1253
1252
|
return n;
|
|
1254
1253
|
}
|
|
1255
1254
|
|
|
1255
|
+
var MARK_BODY = 'M174 100L177 105L180 110L181 116L180 121L178 126L174 131L169 134L164 137L159 139L154 141L149 143L146 146L143 149L141 154L139 159L137 164L134 169L131 174L126 178L121 180L116 181L110 180L105 177L100 174L95 170L91 167L87 164L83 163L79 162L74 162L69 163L63 164L57 164L51 164L46 162L41 159L38 154L36 149L36 143L36 137L37 131L38 126L38 121L37 117L36 113L33 109L30 105L26 100L23 95L20 90L19 84L20 79L22 74L26 69L31 66L36 63L41 61L46 59L51 57L54 54L57 51L59 46L61 41L63 36L66 31L69 26L74 22L79 20L84 19L90 20L95 23L100 26L105 30L109 33L113 36L117 37L121 38L126 38L131 37L137 36L143 36L149 36L154 38L159 41L162 46L164 51L164 57L164 63L163 69L162 74L162 79L163 83L164 87L167 91L170 95Z';
|
|
1256
|
+
var MARK_EYE = 'M-13 12 C-13 -8 -2 -24 17 -32 L20 -25 C8 -18 2 -9 3 -1 A13 13 0 1 1 -13 12 Z';
|
|
1257
|
+
var EYE_A = 'translate(80 106) rotate(-24) scale(1.25)', EYE_B = 'translate(124 101) rotate(-24) scale(1.25)';
|
|
1258
|
+
|
|
1256
1259
|
/** The Heresay mark, compact: a soft wave with quote-mark eyes. Drawn from a constant string.
|
|
1257
1260
|
* `glance` makes it the loader: the eyes look left, look right, blink. */
|
|
1258
1261
|
function markEl(glance) {
|
|
1259
1262
|
var s = document.createElement('span');
|
|
1260
1263
|
s.className = glance ? 'mark glance' : 'mark';
|
|
1261
|
-
s.innerHTML = '<svg viewBox="0 0 200 200" width="22" height="22" aria-hidden="true"><path d="
|
|
1264
|
+
s.innerHTML = '<svg viewBox="0 0 200 200" width="22" height="22" aria-hidden="true"><path d="' + MARK_BODY + '" fill="currentColor"/><g class="eyes">' +
|
|
1265
|
+
'<g class="e" style="transform-origin:80px 106px"><path class="eye" d="' + MARK_EYE + '" transform="' + EYE_A + '"/></g>' +
|
|
1266
|
+
'<g class="e" style="transform-origin:124px 101px"><path class="eye" d="' + MARK_EYE + '" transform="' + EYE_B + '"/></g></g></svg>';
|
|
1262
1267
|
return s;
|
|
1263
1268
|
}
|
|
1264
1269
|
|
|
1265
|
-
/**
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1270
|
+
/**
|
|
1271
|
+
* `data-heresay-mark` on any element of the host page (an empty span inside the app's own
|
|
1272
|
+
* button): filled with the Heresay mark, 1em square, hidden from screen readers. Coloured with
|
|
1273
|
+
* the accent (data-accent, unless data-mark="heresay"), or with the text colour when the
|
|
1274
|
+
* attribute is "currentColor". The eyes are real holes (a mask), so it sits on any background.
|
|
1275
|
+
* Elements added later are filled too. Nothing without the attribute is touched.
|
|
1276
|
+
*/
|
|
1277
|
+
var markSeq = 0;
|
|
1278
|
+
function fillMark(n) {
|
|
1279
|
+
if (n.getAttribute('data-heresay-filled') != null) return;
|
|
1280
|
+
n.setAttribute('data-heresay-filled', '');
|
|
1281
|
+
var id = 'heresay-m' + (++markSeq), acc = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(attr('accent')) && pick('mark', ['accent', 'heresay'], 'accent') === 'accent' ? attr('accent') : '#0b5e57';
|
|
1282
|
+
var col = (n.getAttribute('data-heresay-mark') || '').trim().toLowerCase() === 'currentcolor' ? 'currentColor' : acc;
|
|
1283
|
+
n.setAttribute('aria-hidden', 'true');
|
|
1284
|
+
n.style.display = 'inline-flex'; n.style.width = '1em'; n.style.height = '1em'; n.style.verticalAlign = '-0.125em'; n.style.color = col;
|
|
1285
|
+
n.innerHTML = '<svg viewBox="0 0 200 200" width="1em" height="1em" aria-hidden="true" focusable="false" style="display:block"><mask id="' + id + '"><rect width="200" height="200" fill="#fff"/>' +
|
|
1286
|
+
'<path d="' + MARK_EYE + '" transform="' + EYE_A + '" fill="#000"/><path d="' + MARK_EYE + '" transform="' + EYE_B + '" fill="#000"/></mask>' +
|
|
1287
|
+
'<path d="' + MARK_BODY + '" fill="currentColor" mask="url(#' + id + ')"/></svg>';
|
|
1288
|
+
}
|
|
1289
|
+
function fillMarks(root) {
|
|
1290
|
+
if (root.nodeType !== 1) return;
|
|
1291
|
+
if (root.hasAttribute('data-heresay-mark')) fillMark(root);
|
|
1292
|
+
var all = root.querySelectorAll ? root.querySelectorAll('[data-heresay-mark]') : [];
|
|
1293
|
+
for (var k = 0; k < all.length; k++) fillMark(all[k]);
|
|
1294
|
+
}
|
|
1295
|
+
function watchMarks() {
|
|
1296
|
+
fillMarks(document.documentElement);
|
|
1297
|
+
if (window.MutationObserver) new MutationObserver(function (ms) {
|
|
1298
|
+
for (var a = 0; a < ms.length; a++) for (var b = 0; b < ms[a].addedNodes.length; b++) fillMarks(ms[a].addedNodes[b]);
|
|
1299
|
+
}).observe(document.documentElement, { childList: true, subtree: true });
|
|
1300
|
+
}
|
|
1301
|
+
watchMarks();
|
|
1272
1302
|
|
|
1273
1303
|
var PLACE = POS.join(' ') + (STYLE === 'tab' ? ' side' : '');
|
|
1274
1304
|
var fabDot = el('span', { class: 'dot', hidden: '' });
|
|
@@ -1276,7 +1306,7 @@
|
|
|
1276
1306
|
class: ['fab', PLACE, 'st-' + STYLE, 'sz-' + SIZE, 'sh-' + pick('shadow', ['soft', 'none', 'strong'], 'soft'),
|
|
1277
1307
|
pick('fill', ['neutral', 'accent'], 'neutral') === 'accent' ? 'fill' : '', BUTTON === 'desktop' ? 'desktop' : ''].join(' '),
|
|
1278
1308
|
type: 'button', 'aria-haspopup': 'dialog', title: S.reportAria + ' · ' + S.powered,
|
|
1279
|
-
onclick: function () { open(); },
|
|
1309
|
+
onclick: function () { if (scrim) close(); else open(); },
|
|
1280
1310
|
}, [markEl(), el('span', { class: 'lbl', text: LABEL }), fabDot]);
|
|
1281
1311
|
if (BUTTON !== 'none') root.appendChild(fab);
|
|
1282
1312
|
|
|
@@ -1307,237 +1337,627 @@
|
|
|
1307
1337
|
// Single-page apps change the path without reloading; check cheaply, only when paths are listed.
|
|
1308
1338
|
if (HIDE_ON.length) setInterval(function () { if (location.pathname !== lastPath) placeFab(); }, 500);
|
|
1309
1339
|
|
|
1310
|
-
var scrim = null, view = 'new', listBox = null, lastFocus = null;
|
|
1340
|
+
var scrim = null, view = 'new', listBox = null, lastFocus = null, hdDot = null, hdMine = null;
|
|
1341
|
+
// Whether "Your name and email" is expanded. Only openPreferences() or the reporter opens it.
|
|
1342
|
+
var prefsOpen = false;
|
|
1311
1343
|
|
|
1312
1344
|
function renderBadge() {
|
|
1313
1345
|
var n = unseen();
|
|
1314
1346
|
if (n) fabDot.removeAttribute('hidden'); else fabDot.setAttribute('hidden', '');
|
|
1315
1347
|
fab.setAttribute('aria-label', n ? fmt(S.update, { n: n }) : S.reportAria);
|
|
1348
|
+
if (hdDot) { hdDot.hidden = !n; if (hdMine) hdMine.setAttribute('aria-label', n ? fmt(S.mineAria, { n: n }) : S.mine); }
|
|
1316
1349
|
}
|
|
1317
1350
|
renderBadge();
|
|
1318
1351
|
|
|
1319
|
-
|
|
1352
|
+
/**
|
|
1353
|
+
* Where the panel sits follows the button: the same corner or edge, with room left for the button
|
|
1354
|
+
* so it never covers it, and the same offset. With no button (none, data-button="none") it takes
|
|
1355
|
+
* the corner the position names, bottom-right by default.
|
|
1356
|
+
*/
|
|
1357
|
+
function panelPad() {
|
|
1358
|
+
var shown = fabShowing(), tab = shown && STYLE === 'tab';
|
|
1359
|
+
var gap = shown && !tab ? FAB_H + 8 : 0;
|
|
1360
|
+
var x = Math.max(12, OFFSET[0]), y = Math.max(12, OFFSET[1]);
|
|
1361
|
+
var side = tab ? 48 : POS[0] === 'c' ? 12 : x;
|
|
1362
|
+
var top = POS[1] === 't' && !tab ? y + gap : 12, bottom = POS[1] === 'b' && !tab ? y + gap : 12;
|
|
1363
|
+
return top + 'px ' + (POS[0] === 'r' ? side : 12) + 'px ' + bottom + 'px ' + (POS[0] === 'l' ? side : 12) + 'px';
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
function open(which, o) {
|
|
1320
1367
|
if (dead) return;
|
|
1321
1368
|
if (scrim) { if (which) { view = which; renderPanel(); } return; }
|
|
1322
1369
|
if (bubble) { bubble.remove(); bubble = null; }
|
|
1323
1370
|
if (nudgeEl) { nudgeEl.remove(); nudgeEl = null; }
|
|
1324
|
-
|
|
1371
|
+
o = o || {};
|
|
1372
|
+
anchor = o.corner ? null : detect(o.anchor);
|
|
1373
|
+
cornerOpen = !!o.corner;
|
|
1374
|
+
lastFocus = anchor && anchor.el ? anchor.el : document.activeElement;
|
|
1325
1375
|
view = which || (unseen() ? 'mine' : 'new');
|
|
1326
|
-
|
|
1327
|
-
|
|
1376
|
+
scrim = el('div', { class: surface(), onclick: function (e) {
|
|
1377
|
+
if (e.target !== scrim || Date.now() - menuClosedAt < 600) return;
|
|
1378
|
+
if (!barUp() || scrim.classList.contains('center')) close();
|
|
1379
|
+
} });
|
|
1380
|
+
scrim.style.setProperty('--fb-pad', panelPad());
|
|
1328
1381
|
scrim.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
|
|
1329
1382
|
root.appendChild(scrim);
|
|
1383
|
+
window.addEventListener('scroll', queue, true);
|
|
1384
|
+
window.addEventListener('resize', queue);
|
|
1385
|
+
if (LAYOUT === 'bar' && window.visualViewport) {
|
|
1386
|
+
window.visualViewport.addEventListener('resize', keyboard);
|
|
1387
|
+
window.visualViewport.addEventListener('scroll', keyboard);
|
|
1388
|
+
keyboard();
|
|
1389
|
+
}
|
|
1330
1390
|
renderPanel();
|
|
1331
1391
|
refresh();
|
|
1332
1392
|
}
|
|
1333
1393
|
|
|
1334
|
-
|
|
1394
|
+
/** The bar is a small non-modal composer; Your reports (and everything else) is the panel. */
|
|
1395
|
+
function barUp() { return LAYOUT === 'bar' && view !== 'mine'; }
|
|
1396
|
+
function surface() {
|
|
1397
|
+
var m = opensAs();
|
|
1398
|
+
if (barUp()) return 'scrim bar ' + (m === 'anchor' ? 'anch' : m === 'dock' ? 'c' : m === 'center' ? 'center ' + BACKDROP : PLACE);
|
|
1399
|
+
var cls = LAYOUT === 'bar' ? '' : PANEL === 'center' ? 'center' : PANEL === 'sheet' ? PLACE + ' sheet' : '';
|
|
1400
|
+
if (!cls) cls = m === 'anchor' ? 'anch' : m === 'center' ? 'center' : PLACE + ' corner';
|
|
1401
|
+
return 'scrim ' + cls + ' ' + (cls === 'anch' ? 'clear' : BACKDROP);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
// ---- where the panel opens ---------------------------------------------------------------
|
|
1405
|
+
// Beside the floating button. From the app's own trigger (the element just clicked, a
|
|
1406
|
+
// [data-heresay-open] element, or open({ anchor })): a centred window with the page dimmed (the bar
|
|
1407
|
+
// docks at the bottom centre), or next to the trigger with data-panel="beside". Centred when code
|
|
1408
|
+
// opened it with no click and there is no button. A bottom sheet on phones.
|
|
1409
|
+
// data-panel sheet, center and corner always win.
|
|
1410
|
+
var recent = null; // the last trusted pointer or key target: { el, rect, t }
|
|
1411
|
+
var anchor = null; // the trigger of the open panel: { el, rect }
|
|
1412
|
+
var cornerOpen = false; // opened from the nudge: the corner it sits in
|
|
1413
|
+
var closedBy = null; // an outside click just closed the panel: { el, t }
|
|
1414
|
+
var menuClosedAt = 0;
|
|
1415
|
+
var INTERACTIVE = 'a,button,[role=button],[role=menuitem],[data-heresay-open]';
|
|
1416
|
+
|
|
1417
|
+
function rectOf(n) {
|
|
1418
|
+
var r = n.getBoundingClientRect();
|
|
1419
|
+
return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height };
|
|
1420
|
+
}
|
|
1421
|
+
function pathOf(e) { return e.composedPath ? e.composedPath() : [e.target]; }
|
|
1422
|
+
function markTrigger(e) {
|
|
1423
|
+
if (!e.isTrusted) return;
|
|
1424
|
+
if (e.type === 'keydown' && e.key !== 'Enter' && e.key !== ' ') return;
|
|
1425
|
+
var p = pathOf(e);
|
|
1426
|
+
if (p.indexOf(host) >= 0) { recent = null; return; }
|
|
1427
|
+
var t = p[0];
|
|
1428
|
+
if (!t || t.nodeType !== 1) t = e.target;
|
|
1429
|
+
if (!t || !t.closest) return;
|
|
1430
|
+
t = t.closest(INTERACTIVE) || t;
|
|
1431
|
+
if (t === document.body || t === document.documentElement) { recent = null; return; }
|
|
1432
|
+
recent = { el: t, rect: rectOf(t), t: Date.now() };
|
|
1433
|
+
}
|
|
1434
|
+
function anchorFrom(a) {
|
|
1435
|
+
if (!a) return null;
|
|
1436
|
+
if (a.nodeType === 1) return a === host ? null : { el: a, rect: rectOf(a) };
|
|
1437
|
+
var l = +(a.left != null ? a.left : a.x), t = +(a.top != null ? a.top : a.y);
|
|
1438
|
+
var w = a.width != null ? +a.width : +a.right - l, h = a.height != null ? +a.height : +a.bottom - t;
|
|
1439
|
+
if (!isFinite(l + t + w + h)) return null;
|
|
1440
|
+
return { el: null, rect: { left: l, top: t, right: l + w, bottom: t + h, width: w, height: h } };
|
|
1441
|
+
}
|
|
1442
|
+
function detect(explicit) {
|
|
1443
|
+
var a = anchorFrom(explicit);
|
|
1444
|
+
if (a) return a;
|
|
1445
|
+
return recent && Date.now() - recent.t < 1000 ? { el: recent.el, rect: recent.rect } : null;
|
|
1446
|
+
}
|
|
1447
|
+
/** After an outside click closed the panel on this trigger, the click that follows must not reopen it. */
|
|
1448
|
+
function toggledOff(el) {
|
|
1449
|
+
var t = el || (recent && recent.el);
|
|
1450
|
+
return !!(closedBy && closedBy.el && t === closedBy.el && Date.now() - closedBy.t < 700);
|
|
1451
|
+
}
|
|
1452
|
+
function opensAs() {
|
|
1453
|
+
if (media('(max-width:599px)')) return 'corner';
|
|
1454
|
+
if (anchor && PANEL !== 'corner') return PANEL === 'beside' ? 'anchor' : LAYOUT === 'bar' ? 'dock' : 'center';
|
|
1455
|
+
return cornerOpen || fabShowing() ? 'corner' : 'center';
|
|
1456
|
+
}
|
|
1457
|
+
function rectNow() {
|
|
1458
|
+
if (anchor.el && anchor.el.isConnected) {
|
|
1459
|
+
var r = rectOf(anchor.el);
|
|
1460
|
+
if (r.width || r.height) anchor.rect = r;
|
|
1461
|
+
}
|
|
1462
|
+
return anchor.rect;
|
|
1463
|
+
}
|
|
1464
|
+
var ro = null, raf = 0;
|
|
1465
|
+
function queue() { if (!raf) raf = requestAnimationFrame(function () { raf = 0; place(); }); }
|
|
1466
|
+
/** Put the panel beside the trigger, away from the nearest screen edge, fully on screen. */
|
|
1467
|
+
function place() {
|
|
1468
|
+
if (!scrim || !anchor || !scrim.classList.contains('anch')) return;
|
|
1469
|
+
var box = scrim.firstElementChild;
|
|
1470
|
+
if (!box) return;
|
|
1471
|
+
var vw = document.documentElement.clientWidth || window.innerWidth, vh = window.innerHeight, M = 12, G = 10;
|
|
1472
|
+
var w = Math.min(WIDTH, vw - 2 * M);
|
|
1473
|
+
box.style.width = w + 'px';
|
|
1474
|
+
box.style.maxHeight = Math.min(600, vh - 2 * M) + 'px';
|
|
1475
|
+
var h = box.offsetHeight, r = rectNow();
|
|
1476
|
+
var room = { right: vw - r.right, left: r.left, below: vh - r.bottom, above: r.top };
|
|
1477
|
+
var away = { left: 'right', right: 'left', top: 'below', bottom: 'above' };
|
|
1478
|
+
var edges = { left: r.left, right: vw - r.right, top: r.top, bottom: vh - r.bottom };
|
|
1479
|
+
var near = Object.keys(edges).sort(function (a, b) { return edges[a] - edges[b]; })[0];
|
|
1480
|
+
var sides = [away[near]].concat(['right', 'left', 'below', 'above'].filter(function (s) { return s !== away[near]; })
|
|
1481
|
+
.sort(function (a, b) { return room[b] - room[a]; }));
|
|
1482
|
+
var fits = function (s) { return room[s] >= ((s === 'right' || s === 'left') ? w : h) + G + M; };
|
|
1483
|
+
var side = sides.filter(fits)[0] || sides.slice().sort(function (a, b) { return room[b] - room[a]; })[0];
|
|
1484
|
+
var x, y;
|
|
1485
|
+
if (side === 'right' || side === 'left') {
|
|
1486
|
+
x = side === 'right' ? r.right + G : r.left - G - w;
|
|
1487
|
+
y = r.top + r.height / 2 > vh / 2 ? r.bottom - h : r.top;
|
|
1488
|
+
} else {
|
|
1489
|
+
y = side === 'below' ? r.bottom + G : r.top - G - h;
|
|
1490
|
+
x = r.left + r.width / 2 < vw / 2 ? r.left : r.right - w;
|
|
1491
|
+
}
|
|
1492
|
+
x = Math.max(M, Math.min(x, vw - M - w));
|
|
1493
|
+
y = Math.max(M, Math.min(y, vh - M - h));
|
|
1494
|
+
box.style.left = x + 'px';
|
|
1495
|
+
box.style.top = y + 'px';
|
|
1496
|
+
scrim.classList.toggle('t', y + h / 2 < vh / 2);
|
|
1497
|
+
if (typeof ResizeObserver === 'function') {
|
|
1498
|
+
if (!ro) ro = new ResizeObserver(queue);
|
|
1499
|
+
ro.disconnect();
|
|
1500
|
+
ro.observe(box);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
['pointerdown', 'click', 'keydown'].forEach(function (t) { document.addEventListener(t, markTrigger, true); });
|
|
1505
|
+
// A press outside the panel closes it (the bar's type menu first). The draft and type are kept.
|
|
1506
|
+
// Presses inside Heresay's own shadow DOM never count; its dimmed backdrop closes through its own click.
|
|
1507
|
+
document.addEventListener('pointerdown', function (e) {
|
|
1508
|
+
if (!scrim || !e.isTrusted) return;
|
|
1509
|
+
var path = pathOf(e), mine = path.indexOf(host) >= 0;
|
|
1510
|
+
if (barMenuClose) {
|
|
1511
|
+
var inMenu = path.some(function (n) { return n && n.classList && (n.classList.contains('bmenu') || n.classList.contains('tchip')); });
|
|
1512
|
+
if (!inMenu && barMenuClose()) { menuClosedAt = Date.now(); return; }
|
|
1513
|
+
}
|
|
1514
|
+
if (mine) return;
|
|
1515
|
+
closedBy = { el: recent && recent.el, t: Date.now() };
|
|
1516
|
+
close('outside');
|
|
1517
|
+
}, true);
|
|
1518
|
+
// Any element with data-heresay-open opens the panel from itself; the value may be a type.
|
|
1519
|
+
document.addEventListener('click', function (e) {
|
|
1520
|
+
var p = pathOf(e);
|
|
1521
|
+
if (p.indexOf(host) >= 0) return;
|
|
1522
|
+
var t = null;
|
|
1523
|
+
for (var i = 0; i < p.length && !t; i++) if (p[i] && p[i].nodeType === 1 && p[i].hasAttribute('data-heresay-open')) t = p[i];
|
|
1524
|
+
if (!t) return;
|
|
1525
|
+
if (t.tagName === 'A' && (!t.hasAttribute('href') || t.getAttribute('href') === '#')) e.preventDefault();
|
|
1526
|
+
if (scrim) { close(); return; }
|
|
1527
|
+
if (toggledOff(t)) return;
|
|
1528
|
+
window.Heresay.open({ type: (t.getAttribute('data-heresay-open') || '').toLowerCase().trim(), anchor: t });
|
|
1529
|
+
}, true);
|
|
1530
|
+
/** On a phone the bar docks above the keyboard: lift it by what the keyboard covers. */
|
|
1531
|
+
function keyboard() {
|
|
1532
|
+
if (!scrim) return;
|
|
1533
|
+
var v = window.visualViewport;
|
|
1534
|
+
scrim.style.setProperty('--fb-kb', Math.max(0, Math.round(window.innerHeight - v.height - v.offsetTop)) + 'px');
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
function close(how) {
|
|
1335
1538
|
if (!scrim) return;
|
|
1336
1539
|
if (view === 'mine') markSeen();
|
|
1540
|
+
if (window.visualViewport) {
|
|
1541
|
+
window.visualViewport.removeEventListener('resize', keyboard);
|
|
1542
|
+
window.visualViewport.removeEventListener('scroll', keyboard);
|
|
1543
|
+
}
|
|
1337
1544
|
scrim.remove();
|
|
1338
1545
|
scrim = null;
|
|
1339
|
-
|
|
1546
|
+
window.removeEventListener('scroll', queue, true);
|
|
1547
|
+
window.removeEventListener('resize', queue);
|
|
1548
|
+
if (ro) ro.disconnect();
|
|
1549
|
+
anchor = null;
|
|
1550
|
+
barMenuClose = null;
|
|
1551
|
+
listBox = null; hdDot = null; hdMine = null;
|
|
1340
1552
|
state.justSent = false;
|
|
1553
|
+
prefsOpen = false;
|
|
1341
1554
|
renderBadge();
|
|
1342
|
-
if (lastFocus && lastFocus.focus) lastFocus.focus();
|
|
1555
|
+
if (how !== 'outside' && lastFocus && lastFocus.focus && lastFocus.isConnected !== false) lastFocus.focus();
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
var CLOSE_ICON = 'M6 6l12 12M18 6L6 18';
|
|
1559
|
+
/** A small line icon. The path is always one of the constants in this file. */
|
|
1560
|
+
function icon(d) {
|
|
1561
|
+
var s = document.createElement('span');
|
|
1562
|
+
s.style.display = 'contents';
|
|
1563
|
+
s.innerHTML = '<svg class="ic" viewBox="0 0 24 24" aria-hidden="true">' + (d.charAt(0) === '<' ? d : '<path d="' + d + '"/>') + '</svg>';
|
|
1564
|
+
return s.firstChild;
|
|
1565
|
+
}
|
|
1566
|
+
function closeBtn() {
|
|
1567
|
+
return el('button', { class: 'ib', type: 'button', 'aria-label': S.close, onclick: close }, [icon(CLOSE_ICON)]);
|
|
1568
|
+
}
|
|
1569
|
+
/** One line, on every view: who reads it, and the outside tool. Not configurable. */
|
|
1570
|
+
function foot(short) {
|
|
1571
|
+
return el('div', { class: 'foot' }, [
|
|
1572
|
+
short ? null : document.createTextNode(S.sentTo + ' · '),
|
|
1573
|
+
el('a', { href: HERESAY_URL, target: '_blank', rel: 'noopener', text: S.powered }),
|
|
1574
|
+
]);
|
|
1343
1575
|
}
|
|
1344
1576
|
|
|
1345
1577
|
function renderPanel() {
|
|
1578
|
+
if (view === 'sent' && !state.justSent) view = 'new';
|
|
1346
1579
|
scrim.textContent = '';
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
el('button', { class: 'x', type: 'button', 'aria-label': S.close, text: '×', onclick: close }),
|
|
1358
|
-
]),
|
|
1359
|
-
el('div', { class: 'main' }, [view === 'new' ? formView() : view === 'prefs' ? prefsView() : listView()]),
|
|
1360
|
-
byline(view === 'new'),
|
|
1580
|
+
scrim.className = surface();
|
|
1581
|
+
barMenuClose = null;
|
|
1582
|
+
hdDot = hdMine = null;
|
|
1583
|
+
if (barUp()) { renderBar(); place(); return; }
|
|
1584
|
+
var body, first, picking = LAYOUT === 'steps' && view === 'new' && !state.type;
|
|
1585
|
+
if (view === 'sent') body = sentView();
|
|
1586
|
+
else if (view === 'mine') body = listView();
|
|
1587
|
+
else body = LAYOUT === 'steps' ? stepsView() : formView();
|
|
1588
|
+
var panel = el('div', { class: 'panel', role: 'dialog', 'aria-modal': 'true', 'aria-label': S.dialog, tabindex: '-1' }, [
|
|
1589
|
+
el('div', { class: 'grab', 'aria-hidden': 'true' }, [el('i')]), body, foot(picking),
|
|
1361
1590
|
]);
|
|
1362
1591
|
scrim.appendChild(panel);
|
|
1363
|
-
|
|
1592
|
+
place();
|
|
1593
|
+
renderBadge();
|
|
1594
|
+
first = panel.querySelector(view === 'sent' ? '.send' : view === 'mine' ? '.ib' : state.type ? 'textarea' : picking ? '.pick' : '[role=radio]');
|
|
1595
|
+
// On touch, a focused pill or row would look picked before anyone tapped it: focus the dialog itself.
|
|
1596
|
+
if (first && (first.getAttribute('role') === 'radio' || first.classList.contains('pick')) && media('(pointer: coarse)')) first = panel;
|
|
1364
1597
|
if (first) first.focus();
|
|
1365
1598
|
}
|
|
1366
1599
|
|
|
1600
|
+
/** A report goes: the same for every layout. `busy` and `idle` change the send control. */
|
|
1601
|
+
function submit(text, err, busy, idle) {
|
|
1602
|
+
err.textContent = '';
|
|
1603
|
+
busy();
|
|
1604
|
+
var type = state.type;
|
|
1605
|
+
send(type, text.value.trim()).then(function (b) {
|
|
1606
|
+
state.type = null;
|
|
1607
|
+
state.draft = '';
|
|
1608
|
+
state.reports = [b.report].concat(state.reports);
|
|
1609
|
+
rememberMine();
|
|
1610
|
+
state.justSent = true;
|
|
1611
|
+
view = 'sent';
|
|
1612
|
+
renderPanel();
|
|
1613
|
+
listeners.forEach(function (fn) { try { fn({ id: b.report && b.report.id, type: type }); } catch (x) { console.error(x); } });
|
|
1614
|
+
}).catch(function (x) {
|
|
1615
|
+
err.textContent = x.message || S.cantSend;
|
|
1616
|
+
idle();
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
function typeOf(id) { return OFFERED.filter(function (x) { return x.id === id; })[0]; }
|
|
1620
|
+
|
|
1367
1621
|
function formView() {
|
|
1368
1622
|
var err = el('div', { class: 'err', role: 'alert' });
|
|
1369
1623
|
var text = el('textarea', {
|
|
1370
|
-
'aria-label': S.
|
|
1371
|
-
|
|
1372
|
-
oninput: function () { state.draft = text.value; },
|
|
1624
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '4',
|
|
1625
|
+
oninput: function () { state.draft = text.value; sync(); },
|
|
1373
1626
|
});
|
|
1374
1627
|
text.value = state.draft;
|
|
1375
1628
|
var sendBtn = el('button', { class: 'send', type: 'submit', text: S.send });
|
|
1376
|
-
|
|
1629
|
+
function sync() {
|
|
1630
|
+
var t = typeOf(state.type);
|
|
1631
|
+
text.placeholder = PLACEHOLDER || (t ? t.ph : S.phNone);
|
|
1632
|
+
sendBtn.disabled = !(state.type && text.value.trim());
|
|
1633
|
+
}
|
|
1634
|
+
function choose(i, focusText) {
|
|
1635
|
+
state.type = OFFERED[i].id;
|
|
1636
|
+
pills.forEach(function (b, j) { b.setAttribute('aria-checked', String(j === i)); b.tabIndex = j === i ? 0 : -1; });
|
|
1637
|
+
sync();
|
|
1638
|
+
pills[i].scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
1639
|
+
if (focusText) text.focus();
|
|
1640
|
+
}
|
|
1641
|
+
var picked = OFFERED.map(function (t) { return t.id; }).indexOf(state.type);
|
|
1642
|
+
var pills = OFFERED.map(function (t, i) {
|
|
1377
1643
|
return el('button', {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
text.focus();
|
|
1383
|
-
},
|
|
1384
|
-
}, [el('b', { text: t.label }), el('span', { text: t.hint })]);
|
|
1644
|
+
type: 'button', role: 'radio', 'aria-checked': String(i === picked), tabindex: i === (picked < 0 ? 0 : picked) ? '0' : '-1',
|
|
1645
|
+
'data-type': t.id, text: t.label,
|
|
1646
|
+
onclick: function () { choose(i, true); },
|
|
1647
|
+
});
|
|
1385
1648
|
});
|
|
1386
|
-
var
|
|
1387
|
-
|
|
1649
|
+
var seg = el('div', {
|
|
1650
|
+
class: 'seg', role: 'radiogroup', 'aria-label': S.kindAria,
|
|
1651
|
+
onkeydown: function (e) {
|
|
1652
|
+
var i = pills.indexOf(root.activeElement), n = pills.length, k = e.key;
|
|
1653
|
+
if (i < 0) return;
|
|
1654
|
+
var to = k === 'ArrowRight' || k === 'ArrowDown' ? (i + 1) % n : k === 'ArrowLeft' || k === 'ArrowUp' ? (i + n - 1) % n : -1;
|
|
1655
|
+
if (to < 0) return;
|
|
1388
1656
|
e.preventDefault();
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
if (!text.value.trim()) { err.textContent = S.sayWhat; text.focus(); return; }
|
|
1392
|
-
sendBtn.disabled = true;
|
|
1393
|
-
sendBtn.className = 'send busy';
|
|
1394
|
-
sendBtn.replaceChildren(markEl(true), document.createTextNode(S.sending));
|
|
1395
|
-
var type = state.type;
|
|
1396
|
-
send(type, text.value.trim()).then(function (b) {
|
|
1397
|
-
state.type = null;
|
|
1398
|
-
state.draft = '';
|
|
1399
|
-
state.reports = [b.report].concat(state.reports);
|
|
1400
|
-
rememberMine();
|
|
1401
|
-
markSeen();
|
|
1402
|
-
state.justSent = true;
|
|
1403
|
-
view = 'mine';
|
|
1404
|
-
renderPanel();
|
|
1405
|
-
listeners.forEach(function (fn) { try { fn({ id: b.report && b.report.id, type: type }); } catch (x) { console.error(x); } });
|
|
1406
|
-
}).catch(function (x) {
|
|
1407
|
-
err.textContent = x.message || S.cantSend;
|
|
1408
|
-
sendBtn.disabled = false;
|
|
1409
|
-
sendBtn.className = 'send';
|
|
1410
|
-
sendBtn.textContent = S.send;
|
|
1411
|
-
});
|
|
1657
|
+
pills[to].focus();
|
|
1658
|
+
choose(to);
|
|
1412
1659
|
},
|
|
1413
|
-
},
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
sendBtn,
|
|
1660
|
+
}, pills);
|
|
1661
|
+
sync();
|
|
1662
|
+
return el('div', { class: 'view' }, [
|
|
1663
|
+
el('div', { class: 'hd' }, [
|
|
1664
|
+
markEl(), el('h2', { text: S.report }), el('span', { class: 'sp' }),
|
|
1665
|
+
mineBtn(), closeBtn(),
|
|
1420
1666
|
]),
|
|
1421
|
-
|
|
1667
|
+
el('form', {
|
|
1668
|
+
class: 'pad', novalidate: '',
|
|
1669
|
+
onsubmit: function (e) {
|
|
1670
|
+
e.preventDefault();
|
|
1671
|
+
if (sendBtn.disabled) return;
|
|
1672
|
+
submit(text, err, function () {
|
|
1673
|
+
sendBtn.disabled = true;
|
|
1674
|
+
sendBtn.className = 'send busy';
|
|
1675
|
+
sendBtn.replaceChildren(markEl(true), document.createTextNode(S.sending));
|
|
1676
|
+
}, function () {
|
|
1677
|
+
sendBtn.className = 'send';
|
|
1678
|
+
sendBtn.textContent = S.send;
|
|
1679
|
+
sync();
|
|
1680
|
+
});
|
|
1681
|
+
},
|
|
1682
|
+
}, [seg, text, sendBtn, err]),
|
|
1422
1683
|
]);
|
|
1423
|
-
return form;
|
|
1424
1684
|
}
|
|
1425
1685
|
|
|
1426
|
-
|
|
1427
|
-
* "Attach what happened": the reporter sees what the trail holds, can look at every line of it,
|
|
1428
|
-
* and can switch it off or leave a part out. Nothing shows when there is nothing to attach.
|
|
1429
|
-
*/
|
|
1430
|
-
function trailView() {
|
|
1431
|
-
var ev = recentTrail();
|
|
1432
|
-
if (!ev.length) return null;
|
|
1433
|
-
var count = {};
|
|
1434
|
-
ev.forEach(function (e) { count[e.kind] = (count[e.kind] || 0) + e.n; });
|
|
1435
|
-
var box = el('div', { class: 'trail' + (state.trailOff ? ' off' : '') });
|
|
1436
|
-
var on = el('input', { type: 'checkbox', role: 'switch', onchange: function () {
|
|
1437
|
-
state.trailOff = !on.checked;
|
|
1438
|
-
box.className = 'trail' + (state.trailOff ? ' off' : '');
|
|
1439
|
-
} });
|
|
1440
|
-
on.checked = !state.trailOff;
|
|
1441
|
-
var chips = ['page', 'click', 'request', 'error', 'warn', 'state'].filter(function (k) { return count[k]; }).map(function (k) {
|
|
1442
|
-
var n = count[k];
|
|
1443
|
-
var b = el('button', {
|
|
1444
|
-
class: 'chip', type: 'button', 'aria-pressed': String(!state.trailSkip[k]),
|
|
1445
|
-
text: n + ' ' + S.trail[k][n === 1 ? 0 : 1],
|
|
1446
|
-
onclick: function () {
|
|
1447
|
-
state.trailSkip[k] = !state.trailSkip[k];
|
|
1448
|
-
b.setAttribute('aria-pressed', String(!state.trailSkip[k]));
|
|
1449
|
-
list.querySelectorAll('[data-k="' + k + '"]').forEach(function (li) { li.classList.toggle('skip', !!state.trailSkip[k]); });
|
|
1450
|
-
},
|
|
1451
|
-
});
|
|
1452
|
-
return b;
|
|
1453
|
-
});
|
|
1454
|
-
var now = Date.now();
|
|
1455
|
-
var list = el('ol', { class: 'tlist' }, ev.map(function (e) {
|
|
1456
|
-
var secs = Math.round((now - e.at) / 1000);
|
|
1457
|
-
return el('li', { 'data-k': e.kind, class: state.trailSkip[e.kind] ? 'skip' : '' }, [
|
|
1458
|
-
el('span', { class: 'ago', text: '-' + Math.floor(secs / 60) + ':' + ('0' + secs % 60).slice(-2) }),
|
|
1459
|
-
el('span', { text: e.text + (e.n > 1 ? ' ×' + e.n : '') }),
|
|
1460
|
-
]);
|
|
1461
|
-
}));
|
|
1462
|
-
box.appendChild(el('label', { class: 'switch' }, [on, el('span', { text: S.attachTrail })]));
|
|
1463
|
-
box.appendChild(el('div', { class: 'chips' }, chips));
|
|
1464
|
-
var c = context();
|
|
1465
|
-
var device = [c.device, c.screen, c.theme, c.locale, c.timezone, c.network, c.settings].filter(Boolean).join(' · ');
|
|
1466
|
-
box.appendChild(el('details', {}, [el('summary', { text: S.seeTrail }), el('p', { class: 'small', text: S.trailHint }), list,
|
|
1467
|
-
device ? el('p', { class: 'small', text: S.alsoSent + device }) : null]));
|
|
1468
|
-
return box;
|
|
1469
|
-
}
|
|
1686
|
+
// ---- the layouts -----------------------------------------------------------------------
|
|
1470
1687
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1688
|
+
var TYPE_ICON = {
|
|
1689
|
+
broken: '<path d="M12 4 21.2 19.5H2.8z"/><path d="M12 10v4M12 17h.01"/>',
|
|
1690
|
+
confusing: '<circle cx="12" cy="12" r="9"/><path d="M9.5 9.6a2.6 2.6 0 1 1 3.6 2.4c-.8.4-1.1 1-1.1 1.8M12 17h.01"/>',
|
|
1691
|
+
improvement: '<path d="M3 17l6-6 4 4 8-8"/><path d="M15 7h6v6"/>',
|
|
1692
|
+
idea: '<path d="M9.6 18h4.8M10.2 21h3.6"/><path d="M12 3a6 6 0 0 0-3.6 10.8c.6.5 1.1 1.2 1.1 2.2h5c0-1 .5-1.7 1.1-2.2A6 6 0 0 0 12 3z"/>',
|
|
1693
|
+
};
|
|
1694
|
+
function typeIcon(id) { return icon(TYPE_ICON[id] || TYPE_ICON.idea); }
|
|
1695
|
+
|
|
1696
|
+
/** The "Your reports" icon (a clock) with a dot when something has an update. Steps and bar. */
|
|
1697
|
+
function mineIcon() {
|
|
1698
|
+
hdDot = el('i', { class: 'udot', hidden: '' });
|
|
1699
|
+
hdMine = el('button', { class: 'ib ibd', type: 'button', 'aria-label': S.mine, title: S.mine,
|
|
1700
|
+
onclick: function () { view = 'mine'; renderPanel(); } }, [icon(DONE_ICON.open), hdDot]);
|
|
1701
|
+
return hdMine;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
/** Steps: first "What's going on?" with a row for each type, then the text box for the one picked. */
|
|
1705
|
+
function stepsView() {
|
|
1706
|
+
if (!state.type) {
|
|
1707
|
+
return el('div', { class: 'view' }, [
|
|
1708
|
+
el('div', { class: 'hd' }, [markEl(), el('h2', { class: 'q', text: S.whatsGoing }), el('span', { class: 'sp' }), mineIcon(), closeBtn()]),
|
|
1709
|
+
el('ul', { class: 'rows', role: 'list', 'aria-label': S.kindAria }, OFFERED.map(function (t) {
|
|
1710
|
+
return el('li', {}, [el('button', {
|
|
1711
|
+
class: 'pick', type: 'button', 'data-type': t.id,
|
|
1712
|
+
onclick: function () { state.type = t.id; renderPanel(); },
|
|
1713
|
+
}, [
|
|
1714
|
+
el('span', { class: 'tile' }, [typeIcon(t.id)]), el('span', { class: 'nm', text: t.label }),
|
|
1715
|
+
el('span', { class: 'chev', 'aria-hidden': 'true' }, [icon('M9 6l6 6-6 6')]),
|
|
1716
|
+
])]);
|
|
1717
|
+
})),
|
|
1479
1718
|
]);
|
|
1480
|
-
}
|
|
1481
|
-
var
|
|
1482
|
-
var email = el('input', { type: 'email', maxlength: '200', autocomplete: 'email' });
|
|
1483
|
-
var note = el('textarea', { maxlength: '500', placeholder: S.setupPh });
|
|
1484
|
-
name.value = p.name || ''; email.value = p.email || ''; note.value = p.note || '';
|
|
1719
|
+
}
|
|
1720
|
+
var t = typeOf(state.type);
|
|
1485
1721
|
var err = el('div', { class: 'err', role: 'alert' });
|
|
1722
|
+
var text = el('textarea', {
|
|
1723
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '4',
|
|
1724
|
+
placeholder: PLACEHOLDER || t.ph,
|
|
1725
|
+
oninput: function () { state.draft = text.value; sync(); },
|
|
1726
|
+
});
|
|
1727
|
+
text.value = state.draft;
|
|
1728
|
+
var sendBtn = el('button', { class: 'send', type: 'submit', text: S.send });
|
|
1729
|
+
function sync() { sendBtn.disabled = !text.value.trim(); }
|
|
1730
|
+
sync();
|
|
1731
|
+
return el('div', { class: 'view' }, [
|
|
1732
|
+
el('div', { class: 'hd back' }, [
|
|
1733
|
+
el('button', { class: 'ib', type: 'button', 'aria-label': S.backType, title: S.backType, onclick: function () { state.type = null; renderPanel(); } }, [icon('M15 5l-7 7 7 7')]),
|
|
1734
|
+
el('span', { class: 'tpill' }, [typeIcon(t.id), document.createTextNode(t.label)]),
|
|
1735
|
+
el('span', { class: 'sp' }), mineIcon(), closeBtn(),
|
|
1736
|
+
]),
|
|
1737
|
+
el('form', {
|
|
1738
|
+
class: 'pad big', novalidate: '',
|
|
1739
|
+
onsubmit: function (e) {
|
|
1740
|
+
e.preventDefault();
|
|
1741
|
+
if (sendBtn.disabled) return;
|
|
1742
|
+
submit(text, err, function () {
|
|
1743
|
+
sendBtn.disabled = true;
|
|
1744
|
+
sendBtn.className = 'send busy';
|
|
1745
|
+
sendBtn.replaceChildren(markEl(true), document.createTextNode(S.sending));
|
|
1746
|
+
}, function () {
|
|
1747
|
+
sendBtn.className = 'send';
|
|
1748
|
+
sendBtn.textContent = S.send;
|
|
1749
|
+
sync();
|
|
1750
|
+
});
|
|
1751
|
+
},
|
|
1752
|
+
}, [text, sendBtn, err]),
|
|
1753
|
+
]);
|
|
1754
|
+
}
|
|
1486
1755
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1756
|
+
// Closes the bar's type menu and says whether it was open; set while the bar is showing.
|
|
1757
|
+
var barMenuClose = null;
|
|
1758
|
+
|
|
1759
|
+
/** Bar: one compact composer. [Type v] [text.....] (send), then Your reports, Powered by, close. */
|
|
1760
|
+
function renderBar() {
|
|
1761
|
+
var box, focus;
|
|
1762
|
+
var wrap = function (kids) {
|
|
1763
|
+
return el('div', { class: 'barbox', role: 'dialog', 'aria-modal': 'false', 'aria-label': S.dialog, tabindex: '-1' }, kids);
|
|
1764
|
+
};
|
|
1765
|
+
if (view === 'sent') {
|
|
1766
|
+
box = wrap([el('div', { class: 'bsent', role: 'status' }, [
|
|
1767
|
+
el('div', { class: 'chk', 'aria-hidden': 'true' }, [icon('M5 12.5l4.5 4.5L19 7.5')]),
|
|
1768
|
+
el('p', { text: THANKS || S.sentBar }),
|
|
1769
|
+
el('button', { class: 'send sm', type: 'button', text: S.done, onclick: close }),
|
|
1770
|
+
])]);
|
|
1771
|
+
scrim.appendChild(box);
|
|
1772
|
+
focus = box.querySelector('.send');
|
|
1773
|
+
} else {
|
|
1774
|
+
var err = el('div', { class: 'err', role: 'alert' });
|
|
1775
|
+
var text = el('textarea', {
|
|
1776
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '1',
|
|
1777
|
+
oninput: function () { state.draft = text.value; grow(); sync(); },
|
|
1778
|
+
onkeydown: function (e) {
|
|
1779
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) { e.preventDefault(); form.requestSubmit ? form.requestSubmit() : go(); }
|
|
1780
|
+
},
|
|
1781
|
+
});
|
|
1782
|
+
text.value = state.draft;
|
|
1783
|
+
var go = function () { form.dispatchEvent(new Event('submit', { cancelable: true })); };
|
|
1784
|
+
var sendBtn = el('button', { class: 'bsend', type: 'submit', 'aria-label': S.send, title: S.send }, [icon('M12 19V5M5 12l7-7 7 7')]);
|
|
1785
|
+
var chip = el('button', { class: 'tchip', type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': 'false' });
|
|
1786
|
+
var menu = el('div', { class: 'bmenu', role: 'menu', 'aria-label': S.kindAria, hidden: '' });
|
|
1787
|
+
var items = OFFERED.map(function (t) {
|
|
1788
|
+
return el('button', { type: 'button', role: 'menuitemradio', tabindex: '-1', 'data-type': t.id, 'aria-checked': 'false' },
|
|
1789
|
+
[typeIcon(t.id), document.createTextNode(t.label)]);
|
|
1790
|
+
});
|
|
1791
|
+
items.forEach(function (b, i) { b.addEventListener('click', function () { choose(i); }); menu.appendChild(b); });
|
|
1792
|
+
var grow = function () {
|
|
1793
|
+
text.style.height = 'auto';
|
|
1794
|
+
text.style.height = Math.min(text.scrollHeight, 120) + 'px';
|
|
1795
|
+
};
|
|
1796
|
+
var sync = function () {
|
|
1797
|
+
var t = typeOf(state.type);
|
|
1798
|
+
text.placeholder = PLACEHOLDER || (t ? t.ph : S.tellTeam);
|
|
1799
|
+
sendBtn.disabled = !(state.type && text.value.trim());
|
|
1800
|
+
chip.textContent = '';
|
|
1801
|
+
if (t) chip.appendChild(typeIcon(t.id));
|
|
1802
|
+
chip.appendChild(el('span', { text: t ? t.label : S.typeChip }));
|
|
1803
|
+
chip.appendChild(el('span', { class: 'caret' }, [icon('M6 9l6 6 6-6')]));
|
|
1804
|
+
chip.setAttribute('aria-label', S.kindAria + (t ? ': ' + t.label : ''));
|
|
1805
|
+
items.forEach(function (b) { b.setAttribute('aria-checked', String(b.getAttribute('data-type') === state.type)); });
|
|
1806
|
+
};
|
|
1807
|
+
var shut = function (back) {
|
|
1808
|
+
if (menu.hidden) return false;
|
|
1809
|
+
menu.hidden = true; chip.setAttribute('aria-expanded', 'false');
|
|
1810
|
+
if (back) chip.focus();
|
|
1811
|
+
return true;
|
|
1812
|
+
};
|
|
1813
|
+
var show = function (last) {
|
|
1814
|
+
menu.hidden = false; chip.setAttribute('aria-expanded', 'true');
|
|
1815
|
+
var at = Math.max(0, OFFERED.map(function (t) { return t.id; }).indexOf(state.type));
|
|
1816
|
+
items[last ? items.length - 1 : at].focus();
|
|
1817
|
+
};
|
|
1818
|
+
barMenuClose = shut;
|
|
1819
|
+
var choose = function (i) {
|
|
1820
|
+
state.type = OFFERED[i].id;
|
|
1821
|
+
shut(false); sync(); text.focus();
|
|
1822
|
+
};
|
|
1823
|
+
chip.addEventListener('click', function () { if (menu.hidden) show(); else shut(true); });
|
|
1824
|
+
chip.addEventListener('keydown', function (e) {
|
|
1825
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); show(); }
|
|
1826
|
+
else if (e.key === 'ArrowUp') { e.preventDefault(); show(true); }
|
|
1827
|
+
});
|
|
1828
|
+
menu.addEventListener('keydown', function (e) {
|
|
1829
|
+
var i = items.indexOf(root.activeElement), n = items.length, k = e.key;
|
|
1830
|
+
if (k === 'Escape') { e.preventDefault(); e.stopPropagation(); shut(true); }
|
|
1831
|
+
else if (k === 'Tab') shut(false);
|
|
1832
|
+
else if (k === 'ArrowDown' || k === 'ArrowUp' || k === 'Home' || k === 'End') {
|
|
1833
|
+
e.preventDefault();
|
|
1834
|
+
items[k === 'Home' ? 0 : k === 'End' ? n - 1 : k === 'ArrowDown' ? (i + 1) % n : (i + n - 1) % n].focus();
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
var form = el('form', {
|
|
1838
|
+
class: 'bin', novalidate: '',
|
|
1839
|
+
onsubmit: function (e) {
|
|
1840
|
+
e.preventDefault();
|
|
1841
|
+
if (sendBtn.disabled) return;
|
|
1842
|
+
submit(text, err, function () {
|
|
1843
|
+
sendBtn.disabled = true; sendBtn.classList.add('busy'); text.readOnly = true;
|
|
1844
|
+
sendBtn.replaceChildren(markEl(true));
|
|
1845
|
+
sendBtn.setAttribute('aria-label', S.sending);
|
|
1846
|
+
}, function () {
|
|
1847
|
+
sendBtn.classList.remove('busy'); text.readOnly = false;
|
|
1848
|
+
sendBtn.replaceChildren(icon('M12 19V5M5 12l7-7 7 7'));
|
|
1849
|
+
sendBtn.setAttribute('aria-label', S.send);
|
|
1850
|
+
sync();
|
|
1851
|
+
});
|
|
1852
|
+
},
|
|
1853
|
+
}, [chip, text, sendBtn]);
|
|
1854
|
+
box = wrap([menu, form, err, el('div', { class: 'bmeta' }, [
|
|
1855
|
+
mineIcon(), el('span', { class: 'sp' }),
|
|
1856
|
+
el('span', { class: 'foot2' }, [el('a', { href: HERESAY_URL, target: '_blank', rel: 'noopener', text: S.powered })]),
|
|
1857
|
+
closeBtn(),
|
|
1858
|
+
])]);
|
|
1859
|
+
scrim.appendChild(box);
|
|
1860
|
+
sync(); grow();
|
|
1861
|
+
// On touch, a focused chip would look pressed before anyone tapped it: focus the bar itself.
|
|
1862
|
+
focus = state.type ? text : media('(pointer: coarse)') ? box : chip;
|
|
1501
1863
|
}
|
|
1864
|
+
renderBadge();
|
|
1865
|
+
if (focus) focus.focus();
|
|
1866
|
+
}
|
|
1502
1867
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
},
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
el('div', { class: 'row' }, [
|
|
1520
|
-
el('button', { class: 'link', type: 'button', text: S.clear, onclick: function () {
|
|
1521
|
-
savePrefs({});
|
|
1522
|
-
renderPanel();
|
|
1523
|
-
} }),
|
|
1524
|
-
el('span', {}, [status, document.createTextNode(' '), el('button', { class: 'send', type: 'submit', text: S.save })]),
|
|
1868
|
+
/** The quiet "Your reports" button in the header, with a dot when something has an update. */
|
|
1869
|
+
function mineBtn() {
|
|
1870
|
+
hdDot = el('i', { class: 'udot', hidden: '' });
|
|
1871
|
+
hdMine = el('button', { class: 'quiet', type: 'button', onclick: function () { view = 'mine'; renderPanel(); } },
|
|
1872
|
+
[document.createTextNode(S.mine), hdDot]);
|
|
1873
|
+
return hdMine;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
function sentView() {
|
|
1877
|
+
return el('div', { class: 'view' }, [
|
|
1878
|
+
el('div', { class: 'hd' }, [el('span', { class: 'sp' }), closeBtn()]),
|
|
1879
|
+
el('div', { class: 'view sent', role: 'status' }, [
|
|
1880
|
+
el('div', { class: 'chk', 'aria-hidden': 'true' }, [icon('M5 12.5l4.5 4.5L19 7.5')]),
|
|
1881
|
+
el('p', { text: S.sentMsg }),
|
|
1882
|
+
THANKS ? el('p', { class: 'thanks', text: THANKS }) : null,
|
|
1883
|
+
el('button', { class: 'send', type: 'button', text: S.done, onclick: close }),
|
|
1525
1884
|
]),
|
|
1526
|
-
err,
|
|
1527
|
-
el('p', { class: 'small', text: S.kept }),
|
|
1528
1885
|
]);
|
|
1529
1886
|
}
|
|
1530
1887
|
|
|
1531
1888
|
function listView() {
|
|
1532
|
-
listBox = el('div', {
|
|
1889
|
+
listBox = el('div', { class: 'cards' });
|
|
1533
1890
|
renderList();
|
|
1534
|
-
return
|
|
1891
|
+
return el('div', { class: 'view' }, [
|
|
1892
|
+
el('div', { class: 'hd back' }, [
|
|
1893
|
+
el('button', { class: 'ib', type: 'button', 'aria-label': S.back, onclick: function () { markSeen(); view = 'new'; renderPanel(); } }, [icon('M15 5l-7 7 7 7')]),
|
|
1894
|
+
el('h2', { text: S.mine }), el('span', { class: 'sp' }), closeBtn(),
|
|
1895
|
+
]),
|
|
1896
|
+
listBox,
|
|
1897
|
+
PREFS_ROW ? prefsRow() : null,
|
|
1898
|
+
]);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* "Your name and email": two optional fields, kept on this device and sent with each report.
|
|
1903
|
+
* Signed in (the app called identify), it only says who, and asks for nothing.
|
|
1904
|
+
*/
|
|
1905
|
+
function prefsRow() {
|
|
1906
|
+
if (identified()) {
|
|
1907
|
+
return el('div', { class: 'prefs' }, [el('div', { class: 'signed', text: fmt(S.signedAs, { who: state.userLabel || state.userEmail || S.yourAccount }) })]);
|
|
1908
|
+
}
|
|
1909
|
+
var p = prefs();
|
|
1910
|
+
var name = el('input', { id: 'fb-name', type: 'text', maxlength: '80', autocomplete: 'name' });
|
|
1911
|
+
var email = el('input', { id: 'fb-email', type: 'email', maxlength: '200', autocomplete: 'email' });
|
|
1912
|
+
var status = el('p', { class: 'small', role: 'status' });
|
|
1913
|
+
var err = el('div', { class: 'err', role: 'alert' });
|
|
1914
|
+
name.value = p.name || ''; email.value = p.email || '';
|
|
1915
|
+
function keep() {
|
|
1916
|
+
var em = email.value.trim(), ok = !em || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(em);
|
|
1917
|
+
err.textContent = ok ? '' : S.badEmail;
|
|
1918
|
+
if (!ok) { status.textContent = ''; return; }
|
|
1919
|
+
var q = prefs();
|
|
1920
|
+
savePrefs({ name: name.value.trim(), email: em, note: q.note });
|
|
1921
|
+
status.textContent = S.saved;
|
|
1922
|
+
}
|
|
1923
|
+
name.addEventListener('change', keep);
|
|
1924
|
+
email.addEventListener('change', keep);
|
|
1925
|
+
var box = el('div', { class: 'pb', id: 'fb-pb', hidden: '' }, [
|
|
1926
|
+
el('label', { for: 'fb-name', text: S.nameOpt }), name,
|
|
1927
|
+
el('label', { for: 'fb-email', text: S.emailOpt }), email, err, status,
|
|
1928
|
+
]);
|
|
1929
|
+
var btn = el('button', { type: 'button', 'aria-expanded': 'false', 'aria-controls': 'fb-pb' }, [
|
|
1930
|
+
document.createTextNode(S.nameEmail), icon('M6 9l6 6 6-6'),
|
|
1931
|
+
]);
|
|
1932
|
+
function setOpen(o, focus) {
|
|
1933
|
+
prefsOpen = o;
|
|
1934
|
+
btn.setAttribute('aria-expanded', String(o));
|
|
1935
|
+
if (o) box.removeAttribute('hidden'); else box.setAttribute('hidden', '');
|
|
1936
|
+
if (o && focus) name.focus();
|
|
1937
|
+
}
|
|
1938
|
+
btn.addEventListener('click', function () { setOpen(!prefsOpen, true); });
|
|
1939
|
+
setOpen(prefsOpen, false);
|
|
1940
|
+
return el('div', { class: 'prefs' }, [btn, box]);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
var DONE_ICON = { open: '<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>', fixed: 'M5 12.5l4.5 4.5L19 7.5', declined: 'M7 7l10 10M17 7L7 17', withdrawn: 'M7 12h10' };
|
|
1944
|
+
/** "Today", "Yesterday", or the date, in the reporter's language. */
|
|
1945
|
+
function when(iso) {
|
|
1946
|
+
var d = new Date(iso);
|
|
1947
|
+
if (isNaN(d)) return '';
|
|
1948
|
+
var days = Math.round((new Date().setHours(0, 0, 0, 0) - new Date(d).setHours(0, 0, 0, 0)) / 864e5);
|
|
1949
|
+
try {
|
|
1950
|
+
if (days >= 0 && days <= 1) {
|
|
1951
|
+
var w = new Intl.RelativeTimeFormat(LANG, { numeric: 'auto' }).format(-days, 'day');
|
|
1952
|
+
return w.charAt(0).toLocaleUpperCase(LANG) + w.slice(1);
|
|
1953
|
+
}
|
|
1954
|
+
} catch (e) { /* older browser: the date */ }
|
|
1955
|
+
return d.toLocaleDateString(LANG);
|
|
1535
1956
|
}
|
|
1536
1957
|
|
|
1537
1958
|
function renderList() {
|
|
1538
1959
|
if (!listBox) return;
|
|
1539
1960
|
listBox.textContent = '';
|
|
1540
|
-
if (state.justSent && THANKS) listBox.appendChild(el('div', { class: 'thanks', role: 'status', text: THANKS }));
|
|
1541
1961
|
if (!state.reports.length) {
|
|
1542
1962
|
listBox.appendChild(el('div', { class: 'empty', text: S.none }));
|
|
1543
1963
|
return;
|
|
@@ -1546,22 +1966,26 @@
|
|
|
1546
1966
|
state.reports.forEach(function (r) {
|
|
1547
1967
|
var label = (TYPES.filter(function (t) { return t.id === r.type; })[0] || {}).label || r.type;
|
|
1548
1968
|
var fresh = r.status !== 'open' && r.status !== 'withdrawn' && s[r.id] !== mark(r);
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
el('div', { class: '
|
|
1552
|
-
|
|
1969
|
+
var d = DONE_ICON[r.status === 'accepted' ? 'open' : r.status];
|
|
1970
|
+
listBox.appendChild(el('article', { class: 'card' }, [
|
|
1971
|
+
el('div', { class: 'top' }, [
|
|
1972
|
+
el('b', { text: label }), el('span', { text: '·' }), el('span', { text: when(r.created_at) }),
|
|
1973
|
+
fresh ? el('i', { class: 'udot', role: 'img', 'aria-label': S.fresh }) : null,
|
|
1974
|
+
]),
|
|
1975
|
+
el('p', { class: 't', text: r.text }),
|
|
1976
|
+
el('span', { class: 'chip' + (r.status === 'fixed' ? ' fx' : '') }, [d ? icon(d) : null, document.createTextNode(S.status[r.status] || r.status)]),
|
|
1553
1977
|
r.status === 'declined' && r.decline_reason
|
|
1554
|
-
? el('
|
|
1555
|
-
r.status === 'fixed' && r.fix_note
|
|
1556
|
-
? el('div', { class: 'reason', text: r.fix_note }) : null,
|
|
1978
|
+
? el('p', { class: 'n2' }, [el('b', { text: S.why }), document.createTextNode(r.decline_reason)]) : null,
|
|
1979
|
+
r.status === 'fixed' && r.fix_note ? el('p', { class: 'n2', text: r.fix_note }) : null,
|
|
1557
1980
|
r.status === 'fixed' && r.fix_version
|
|
1558
|
-
? el('
|
|
1559
|
-
r.status === 'withdrawn' && r.withdrawn_reason ? el('
|
|
1981
|
+
? el('p', { class: 'n2', text: fmt(S.fixedIn, { v: r.fix_version }) + (older(state.version, r.fix_version) ? ' ' + fmt(S.updateTo, { v: r.fix_version }) : '') }) : null,
|
|
1982
|
+
r.status === 'withdrawn' && r.withdrawn_reason ? el('p', { class: 'n2', text: S.yourWhy + r.withdrawn_reason }) : null,
|
|
1560
1983
|
r.status === 'open' ? takeBack(r) : null,
|
|
1561
1984
|
]));
|
|
1562
1985
|
});
|
|
1563
1986
|
}
|
|
1564
1987
|
|
|
1988
|
+
|
|
1565
1989
|
/** "Take back": a report they sent and the team hasn't accepted. Kept as withdrawn, not deleted. */
|
|
1566
1990
|
function takeBack(r) {
|
|
1567
1991
|
var box = el('div', { class: 'take-back' });
|
|
@@ -1573,7 +1997,7 @@
|
|
|
1573
1997
|
box.appendChild(why);
|
|
1574
1998
|
box.appendChild(el('div', { class: 'row' }, [
|
|
1575
1999
|
el('button', { class: 'link', type: 'button', text: S.keep, onclick: idle }),
|
|
1576
|
-
el('button', { class: 'send', type: 'button', text: S.takeBackYes, onclick: function () {
|
|
2000
|
+
el('button', { class: 'send sm', type: 'button', text: S.takeBackYes, onclick: function () {
|
|
1577
2001
|
withdrawReport(r.id, why.value.trim()).then(function (b) {
|
|
1578
2002
|
state.reports = state.reports.map(function (x) { return x.id === r.id ? b.report : x; });
|
|
1579
2003
|
markSeen();
|
|
@@ -1606,15 +2030,11 @@
|
|
|
1606
2030
|
if (dead || bubble || scrim || load(INTRO_KEY) || !fabShowing()) return false;
|
|
1607
2031
|
save(INTRO_KEY, new Date().toISOString());
|
|
1608
2032
|
var done = function () { if (bubble) { bubble.remove(); bubble = null; } };
|
|
1609
|
-
var label = LABEL === S.report ? LABEL : '“' + LABEL + '”';
|
|
1610
2033
|
bubble = el('div', { class: 'intro ' + PLACE + ' st-' + STYLE, role: 'dialog', 'aria-label': S.introAria }, [
|
|
1611
2034
|
el('b', { text: words(o.title, 80) || S.introTitle }),
|
|
1612
|
-
el('p', { text: words(o.body, 280) ||
|
|
1613
|
-
el('div', { class: 'row' }, [
|
|
1614
|
-
|
|
1615
|
-
el('button', { class: 'send', type: 'button', text: S.tryIt, onclick: function () { done(); open('new'); } }),
|
|
1616
|
-
]),
|
|
1617
|
-
byline(false),
|
|
2035
|
+
el('p', { text: words(o.body, 280) || S.introBody }),
|
|
2036
|
+
el('div', { class: 'row' }, [el('span'), el('button', { class: 'send sm', type: 'button', text: S.got, onclick: done })]),
|
|
2037
|
+
foot(),
|
|
1618
2038
|
]);
|
|
1619
2039
|
bubble.addEventListener('keydown', function (e) { if (e.key === 'Escape') done(); });
|
|
1620
2040
|
root.appendChild(bubble);
|
|
@@ -1662,14 +2082,14 @@
|
|
|
1662
2082
|
el('p', { text: stuck ? S.nudgeStuckBody : S.nudgeBody }),
|
|
1663
2083
|
el('div', { class: 'row' }, [
|
|
1664
2084
|
el('button', { class: 'link', type: 'button', text: S.nudgeNo, onclick: function () { done(); } }),
|
|
1665
|
-
el('button', { class: 'send', type: 'button', text: S.nudgeYes, onclick: function () {
|
|
2085
|
+
el('button', { class: 'send sm', type: 'button', text: S.nudgeYes, onclick: function () {
|
|
1666
2086
|
done();
|
|
1667
2087
|
var as = stuck ? 'confusing' : 'broken';
|
|
1668
2088
|
if (!state.type && OFFERED.some(function (t) { return t.id === as; })) state.type = as;
|
|
1669
|
-
open('new');
|
|
2089
|
+
open('new', { corner: true });
|
|
1670
2090
|
} }),
|
|
1671
2091
|
]),
|
|
1672
|
-
|
|
2092
|
+
foot(),
|
|
1673
2093
|
]);
|
|
1674
2094
|
root.appendChild(nudgeEl);
|
|
1675
2095
|
later();
|
|
@@ -1693,7 +2113,7 @@
|
|
|
1693
2113
|
state.userId = u.id != null ? String(u.id) : null;
|
|
1694
2114
|
state.userLabel = u.label != null ? String(u.label) : null;
|
|
1695
2115
|
state.userEmail = u.email != null ? String(u.email) : null;
|
|
1696
|
-
if (scrim && view === '
|
|
2116
|
+
if (scrim && view === 'mine') renderPanel();
|
|
1697
2117
|
},
|
|
1698
2118
|
setVersion: function (v) { state.version = v != null ? String(v) : null; versionSeen(state.version); },
|
|
1699
2119
|
setScreen: function (s) {
|
|
@@ -1703,11 +2123,12 @@
|
|
|
1703
2123
|
/** Open the report form. { type, text } fill it in; the reporter still reviews and sends. */
|
|
1704
2124
|
open: function (o) {
|
|
1705
2125
|
o = o || {};
|
|
2126
|
+
if (!o.anchor && toggledOff()) return;
|
|
1706
2127
|
if (OFFERED.some(function (t) { return t.id === o.type; })) state.type = o.type;
|
|
1707
2128
|
if (o.text != null) state.draft = String(o.text).slice(0, 2000);
|
|
1708
|
-
open('new');
|
|
2129
|
+
open('new', { anchor: o.anchor });
|
|
1709
2130
|
},
|
|
1710
|
-
openPreferences: function () { if (
|
|
2131
|
+
openPreferences: function () { if (PREFS_ROW) { prefsOpen = true; open('mine'); } },
|
|
1711
2132
|
/** Show the one-time introduction now. False if it was already shown on this device. */
|
|
1712
2133
|
introduce: function (o) { return introduce(o); },
|
|
1713
2134
|
/** The app saw trouble itself (an error screen, a retry that failed): offer to report it.
|
|
@@ -1720,6 +2141,6 @@
|
|
|
1720
2141
|
listeners.push(fn);
|
|
1721
2142
|
return function () { listeners = listeners.filter(function (f) { return f !== fn; }); };
|
|
1722
2143
|
},
|
|
1723
|
-
close: close,
|
|
2144
|
+
close: function () { close(); },
|
|
1724
2145
|
};
|
|
1725
2146
|
})();
|