-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtu_sdk_story_book.html
327 lines (318 loc) · 9.88 KB
/
dtu_sdk_story_book.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>"Do They Use" JavaScript SDK HTML Story Book page</title>
</head>
<style type="text/css">
table, th, td {
border: 1px solid lightgray;
border-collapse: collapse;
}
th, td {
border-style: groove;
padding: 5px;
text-align: left;
}
h3 {
margin-bottom: 7px;
}
.unsupported {
background-color: lightcoral;
}
</style>
<body data-dtu="body">
<h1>Story Book for <a href="https://github.com/alexeyhimself/dtu_sdk_js">"Do They Use" service JavaScript SDK</a></h1>
<p>Listed all supported by JS SDK elements with their events and report samples.<br>
<u>Elements are interactive:</u> click and change values and see what to be sent in this case in report.</p>
<h3><input></h3>
<table data-dtu="input table">
<tr>
<th>type</th>
<th>element</th>
<th>listen event</th>
<th>data-dtu attribute value in this demo</th>
<th>element and value to be sent in a report</th>
<th>comment</th>
</tr>
<tbody>
<tr>
<td>date</td>
<td>
<input type="date" data-dtu="some date"/>
</td>
<td>change</td>
<td>some date</td>
<td id="some date">...</td>
<td></td>
</tr>
<tr>
<td>time</td>
<td>
<input type="time" data-dtu="some time"/>
</td>
<td>change</td>
<td>some time</td>
<td id="some time">...</td>
<td></td>
</tr>
<tr>
<td>datetime-local</td>
<td>
<input type="datetime-local" data-dtu="some datetime-local"/>
</td>
<td>change</td>
<td>some datetime-local</td>
<td id="some datetime-local">...</td>
<td></td>
</tr>
<tr>
<tr>
<td>button</td>
<td>
<input type="button" data-dtu="some input button" value="input button value" />
</td>
<td>click</td>
<td>some input button</td>
<td id="some input button">...</td>
<td></td>
</tr>
<tr>
<td>checkbox</td>
<td>
<input type="checkbox" data-dtu="some input checkbox" name="some checkbox" value="input checkbox value 1" />
<input type="checkbox" data-dtu="some input checkbox" name="some checkbox" value="input checkbox value 2" />
</td>
<td>change</td>
<td>some input checkbox</td>
<td id="some input checkbox">...</td>
<td>has additional attribute: "checked"</td>
</tr>
<tr>
<td>radio</td>
<td>
<input type="radio" data-dtu="some input radio" name="some radio" value="input radio value 1" />
<input type="radio" data-dtu="some input radio" name="some radio" value="input radio value 2" />
</td>
<td>change</td>
<td>some input radio</td>
<td id="some input radio">...</td>
<td>has additional attribute: "checked"</td>
</tr>
<tr>
<td>email</td>
<td>
<input type="email" data-dtu="some input email" name="some email" value="" />
</td>
<td>change</td>
<td>some input email</td>
<td id="some input email">...</td>
<td></td>
</tr>
<tr>
<td>password</td>
<td>
<input type="password" data-dtu="some input password" name="some password" value="" />
</td>
<td>change</td>
<td>some input password</td>
<td id="some input password">...</td>
<td>value contains length of an input value instead of the value itself</td>
</tr>
<tr>
<td>number</td>
<td>
<input type="number" data-dtu="some input number" name="some number" value="" />
</td>
<td>change</td>
<td>some input number</td>
<td id="some input number">...</td>
<td></td>
</tr>
<tr>
<td>range</td>
<td>
<input type="range" data-dtu="some input range" name="some range" value="" />
</td>
<td>change</td>
<td>some input range</td>
<td id="some input range">...</td>
<td></td>
</tr>
<tr>
<td>file</td>
<td>
<input type="file" data-dtu="some input file" name="some file" value="" />
</td>
<td>change</td>
<td>some input file</td>
<td id="some input file">...</td>
<td></td>
</tr>
<tr>
<td>file</td>
<td>
<input type="file" data-dtu="some input file (miltiple)" name="some file (miltiple)" value="" multiple/>
</td>
<td>change</td>
<td>some input file (miltiple)</td>
<td id="some input file (miltiple)">...</td>
<td>multiple files</td>
</tr>
<tr>
<td>text</td>
<td>
<input type="text" data-dtu="some input text" name="some text" value="" />
</td>
<td>change</td>
<td>some input text</td>
<td id="some input text">...</td>
<td>value contains length of an input value instead of the value itself</td>
</tr>
</tbody>
</table>
<h3><select></h3>
<table data-dtu="select table">
<tr>
<th>type</th>
<th>element</th>
<th>listen event</th>
<th>data-dtu attribute value in this demo</th>
<th>element and value to be sent in a report</th>
</tr>
<tbody>
<tr>
<td>select-one</td>
<td>
<select data-dtu="some dropdown">
<option>some value 1</option>
<option>some value 2</option>
</select>
</td>
<td>change</td>
<td>some dropdown</td>
<td id="some dropdown">...</td>
</tr>
<tr>
<td>select-multiple</td>
<td>
<select data-dtu="some dropdown (multiple)" multiple>
<option>some value 1</option>
<option>some value 2</option>
</select>
</td>
<td>change</td>
<td>some dropdown (multiple)</td>
<td id="some dropdown (multiple)">...</td>
</tr>
</tbody>
</table>
<h3><a></h3>
<table data-dtu="anchor table">
<tr>
<th>type</th>
<th>element</th>
<th>listen event</th>
<th>data-dtu attribute value in this demo</th>
<th>element and value to be sent in a report</th>
<th>comment</th>
</tr>
<tbody>
<tr>
<td>''</td>
<td>
<a href="javascript:;" data-dtu="some link"/>some text in link</a>
</td>
<td>click</td>
<td>some link</td>
<td id="some link">...</td>
<td></td>
</tr>
<tr>
<td>''</td>
<td>
<a href="javascript:;" data-dtu/>some text in link (empty data-dtu)</a>
</td>
<td>click</td>
<td>''</td>
<td id="some text in link (empty data-dtu)">...</td>
<td>empty data-dtu attribute forces to use element's innerText</td>
</tr>
</tbody>
</table>
<h3><button></h3>
<table data-dtu="button table">
<tr>
<th>type</th>
<th>element</th>
<th>listen event</th>
<th>data-dtu attribute value in this demo</th>
<th>element and value to be sent in a report</th>
<th>comment</th>
</tr>
<tbody>
<tr>
<td>submit</td>
<td>
<button type="submit" data-dtu="some button"/>button text</button>
</td>
<td>click</td>
<td>some button</td>
<td id="some button">...</td>
<td></td>
</tr>
<tr>
<td>submit</td>
<td>
<button type="submit" data-dtu/>button text (empty data-dtu)</button>
</td>
<td>click</td>
<td>''</td>
<td id="button text (empty data-dtu)">...</td>
<td>empty data-dtu attribute forces to use element's innerText</td>
</tr>
</tbody>
</table>
<h3><textarea></h3>
<table data-dtu="textarea table">
<tr>
<th>type</th>
<th>element</th>
<th>listen event</th>
<th>data-dtu attribute value in this demo</th>
<th>element and value to be sent in a report</th>
<th>comment</th>
</tr>
<tbody>
<tr>
<td>textarea</td>
<td>
<textarea data-dtu="some textarea"/>textarea text</textarea>
</td>
<td>change</td>
<td>some textarea</td>
<td id="some textarea">...</td>
<td></td>
</tr>
</tbody>
</table>
<script type="text/javascript">
function update_storybook(report) {
const values_to_exclude = ['ctag', 'topic', 'uid', 'ugid', 'date_time', 'url_scheme', 'url_domain_name', 'url_port', 'url_path', 'url_parameters', 'page_title', 'element_type', 'event_type']; // this exclude - is just to display more meaningful items in story book table
for (let i in values_to_exclude)
delete report[values_to_exclude[i]];
let td_element = document.getElementById(report.element);
td_element.innerHTML = JSON.stringify(report);
console.log(JSON.stringify(report))
};
</script>
<script src="dtu_sdk.js"></script>
<script type="text/javascript">
const dtu = dotheyuse({
'ctag': 'DTU STORY BOOK CTAG',
'callback': update_storybook,
});
</script>
</body>
</html>