Skip to content

Commit 6ee238b

Browse files
committed
v13.1.4
1 parent ebbc6d4 commit 6ee238b

File tree

8 files changed

+120
-6
lines changed

8 files changed

+120
-6
lines changed

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/index.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,54 @@
193193
width: 100%;
194194
background-color: #eee;
195195
}
196+
197+
/* The Modal (background) */
198+
.modal {
199+
display: none;
200+
/* Hidden by default */
201+
position: fixed;
202+
/* Stay in place */
203+
z-index: 1;
204+
/* Sit on top */
205+
left: 0;
206+
top: 0;
207+
width: 100%;
208+
/* Full width */
209+
height: 100%;
210+
/* Full height */
211+
overflow: auto;
212+
/* Enable scroll if needed */
213+
background-color: rgb(0, 0, 0);
214+
/* Fallback color */
215+
background-color: rgba(0, 0, 0, 0.4);
216+
/* Black w/ opacity */
217+
}
218+
219+
/* Modal Content */
220+
.modal-content {
221+
background-color: #fefefe;
222+
margin: 15% auto;
223+
/* 15% from the top and centered */
224+
padding: 20px;
225+
border: 1px solid #888;
226+
width: 80%;
227+
/* Could be more or less, depending on screen size */
228+
}
229+
230+
/* The Close Button */
231+
.close {
232+
color: #aaa;
233+
float: right;
234+
font-size: 28px;
235+
font-weight: bold;
236+
}
237+
238+
.close:hover,
239+
.close:focus {
240+
color: black;
241+
text-decoration: none;
242+
cursor: pointer;
243+
}
196244
</style>
197245
</head>
198246

@@ -223,7 +271,20 @@ <h2 class="sub-headline">
223271
ctx.fill();
224272
ctx.stroke();
225273
</script>
274+
275+
<!-- The Modal -->
276+
<div id="myModal" class="modal">
277+
278+
<!-- Modal content -->
279+
<div class="modal-content">
280+
<span class="close">&times;</span>
281+
<p>Some text in the Modal..</p>
282+
</div>
283+
284+
</div>
285+
226286
<div class="content" id="haha">
287+
<button id="myBtn">Open Modal</button>
227288
<a href="https://www.google.com">asdf asfasdfasfdasdf</a>
228289
<div class="skeleton-text"></div>
229290
<div class="skeleton-text"></div>
@@ -234,6 +295,35 @@ <h2 class="sub-headline">
234295
<div class="skeleton-text"></div>
235296
</div>
236297

298+
<script>
299+
// Get the modal
300+
var modal = document.getElementById("myModal");
301+
302+
// Get the button that opens the modal
303+
var btn = document.getElementById("myBtn");
304+
305+
// Get the <span> element that closes the modal
306+
var span = document.getElementsByClassName("close")[0];
307+
308+
// When the user clicks the button, open the modal
309+
btn.onclick = function () {
310+
modal.style.display = "block";
311+
}
312+
313+
// When the user clicks on <span> (x), close the modal
314+
span.onclick = function () {
315+
modal.style.display = "none";
316+
}
317+
318+
// When the user clicks anywhere outside of the modal, close it
319+
window.onclick = function (event) {
320+
if (event.target == modal) {
321+
modal.style.display = "none";
322+
}
323+
}
324+
325+
</script>
326+
237327
</body>
238328

239329
</html>

demo/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Gleap.setFrameUrl("http://0.0.0.0:3001");
44
Gleap.setApiUrl("http://0.0.0.0:9000");
55
Gleap.setWSApiUrl("ws://0.0.0.0:8080");
66

7-
Gleap.initialize("rinrKZAvjqOheSjpdUjFnp01tSOF3WTd");
7+
Gleap.initialize("vcxExo94dQQv7KIXd1BnMgN2bzpwZnoj");
88

99
/*Gleap.setUrlHandler((url, newTab) => {
1010
alert("URL: " + url + " newTab: " + newTab);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "13.1.3",
3+
"version": "13.1.4",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

published/13.1.4/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapAdminManager.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ export default class GleapAdminManager {
140140
});
141141
}
142142

143+
if (data.name === "click") {
144+
try {
145+
document.querySelector(data.data.selector).click();
146+
} catch (e) {
147+
console.log(e);
148+
}
149+
}
150+
143151
if (data.name === "status-changed") {
144152
self.status = data.data;
145153
this.setFrameHeight(self.status);

src/GleapProductTours.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export default class GleapProductTours {
4343
for (let i = 0; i < steps.length; i++) {
4444
const step = steps[i];
4545

46+
const isClickMode = step.mode === "CLICK";
47+
4648
var message = "";
4749
var hasSender = false;
4850

@@ -68,10 +70,13 @@ export default class GleapProductTours {
6870
}
6971

7072
var driverStep = {
71-
disableActiveInteraction: !(step.allowClick ?? true),
73+
disableActiveInteraction: !isClickMode,
7274
popover: {
7375
description: message,
7476
popoverClass: `gleap-tour-popover-${step.type} ${!hasSender && 'gleap-tour-popover-no-sender'} ${config.allowClose && 'gleap-tour-popover-can-close'}`,
77+
...(isClickMode ? {
78+
showButtons: [],
79+
} : {})
7580
},
7681
}
7782
if (step.selector && step.selector.length > 0) {
@@ -85,11 +90,17 @@ export default class GleapProductTours {
8590
'close'
8691
];
8792

88-
console.log("config.backButton", config);
8993
if (config.backButton) {
9094
buttons.push('previous');
9195
}
9296

97+
function onDocumentClick(evnt) {
98+
var gleapTourPopover = document.querySelector('.gleap-tour-popover');
99+
if (!gleapTourPopover.contains(evnt.target)) {
100+
gleapTourObj.moveNext();
101+
}
102+
}
103+
93104
const gleapTourObj = GleapTours({
94105
showProgress: true,
95106
steps: driverSteps,
@@ -111,6 +122,8 @@ export default class GleapProductTours {
111122
} else {
112123
gleapTourObj.destroy();
113124
}
125+
126+
document.removeEventListener("click", onDocumentClick);
114127
},
115128
onPopoverRender: (popoverElement) => {
116129
// Fix for images and videos.
@@ -197,5 +210,7 @@ export default class GleapProductTours {
197210
}
198211
});
199212
gleapTourObj.drive();
213+
214+
document.addEventListener("click", onDocumentClick);
200215
}
201216
}

0 commit comments

Comments
 (0)