kamrify commited on
Commit
e09eecc
Β·
1 Parent(s): 8122c36

Update docs

Browse files
Files changed (5) hide show
  1. demo/scripts/demo.js +271 -225
  2. demo/styles/demo.scss +4 -0
  3. index.html +35 -21
  4. package.json +4 -0
  5. src/core/popover.js +3 -1
demo/scripts/demo.js CHANGED
@@ -1,291 +1,337 @@
1
  /* eslint-disable */
 
 
 
 
 
 
 
2
 
3
- const tourDriver = new Driver({
4
- animate: true,
5
- opacity: 0.8,
6
- padding: 5,
7
- showButtons: false,
8
- });
9
-
10
- tourDriver.defineSteps([
11
- {
12
- element: '.emoji',
13
- popover: {
14
- title: 'Adding Introductions',
15
- description: 'You can use it to add popovers on top of the website',
16
- position: 'bottom',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  },
18
- }, {
19
- element: '.section__header',
20
- popover: {
21
- title: 'Adding Introductions',
22
- description: 'You can use it to add popovers on top of the website',
23
- position: 'bottom',
24
  },
25
- },
26
- {
27
- element: '.btn__dark',
28
- popover: {
29
- title: 'This is Button',
30
- description: 'Yeah I know I dont need to tell that but anyways, we need a step in the listing so yeah!'
31
- }
32
- },
33
- {
34
- element: '#free-use',
35
- popover: {
36
- title: 'Free to Use',
37
- description: 'Yes, you can use it in your personal or commercial products'
38
- }
39
- },
40
- {
41
- element: '.section__how',
42
- popover: {
43
- title: 'Just Specify the Item',
44
- description: 'All you have to do is provide the query selector of element to highlight',
45
- position: 'right',
46
  },
47
- },
48
- {
49
- element: '.section__purpose',
50
- popover: {
51
- title: 'Automatically Position',
52
- description: 'It can automatically position too if you dont provide',
53
  },
54
- },
55
- {
56
- element: '.section__examples',
57
- },
58
- {
59
- element: '.section__contributing',
60
- popover: {
61
- title: 'Automatically Position',
62
- description: 'It can automatically position too if you dont provide',
63
  },
64
- },
65
- ]);
66
 
67
- document.querySelector('.btn__example')
68
- .addEventListener('click', () => {
69
- tourDriver.start();
70
- });
71
 
72
 
73
- document.querySelectorAll('pre code').forEach((element) => {
74
- hljs.highlightBlock(element);
75
- });
76
 
77
 
78
  /////////////////////////////////////////////
79
  // First example – highlighting without popover
80
  /////////////////////////////////////////////
81
- const singleDriverNoPopover = new Driver();
82
- document.querySelector('#run-single-element-no-popover')
83
- .addEventListener('click', (e) => {
84
- e.preventDefault();
85
- singleDriverNoPopover.highlight('#single-element-no-popover');
86
- });
87
 
88
  /////////////////////////////////////////////
89
  // Form focus examples
90
  /////////////////////////////////////////////
91
- const focusDriver = new Driver({ padding: 0 });
92
- const inputIds = ['creation-input', 'creation-input-2', 'creation-input-3', 'creation-input-4'];
93
- inputIds.forEach(inputId => {
94
- // Highlight the section on focus
95
- document.getElementById(inputId).addEventListener('focus', () => {
96
- focusDriver.highlight(`#${inputId}`);
 
97
  });
98
- });
99
 
100
  /////////////////////////////////////////////
101
  // Highlighting single element with popover
102
  /////////////////////////////////////////////
103
- const singleDriverWithPopover = new Driver();
104
- document.querySelector('#run-single-element-with-popover')
105
- .addEventListener('click', (e) => {
106
- e.preventDefault();
107
- singleDriverWithPopover.highlight({
108
- element: '#single-element-with-popover',
109
- popover: {
110
- title: 'Did you know?',
111
- description: 'You can add HTML in title or description also!',
112
- position: 'top'
113
- }
 
114
  });
115
- });
116
 
117
  /////////////////////////////////////////////////////
118
  // Highlighting single element with popover position
119
  /////////////////////////////////////////////////////
120
- const singleDriverWithPopoverPosition = new Driver();
121
- document.querySelector('#run-single-element-with-popover-position')
122
- .addEventListener('click', (e) => {
123
- e.preventDefault();
124
 
125
- singleDriverWithPopoverPosition.highlight({
126
- element: '#single-element-with-popover-position',
127
- popover: {
128
- title: 'Did you know?',
129
- description: 'You can add HTML in title or description also!',
130
- position: 'left'
131
- }
 
132
  });
133
- });
134
 
135
  /////////////////////////////////////////////////////
136
  // Highlighting single element with popover position
137
  /////////////////////////////////////////////////////
138
- const positionBtnsDriver = new Driver({
139
- padding: 0,
140
- });
141
 
142
- document.querySelector('#position-btn-left')
143
- .addEventListener('click', (e) => {
144
- e.preventDefault();
145
 
146
- positionBtnsDriver.highlight({
147
- element: '#position-btn-left',
148
- popover: {
149
- title: 'Did you know?',
150
- description: 'You can add HTML in title or description also!',
151
- position: 'left'
152
- }
 
153
  });
154
- });
155
 
156
- document.querySelector('#position-btn-right')
157
- .addEventListener('click', (e) => {
158
- e.preventDefault();
159
 
160
- positionBtnsDriver.highlight({
161
- element: '#position-btn-right',
162
- popover: {
163
- title: 'Did you know?',
164
- description: 'You can add HTML in title or description also!',
165
- position: 'right'
166
- }
 
167
  });
168
- });
169
 
170
- document.querySelector('#position-btn-bottom')
171
- .addEventListener('click', (e) => {
172
- e.preventDefault();
173
 
174
- positionBtnsDriver.highlight({
175
- element: '#position-btn-bottom',
176
- popover: {
177
- title: 'Did you know?',
178
- description: 'You can add HTML in title or description also!',
179
- position: 'bottom'
180
- }
 
181
  });
182
- });
183
 
184
- document.querySelector('#position-btn-top')
185
- .addEventListener('click', (e) => {
186
- e.preventDefault();
187
 
188
- positionBtnsDriver.highlight({
189
- element: '#position-btn-top',
190
- popover: {
191
- title: 'Did you know?',
192
- description: 'You can add HTML in title or description also!',
193
- position: 'top'
194
- }
 
195
  });
196
- });
197
 
198
  /////////////////////////////////////////////////////
199
  // Highlighting single element with popover position
200
  /////////////////////////////////////////////////////
201
- const htmlDriver = new Driver();
202
 
203
- document.querySelector('#run-single-element-with-popover-html')
204
- .addEventListener('click', (e) => {
205
- e.preventDefault();
206
 
207
- htmlDriver.highlight({
208
- element: '#single-element-with-popover-html',
209
- popover: {
210
- title: '<em>Tags</em> in title or <u>body</u>',
211
- description: 'Body can also have <strong>html tags</strong>!',
212
- position: 'top'
213
- }
 
214
  });
215
- });
216
 
217
  /////////////////////////////////////////////////////
218
  // Without Overlay Example
219
  /////////////////////////////////////////////////////
220
- const withoutOverlay = new Driver({
221
- opacity: 0,
222
- padding: 0
223
- });
224
 
225
- document.querySelector('#run-element-without-popover')
226
- .addEventListener('click', (e) => {
227
- e.preventDefault();
228
 
229
- withoutOverlay.highlight({
230
- element: '#run-element-without-popover',
231
- popover: {
232
- title: 'Title for the Popover',
233
- description: 'Description for it',
234
- position: 'left', // can be `top`, `left`, `right`, `bottom`
235
- }
236
- } );
237
- });
238
 
239
  /////////////////////////////////////////////////////
240
  // Highlighting single element with popover position
241
  /////////////////////////////////////////////////////
242
- const featureIntroductionDriver = new Driver();
243
- featureIntroductionDriver.defineSteps([
244
- {
245
- element: '#first-element-introduction',
246
- popover: {
247
- title: 'Title on Popover',
248
- description: 'Body of the popover',
249
- position: 'bottom'
250
- }
251
- },
252
- {
253
- element: '#second-para-feature-introductions',
254
- popover: {
255
- title: 'Title on Popover',
256
- description: 'Body of the popover',
257
- position: 'left'
258
- }
259
- },
260
- {
261
- element: '#third-para-feature-introductions',
262
- popover: {
263
- title: 'Title on Popover',
264
- description: 'Body of the popover',
265
- position: 'right'
266
- }
267
- },
268
- {
269
- element: '#run-multi-element-popovers',
270
- popover: {
271
- title: 'Title on Popover',
272
- description: 'Body of the popover',
273
- position: 'top'
274
- }
275
- },
276
- {
277
- element: '#third-element-introduction',
278
- popover: {
279
- title: 'Title on Popover',
280
- description: 'Body of the popover',
281
- position: 'top'
282
- }
283
- },
284
- ]);
285
 
286
- document.querySelector('#run-multi-element-popovers')
287
- .addEventListener('click', (e) => {
288
- e.preventDefault();
289
- featureIntroductionDriver.start();
290
- });
291
 
 
 
1
  /* eslint-disable */
2
+ document.addEventListener("DOMContentLoaded", function () {
3
+ const tourDriver = new Driver({
4
+ animate: true,
5
+ opacity: 0.8,
6
+ padding: 5,
7
+ showButtons: true,
8
+ });
9
 
10
+ tourDriver.defineSteps([
11
+ {
12
+ element: '#driver-demo-head',
13
+ popover: {
14
+ title: 'Before we start',
15
+ description: 'This is just one use-case, make sure to check out the rest of the docs below.',
16
+ nextBtnText: 'Okay, Start!',
17
+ },
18
+ },
19
+ {
20
+ element: '#logo_emoji',
21
+ popover: {
22
+ title: 'Focus Anything',
23
+ description: 'You can use it to highlight literally anything, images, text, div, span, li etc.',
24
+ position: 'bottom',
25
+ },
26
+ },
27
+ {
28
+ element: '#name_driver',
29
+ popover: {
30
+ title: 'Why Driver?',
31
+ description: 'Because it let\'s you drive the user across the page',
32
+ position: 'bottom',
33
+ },
34
+ },
35
+ {
36
+ element: '#driver-demo-head',
37
+ popover: {
38
+ title: 'Lets talk features',
39
+ description: 'You may leave your mouse and use the <strong>arrow keys</strong> to move next and back or <strong>escape key</strong> anytime to close this',
40
+ position: 'bottom',
41
+ },
42
+ },
43
+ {
44
+ element: '#highlight_feature',
45
+ popover: {
46
+ title: 'Highlight Feature',
47
+ description: 'You may use it to highlight single elements (with or without popover) e.g. like facebook does while creating posts'
48
+ }
49
+ },
50
+ {
51
+ element: '#feature_introductions_feature',
52
+ popover: {
53
+ title: 'Feature Introductions',
54
+ description: 'With it\'s powerful API you can use it to make programmatic or user driven feature introductions',
55
+ position: 'bottom',
56
+ }
57
+ },
58
+ {
59
+ element: '#focus_shifters_feature',
60
+ popover: {
61
+ title: 'Focus Shifters',
62
+ description: 'If some element or part of the page needs user\'s interaction, you can just call the highlight method. Driver will take care of driving the user there',
63
+ position: 'bottom',
64
+ }
65
+ },
66
+ {
67
+ element: '#customizable_feature',
68
+ popover: {
69
+ title: 'Highly Customizable',
70
+ description: 'Driver has a powerful API allowing you to customize the experience as much as you can.',
71
+ position: 'bottom',
72
+ }
73
+ },
74
+ {
75
+ element: '#keyboard_feature',
76
+ popover: {
77
+ title: 'User Friendly',
78
+ description: 'Your users can control it with the arrow keys on keyboard, or escape to close it',
79
+ position: 'bottom',
80
+ }
81
  },
82
+ {
83
+ element: '#free_use_feature',
84
+ popover: {
85
+ title: 'MIT License',
86
+ description: 'I believe in open=source and thus Driver is completely free for both personal or commercial use'
87
+ }
88
  },
89
+ {
90
+ element: '#lightweight_feature',
91
+ popover: {
92
+ title: 'Only ~4KB',
93
+ description: 'Driver is free of bloat and written in Vanilla JS. There is no external dependency at all, thus keeping it smaller in size.'
94
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  },
96
+ {
97
+ element: '#examples_section',
98
+ popover: {
99
+ title: 'Usage Examples',
100
+ description: 'Have a look at the usage examples and see how you can use it.'
101
+ }
102
  },
103
+ {
104
+ element: '#driver-demo-head',
105
+ popover: {
106
+ title: 'Quick Tour Ends',
107
+ description: 'This was just a sneak peak, have a look at the API section and examples to learn more!',
108
+ },
 
 
 
109
  },
110
+ ]);
 
111
 
112
+ document.querySelector('.btn__example')
113
+ .addEventListener('click', () => {
114
+ tourDriver.start();
115
+ });
116
 
117
 
118
+ document.querySelectorAll('pre code').forEach((element) => {
119
+ hljs.highlightBlock(element);
120
+ });
121
 
122
 
123
  /////////////////////////////////////////////
124
  // First example – highlighting without popover
125
  /////////////////////////////////////////////
126
+ const singleDriverNoPopover = new Driver();
127
+ document.querySelector('#run-single-element-no-popover')
128
+ .addEventListener('click', (e) => {
129
+ e.preventDefault();
130
+ singleDriverNoPopover.highlight('#single-element-no-popover');
131
+ });
132
 
133
  /////////////////////////////////////////////
134
  // Form focus examples
135
  /////////////////////////////////////////////
136
+ const focusDriver = new Driver({ padding: 0 });
137
+ const inputIds = ['creation-input', 'creation-input-2', 'creation-input-3', 'creation-input-4'];
138
+ inputIds.forEach(inputId => {
139
+ // Highlight the section on focus
140
+ document.getElementById(inputId).addEventListener('focus', () => {
141
+ focusDriver.highlight(`#${inputId}`);
142
+ });
143
  });
 
144
 
145
  /////////////////////////////////////////////
146
  // Highlighting single element with popover
147
  /////////////////////////////////////////////
148
+ const singleDriverWithPopover = new Driver();
149
+ document.querySelector('#run-single-element-with-popover')
150
+ .addEventListener('click', (e) => {
151
+ e.preventDefault();
152
+ singleDriverWithPopover.highlight({
153
+ element: '#single-element-with-popover',
154
+ popover: {
155
+ title: 'Did you know?',
156
+ description: 'You can add HTML in title or description also!',
157
+ position: 'top'
158
+ }
159
+ });
160
  });
 
161
 
162
  /////////////////////////////////////////////////////
163
  // Highlighting single element with popover position
164
  /////////////////////////////////////////////////////
165
+ const singleDriverWithPopoverPosition = new Driver();
166
+ document.querySelector('#run-single-element-with-popover-position')
167
+ .addEventListener('click', (e) => {
168
+ e.preventDefault();
169
 
170
+ singleDriverWithPopoverPosition.highlight({
171
+ element: '#single-element-with-popover-position',
172
+ popover: {
173
+ title: 'Did you know?',
174
+ description: 'You can add HTML in title or description also!',
175
+ position: 'left'
176
+ }
177
+ });
178
  });
 
179
 
180
  /////////////////////////////////////////////////////
181
  // Highlighting single element with popover position
182
  /////////////////////////////////////////////////////
183
+ const positionBtnsDriver = new Driver({
184
+ padding: 0,
185
+ });
186
 
187
+ document.querySelector('#position-btn-left')
188
+ .addEventListener('click', (e) => {
189
+ e.preventDefault();
190
 
191
+ positionBtnsDriver.highlight({
192
+ element: '#position-btn-left',
193
+ popover: {
194
+ title: 'Did you know?',
195
+ description: 'You can add HTML in title or description also!',
196
+ position: 'left'
197
+ }
198
+ });
199
  });
 
200
 
201
+ document.querySelector('#position-btn-right')
202
+ .addEventListener('click', (e) => {
203
+ e.preventDefault();
204
 
205
+ positionBtnsDriver.highlight({
206
+ element: '#position-btn-right',
207
+ popover: {
208
+ title: 'Did you know?',
209
+ description: 'You can add HTML in title or description also!',
210
+ position: 'right'
211
+ }
212
+ });
213
  });
 
214
 
215
+ document.querySelector('#position-btn-bottom')
216
+ .addEventListener('click', (e) => {
217
+ e.preventDefault();
218
 
219
+ positionBtnsDriver.highlight({
220
+ element: '#position-btn-bottom',
221
+ popover: {
222
+ title: 'Did you know?',
223
+ description: 'You can add HTML in title or description also!',
224
+ position: 'bottom'
225
+ }
226
+ });
227
  });
 
228
 
229
+ document.querySelector('#position-btn-top')
230
+ .addEventListener('click', (e) => {
231
+ e.preventDefault();
232
 
233
+ positionBtnsDriver.highlight({
234
+ element: '#position-btn-top',
235
+ popover: {
236
+ title: 'Did you know?',
237
+ description: 'You can add HTML in title or description also!',
238
+ position: 'top'
239
+ }
240
+ });
241
  });
 
242
 
243
  /////////////////////////////////////////////////////
244
  // Highlighting single element with popover position
245
  /////////////////////////////////////////////////////
246
+ const htmlDriver = new Driver();
247
 
248
+ document.querySelector('#run-single-element-with-popover-html')
249
+ .addEventListener('click', (e) => {
250
+ e.preventDefault();
251
 
252
+ htmlDriver.highlight({
253
+ element: '#single-element-with-popover-html',
254
+ popover: {
255
+ title: '<em>Tags</em> in title or <u>body</u>',
256
+ description: 'Body can also have <strong>html tags</strong>!',
257
+ position: 'top'
258
+ }
259
+ });
260
  });
 
261
 
262
  /////////////////////////////////////////////////////
263
  // Without Overlay Example
264
  /////////////////////////////////////////////////////
265
+ const withoutOverlay = new Driver({
266
+ opacity: 0,
267
+ padding: 0
268
+ });
269
 
270
+ document.querySelector('#run-element-without-popover')
271
+ .addEventListener('click', (e) => {
272
+ e.preventDefault();
273
 
274
+ withoutOverlay.highlight({
275
+ element: '#run-element-without-popover',
276
+ popover: {
277
+ title: 'Title for the Popover',
278
+ description: 'Description for it',
279
+ position: 'left', // can be `top`, `left`, `right`, `bottom`
280
+ }
281
+ });
282
+ });
283
 
284
  /////////////////////////////////////////////////////
285
  // Highlighting single element with popover position
286
  /////////////////////////////////////////////////////
287
+ const featureIntroductionDriver = new Driver();
288
+ featureIntroductionDriver.defineSteps([
289
+ {
290
+ element: '#first-element-introduction',
291
+ popover: {
292
+ title: 'Title on Popover',
293
+ description: 'Body of the popover',
294
+ position: 'bottom'
295
+ }
296
+ },
297
+ {
298
+ element: '#second-para-feature-introductions',
299
+ popover: {
300
+ title: 'Title on Popover',
301
+ description: 'Body of the popover',
302
+ position: 'left'
303
+ }
304
+ },
305
+ {
306
+ element: '#third-para-feature-introductions',
307
+ popover: {
308
+ title: 'Title on Popover',
309
+ description: 'Body of the popover',
310
+ position: 'right'
311
+ }
312
+ },
313
+ {
314
+ element: '#run-multi-element-popovers',
315
+ popover: {
316
+ title: 'Title on Popover',
317
+ description: 'Body of the popover',
318
+ position: 'top'
319
+ }
320
+ },
321
+ {
322
+ element: '#third-element-introduction',
323
+ popover: {
324
+ title: 'Title on Popover',
325
+ description: 'Body of the popover',
326
+ position: 'top'
327
+ }
328
+ },
329
+ ]);
330
 
331
+ document.querySelector('#run-multi-element-popovers')
332
+ .addEventListener('click', (e) => {
333
+ e.preventDefault();
334
+ featureIntroductionDriver.start();
335
+ });
336
 
337
+ });
demo/styles/demo.scss CHANGED
@@ -18,9 +18,11 @@ img.emoji {
18
 
19
  a, a:visited, a:focus {
20
  color: #333333;
 
21
  }
22
 
23
  a.btn__dark {
 
24
  color: #FFFFFF;
25
  background-color: #F44336;
26
  padding: 0 18px;
@@ -37,6 +39,7 @@ img.emoji {
37
  }
38
 
39
  a.btn__run-demo {
 
40
  background: #f54336;
41
  padding: 5px;
42
  border-radius: 20px;
@@ -90,6 +93,7 @@ section {
90
  }
91
 
92
  .position-btns a {
 
93
  font-size: 13px;
94
  padding: 10px 15px;
95
  background: #f54336;
 
18
 
19
  a, a:visited, a:focus {
20
  color: #333333;
21
+ text-decoration: underline;
22
  }
23
 
24
  a.btn__dark {
25
+ text-decoration: none;
26
  color: #FFFFFF;
27
  background-color: #F44336;
28
  padding: 0 18px;
 
39
  }
40
 
41
  a.btn__run-demo {
42
+ text-decoration: none;
43
  background: #f54336;
44
  padding: 5px;
45
  border-radius: 20px;
 
93
  }
94
 
95
  .position-btns a {
96
+ text-decoration: none;
97
  font-size: 13px;
98
  padding: 10px 15px;
99
  background: #f54336;
index.html CHANGED
@@ -6,13 +6,15 @@
6
  content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
  <title>Driver</title>
 
 
9
  <link rel="stylesheet" href="./dist/demo.css">
10
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/monokai.min.css">
11
  </head>
12
  <body>
13
  <div class="page-wrap">
14
- <section class="section__header" data-driver="Hey welcome to presenter!">
15
- <h1><span class="emoji">πŸ‘¨β€πŸ”§οΈ</span> Driver</h1>
16
  <p class="text-muted">A light-weight, no-dependency, vanilla JavaScript library to drive the user's focus across the
17
  page</p>
18
  <a href="javascript:void(0)" class="btn btn__example btn__dark">Quick Tour</a>
@@ -29,15 +31,15 @@
29
  <p>Driver is compatible with all the major browsers and can be used for any of your overlay needs. Feature
30
  introductions, focus shifters, call-to-action are just a few examples.</p>
31
  <ul>
32
- <li>πŸ”† <strong>Highlight</strong> any (literally any) item on page</li>
33
- <li>βœ‹ <strong>Block user interactions</strong></li>
34
- <li>πŸ“£ Create <strong>feature introductions</strong></li>
35
- <li>πŸ‘“ Add <strong>focus shifters</strong> for users</li>
36
- <li>πŸ› οΈ Highly customizable – <strong>Use it anywhere</strong> for overlay</li>
37
- <li>⌨️ User Friendly – <strong>Controllable by keys</strong></li>
38
- <li id="free-use">πŸ†“ <strong>MIT Licensed</strong> – Free for personal and commercial use</li>
39
- <li>πŸ•ŠοΈ Lightweight – Only <strong>~4kb</strong> when gzipped</li>
40
- <li>πŸŒ€ <strong>Consistent behavior</strong> across all major browsers</li>
41
  </ul>
42
  </section>
43
  <hr class="hr__fancy">
@@ -49,9 +51,11 @@
49
  </section>
50
  <hr class="hr__fancy">
51
  <section class="section__examples">
52
- <h3>Can you show some Examples?</h3>
53
- <p>Below you find some of the examples and sample use-cases on how you can use it. Run by clicking the
54
- <code>RUN</code> button.</p>
 
 
55
  <div id="single-element-no-popover" class="section__example">
56
  <h4>Highlighting a Single Element – Without Popover</h4>
57
  <p class="zero-bottom">If all you want is just highlight a single element, you can do that simply by passing the
@@ -204,7 +208,8 @@ driver.start();
204
 
205
  <div id="element-without-popover" class="section__example">
206
  <h4>Without Overlay</h4>
207
- <p>You can create feature introductions and do everything listed above without overlays also. All you have to do is just set the opacity to `0`.</p>
 
208
  <a href="#" class="btn__run-demo" id="run-element-without-popover">Show Demo</a>
209
  <pre><code class="javascript">const driver = new Driver({
210
  opacity: 0,
@@ -225,8 +230,10 @@ driver.highlight({
225
  <hr class="hr__fancy">
226
 
227
  <div class="section__example">
228
- <h3>..and much much more</h3>
229
- <p>Driver comes with many options that you can manipulate to make driver behave as you may like</p>
 
 
230
  <h4>Driver Definition</h4>
231
  <p>Here are the options that Driver understands</p>
232
  <pre><code class="javascript">const driver = new Driver({
@@ -241,7 +248,8 @@ driver.highlight({
241
  </div>
242
  <div class="section__example">
243
  <h4>Step Definition</h4>
244
- <p>Here are the set of options that you can pass in each step i.e. an item in array of steps or the object that you pass to <code>highlight</code> method</p>
 
245
  <pre><code class="javascript">const stepDefinition = {
246
  element: '#some-item', // Query selector for the item to be highlighted
247
  popover: { // There will be no popover if empty or not given
@@ -281,16 +289,22 @@ activeElement.showPopover(); // Show the popover
281
  activeElement.getNode(); // Gets the DOM Element behind this element
282
  </code></pre>
283
  </div>
284
- <p class="top-20">You can use a variety of options to achieve whatever you may want. I have some plans on improving it further, make sure to keep an eye on the <a href="https://github.com/kamranahmedse/driver.js" target="_blank">github page</a></p>
 
 
285
  </section>
286
  <hr class="hr__fancy">
287
  <div class="section__example">
288
  <h4>Contributing</h4>
289
- <p>You can find the contribution instructions on the <a href="https://github.com/kamranahmedse/driver.js" target="_blank">github page</a>. Feel free to submit an issue, create a pull request or spread the word</p>
 
 
290
  </div>
291
  <hr class="hr__fancy">
292
  <div class="section__example">
293
- <p>A product by <a href="http://twitter.com/kamranahmedse" target="_blank">Kamran</a> produced out of boredom and frustration in cold Berlin after he gave up on trying to find a perfect solution to integrate journey introduction and overlays.</p>
 
 
294
  <a href="https://twitter.com/kamranahmedse?ref_src=twsrc%5Etfw"
295
  class="twitter-follow-button mr-3"
296
  data-show-screen-name="false"
 
6
  content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
  <title>Driver</title>
9
+ <meta name=description itemprop=description
10
+ content="A light-weight, no-dependency, vanilla JavaScript library to drive the user's focus across the page"/>
11
  <link rel="stylesheet" href="./dist/demo.css">
12
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/monokai.min.css">
13
  </head>
14
  <body>
15
  <div class="page-wrap">
16
+ <section class="section__header" id="driver-demo-head">
17
+ <h1><span id="logo_emoji" class="emoji">πŸ‘¨β€πŸ”§οΈ</span> <span id="name_driver">Driver</span></h1>
18
  <p class="text-muted">A light-weight, no-dependency, vanilla JavaScript library to drive the user's focus across the
19
  page</p>
20
  <a href="javascript:void(0)" class="btn btn__example btn__dark">Quick Tour</a>
 
31
  <p>Driver is compatible with all the major browsers and can be used for any of your overlay needs. Feature
32
  introductions, focus shifters, call-to-action are just a few examples.</p>
33
  <ul>
34
+ <li id="highlight_feature">πŸ”† <strong>Highlight</strong> any (literally any) item on page</li>
35
+ <li id="interactions_feature">βœ‹ <strong>Block user interactions</strong></li>
36
+ <li id="feature_introductions_feature">πŸ“£ Create <strong>feature introductions</strong></li>
37
+ <li id="focus_shifters_feature">πŸ‘“ Add <strong>focus shifters</strong> for users</li>
38
+ <li id="customizable_feature">πŸ› οΈ Highly customizable – <strong>Use it anywhere</strong> for overlay</li>
39
+ <li id="keyboard_feature">⌨️ User Friendly – <strong>Controllable by keys</strong></li>
40
+ <li id="free_use_feature">πŸ†“ <strong>MIT Licensed</strong> – Free for personal and commercial use</li>
41
+ <li id="lightweight_feature">πŸ•ŠοΈ Lightweight – Only <strong>~4kb</strong> when gzipped</li>
42
+ <li id="major_browsers_feature">πŸŒ€ <strong>Consistent behavior</strong> across all major browsers</li>
43
  </ul>
44
  </section>
45
  <hr class="hr__fancy">
 
51
  </section>
52
  <hr class="hr__fancy">
53
  <section class="section__examples">
54
+ <div id="examples_section">
55
+ <h3>Can you show some Examples?</h3>
56
+ <p>Below you find some of the examples and sample use-cases on how you can use it. Run by clicking the
57
+ <code>RUN</code> button.</p>
58
+ </div>
59
  <div id="single-element-no-popover" class="section__example">
60
  <h4>Highlighting a Single Element – Without Popover</h4>
61
  <p class="zero-bottom">If all you want is just highlight a single element, you can do that simply by passing the
 
208
 
209
  <div id="element-without-popover" class="section__example">
210
  <h4>Without Overlay</h4>
211
+ <p>You can create feature introductions and do everything listed above without overlays also. All you have to do
212
+ is just set the opacity to `0`.</p>
213
  <a href="#" class="btn__run-demo" id="run-element-without-popover">Show Demo</a>
214
  <pre><code class="javascript">const driver = new Driver({
215
  opacity: 0,
 
230
  <hr class="hr__fancy">
231
 
232
  <div class="section__example">
233
+ <div id="api_section">
234
+ <h3>..and much much more</h3>
235
+ <p>Driver comes with many options that you can manipulate to make driver behave as you may like</p>
236
+ </div>
237
  <h4>Driver Definition</h4>
238
  <p>Here are the options that Driver understands</p>
239
  <pre><code class="javascript">const driver = new Driver({
 
248
  </div>
249
  <div class="section__example">
250
  <h4>Step Definition</h4>
251
+ <p>Here are the set of options that you can pass in each step i.e. an item in array of steps or the object that
252
+ you pass to <code>highlight</code> method</p>
253
  <pre><code class="javascript">const stepDefinition = {
254
  element: '#some-item', // Query selector for the item to be highlighted
255
  popover: { // There will be no popover if empty or not given
 
289
  activeElement.getNode(); // Gets the DOM Element behind this element
290
  </code></pre>
291
  </div>
292
+ <p class="top-20">You can use a variety of options to achieve whatever you may want. I have some plans on improving
293
+ it further, make sure to keep an eye on the <a href="https://github.com/kamranahmedse/driver.js" target="_blank">github
294
+ page</a></p>
295
  </section>
296
  <hr class="hr__fancy">
297
  <div class="section__example">
298
  <h4>Contributing</h4>
299
+ <p>You can find the contribution instructions on the <a href="https://github.com/kamranahmedse/driver.js"
300
+ target="_blank">github page</a>. Feel free to submit an
301
+ issue, create a pull request or spread the word</p>
302
  </div>
303
  <hr class="hr__fancy">
304
  <div class="section__example">
305
+ <p>A product by <a href="http://twitter.com/kamranahmedse" target="_blank">Kamran</a> produced out of boredom and
306
+ frustration in cold Berlin after he gave up on trying to find a perfect solution to integrate journey introduction
307
+ and overlays.</p>
308
  <a href="https://twitter.com/kamranahmedse?ref_src=twsrc%5Etfw"
309
  class="twitter-follow-button mr-3"
310
  data-show-screen-name="false"
package.json CHANGED
@@ -7,6 +7,10 @@
7
  "start": "node server.js",
8
  "build": "webpack --config webpack.config.prod.js "
9
  },
 
 
 
 
10
  "repository": "https://github.com/kamranahmedse/driver.js",
11
  "author": "Kamran Ahmed <[email protected]>",
12
  "license": "MIT",
 
7
  "start": "node server.js",
8
  "build": "webpack --config webpack.config.prod.js "
9
  },
10
+ "bugs": {
11
+ "url": "https://github.com/kamranahmedse/driver.js/issues"
12
+ },
13
+ "homepage": "https://github.com/kamranahmedse/driver.js#readme",
14
  "repository": "https://github.com/kamranahmedse/driver.js",
15
  "author": "Kamran Ahmed <[email protected]>",
16
  "license": "MIT",
src/core/popover.js CHANGED
@@ -28,8 +28,9 @@ export default class Popover extends Element {
28
  totalCount: 1,
29
  currentIndex: 0,
30
  showButtons: true,
31
- doneBtnText: 'Done',
32
  closeBtnText: 'Close',
 
 
33
  nextBtnText: 'Next &rarr;',
34
  prevBtnText: '&larr; Previous',
35
  }, options);
@@ -154,6 +155,7 @@ export default class Popover extends Element {
154
  this.footerNode.style.display = 'block';
155
  if (this.options.isFirst) {
156
  this.prevBtnNode.classList.add(CLASS_BTN_DISABLED);
 
157
  } else {
158
  this.prevBtnNode.classList.remove(CLASS_BTN_DISABLED);
159
  }
 
28
  totalCount: 1,
29
  currentIndex: 0,
30
  showButtons: true,
 
31
  closeBtnText: 'Close',
32
+ doneBtnText: 'Done',
33
+ startBtnText: 'Next &rarr;',
34
  nextBtnText: 'Next &rarr;',
35
  prevBtnText: '&larr; Previous',
36
  }, options);
 
155
  this.footerNode.style.display = 'block';
156
  if (this.options.isFirst) {
157
  this.prevBtnNode.classList.add(CLASS_BTN_DISABLED);
158
+ this.nextBtnNode.innerHTML = this.options.startBtnText;
159
  } else {
160
  this.prevBtnNode.classList.remove(CLASS_BTN_DISABLED);
161
  }