create-heresay 0.2.49 → 0.2.50
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 +52 -61
- package/release/public/demo.html +1 -1
- package/release/public/docs.html +20 -24
- package/release/public/guides/customize-apple.md +83 -89
- package/release/public/guides/customize-web.md +101 -98
- package/release/public/guides/index.json +3 -3
- package/release/public/guides/install-apple.md +17 -23
- package/release/public/guides/install-web.md +60 -44
- package/release/public/guides/start.md +29 -43
- package/release/public/llms.txt +1 -1
- package/release/public/sdk.js +629 -389
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,12 @@
|
|
|
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) | sheet | center (bar ignores it)
|
|
27
31
|
* data-width regular (default) | narrow | wide
|
|
28
32
|
* data-backdrop dim (default) | clear | blur
|
|
29
|
-
* data-preferences show (default) | hide
|
|
33
|
+
* data-preferences show (default) | hide ("Your name and email" in Your reports)
|
|
30
34
|
* data-intro "auto": introduce the button a few seconds after the first load
|
|
31
35
|
* Trail: data-trail on (default) | off | the parts to keep, e.g. "pages errors requests"
|
|
32
36
|
* (pages, clicks, requests, errors). What happened in the app before
|
|
@@ -45,15 +49,17 @@
|
|
|
45
49
|
* Feedback.introduce({ title, body }) once per device: a bubble saying the button is there
|
|
46
50
|
* Feedback.nudge({ stuck }) the app saw trouble itself: offer to report it, as data-nudge does
|
|
47
51
|
* data-preview for the dashboard's designer: nothing is sent or stored
|
|
48
|
-
* Feedback.openPreferences()
|
|
52
|
+
* Feedback.openPreferences() opens Your reports with "Your name and email" expanded (if not signed in)
|
|
49
53
|
*
|
|
50
54
|
* Not configurable, on purpose: the Heresay mark on the button, the report types' names (they set
|
|
51
|
-
* the priority), the "Your reports"
|
|
55
|
+
* the priority), the "Your reports" view (reporters read why a report was declined), and the
|
|
52
56
|
* "Powered by Heresay" line, so people can tell the app uses an outside tool.
|
|
53
57
|
*
|
|
54
58
|
* No account, no cookies. The reporter is a random per-device id kept in localStorage, and
|
|
55
59
|
* that id is also what lets them see what happened to their own reports. Their preferences are
|
|
56
60
|
* kept on the device too, and sent with each report only if they filled them in.
|
|
61
|
+
* The panel is quiet: no tabs and no trail on show. The trail is collected for the team and the
|
|
62
|
+
* reporter is not asked about it; the developer controls it (data-trail, data-heresay-private).
|
|
57
63
|
*/
|
|
58
64
|
(function () {
|
|
59
65
|
'use strict';
|
|
@@ -84,162 +90,110 @@
|
|
|
84
90
|
en: {
|
|
85
91
|
report: 'Report', reportAria: 'Report a problem',
|
|
86
92
|
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.',
|
|
93
|
+
close: 'Close', dialog: 'Feedback', back: 'Back to Report',
|
|
94
|
+
mine: 'Your reports', mineAria: 'Your reports, {n} with an update', kindAria: 'What kind of report is this?', reportLabel: 'Your report',
|
|
95
|
+
phNone: 'What’s on your mind?',
|
|
96
|
+
send: 'Send', sending: 'Sending…', cantSend: 'Could not send. Try again.',
|
|
97
|
+
sentMsg: 'Sent. You’ll see the reply under Your reports.', done: 'Done',
|
|
94
98
|
types: {
|
|
95
|
-
broken: ['Broken', '
|
|
96
|
-
confusing: ['Confusing', '
|
|
97
|
-
improvement: ['Could be better', '
|
|
98
|
-
idea: ['Idea', '
|
|
99
|
+
broken: ['Broken', 'What went wrong?'],
|
|
100
|
+
confusing: ['Confusing', 'What were you trying to do?'],
|
|
101
|
+
improvement: ['Could be better', 'What would make it better?'],
|
|
102
|
+
idea: ['Idea', 'What would you like?'],
|
|
99
103
|
},
|
|
100
104
|
status: { open: 'Waiting for the developer', accepted: 'Accepted, being worked on', fixed: 'Fixed', declined: 'Declined', withdrawn: 'You took this back' },
|
|
101
105
|
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.',
|
|
106
|
+
fresh: 'New update', nameEmail: 'Your name and email', nameOpt: 'Name (optional)', emailOpt: 'Email (optional)',
|
|
106
107
|
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
108
|
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
109
|
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'] },
|
|
110
|
+
introAria: 'About the Report button', introTitle: 'Spotted something off?', introBody: 'Tell the team here.',
|
|
111
|
+
got: 'Got it',
|
|
120
112
|
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
113
|
fixedIn: 'Fixed in version {v}.', updateTo: 'Update to {v} to get it.',
|
|
122
114
|
sentTo: 'Sent to this app’s team', powered: 'Powered by Heresay',
|
|
115
|
+
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
116
|
},
|
|
124
117
|
fr: {
|
|
125
118
|
report: 'Signaler', reportAria: 'Signaler un problème',
|
|
126
119
|
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.',
|
|
120
|
+
close: 'Fermer', dialog: 'Signalement', back: 'Retour à Signaler',
|
|
121
|
+
mine: 'Vos signalements', mineAria: 'Vos signalements, {n} avec du nouveau', kindAria: 'De quel type de signalement s’agit-il ?', reportLabel: 'Votre signalement',
|
|
122
|
+
phNone: 'Qu’avez-vous en tête ?',
|
|
123
|
+
send: 'Envoyer', sending: 'Envoi…', cantSend: 'Envoi impossible. Réessayez.',
|
|
124
|
+
sentMsg: 'Envoyé. Vous verrez la réponse dans Vos signalements.', done: 'Terminé',
|
|
134
125
|
types: {
|
|
135
|
-
broken: ['Cassé', '
|
|
136
|
-
confusing: ['Déroutant', '
|
|
137
|
-
improvement: ['
|
|
138
|
-
idea: ['Idée', '
|
|
126
|
+
broken: ['Cassé', 'Que s’est-il passé ?'],
|
|
127
|
+
confusing: ['Déroutant', 'Que cherchiez-vous à faire ?'],
|
|
128
|
+
improvement: ['À améliorer', 'Qu’est-ce qui serait mieux ?'],
|
|
129
|
+
idea: ['Idée', 'Que souhaiteriez-vous ?'],
|
|
139
130
|
},
|
|
140
131
|
status: { open: 'En attente de l’équipe', accepted: 'Accepté, en cours', fixed: 'Corrigé', declined: 'Refusé', withdrawn: 'Vous l’avez retiré' },
|
|
141
132
|
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.',
|
|
133
|
+
fresh: 'Nouveauté', nameEmail: 'Votre nom et e-mail', nameOpt: 'Nom (facultatif)', emailOpt: 'E-mail (facultatif)',
|
|
146
134
|
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
135
|
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
136
|
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'] },
|
|
137
|
+
introAria: 'À propos du bouton Signaler', introTitle: 'Vous avez repéré un souci ?', introBody: 'Dites-le à l’équipe ici.',
|
|
138
|
+
got: 'Compris',
|
|
160
139
|
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
140
|
fixedIn: 'Corrigé dans la version {v}.', updateTo: 'Passez à la {v} pour en profiter.',
|
|
162
141
|
sentTo: 'Envoyé à l’équipe de cette app', powered: 'Propulsé par Heresay',
|
|
142
|
+
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
143
|
},
|
|
164
144
|
ta: {
|
|
165
145
|
report: 'தெரிவி', reportAria: 'சிக்கலைத் தெரிவிக்கவும்',
|
|
166
146
|
update: 'சிக்கலைத் தெரிவிக்கவும். உங்கள் {n} புகார்களில் புதிய தகவல் உள்ளது',
|
|
167
|
-
close: 'மூடு', dialog: 'கருத்து',
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
send: 'அனுப்பு', sending: 'அனுப்புகிறது…',
|
|
171
|
-
|
|
172
|
-
attachedPrefs: 'இந்தப் பக்கம், ஆப் பதிப்பு, சாதன விவரங்கள் மற்றும் உங்கள் விருப்பங்கள் இணைக்கப்படும்.',
|
|
173
|
-
attached: 'இந்தப் பக்கம், ஆப் பதிப்பு மற்றும் சாதன விவரங்கள் இணைக்கப்படும்.',
|
|
147
|
+
close: 'மூடு', dialog: 'கருத்து', back: 'தெரிவி பக்கத்துக்குத் திரும்பு',
|
|
148
|
+
mine: 'உங்கள் புகார்கள்', mineAria: 'உங்கள் புகார்கள், {n} இல் புதிய தகவல் உள்ளது', kindAria: 'இது எந்த வகைப் புகார்?', reportLabel: 'உங்கள் புகார்',
|
|
149
|
+
phNone: 'உங்கள் மனதில் என்ன இருக்கிறது?',
|
|
150
|
+
send: 'அனுப்பு', sending: 'அனுப்புகிறது…', cantSend: 'அனுப்ப முடியவில்லை. மீண்டும் முயலவும்.',
|
|
151
|
+
sentMsg: 'அனுப்பப்பட்டது. பதிலை “உங்கள் புகார்கள்” பகுதியில் பார்க்கலாம்.', done: 'முடிந்தது',
|
|
174
152
|
types: {
|
|
175
|
-
broken: ['
|
|
176
|
-
confusing: ['
|
|
177
|
-
improvement: ['
|
|
178
|
-
idea: ['யோசனை', '
|
|
153
|
+
broken: ['பழுது', 'என்ன தவறு நடந்தது?'],
|
|
154
|
+
confusing: ['குழப்பம்', 'என்ன செய்ய முயன்றீர்கள்?'],
|
|
155
|
+
improvement: ['மேம்படுத்த', 'எப்படி மேம்படுத்தலாம்?'],
|
|
156
|
+
idea: ['யோசனை', 'உங்களுக்கு என்ன வேண்டும்?'],
|
|
179
157
|
},
|
|
180
158
|
status: { open: 'டெவலப்பருக்காகக் காத்திருக்கிறது', accepted: 'ஏற்கப்பட்டது, வேலை நடக்கிறது', fixed: 'சரிசெய்யப்பட்டது', declined: 'நிராகரிக்கப்பட்டது', withdrawn: 'நீங்கள் திரும்பப் பெற்றீர்கள்' },
|
|
181
159
|
takeBack: 'திரும்பப் பெறு', takeBackAsk: 'இதைத் திரும்பப் பெறவா? இது நீக்கப்படாது: நீங்கள் திரும்பப் பெற்றதைக் குழு பார்க்கும்.', takeBackWhy: 'ஏன்? (விருப்பத்தேர்வு)', takeBackYes: 'திரும்பப் பெறு', keep: 'வைத்திரு', yourWhy: 'உங்கள் காரணம்: ',
|
|
182
|
-
|
|
183
|
-
emailHint: 'குழு உங்களுக்குப் பதில் அனுப்பலாம் என்றால் மட்டும்.',
|
|
184
|
-
setup: 'உங்கள் அமைப்பு பற்றி', setupHint: 'ஒவ்வொரு புகாருடனும் அனுப்பப்படும், எனவே ஒருமுறை சொன்னால் போதும்.',
|
|
185
|
-
setupPh: 'உதாரணமாக: நான் ஸ்கிரீன் ரீடர் பயன்படுத்துகிறேன், அல்லது என் Wi-Fi பெரும்பாலும் மெதுவாக இருக்கும்.',
|
|
160
|
+
fresh: 'புதிய தகவல்', nameEmail: 'உங்கள் பெயர் மற்றும் மின்னஞ்சல்', nameOpt: 'பெயர் (விருப்பத்தேர்வு)', emailOpt: 'மின்னஞ்சல் (விருப்பத்தேர்வு)',
|
|
186
161
|
signedAs: '{who} ஆக உள்நுழைந்துள்ளீர்கள்', yourAccount: 'உங்கள் கணக்கு',
|
|
187
|
-
seesReply: '{email}. ஒவ்வொரு புகாருடனும் குழு இதைப் பார்க்கும், பதிலும் அனுப்பலாம்.',
|
|
188
|
-
sees: 'ஒவ்வொரு புகாருடனும் குழு இதைப் பார்க்கும்.',
|
|
189
162
|
badEmail: 'இந்த மின்னஞ்சல் சரியாகத் தெரியவில்லை.', saved: 'இந்தச் சாதனத்தில் சேமிக்கப்பட்டது.',
|
|
190
|
-
clear: 'அனைத்தையும் அழி', save: 'சேமி',
|
|
191
|
-
kept: 'இந்த உலாவியில் வைக்கப்படும்; நீங்கள் அனுப்பும் புகார்களுடன் மட்டுமே அனுப்பப்படும்.',
|
|
192
163
|
none: 'இந்தச் சாதனத்திலிருந்து இன்னும் எதுவும் அனுப்பப்படவில்லை.', why: 'காரணம்: ',
|
|
193
|
-
introAria: 'தெரிவி பொத்தான் பற்றி', introTitle: '
|
|
194
|
-
|
|
195
|
-
got: 'சரி', tryIt: 'முயன்று பாருங்கள்',
|
|
196
|
-
attachTrail: 'என்ன நடந்தது என்பதையும் இணை',
|
|
197
|
-
trailHint: 'இந்த ஆப்பில் சமீபத்திய பக்கங்கள், கிளிக்குகள், பிழைகள். நீங்கள் தட்டச்சு செய்தது ஒருபோதும் இல்லை.',
|
|
198
|
-
seeTrail: 'பார்', alsoSent: 'இவையும் அனுப்பப்படும்: ',
|
|
199
|
-
trail: { page: ['பக்கம்', 'பக்கங்கள்'], click: ['கிளிக்', 'கிளிக்குகள்'], request: ['தோல்வியடைந்த கோரிக்கை', 'தோல்வியடைந்த கோரிக்கைகள்'], error: ['பிழை', 'பிழைகள்'], warn: ['எச்சரிக்கை', 'எச்சரிக்கைகள்'], state: ['சாதன நிகழ்வு', 'சாதன நிகழ்வுகள்'] },
|
|
164
|
+
introAria: 'தெரிவி பொத்தான் பற்றி', introTitle: 'ஏதாவது சரியில்லையா?', introBody: 'குழுவிடம் இங்கேயே சொல்லுங்கள்.',
|
|
165
|
+
got: 'சரி',
|
|
200
166
|
nudgeStuckTitle: 'எங்காவது சிக்கிக்கொண்டீர்களா?', nudgeStuckBody: 'இங்கே ஏதாவது புரியவில்லை என்றால், குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeAria: 'சிக்கலைத் தெரிவிக்க ஒரு அழைப்பு', nudgeTitle: 'ஏதாவது வேலை செய்யவில்லையா?', nudgeBody: 'என்ன நடந்தது என்று குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeYes: 'குழுவிடம் சொல்', nudgeNo: 'இப்போது வேண்டாம்',
|
|
201
167
|
fixedIn: 'பதிப்பு {v} இல் சரிசெய்யப்பட்டது.', updateTo: 'இதைப் பெற {v} க்குப் புதுப்பிக்கவும்.',
|
|
202
168
|
sentTo: 'இந்த ஆப்பின் குழுவுக்கு அனுப்பப்படும்', powered: 'Heresay மூலம் இயங்குகிறது',
|
|
169
|
+
whatsGoing: 'என்ன நடக்கிறது?', typeChip: 'வகை', tellTeam: 'குழுவிடம் சொல்லுங்கள்…', sentBar: 'அனுப்பப்பட்டது. பதில்கள் “உங்கள் புகார்கள்” பகுதியில் தெரியும்.', backType: 'வகையைத் தேர்வுசெய்ய திரும்பு',
|
|
203
170
|
},
|
|
204
171
|
hi: {
|
|
205
172
|
report: 'रिपोर्ट करें', reportAria: 'समस्या की रिपोर्ट करें',
|
|
206
173
|
update: 'समस्या की रिपोर्ट करें। आपकी {n} रिपोर्ट में नई जानकारी है',
|
|
207
|
-
close: 'बंद करें', dialog: 'फ़ीडबैक',
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
send: 'भेजें', sending: 'भेजा जा रहा है…',
|
|
211
|
-
|
|
212
|
-
attachedPrefs: 'यह पेज, ऐप का वर्शन, डिवाइस की जानकारी और आपकी प्राथमिकताएँ साथ भेजी जाती हैं।',
|
|
213
|
-
attached: 'यह पेज, ऐप का वर्शन और डिवाइस की जानकारी साथ भेजी जाती है।',
|
|
174
|
+
close: 'बंद करें', dialog: 'फ़ीडबैक', back: 'रिपोर्ट पर वापस जाएँ',
|
|
175
|
+
mine: 'आपकी रिपोर्ट', mineAria: 'आपकी रिपोर्ट, {n} में नई जानकारी है', kindAria: 'यह किस तरह की रिपोर्ट है?', reportLabel: 'आपकी रिपोर्ट',
|
|
176
|
+
phNone: 'आपके मन में क्या है?',
|
|
177
|
+
send: 'भेजें', sending: 'भेजा जा रहा है…', cantSend: 'भेजा नहीं जा सका। फिर से कोशिश करें।',
|
|
178
|
+
sentMsg: 'भेज दिया गया। जवाब आपको “आपकी रिपोर्ट” में दिखेगा।', done: 'हो गया',
|
|
214
179
|
types: {
|
|
215
|
-
broken: ['टूटा हुआ', '
|
|
216
|
-
confusing: ['उलझन
|
|
217
|
-
improvement: ['बेहतर हो
|
|
218
|
-
idea: ['सुझाव', '
|
|
180
|
+
broken: ['टूटा हुआ', 'क्या गड़बड़ हुई?'],
|
|
181
|
+
confusing: ['उलझन', 'आप क्या करने की कोशिश कर रहे थे?'],
|
|
182
|
+
improvement: ['बेहतर हो', 'क्या बेहतर हो सकता है?'],
|
|
183
|
+
idea: ['सुझाव', 'आप क्या चाहेंगे?'],
|
|
219
184
|
},
|
|
220
185
|
status: { open: 'डेवलपर का इंतज़ार', accepted: 'स्वीकार, इस पर काम चल रहा है', fixed: 'ठीक हो गया', declined: 'अस्वीकार', withdrawn: 'आपने इसे वापस ले लिया' },
|
|
221
186
|
takeBack: 'वापस लें', takeBackAsk: 'इसे वापस लें? यह हटाया नहीं जाएगा: टीम देखेगी कि आपने इसे वापस लिया।', takeBackWhy: 'क्यों? (वैकल्पिक)', takeBackYes: 'वापस लें', keep: 'रहने दें', yourWhy: 'आपकी वजह: ',
|
|
222
|
-
|
|
223
|
-
emailHint: 'सिर्फ़ तब, जब आप चाहते हैं कि टीम आपको जवाब दे।',
|
|
224
|
-
setup: 'आपके सेटअप के बारे में', setupHint: 'हर रिपोर्ट के साथ भेजा जाता है, ताकि आपको एक ही बार बताना पड़े।',
|
|
225
|
-
setupPh: 'जैसे: स्क्रीन रीडर के साथ इस्तेमाल, या अक्सर धीमा Wi-Fi।',
|
|
187
|
+
fresh: 'नई जानकारी', nameEmail: 'आपका नाम और ईमेल', nameOpt: 'नाम (वैकल्पिक)', emailOpt: 'ईमेल (वैकल्पिक)',
|
|
226
188
|
signedAs: '{who} के रूप में साइन इन', yourAccount: 'आपका खाता',
|
|
227
|
-
seesReply: '{email}. टीम हर रिपोर्ट के साथ इसे देखती है और जवाब दे सकती है।',
|
|
228
|
-
sees: 'टीम हर रिपोर्ट के साथ इसे देखती है।',
|
|
229
189
|
badEmail: 'यह ईमेल सही नहीं लग रहा।', saved: 'इस डिवाइस पर सेव हो गया।',
|
|
230
|
-
clear: 'सब हटाएँ', save: 'सेव करें',
|
|
231
|
-
kept: 'इसी ब्राउज़र में रखा जाता है, और सिर्फ़ आपकी भेजी रिपोर्ट के साथ जाता है।',
|
|
232
190
|
none: 'इस डिवाइस से अभी तक कुछ नहीं भेजा गया।', why: 'वजह: ',
|
|
233
|
-
introAria: 'रिपोर्ट बटन के बारे में', introTitle: '
|
|
234
|
-
|
|
235
|
-
got: 'ठीक है', tryIt: 'आज़माएँ',
|
|
236
|
-
attachTrail: 'क्या हुआ, वह भी भेजें',
|
|
237
|
-
trailHint: 'इस ऐप में हाल के पेज, क्लिक और त्रुटियाँ। आपने जो टाइप किया, वह कभी नहीं।',
|
|
238
|
-
seeTrail: 'देखें', alsoSent: 'यह भी भेजा जाता है: ',
|
|
239
|
-
trail: { page: ['पेज', 'पेज'], click: ['क्लिक', 'क्लिक'], request: ['विफल अनुरोध', 'विफल अनुरोध'], error: ['त्रुटि', 'त्रुटियाँ'], warn: ['चेतावनी', 'चेतावनियाँ'], state: ['डिवाइस घटना', 'डिवाइस घटनाएँ'] },
|
|
191
|
+
introAria: 'रिपोर्ट बटन के बारे में', introTitle: 'कुछ गड़बड़ दिखी?', introBody: 'टीम को यहीं बताइए।',
|
|
192
|
+
got: 'ठीक है',
|
|
240
193
|
nudgeStuckTitle: 'कहीं अटक गए?', nudgeStuckBody: 'अगर यहाँ कुछ साफ़ नहीं है, तो टीम को बताइए। इसे कोई इंसान पढ़ता है।', nudgeAria: 'समस्या बताने का सुझाव', nudgeTitle: 'कुछ काम नहीं कर रहा?', nudgeBody: 'टीम को बताइए क्या हुआ। इसे कोई इंसान पढ़ता है।', nudgeYes: 'टीम को बताएँ', nudgeNo: 'अभी नहीं',
|
|
241
194
|
fixedIn: 'वर्शन {v} में ठीक किया गया।', updateTo: 'इसे पाने के लिए {v} पर अपडेट करें।',
|
|
242
195
|
sentTo: 'इस ऐप की टीम को भेजा जाता है', powered: 'Heresay द्वारा संचालित',
|
|
196
|
+
whatsGoing: 'क्या हो रहा है?', typeChip: 'प्रकार', tellTeam: 'टीम को बताइए…', sentBar: 'भेज दिया गया। जवाब “आपकी रिपोर्ट” में दिखेंगे।', backType: 'प्रकार चुनने पर वापस जाएँ',
|
|
243
197
|
},
|
|
244
198
|
};
|
|
245
199
|
/** The page's own language by default, so the widget speaks like the app around it. */
|
|
@@ -259,12 +213,18 @@
|
|
|
259
213
|
|
|
260
214
|
// ---- the developer's choices -----------------------------------------------------------
|
|
261
215
|
|
|
262
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* Where the button sits is the developer's choice (data-position), not the reporter's:
|
|
218
|
+
* bottom-right (default) | bottom-left | top-right | top-left | bottom-center
|
|
219
|
+
* | left-tab | right-tab (a tab on the side edge) | none (no button; call Heresay.open()).
|
|
220
|
+
* The older right, left and center still work. An explicit data-style or data-button wins.
|
|
221
|
+
*/
|
|
222
|
+
var POSITION = attr('position').toLowerCase().trim();
|
|
263
223
|
var POS = ({
|
|
264
224
|
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');
|
|
225
|
+
center: ['c', 'b'], 'bottom-center': ['c', 'b'], 'left-tab': ['l', 'b'], 'right-tab': ['r', 'b'],
|
|
226
|
+
})[POSITION] || ['r', 'b'];
|
|
227
|
+
var STYLE = pick('style', ['pill', 'icon', 'tab'], POSITION === 'left-tab' || POSITION === 'right-tab' ? 'tab' : 'pill');
|
|
268
228
|
if (STYLE === 'tab' && POS[0] === 'c') POS = ['r', 'b'];
|
|
269
229
|
var LEFT = POS[0] === 'l';
|
|
270
230
|
var OFFSET = (function () {
|
|
@@ -272,20 +232,22 @@
|
|
|
272
232
|
var clamp = function (n) { return Math.min(400, +n); };
|
|
273
233
|
return m ? [clamp(m[1]), clamp(m[2] != null ? m[2] : m[1])] : [20, 20];
|
|
274
234
|
})();
|
|
275
|
-
var BUTTON = pick('button', ['always', 'none', 'desktop', 'scroll'], 'always');
|
|
235
|
+
var BUTTON = pick('button', ['always', 'none', 'desktop', 'scroll'], POSITION === 'none' ? 'none' : 'always');
|
|
276
236
|
var SIZE = pick('size', ['regular', 'small', 'large'], 'regular');
|
|
277
237
|
var LABEL = words(attr('label'), 40) || S.report;
|
|
278
238
|
var HIDE_ON = attr('hide-on').split(',').map(function (p) { return p.trim().replace(/\/+$/, ''); })
|
|
279
239
|
.filter(function (p) { return p.charAt(0) === '/'; });
|
|
240
|
+
var LAYOUT = pick('layout', ['composer', 'steps', 'bar'], 'composer');
|
|
280
241
|
var PANEL = pick('panel', ['corner', 'sheet', 'center'], 'corner');
|
|
281
|
-
var WIDTH = ({ narrow: 320, wide: 460 })[attr('width').toLowerCase()] ||
|
|
242
|
+
var WIDTH = ({ narrow: 320, wide: 460 })[attr('width').toLowerCase()] || 360;
|
|
282
243
|
var BACKDROP = pick('backdrop', ['dim', 'clear', 'blur'], 'dim');
|
|
283
|
-
var
|
|
284
|
-
|
|
244
|
+
var PREFS_ROW = pick('preferences', ['show', 'hide'], 'show') === 'show';
|
|
245
|
+
// data-placeholder, if set, replaces the line that follows the type.
|
|
246
|
+
var PLACEHOLDER = words(attr('placeholder'), 120);
|
|
285
247
|
var THANKS = words(attr('thanks'), 160);
|
|
286
248
|
|
|
287
249
|
var TYPES = ['broken', 'confusing', 'improvement', 'idea'].map(function (id) {
|
|
288
|
-
return { id: id, label: S.types[id][0],
|
|
250
|
+
return { id: id, label: S.types[id][0], ph: S.types[id][1] };
|
|
289
251
|
});
|
|
290
252
|
/** The types the reporter can pick. Names and priorities never change; a developer can only leave some out. */
|
|
291
253
|
var OFFERED = (function () {
|
|
@@ -304,9 +266,6 @@
|
|
|
304
266
|
draft: '',
|
|
305
267
|
justSent: false,
|
|
306
268
|
reports: [],
|
|
307
|
-
// The reporter's say over the trail: all of it off, or some kinds left out.
|
|
308
|
-
trailOff: false,
|
|
309
|
-
trailSkip: {},
|
|
310
269
|
};
|
|
311
270
|
var listeners = [];
|
|
312
271
|
|
|
@@ -368,8 +327,8 @@
|
|
|
368
327
|
function reporter() {
|
|
369
328
|
var p = prefs();
|
|
370
329
|
var mine = !identified();
|
|
371
|
-
var r = { name: mine && p.name || null, email: mine && p.email || null
|
|
372
|
-
return r.name || r.email
|
|
330
|
+
var r = { name: mine && p.name || null, email: mine && p.email || null };
|
|
331
|
+
return r.name || r.email ? r : null;
|
|
373
332
|
}
|
|
374
333
|
|
|
375
334
|
// ---- context ---------------------------------------------------------------------------
|
|
@@ -471,7 +430,8 @@
|
|
|
471
430
|
/**
|
|
472
431
|
* What happened in the app before a report: pages, clicks, requests that failed, errors. Kept
|
|
473
432
|
* on this device only, in memory and this tab's sessionStorage (the newest 50, for 5 minutes),
|
|
474
|
-
* and sent
|
|
433
|
+
* and sent with every report; the reporter is not shown it, and the developer controls it (data-trail,
|
|
434
|
+
* data-heresay-private). Never what anyone typed, never request
|
|
475
435
|
* or response bodies or headers, never query strings. Nothing is recorded inside the widget.
|
|
476
436
|
*/
|
|
477
437
|
var TRAIL_PARTS = { pages: 'page', clicks: 'click', requests: 'request', errors: 'error' };
|
|
@@ -570,11 +530,10 @@
|
|
|
570
530
|
var cut = Date.now() - TRAIL_AGE;
|
|
571
531
|
return trail.filter(function (e) { return e.at >= cut; });
|
|
572
532
|
}
|
|
573
|
-
/** What goes with the report:
|
|
533
|
+
/** What goes with the report: ages in seconds before now. */
|
|
574
534
|
function trailToSend() {
|
|
575
|
-
if (state.trailOff) return null;
|
|
576
535
|
var now = Date.now();
|
|
577
|
-
var t = recentTrail().
|
|
536
|
+
var t = recentTrail().map(function (e) {
|
|
578
537
|
return { kind: e.kind, ago: Math.round((now - e.at) / 1000), text: e.text, detail: e.detail, n: e.n };
|
|
579
538
|
});
|
|
580
539
|
return t.length ? t : null;
|
|
@@ -1077,12 +1036,12 @@
|
|
|
1077
1036
|
|
|
1078
1037
|
// ---- ui --------------------------------------------------------------------------------
|
|
1079
1038
|
|
|
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';
|
|
1039
|
+
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
1040
|
var THEME = pick('theme', ['auto', 'light', 'dark'], 'auto');
|
|
1082
1041
|
var FAB_H = { small: 40, regular: 48, large: 58 }[SIZE];
|
|
1083
1042
|
|
|
1084
1043
|
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;',
|
|
1044
|
+
':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
1045
|
'--fb-x:' + OFFSET[0] + 'px;--fb-y:' + OFFSET[1] + 'px;--fb-h:' + FAB_H + 'px;--fb-w:' + WIDTH + 'px;',
|
|
1087
1046
|
'font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--fb-fg)}',
|
|
1088
1047
|
THEME === 'dark' ? ':host{' + DARK + '}' : THEME === 'light' ? '' : '@media (prefers-color-scheme:dark){:host{' + DARK + '}}',
|
|
@@ -1110,7 +1069,7 @@
|
|
|
1110
1069
|
|
|
1111
1070
|
// the introduction
|
|
1112
1071
|
'.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:
|
|
1072
|
+
'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
1073
|
'.intro.r{right:var(--fb-x)}.intro.l{left:var(--fb-x)}.intro.c{left:50%;margin-left:min(-150px,calc(20px - 50vw))}',
|
|
1115
1074
|
'.intro.b{bottom:calc(var(--fb-y) + var(--fb-h) + 8px)}.intro.t{top:calc(var(--fb-y) + var(--fb-h) + 8px)}',
|
|
1116
1075
|
'.intro:after{content:"";position:absolute;bottom:-7px;right:36px;width:12px;height:12px;background:var(--fb-bg);',
|
|
@@ -1121,7 +1080,7 @@
|
|
|
1121
1080
|
'.intro b{display:block;margin-bottom:4px;font-weight:700}',
|
|
1122
1081
|
'.intro p{margin:0 0 12px;color:var(--fb-mute);font-size:13px}',
|
|
1123
1082
|
'.intro .row{margin-top:0;justify-content:flex-end}',
|
|
1124
|
-
'.intro .
|
|
1083
|
+
'.intro .foot{margin-top:12px;padding:8px 0 0;border-top:1px solid var(--fb-line);text-align:left}',
|
|
1125
1084
|
'@keyframes fb-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}',
|
|
1126
1085
|
'@media (prefers-reduced-motion:reduce){.intro{animation:none}}',
|
|
1127
1086
|
// offering help: the introduction's bubble; with no button to point at, it sits in its place
|
|
@@ -1130,82 +1089,117 @@
|
|
|
1130
1089
|
'.dot{width:8px;height:8px;border-radius:50%;background:var(--fb-acc)}',
|
|
1131
1090
|
|
|
1132
1091
|
// 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}',
|
|
1092
|
+
'.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
1093
|
'.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}',
|
|
1094
|
+
'.scrim.center{align-items:center;justify-content:center;padding:16px}',
|
|
1136
1095
|
'.scrim.sheet{padding:0;align-items:stretch}',
|
|
1096
|
+
'.panel{animation:fb-rise .2s ease-out}.scrim.t .panel{animation-name:fb-drop}.scrim.center .panel,.scrim.side .panel{animation-name:fb-fade}',
|
|
1097
|
+
'@keyframes fb-rise{from{opacity:0;transform:translateY(8px)}}@keyframes fb-drop{from{opacity:0;transform:translateY(-8px)}}',
|
|
1137
1098
|
'.scrim.clear{background:none}',
|
|
1138
1099
|
'.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)}',
|
|
1100
|
+
'.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);',
|
|
1101
|
+
'border-radius:16px;box-shadow:0 12px 40px rgba(16,24,40,.16),0 0 0 1px var(--fb-ring)}',
|
|
1102
|
+
'.sheet .panel{max-height:none;height:100%;border-radius:0}',
|
|
1103
|
+
'.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}',
|
|
1104
|
+
'@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%}}',
|
|
1105
|
+
'@keyframes fb-sheet{from{transform:translateY(40px)}}',
|
|
1106
|
+
'.view{display:flex;flex-direction:column;min-height:0;animation:fb-fade .16s}@keyframes fb-fade{from{opacity:0}}',
|
|
1107
|
+
'.hd{display:flex;align-items:center;flex:none;gap:8px;padding:14px 12px 8px 18px;min-height:56px}.hd.back{padding-left:8px}',
|
|
1108
|
+
'.hd h2{margin:0;font-size:16px;font-weight:650}.hd .mark svg{width:24px;height:24px}.sp{flex:1}',
|
|
1109
|
+
'.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}',
|
|
1110
|
+
'.ib:hover,.quiet:hover{background:var(--fb-soft)}',
|
|
1111
|
+
'.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}',
|
|
1112
|
+
'.ic{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;display:block}',
|
|
1113
|
+
'.udot{width:7px;height:7px;border-radius:50%;background:var(--fb-dot);flex:none}',
|
|
1114
|
+
'form.pad{padding:4px 18px;min-height:0;overflow-y:auto}',
|
|
1115
|
+
'.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}',
|
|
1116
|
+
'.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}',
|
|
1117
|
+
'.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)}',
|
|
1118
|
+
'@media (max-width:440px){.seg button{padding:8px 6px;font-size:12.5px}}',
|
|
1119
|
+
'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}',
|
|
1120
|
+
'textarea::placeholder,input::placeholder{color:var(--fb-ph);opacity:1}',
|
|
1121
|
+
'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)}',
|
|
1122
|
+
'.panel:focus{outline:0}',
|
|
1123
|
+
'button:focus:not(:focus-visible){outline:0}',
|
|
1124
|
+
'button:focus-visible,a:focus-visible{outline:2px solid var(--fb-acc);outline-offset:2px}',
|
|
1125
|
+
'.seg button:focus-visible{outline-offset:-2px}',
|
|
1126
|
+
'.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}',
|
|
1127
|
+
'.send:disabled{background:var(--fb-soft);color:var(--fb-ph);cursor:not-allowed}',
|
|
1128
|
+
'.send.busy{display:flex;align-items:center;justify-content:center;gap:7px;background:var(--fb-acc);color:var(--fb-acc-fg);cursor:default}',
|
|
1129
|
+
'.send .mark{color:var(--fb-acc-fg)}.send .mark svg{width:20px;height:20px}.send .eye{fill:var(--fb-acc)}',
|
|
1130
|
+
'.send.sm{display:inline-block;width:auto;height:auto;margin:0;padding:8px 14px;font-size:13px;border-radius:10px}',
|
|
1172
1131
|
// The loader: the mark's eyes look left, look right, blink (brand/svg/loaders/heresay-loader-glance.svg, faster).
|
|
1173
1132
|
'.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
1133
|
'@keyframes fb-look{0%,10%{transform:none}25%,40%{transform:translate(-9px,1px)}55%,70%{transform:translate(9px,-1px)}85%,100%{transform:none}}',
|
|
1175
1134
|
'@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
|
-
'.
|
|
1135
|
+
'.err{color:var(--fb-bad);font-size:13px;margin-top:8px}.err:empty{display:none}',
|
|
1136
|
+
'.foot{flex:none;text-align:center;font-size:12px;color:var(--fb-mute);padding:12px 18px 14px}',
|
|
1137
|
+
'.foot a{color:inherit;text-decoration:none;font-weight:600}.foot a:hover{text-decoration:underline}',
|
|
1138
|
+
// sent
|
|
1139
|
+
'.sent{align-items:center;text-align:center;padding:10px 28px 6px}',
|
|
1140
|
+
'.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}',
|
|
1141
|
+
'.chk svg{width:36px;height:36px;fill:none;stroke:var(--fb-acc-fg);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}',
|
|
1142
|
+
'.chk path{stroke-dasharray:30;stroke-dashoffset:30;animation:fb-draw .3s .22s forwards}',
|
|
1143
|
+
'@keyframes fb-pop{from{transform:scale(.6);opacity:0}}@keyframes fb-draw{to{stroke-dashoffset:0}}',
|
|
1144
|
+
'.sent p{margin:18px 0 0;font-size:17px;font-weight:550;max-width:250px}',
|
|
1145
|
+
'.sent p.thanks{margin-top:8px;font-size:14px;font-weight:400;color:var(--fb-mute)}',
|
|
1146
|
+
'.sent .send{margin:20px 0 0}',
|
|
1147
|
+
// your reports
|
|
1148
|
+
'.cards{display:grid;gap:10px;padding:6px 18px;overflow-y:auto;min-height:0;align-content:start}',
|
|
1149
|
+
'.card{border:1px solid var(--fb-line);border-radius:14px;padding:13px 14px}',
|
|
1150
|
+
'.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}',
|
|
1151
|
+
'.card .t{margin:0;font-size:14px;white-space:pre-wrap;word-break:break-word}',
|
|
1152
|
+
'.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)}',
|
|
1153
|
+
'.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)}',
|
|
1154
|
+
'.n2{margin:8px 0 0;font-size:13px;color:var(--fb-mute)}.n2 b{color:var(--fb-fg)}',
|
|
1155
|
+
'.empty{color:var(--fb-mute);padding:12px 2px}',
|
|
1156
|
+
'.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}',
|
|
1157
|
+
'.take-back .row{margin-top:4px}',
|
|
1158
|
+
'.link{border:0;background:none;padding:0;cursor:pointer;color:var(--fb-mute);text-decoration:underline;font-size:12px}',
|
|
1159
|
+
'.row{display:flex;justify-content:space-between;align-items:center;margin-top:10px;gap:8px}',
|
|
1160
|
+
'.small{font-size:12px;color:var(--fb-mute);margin:0}',
|
|
1161
|
+
'.prefs{flex:none;margin:8px 18px 0;border-top:1px solid var(--fb-line)}',
|
|
1162
|
+
'.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)}',
|
|
1163
|
+
'.prefs>button .ic{width:15px;height:15px;margin-left:auto;transition:transform .2s}.prefs>button[aria-expanded=true] .ic{transform:rotate(180deg)}',
|
|
1164
|
+
'.prefs>.signed{padding:12px 2px;font-size:13px;font-weight:550;color:var(--fb-mute)}',
|
|
1165
|
+
'.pb{padding-bottom:4px}',
|
|
1166
|
+
'.pb label{display:block;font-size:12px;color:var(--fb-mute);margin:0 0 4px 2px}',
|
|
1167
|
+
'.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}',
|
|
1168
|
+
'.pb .err{margin:-4px 0 8px}.pb .small{margin:-4px 0 8px 2px}',
|
|
1169
|
+
// layout: steps (what's going on? rows, then the text)
|
|
1170
|
+
'.ibd{position:relative}.ibd .udot{position:absolute;top:3px;right:3px;width:9px;height:9px;box-shadow:0 0 0 2px var(--fb-bg)}',
|
|
1171
|
+
'.hd h2.q{font-size:17px}',
|
|
1172
|
+
'.rows{list-style:none;margin:0;padding:4px 18px 2px;display:grid;gap:10px;overflow-y:auto;min-height:0}',
|
|
1173
|
+
'.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}',
|
|
1174
|
+
'@media (hover:hover){.pick:hover{background:var(--fb-soft)}}',
|
|
1175
|
+
'.pick .tile{flex:none;width:42px;height:42px;border-radius:12px;background:var(--fb-soft);display:grid;place-items:center}',
|
|
1176
|
+
'.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}',
|
|
1177
|
+
'.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}',
|
|
1178
|
+
'form.big textarea{min-height:132px}',
|
|
1179
|
+
// layout: bar (a compact composer beside the button; a docked bar on phones)
|
|
1180
|
+
'.scrim.bar{background:none;pointer-events:none;inset:0 0 var(--fb-kb,0px) 0}.scrim.bar>*{pointer-events:auto}',
|
|
1181
|
+
'.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}',
|
|
1182
|
+
'.barbox:focus{outline:0}.scrim.t .barbox{animation-name:fb-drop}',
|
|
1183
|
+
'.bin{display:flex;align-items:flex-end;gap:8px;margin:0}',
|
|
1184
|
+
'.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}',
|
|
1185
|
+
'.tchip span{overflow:hidden;text-overflow:ellipsis}.tchip .ic{width:16px;height:16px;flex:none}.tchip .caret{color:var(--fb-mute)}',
|
|
1186
|
+
'.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}',
|
|
1187
|
+
'.bin textarea:focus{box-shadow:none;border:0}',
|
|
1188
|
+
'.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}',
|
|
1189
|
+
'.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}',
|
|
1190
|
+
'.bsend .mark{color:var(--fb-acc-fg)}.bsend .mark svg{width:22px;height:22px}.bsend .eye{fill:var(--fb-acc)}',
|
|
1191
|
+
'.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}',
|
|
1192
|
+
'.bmeta .foot2 a{color:inherit;text-decoration:none;font-weight:600}.bmeta .foot2 a:hover{text-decoration:underline}',
|
|
1193
|
+
'.barbox .err{margin:2px 4px 0}',
|
|
1194
|
+
'.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}',
|
|
1195
|
+
'.scrim.t .bmenu{bottom:auto;top:calc(100% + 8px)}',
|
|
1196
|
+
'.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}',
|
|
1197
|
+
'@media (hover:hover){.bmenu button:hover{background:var(--fb-soft)}}',
|
|
1198
|
+
'.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}',
|
|
1199
|
+
'.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}',
|
|
1200
|
+
'.bsent p{flex:1;margin:0;font-size:14px;font-weight:550;min-width:0}.bsent .send.sm{flex:none}',
|
|
1201
|
+
'@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)}}',
|
|
1202
|
+
'@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
1203
|
].join('');
|
|
1210
1204
|
|
|
1211
1205
|
/**
|
|
@@ -1262,13 +1256,6 @@
|
|
|
1262
1256
|
return s;
|
|
1263
1257
|
}
|
|
1264
1258
|
|
|
1265
|
-
/** "Powered by Heresay", on every view. Not configurable. */
|
|
1266
|
-
function byline(sentTo) {
|
|
1267
|
-
return el('div', { class: 'by' }, [
|
|
1268
|
-
sentTo ? el('span', { text: S.sentTo }) : null,
|
|
1269
|
-
el('a', { href: HERESAY_URL, target: '_blank', rel: 'noopener' }, [markEl(), document.createTextNode(S.powered)]),
|
|
1270
|
-
]);
|
|
1271
|
-
}
|
|
1272
1259
|
|
|
1273
1260
|
var PLACE = POS.join(' ') + (STYLE === 'tab' ? ' side' : '');
|
|
1274
1261
|
var fabDot = el('span', { class: 'dot', hidden: '' });
|
|
@@ -1307,15 +1294,32 @@
|
|
|
1307
1294
|
// Single-page apps change the path without reloading; check cheaply, only when paths are listed.
|
|
1308
1295
|
if (HIDE_ON.length) setInterval(function () { if (location.pathname !== lastPath) placeFab(); }, 500);
|
|
1309
1296
|
|
|
1310
|
-
var scrim = null, view = 'new', listBox = null, lastFocus = null;
|
|
1297
|
+
var scrim = null, view = 'new', listBox = null, lastFocus = null, hdDot = null, hdMine = null;
|
|
1298
|
+
// Whether "Your name and email" is expanded. Only openPreferences() or the reporter opens it.
|
|
1299
|
+
var prefsOpen = false;
|
|
1311
1300
|
|
|
1312
1301
|
function renderBadge() {
|
|
1313
1302
|
var n = unseen();
|
|
1314
1303
|
if (n) fabDot.removeAttribute('hidden'); else fabDot.setAttribute('hidden', '');
|
|
1315
1304
|
fab.setAttribute('aria-label', n ? fmt(S.update, { n: n }) : S.reportAria);
|
|
1305
|
+
if (hdDot) { hdDot.hidden = !n; if (hdMine) hdMine.setAttribute('aria-label', n ? fmt(S.mineAria, { n: n }) : S.mine); }
|
|
1316
1306
|
}
|
|
1317
1307
|
renderBadge();
|
|
1318
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* Where the panel sits follows the button: the same corner or edge, with room left for the button
|
|
1311
|
+
* so it never covers it, and the same offset. With no button (none, data-button="none") it takes
|
|
1312
|
+
* the corner the position names, bottom-right by default.
|
|
1313
|
+
*/
|
|
1314
|
+
function panelPad() {
|
|
1315
|
+
var shown = fabShowing(), tab = shown && STYLE === 'tab';
|
|
1316
|
+
var gap = shown && !tab ? FAB_H + 8 : 0;
|
|
1317
|
+
var x = Math.max(12, OFFSET[0]), y = Math.max(12, OFFSET[1]);
|
|
1318
|
+
var side = tab ? 48 : POS[0] === 'c' ? 12 : x;
|
|
1319
|
+
var top = POS[1] === 't' && !tab ? y + gap : 12, bottom = POS[1] === 'b' && !tab ? y + gap : 12;
|
|
1320
|
+
return top + 'px ' + (POS[0] === 'r' ? side : 12) + 'px ' + bottom + 'px ' + (POS[0] === 'l' ? side : 12) + 'px';
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1319
1323
|
function open(which) {
|
|
1320
1324
|
if (dead) return;
|
|
1321
1325
|
if (scrim) { if (which) { view = which; renderPanel(); } return; }
|
|
@@ -1323,221 +1327,457 @@
|
|
|
1323
1327
|
if (nudgeEl) { nudgeEl.remove(); nudgeEl = null; }
|
|
1324
1328
|
lastFocus = document.activeElement;
|
|
1325
1329
|
view = which || (unseen() ? 'mine' : 'new');
|
|
1326
|
-
|
|
1327
|
-
scrim
|
|
1330
|
+
scrim = el('div', { class: surface(), onclick: function (e) { if (e.target === scrim && !barUp()) close(); } });
|
|
1331
|
+
scrim.style.setProperty('--fb-pad', panelPad());
|
|
1328
1332
|
scrim.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
|
|
1329
1333
|
root.appendChild(scrim);
|
|
1334
|
+
if (LAYOUT === 'bar' && window.visualViewport) {
|
|
1335
|
+
window.visualViewport.addEventListener('resize', keyboard);
|
|
1336
|
+
window.visualViewport.addEventListener('scroll', keyboard);
|
|
1337
|
+
keyboard();
|
|
1338
|
+
}
|
|
1330
1339
|
renderPanel();
|
|
1331
1340
|
refresh();
|
|
1332
1341
|
}
|
|
1333
1342
|
|
|
1343
|
+
/** The bar is a small non-modal composer; Your reports (and everything else) is the panel. */
|
|
1344
|
+
function barUp() { return LAYOUT === 'bar' && view !== 'mine'; }
|
|
1345
|
+
function surface() {
|
|
1346
|
+
if (barUp()) return 'scrim ' + PLACE + ' bar';
|
|
1347
|
+
var cls = LAYOUT === 'bar' ? PLACE + ' corner' : PANEL === 'center' ? 'center' : PLACE + (PANEL === 'sheet' ? ' sheet' : ' corner');
|
|
1348
|
+
return 'scrim ' + cls + ' ' + BACKDROP;
|
|
1349
|
+
}
|
|
1350
|
+
/** On a phone the bar docks above the keyboard: lift it by what the keyboard covers. */
|
|
1351
|
+
function keyboard() {
|
|
1352
|
+
if (!scrim) return;
|
|
1353
|
+
var v = window.visualViewport;
|
|
1354
|
+
scrim.style.setProperty('--fb-kb', Math.max(0, Math.round(window.innerHeight - v.height - v.offsetTop)) + 'px');
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1334
1357
|
function close() {
|
|
1335
1358
|
if (!scrim) return;
|
|
1336
1359
|
if (view === 'mine') markSeen();
|
|
1360
|
+
if (window.visualViewport) {
|
|
1361
|
+
window.visualViewport.removeEventListener('resize', keyboard);
|
|
1362
|
+
window.visualViewport.removeEventListener('scroll', keyboard);
|
|
1363
|
+
}
|
|
1337
1364
|
scrim.remove();
|
|
1338
1365
|
scrim = null;
|
|
1339
|
-
|
|
1366
|
+
barMenuClose = null;
|
|
1367
|
+
listBox = null; hdDot = null; hdMine = null;
|
|
1340
1368
|
state.justSent = false;
|
|
1369
|
+
prefsOpen = false;
|
|
1341
1370
|
renderBadge();
|
|
1342
1371
|
if (lastFocus && lastFocus.focus) lastFocus.focus();
|
|
1343
1372
|
}
|
|
1344
1373
|
|
|
1374
|
+
var CLOSE_ICON = 'M6 6l12 12M18 6L6 18';
|
|
1375
|
+
/** A small line icon. The path is always one of the constants in this file. */
|
|
1376
|
+
function icon(d) {
|
|
1377
|
+
var s = document.createElement('span');
|
|
1378
|
+
s.style.display = 'contents';
|
|
1379
|
+
s.innerHTML = '<svg class="ic" viewBox="0 0 24 24" aria-hidden="true">' + (d.charAt(0) === '<' ? d : '<path d="' + d + '"/>') + '</svg>';
|
|
1380
|
+
return s.firstChild;
|
|
1381
|
+
}
|
|
1382
|
+
function closeBtn() {
|
|
1383
|
+
return el('button', { class: 'ib', type: 'button', 'aria-label': S.close, onclick: close }, [icon(CLOSE_ICON)]);
|
|
1384
|
+
}
|
|
1385
|
+
/** One line, on every view: who reads it, and the outside tool. Not configurable. */
|
|
1386
|
+
function foot(short) {
|
|
1387
|
+
return el('div', { class: 'foot' }, [
|
|
1388
|
+
short ? null : document.createTextNode(S.sentTo + ' · '),
|
|
1389
|
+
el('a', { href: HERESAY_URL, target: '_blank', rel: 'noopener', text: S.powered }),
|
|
1390
|
+
]);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1345
1393
|
function renderPanel() {
|
|
1394
|
+
if (view === 'sent' && !state.justSent) view = 'new';
|
|
1346
1395
|
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'),
|
|
1396
|
+
scrim.className = surface();
|
|
1397
|
+
barMenuClose = null;
|
|
1398
|
+
hdDot = hdMine = null;
|
|
1399
|
+
if (barUp()) { renderBar(); return; }
|
|
1400
|
+
var body, first, picking = LAYOUT === 'steps' && view === 'new' && !state.type;
|
|
1401
|
+
if (view === 'sent') body = sentView();
|
|
1402
|
+
else if (view === 'mine') body = listView();
|
|
1403
|
+
else body = LAYOUT === 'steps' ? stepsView() : formView();
|
|
1404
|
+
var panel = el('div', { class: 'panel', role: 'dialog', 'aria-modal': 'true', 'aria-label': S.dialog, tabindex: '-1' }, [
|
|
1405
|
+
el('div', { class: 'grab', 'aria-hidden': 'true' }, [el('i')]), body, foot(picking),
|
|
1361
1406
|
]);
|
|
1362
1407
|
scrim.appendChild(panel);
|
|
1363
|
-
|
|
1408
|
+
renderBadge();
|
|
1409
|
+
first = panel.querySelector(view === 'sent' ? '.send' : view === 'mine' ? '.ib' : state.type ? 'textarea' : picking ? '.pick' : '[role=radio]');
|
|
1410
|
+
// On touch, a focused pill or row would look picked before anyone tapped it: focus the dialog itself.
|
|
1411
|
+
if (first && (first.getAttribute('role') === 'radio' || first.classList.contains('pick')) && media('(pointer: coarse)')) first = panel;
|
|
1364
1412
|
if (first) first.focus();
|
|
1365
1413
|
}
|
|
1366
1414
|
|
|
1415
|
+
/** A report goes: the same for every layout. `busy` and `idle` change the send control. */
|
|
1416
|
+
function submit(text, err, busy, idle) {
|
|
1417
|
+
err.textContent = '';
|
|
1418
|
+
busy();
|
|
1419
|
+
var type = state.type;
|
|
1420
|
+
send(type, text.value.trim()).then(function (b) {
|
|
1421
|
+
state.type = null;
|
|
1422
|
+
state.draft = '';
|
|
1423
|
+
state.reports = [b.report].concat(state.reports);
|
|
1424
|
+
rememberMine();
|
|
1425
|
+
state.justSent = true;
|
|
1426
|
+
view = 'sent';
|
|
1427
|
+
renderPanel();
|
|
1428
|
+
listeners.forEach(function (fn) { try { fn({ id: b.report && b.report.id, type: type }); } catch (x) { console.error(x); } });
|
|
1429
|
+
}).catch(function (x) {
|
|
1430
|
+
err.textContent = x.message || S.cantSend;
|
|
1431
|
+
idle();
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
function typeOf(id) { return OFFERED.filter(function (x) { return x.id === id; })[0]; }
|
|
1435
|
+
|
|
1367
1436
|
function formView() {
|
|
1368
1437
|
var err = el('div', { class: 'err', role: 'alert' });
|
|
1369
1438
|
var text = el('textarea', {
|
|
1370
|
-
'aria-label': S.
|
|
1371
|
-
|
|
1372
|
-
oninput: function () { state.draft = text.value; },
|
|
1439
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '4',
|
|
1440
|
+
oninput: function () { state.draft = text.value; sync(); },
|
|
1373
1441
|
});
|
|
1374
1442
|
text.value = state.draft;
|
|
1375
1443
|
var sendBtn = el('button', { class: 'send', type: 'submit', text: S.send });
|
|
1376
|
-
|
|
1444
|
+
function sync() {
|
|
1445
|
+
var t = typeOf(state.type);
|
|
1446
|
+
text.placeholder = PLACEHOLDER || (t ? t.ph : S.phNone);
|
|
1447
|
+
sendBtn.disabled = !(state.type && text.value.trim());
|
|
1448
|
+
}
|
|
1449
|
+
function choose(i, focusText) {
|
|
1450
|
+
state.type = OFFERED[i].id;
|
|
1451
|
+
pills.forEach(function (b, j) { b.setAttribute('aria-checked', String(j === i)); b.tabIndex = j === i ? 0 : -1; });
|
|
1452
|
+
sync();
|
|
1453
|
+
pills[i].scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
1454
|
+
if (focusText) text.focus();
|
|
1455
|
+
}
|
|
1456
|
+
var picked = OFFERED.map(function (t) { return t.id; }).indexOf(state.type);
|
|
1457
|
+
var pills = OFFERED.map(function (t, i) {
|
|
1377
1458
|
return el('button', {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
text.focus();
|
|
1383
|
-
},
|
|
1384
|
-
}, [el('b', { text: t.label }), el('span', { text: t.hint })]);
|
|
1459
|
+
type: 'button', role: 'radio', 'aria-checked': String(i === picked), tabindex: i === (picked < 0 ? 0 : picked) ? '0' : '-1',
|
|
1460
|
+
'data-type': t.id, text: t.label,
|
|
1461
|
+
onclick: function () { choose(i, true); },
|
|
1462
|
+
});
|
|
1385
1463
|
});
|
|
1386
|
-
var
|
|
1387
|
-
|
|
1464
|
+
var seg = el('div', {
|
|
1465
|
+
class: 'seg', role: 'radiogroup', 'aria-label': S.kindAria,
|
|
1466
|
+
onkeydown: function (e) {
|
|
1467
|
+
var i = pills.indexOf(root.activeElement), n = pills.length, k = e.key;
|
|
1468
|
+
if (i < 0) return;
|
|
1469
|
+
var to = k === 'ArrowRight' || k === 'ArrowDown' ? (i + 1) % n : k === 'ArrowLeft' || k === 'ArrowUp' ? (i + n - 1) % n : -1;
|
|
1470
|
+
if (to < 0) return;
|
|
1388
1471
|
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
|
-
});
|
|
1472
|
+
pills[to].focus();
|
|
1473
|
+
choose(to);
|
|
1412
1474
|
},
|
|
1413
|
-
},
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
sendBtn,
|
|
1475
|
+
}, pills);
|
|
1476
|
+
sync();
|
|
1477
|
+
return el('div', { class: 'view' }, [
|
|
1478
|
+
el('div', { class: 'hd' }, [
|
|
1479
|
+
markEl(), el('h2', { text: S.report }), el('span', { class: 'sp' }),
|
|
1480
|
+
mineBtn(), closeBtn(),
|
|
1420
1481
|
]),
|
|
1421
|
-
|
|
1482
|
+
el('form', {
|
|
1483
|
+
class: 'pad', novalidate: '',
|
|
1484
|
+
onsubmit: function (e) {
|
|
1485
|
+
e.preventDefault();
|
|
1486
|
+
if (sendBtn.disabled) return;
|
|
1487
|
+
submit(text, err, function () {
|
|
1488
|
+
sendBtn.disabled = true;
|
|
1489
|
+
sendBtn.className = 'send busy';
|
|
1490
|
+
sendBtn.replaceChildren(markEl(true), document.createTextNode(S.sending));
|
|
1491
|
+
}, function () {
|
|
1492
|
+
sendBtn.className = 'send';
|
|
1493
|
+
sendBtn.textContent = S.send;
|
|
1494
|
+
sync();
|
|
1495
|
+
});
|
|
1496
|
+
},
|
|
1497
|
+
}, [seg, text, sendBtn, err]),
|
|
1422
1498
|
]);
|
|
1423
|
-
return form;
|
|
1424
1499
|
}
|
|
1425
1500
|
|
|
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
|
-
}
|
|
1501
|
+
// ---- the layouts -----------------------------------------------------------------------
|
|
1470
1502
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1503
|
+
var TYPE_ICON = {
|
|
1504
|
+
broken: '<path d="M12 4 21.2 19.5H2.8z"/><path d="M12 10v4M12 17h.01"/>',
|
|
1505
|
+
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"/>',
|
|
1506
|
+
improvement: '<path d="M3 17l6-6 4 4 8-8"/><path d="M15 7h6v6"/>',
|
|
1507
|
+
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"/>',
|
|
1508
|
+
};
|
|
1509
|
+
function typeIcon(id) { return icon(TYPE_ICON[id] || TYPE_ICON.idea); }
|
|
1510
|
+
|
|
1511
|
+
/** The "Your reports" icon (a clock) with a dot when something has an update. Steps and bar. */
|
|
1512
|
+
function mineIcon() {
|
|
1513
|
+
hdDot = el('i', { class: 'udot', hidden: '' });
|
|
1514
|
+
hdMine = el('button', { class: 'ib ibd', type: 'button', 'aria-label': S.mine, title: S.mine,
|
|
1515
|
+
onclick: function () { view = 'mine'; renderPanel(); } }, [icon(DONE_ICON.open), hdDot]);
|
|
1516
|
+
return hdMine;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/** Steps: first "What's going on?" with a row for each type, then the text box for the one picked. */
|
|
1520
|
+
function stepsView() {
|
|
1521
|
+
if (!state.type) {
|
|
1522
|
+
return el('div', { class: 'view' }, [
|
|
1523
|
+
el('div', { class: 'hd' }, [markEl(), el('h2', { class: 'q', text: S.whatsGoing }), el('span', { class: 'sp' }), mineIcon(), closeBtn()]),
|
|
1524
|
+
el('ul', { class: 'rows', role: 'list', 'aria-label': S.kindAria }, OFFERED.map(function (t) {
|
|
1525
|
+
return el('li', {}, [el('button', {
|
|
1526
|
+
class: 'pick', type: 'button', 'data-type': t.id,
|
|
1527
|
+
onclick: function () { state.type = t.id; renderPanel(); },
|
|
1528
|
+
}, [
|
|
1529
|
+
el('span', { class: 'tile' }, [typeIcon(t.id)]), el('span', { class: 'nm', text: t.label }),
|
|
1530
|
+
el('span', { class: 'chev', 'aria-hidden': 'true' }, [icon('M9 6l6 6-6 6')]),
|
|
1531
|
+
])]);
|
|
1532
|
+
})),
|
|
1479
1533
|
]);
|
|
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 || '';
|
|
1534
|
+
}
|
|
1535
|
+
var t = typeOf(state.type);
|
|
1485
1536
|
var err = el('div', { class: 'err', role: 'alert' });
|
|
1537
|
+
var text = el('textarea', {
|
|
1538
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '4',
|
|
1539
|
+
placeholder: PLACEHOLDER || t.ph,
|
|
1540
|
+
oninput: function () { state.draft = text.value; sync(); },
|
|
1541
|
+
});
|
|
1542
|
+
text.value = state.draft;
|
|
1543
|
+
var sendBtn = el('button', { class: 'send', type: 'submit', text: S.send });
|
|
1544
|
+
function sync() { sendBtn.disabled = !text.value.trim(); }
|
|
1545
|
+
sync();
|
|
1546
|
+
return el('div', { class: 'view' }, [
|
|
1547
|
+
el('div', { class: 'hd back' }, [
|
|
1548
|
+
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')]),
|
|
1549
|
+
el('span', { class: 'tpill' }, [typeIcon(t.id), document.createTextNode(t.label)]),
|
|
1550
|
+
el('span', { class: 'sp' }), mineIcon(), closeBtn(),
|
|
1551
|
+
]),
|
|
1552
|
+
el('form', {
|
|
1553
|
+
class: 'pad big', novalidate: '',
|
|
1554
|
+
onsubmit: function (e) {
|
|
1555
|
+
e.preventDefault();
|
|
1556
|
+
if (sendBtn.disabled) return;
|
|
1557
|
+
submit(text, err, function () {
|
|
1558
|
+
sendBtn.disabled = true;
|
|
1559
|
+
sendBtn.className = 'send busy';
|
|
1560
|
+
sendBtn.replaceChildren(markEl(true), document.createTextNode(S.sending));
|
|
1561
|
+
}, function () {
|
|
1562
|
+
sendBtn.className = 'send';
|
|
1563
|
+
sendBtn.textContent = S.send;
|
|
1564
|
+
sync();
|
|
1565
|
+
});
|
|
1566
|
+
},
|
|
1567
|
+
}, [text, sendBtn, err]),
|
|
1568
|
+
]);
|
|
1569
|
+
}
|
|
1486
1570
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1571
|
+
// Closes the bar's type menu; set while the bar is showing, so a click elsewhere can close it.
|
|
1572
|
+
var barMenuClose = null;
|
|
1573
|
+
document.addEventListener('pointerdown', function (e) {
|
|
1574
|
+
if (!barMenuClose) return;
|
|
1575
|
+
var path = e.composedPath ? e.composedPath() : [];
|
|
1576
|
+
var inside = path.some(function (n) { return n && n.classList && (n.classList.contains('bmenu') || n.classList.contains('tchip')); });
|
|
1577
|
+
if (!inside) barMenuClose();
|
|
1578
|
+
}, true);
|
|
1579
|
+
|
|
1580
|
+
/** Bar: one compact composer. [Type v] [text.....] (send), then Your reports, Powered by, close. */
|
|
1581
|
+
function renderBar() {
|
|
1582
|
+
var box, focus;
|
|
1583
|
+
var wrap = function (kids) {
|
|
1584
|
+
return el('div', { class: 'barbox', role: 'dialog', 'aria-modal': 'false', 'aria-label': S.dialog, tabindex: '-1' }, kids);
|
|
1585
|
+
};
|
|
1586
|
+
if (view === 'sent') {
|
|
1587
|
+
box = wrap([el('div', { class: 'bsent', role: 'status' }, [
|
|
1588
|
+
el('div', { class: 'chk', 'aria-hidden': 'true' }, [icon('M5 12.5l4.5 4.5L19 7.5')]),
|
|
1589
|
+
el('p', { text: THANKS || S.sentBar }),
|
|
1590
|
+
el('button', { class: 'send sm', type: 'button', text: S.done, onclick: close }),
|
|
1591
|
+
])]);
|
|
1592
|
+
scrim.appendChild(box);
|
|
1593
|
+
focus = box.querySelector('.send');
|
|
1594
|
+
} else {
|
|
1595
|
+
var err = el('div', { class: 'err', role: 'alert' });
|
|
1596
|
+
var text = el('textarea', {
|
|
1597
|
+
'aria-label': S.reportLabel, maxlength: '2000', rows: '1',
|
|
1598
|
+
oninput: function () { state.draft = text.value; grow(); sync(); },
|
|
1599
|
+
onkeydown: function (e) {
|
|
1600
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) { e.preventDefault(); form.requestSubmit ? form.requestSubmit() : go(); }
|
|
1601
|
+
},
|
|
1602
|
+
});
|
|
1603
|
+
text.value = state.draft;
|
|
1604
|
+
var go = function () { form.dispatchEvent(new Event('submit', { cancelable: true })); };
|
|
1605
|
+
var sendBtn = el('button', { class: 'bsend', type: 'submit', 'aria-label': S.send, title: S.send }, [icon('M12 19V5M5 12l7-7 7 7')]);
|
|
1606
|
+
var chip = el('button', { class: 'tchip', type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': 'false' });
|
|
1607
|
+
var menu = el('div', { class: 'bmenu', role: 'menu', 'aria-label': S.kindAria, hidden: '' });
|
|
1608
|
+
var items = OFFERED.map(function (t) {
|
|
1609
|
+
return el('button', { type: 'button', role: 'menuitemradio', tabindex: '-1', 'data-type': t.id, 'aria-checked': 'false' },
|
|
1610
|
+
[typeIcon(t.id), document.createTextNode(t.label)]);
|
|
1611
|
+
});
|
|
1612
|
+
items.forEach(function (b, i) { b.addEventListener('click', function () { choose(i); }); menu.appendChild(b); });
|
|
1613
|
+
var grow = function () {
|
|
1614
|
+
text.style.height = 'auto';
|
|
1615
|
+
text.style.height = Math.min(text.scrollHeight, 120) + 'px';
|
|
1616
|
+
};
|
|
1617
|
+
var sync = function () {
|
|
1618
|
+
var t = typeOf(state.type);
|
|
1619
|
+
text.placeholder = PLACEHOLDER || (t ? t.ph : S.tellTeam);
|
|
1620
|
+
sendBtn.disabled = !(state.type && text.value.trim());
|
|
1621
|
+
chip.textContent = '';
|
|
1622
|
+
if (t) chip.appendChild(typeIcon(t.id));
|
|
1623
|
+
chip.appendChild(el('span', { text: t ? t.label : S.typeChip }));
|
|
1624
|
+
chip.appendChild(el('span', { class: 'caret' }, [icon('M6 9l6 6 6-6')]));
|
|
1625
|
+
chip.setAttribute('aria-label', S.kindAria + (t ? ': ' + t.label : ''));
|
|
1626
|
+
items.forEach(function (b) { b.setAttribute('aria-checked', String(b.getAttribute('data-type') === state.type)); });
|
|
1627
|
+
};
|
|
1628
|
+
var shut = function (back) {
|
|
1629
|
+
if (menu.hidden) return;
|
|
1630
|
+
menu.hidden = true; chip.setAttribute('aria-expanded', 'false');
|
|
1631
|
+
if (back) chip.focus();
|
|
1632
|
+
};
|
|
1633
|
+
var show = function (last) {
|
|
1634
|
+
menu.hidden = false; chip.setAttribute('aria-expanded', 'true');
|
|
1635
|
+
var at = Math.max(0, OFFERED.map(function (t) { return t.id; }).indexOf(state.type));
|
|
1636
|
+
items[last ? items.length - 1 : at].focus();
|
|
1637
|
+
};
|
|
1638
|
+
barMenuClose = shut;
|
|
1639
|
+
var choose = function (i) {
|
|
1640
|
+
state.type = OFFERED[i].id;
|
|
1641
|
+
shut(false); sync(); text.focus();
|
|
1642
|
+
};
|
|
1643
|
+
chip.addEventListener('click', function () { if (menu.hidden) show(); else shut(true); });
|
|
1644
|
+
chip.addEventListener('keydown', function (e) {
|
|
1645
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); show(); }
|
|
1646
|
+
else if (e.key === 'ArrowUp') { e.preventDefault(); show(true); }
|
|
1647
|
+
});
|
|
1648
|
+
menu.addEventListener('keydown', function (e) {
|
|
1649
|
+
var i = items.indexOf(root.activeElement), n = items.length, k = e.key;
|
|
1650
|
+
if (k === 'Escape') { e.preventDefault(); e.stopPropagation(); shut(true); }
|
|
1651
|
+
else if (k === 'Tab') shut(false);
|
|
1652
|
+
else if (k === 'ArrowDown' || k === 'ArrowUp' || k === 'Home' || k === 'End') {
|
|
1653
|
+
e.preventDefault();
|
|
1654
|
+
items[k === 'Home' ? 0 : k === 'End' ? n - 1 : k === 'ArrowDown' ? (i + 1) % n : (i + n - 1) % n].focus();
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
var form = el('form', {
|
|
1658
|
+
class: 'bin', novalidate: '',
|
|
1659
|
+
onsubmit: function (e) {
|
|
1660
|
+
e.preventDefault();
|
|
1661
|
+
if (sendBtn.disabled) return;
|
|
1662
|
+
submit(text, err, function () {
|
|
1663
|
+
sendBtn.disabled = true; sendBtn.classList.add('busy'); text.readOnly = true;
|
|
1664
|
+
sendBtn.replaceChildren(markEl(true));
|
|
1665
|
+
sendBtn.setAttribute('aria-label', S.sending);
|
|
1666
|
+
}, function () {
|
|
1667
|
+
sendBtn.classList.remove('busy'); text.readOnly = false;
|
|
1668
|
+
sendBtn.replaceChildren(icon('M12 19V5M5 12l7-7 7 7'));
|
|
1669
|
+
sendBtn.setAttribute('aria-label', S.send);
|
|
1670
|
+
sync();
|
|
1671
|
+
});
|
|
1672
|
+
},
|
|
1673
|
+
}, [chip, text, sendBtn]);
|
|
1674
|
+
box = wrap([menu, form, err, el('div', { class: 'bmeta' }, [
|
|
1675
|
+
mineIcon(), el('span', { class: 'sp' }),
|
|
1676
|
+
el('span', { class: 'foot2' }, [el('a', { href: HERESAY_URL, target: '_blank', rel: 'noopener', text: S.powered })]),
|
|
1677
|
+
closeBtn(),
|
|
1678
|
+
])]);
|
|
1679
|
+
scrim.appendChild(box);
|
|
1680
|
+
sync(); grow();
|
|
1681
|
+
// On touch, a focused chip would look pressed before anyone tapped it: focus the bar itself.
|
|
1682
|
+
focus = state.type ? text : media('(pointer: coarse)') ? box : chip;
|
|
1501
1683
|
}
|
|
1684
|
+
renderBadge();
|
|
1685
|
+
if (focus) focus.focus();
|
|
1686
|
+
}
|
|
1502
1687
|
|
|
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 })]),
|
|
1688
|
+
/** The quiet "Your reports" button in the header, with a dot when something has an update. */
|
|
1689
|
+
function mineBtn() {
|
|
1690
|
+
hdDot = el('i', { class: 'udot', hidden: '' });
|
|
1691
|
+
hdMine = el('button', { class: 'quiet', type: 'button', onclick: function () { view = 'mine'; renderPanel(); } },
|
|
1692
|
+
[document.createTextNode(S.mine), hdDot]);
|
|
1693
|
+
return hdMine;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
function sentView() {
|
|
1697
|
+
return el('div', { class: 'view' }, [
|
|
1698
|
+
el('div', { class: 'hd' }, [el('span', { class: 'sp' }), closeBtn()]),
|
|
1699
|
+
el('div', { class: 'view sent', role: 'status' }, [
|
|
1700
|
+
el('div', { class: 'chk', 'aria-hidden': 'true' }, [icon('M5 12.5l4.5 4.5L19 7.5')]),
|
|
1701
|
+
el('p', { text: S.sentMsg }),
|
|
1702
|
+
THANKS ? el('p', { class: 'thanks', text: THANKS }) : null,
|
|
1703
|
+
el('button', { class: 'send', type: 'button', text: S.done, onclick: close }),
|
|
1525
1704
|
]),
|
|
1526
|
-
err,
|
|
1527
|
-
el('p', { class: 'small', text: S.kept }),
|
|
1528
1705
|
]);
|
|
1529
1706
|
}
|
|
1530
1707
|
|
|
1531
1708
|
function listView() {
|
|
1532
|
-
listBox = el('div', {
|
|
1709
|
+
listBox = el('div', { class: 'cards' });
|
|
1533
1710
|
renderList();
|
|
1534
|
-
return
|
|
1711
|
+
return el('div', { class: 'view' }, [
|
|
1712
|
+
el('div', { class: 'hd back' }, [
|
|
1713
|
+
el('button', { class: 'ib', type: 'button', 'aria-label': S.back, onclick: function () { markSeen(); view = 'new'; renderPanel(); } }, [icon('M15 5l-7 7 7 7')]),
|
|
1714
|
+
el('h2', { text: S.mine }), el('span', { class: 'sp' }), closeBtn(),
|
|
1715
|
+
]),
|
|
1716
|
+
listBox,
|
|
1717
|
+
PREFS_ROW ? prefsRow() : null,
|
|
1718
|
+
]);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* "Your name and email": two optional fields, kept on this device and sent with each report.
|
|
1723
|
+
* Signed in (the app called identify), it only says who, and asks for nothing.
|
|
1724
|
+
*/
|
|
1725
|
+
function prefsRow() {
|
|
1726
|
+
if (identified()) {
|
|
1727
|
+
return el('div', { class: 'prefs' }, [el('div', { class: 'signed', text: fmt(S.signedAs, { who: state.userLabel || state.userEmail || S.yourAccount }) })]);
|
|
1728
|
+
}
|
|
1729
|
+
var p = prefs();
|
|
1730
|
+
var name = el('input', { id: 'fb-name', type: 'text', maxlength: '80', autocomplete: 'name' });
|
|
1731
|
+
var email = el('input', { id: 'fb-email', type: 'email', maxlength: '200', autocomplete: 'email' });
|
|
1732
|
+
var status = el('p', { class: 'small', role: 'status' });
|
|
1733
|
+
var err = el('div', { class: 'err', role: 'alert' });
|
|
1734
|
+
name.value = p.name || ''; email.value = p.email || '';
|
|
1735
|
+
function keep() {
|
|
1736
|
+
var em = email.value.trim(), ok = !em || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(em);
|
|
1737
|
+
err.textContent = ok ? '' : S.badEmail;
|
|
1738
|
+
if (!ok) { status.textContent = ''; return; }
|
|
1739
|
+
var q = prefs();
|
|
1740
|
+
savePrefs({ name: name.value.trim(), email: em, note: q.note });
|
|
1741
|
+
status.textContent = S.saved;
|
|
1742
|
+
}
|
|
1743
|
+
name.addEventListener('change', keep);
|
|
1744
|
+
email.addEventListener('change', keep);
|
|
1745
|
+
var box = el('div', { class: 'pb', id: 'fb-pb', hidden: '' }, [
|
|
1746
|
+
el('label', { for: 'fb-name', text: S.nameOpt }), name,
|
|
1747
|
+
el('label', { for: 'fb-email', text: S.emailOpt }), email, err, status,
|
|
1748
|
+
]);
|
|
1749
|
+
var btn = el('button', { type: 'button', 'aria-expanded': 'false', 'aria-controls': 'fb-pb' }, [
|
|
1750
|
+
document.createTextNode(S.nameEmail), icon('M6 9l6 6 6-6'),
|
|
1751
|
+
]);
|
|
1752
|
+
function setOpen(o, focus) {
|
|
1753
|
+
prefsOpen = o;
|
|
1754
|
+
btn.setAttribute('aria-expanded', String(o));
|
|
1755
|
+
if (o) box.removeAttribute('hidden'); else box.setAttribute('hidden', '');
|
|
1756
|
+
if (o && focus) name.focus();
|
|
1757
|
+
}
|
|
1758
|
+
btn.addEventListener('click', function () { setOpen(!prefsOpen, true); });
|
|
1759
|
+
setOpen(prefsOpen, false);
|
|
1760
|
+
return el('div', { class: 'prefs' }, [btn, box]);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
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' };
|
|
1764
|
+
/** "Today", "Yesterday", or the date, in the reporter's language. */
|
|
1765
|
+
function when(iso) {
|
|
1766
|
+
var d = new Date(iso);
|
|
1767
|
+
if (isNaN(d)) return '';
|
|
1768
|
+
var days = Math.round((new Date().setHours(0, 0, 0, 0) - new Date(d).setHours(0, 0, 0, 0)) / 864e5);
|
|
1769
|
+
try {
|
|
1770
|
+
if (days >= 0 && days <= 1) {
|
|
1771
|
+
var w = new Intl.RelativeTimeFormat(LANG, { numeric: 'auto' }).format(-days, 'day');
|
|
1772
|
+
return w.charAt(0).toLocaleUpperCase(LANG) + w.slice(1);
|
|
1773
|
+
}
|
|
1774
|
+
} catch (e) { /* older browser: the date */ }
|
|
1775
|
+
return d.toLocaleDateString(LANG);
|
|
1535
1776
|
}
|
|
1536
1777
|
|
|
1537
1778
|
function renderList() {
|
|
1538
1779
|
if (!listBox) return;
|
|
1539
1780
|
listBox.textContent = '';
|
|
1540
|
-
if (state.justSent && THANKS) listBox.appendChild(el('div', { class: 'thanks', role: 'status', text: THANKS }));
|
|
1541
1781
|
if (!state.reports.length) {
|
|
1542
1782
|
listBox.appendChild(el('div', { class: 'empty', text: S.none }));
|
|
1543
1783
|
return;
|
|
@@ -1546,22 +1786,26 @@
|
|
|
1546
1786
|
state.reports.forEach(function (r) {
|
|
1547
1787
|
var label = (TYPES.filter(function (t) { return t.id === r.type; })[0] || {}).label || r.type;
|
|
1548
1788
|
var fresh = r.status !== 'open' && r.status !== 'withdrawn' && s[r.id] !== mark(r);
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
el('div', { class: '
|
|
1552
|
-
|
|
1789
|
+
var d = DONE_ICON[r.status === 'accepted' ? 'open' : r.status];
|
|
1790
|
+
listBox.appendChild(el('article', { class: 'card' }, [
|
|
1791
|
+
el('div', { class: 'top' }, [
|
|
1792
|
+
el('b', { text: label }), el('span', { text: '·' }), el('span', { text: when(r.created_at) }),
|
|
1793
|
+
fresh ? el('i', { class: 'udot', role: 'img', 'aria-label': S.fresh }) : null,
|
|
1794
|
+
]),
|
|
1795
|
+
el('p', { class: 't', text: r.text }),
|
|
1796
|
+
el('span', { class: 'chip' + (r.status === 'fixed' ? ' fx' : '') }, [d ? icon(d) : null, document.createTextNode(S.status[r.status] || r.status)]),
|
|
1553
1797
|
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,
|
|
1798
|
+
? el('p', { class: 'n2' }, [el('b', { text: S.why }), document.createTextNode(r.decline_reason)]) : null,
|
|
1799
|
+
r.status === 'fixed' && r.fix_note ? el('p', { class: 'n2', text: r.fix_note }) : null,
|
|
1557
1800
|
r.status === 'fixed' && r.fix_version
|
|
1558
|
-
? el('
|
|
1559
|
-
r.status === 'withdrawn' && r.withdrawn_reason ? el('
|
|
1801
|
+
? 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,
|
|
1802
|
+
r.status === 'withdrawn' && r.withdrawn_reason ? el('p', { class: 'n2', text: S.yourWhy + r.withdrawn_reason }) : null,
|
|
1560
1803
|
r.status === 'open' ? takeBack(r) : null,
|
|
1561
1804
|
]));
|
|
1562
1805
|
});
|
|
1563
1806
|
}
|
|
1564
1807
|
|
|
1808
|
+
|
|
1565
1809
|
/** "Take back": a report they sent and the team hasn't accepted. Kept as withdrawn, not deleted. */
|
|
1566
1810
|
function takeBack(r) {
|
|
1567
1811
|
var box = el('div', { class: 'take-back' });
|
|
@@ -1573,7 +1817,7 @@
|
|
|
1573
1817
|
box.appendChild(why);
|
|
1574
1818
|
box.appendChild(el('div', { class: 'row' }, [
|
|
1575
1819
|
el('button', { class: 'link', type: 'button', text: S.keep, onclick: idle }),
|
|
1576
|
-
el('button', { class: 'send', type: 'button', text: S.takeBackYes, onclick: function () {
|
|
1820
|
+
el('button', { class: 'send sm', type: 'button', text: S.takeBackYes, onclick: function () {
|
|
1577
1821
|
withdrawReport(r.id, why.value.trim()).then(function (b) {
|
|
1578
1822
|
state.reports = state.reports.map(function (x) { return x.id === r.id ? b.report : x; });
|
|
1579
1823
|
markSeen();
|
|
@@ -1606,15 +1850,11 @@
|
|
|
1606
1850
|
if (dead || bubble || scrim || load(INTRO_KEY) || !fabShowing()) return false;
|
|
1607
1851
|
save(INTRO_KEY, new Date().toISOString());
|
|
1608
1852
|
var done = function () { if (bubble) { bubble.remove(); bubble = null; } };
|
|
1609
|
-
var label = LABEL === S.report ? LABEL : '“' + LABEL + '”';
|
|
1610
1853
|
bubble = el('div', { class: 'intro ' + PLACE + ' st-' + STYLE, role: 'dialog', 'aria-label': S.introAria }, [
|
|
1611
1854
|
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),
|
|
1855
|
+
el('p', { text: words(o.body, 280) || S.introBody }),
|
|
1856
|
+
el('div', { class: 'row' }, [el('span'), el('button', { class: 'send sm', type: 'button', text: S.got, onclick: done })]),
|
|
1857
|
+
foot(),
|
|
1618
1858
|
]);
|
|
1619
1859
|
bubble.addEventListener('keydown', function (e) { if (e.key === 'Escape') done(); });
|
|
1620
1860
|
root.appendChild(bubble);
|
|
@@ -1662,14 +1902,14 @@
|
|
|
1662
1902
|
el('p', { text: stuck ? S.nudgeStuckBody : S.nudgeBody }),
|
|
1663
1903
|
el('div', { class: 'row' }, [
|
|
1664
1904
|
el('button', { class: 'link', type: 'button', text: S.nudgeNo, onclick: function () { done(); } }),
|
|
1665
|
-
el('button', { class: 'send', type: 'button', text: S.nudgeYes, onclick: function () {
|
|
1905
|
+
el('button', { class: 'send sm', type: 'button', text: S.nudgeYes, onclick: function () {
|
|
1666
1906
|
done();
|
|
1667
1907
|
var as = stuck ? 'confusing' : 'broken';
|
|
1668
1908
|
if (!state.type && OFFERED.some(function (t) { return t.id === as; })) state.type = as;
|
|
1669
1909
|
open('new');
|
|
1670
1910
|
} }),
|
|
1671
1911
|
]),
|
|
1672
|
-
|
|
1912
|
+
foot(),
|
|
1673
1913
|
]);
|
|
1674
1914
|
root.appendChild(nudgeEl);
|
|
1675
1915
|
later();
|
|
@@ -1693,7 +1933,7 @@
|
|
|
1693
1933
|
state.userId = u.id != null ? String(u.id) : null;
|
|
1694
1934
|
state.userLabel = u.label != null ? String(u.label) : null;
|
|
1695
1935
|
state.userEmail = u.email != null ? String(u.email) : null;
|
|
1696
|
-
if (scrim && view === '
|
|
1936
|
+
if (scrim && view === 'mine') renderPanel();
|
|
1697
1937
|
},
|
|
1698
1938
|
setVersion: function (v) { state.version = v != null ? String(v) : null; versionSeen(state.version); },
|
|
1699
1939
|
setScreen: function (s) {
|
|
@@ -1707,7 +1947,7 @@
|
|
|
1707
1947
|
if (o.text != null) state.draft = String(o.text).slice(0, 2000);
|
|
1708
1948
|
open('new');
|
|
1709
1949
|
},
|
|
1710
|
-
openPreferences: function () { if (
|
|
1950
|
+
openPreferences: function () { if (PREFS_ROW) { prefsOpen = true; open('mine'); } },
|
|
1711
1951
|
/** Show the one-time introduction now. False if it was already shown on this device. */
|
|
1712
1952
|
introduce: function (o) { return introduce(o); },
|
|
1713
1953
|
/** The app saw trouble itself (an error screen, a retry that failed): offer to report it.
|