@chat21/chat21-web-widget 5.0.82-rc.1 → 5.0.82-rc.2
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/launch.js +33 -40
- package/src/launch_template.js +34 -42
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/launch.js
CHANGED
|
@@ -7,51 +7,44 @@ ready(function() {
|
|
|
7
7
|
initWidget();
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
function detectIfIsMobile(windowContext) {
|
|
11
|
-
let isMobile = false;
|
|
12
|
-
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(windowContext.navigator.userAgent))
|
|
13
|
-
isMobile = true
|
|
14
|
-
else
|
|
15
|
-
isMobile = false
|
|
16
|
-
return isMobile;
|
|
17
|
-
}
|
|
18
10
|
|
|
19
11
|
/** */
|
|
20
12
|
function ready(callbackFunction){
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
// if(document.readyState != 'loading'){
|
|
14
|
+
// console.log('in ifffffff', document.readyState)
|
|
15
|
+
// callbackFunction()
|
|
16
|
+
// }
|
|
17
|
+
// else{
|
|
18
|
+
// document.addEventListener("DOMContentLoaded", callbackFunction)
|
|
19
|
+
// }
|
|
20
|
+
document.addEventListener('scroll', start);
|
|
21
|
+
document.addEventListener('mousedown', start);
|
|
22
|
+
document.addEventListener('mousemove', start);
|
|
23
|
+
document.addEventListener('touchstart', start);
|
|
24
|
+
document.addEventListener('keydown', start);
|
|
25
|
+
|
|
26
|
+
let time = 5000;
|
|
27
|
+
let timeout = setTimeout(()=> {
|
|
28
|
+
console.log('in timeout')
|
|
29
|
+
start();
|
|
30
|
+
}, time)
|
|
31
|
+
|
|
32
|
+
function start(){
|
|
33
|
+
clearTimeout(timeout);
|
|
34
|
+
if(document.readyState==='complete'){
|
|
35
|
+
callbackFunction()
|
|
36
|
+
}else if(window.attachEvent){
|
|
37
|
+
window.attachEvent('onload',callbackFunction);
|
|
38
|
+
}else{
|
|
39
|
+
window.addEventListener('load',callbackFunction,false);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
window.addEventListener('load',callbackFunction,false);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
document.removeEventListener('scroll', start);
|
|
50
|
-
document.removeEventListener('mousedown', start);
|
|
51
|
-
document.removeEventListener('mousemove', start);
|
|
52
|
-
document.removeEventListener('touchstart', start);
|
|
53
|
-
document.removeEventListener('keydown', start);
|
|
54
|
-
}
|
|
42
|
+
document.removeEventListener('scroll', start);
|
|
43
|
+
document.removeEventListener('mousedown', start);
|
|
44
|
+
document.removeEventListener('mousemove', start);
|
|
45
|
+
document.removeEventListener('touchstart', start);
|
|
46
|
+
document.removeEventListener('keydown', start);
|
|
47
|
+
}
|
|
55
48
|
|
|
56
49
|
|
|
57
50
|
}
|
package/src/launch_template.js
CHANGED
|
@@ -7,52 +7,44 @@ ready(function() {
|
|
|
7
7
|
initWidget();
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
function detectIfIsMobile(windowContext) {
|
|
11
|
-
let isMobile = false;
|
|
12
|
-
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(windowContext.navigator.userAgent))
|
|
13
|
-
isMobile = true
|
|
14
|
-
else
|
|
15
|
-
isMobile = false
|
|
16
|
-
return isMobile;
|
|
17
|
-
}
|
|
18
10
|
|
|
19
11
|
/** */
|
|
20
12
|
function ready(callbackFunction){
|
|
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
|
-
document.removeEventListener('scroll', start);
|
|
50
|
-
document.removeEventListener('mousedown', start);
|
|
51
|
-
document.removeEventListener('mousemove', start);
|
|
52
|
-
document.removeEventListener('touchstart', start);
|
|
53
|
-
document.removeEventListener('scroll', start);
|
|
54
|
-
document.removeEventListener('keydown', start);
|
|
13
|
+
// if(document.readyState != 'loading'){
|
|
14
|
+
// console.log('in ifffffff', document.readyState)
|
|
15
|
+
// callbackFunction()
|
|
16
|
+
// }
|
|
17
|
+
// else{
|
|
18
|
+
// document.addEventListener("DOMContentLoaded", callbackFunction)
|
|
19
|
+
// }
|
|
20
|
+
document.addEventListener('scroll', start);
|
|
21
|
+
document.addEventListener('mousedown', start);
|
|
22
|
+
document.addEventListener('mousemove', start);
|
|
23
|
+
document.addEventListener('touchstart', start);
|
|
24
|
+
document.addEventListener('keydown', start);
|
|
25
|
+
|
|
26
|
+
let time = 5000;
|
|
27
|
+
let timeout = setTimeout(()=> {
|
|
28
|
+
console.log('in timeout')
|
|
29
|
+
start();
|
|
30
|
+
}, time)
|
|
31
|
+
|
|
32
|
+
function start(){
|
|
33
|
+
if(document.readyState==='complete'){
|
|
34
|
+
callbackFunction()
|
|
35
|
+
}else if(window.attachEvent){
|
|
36
|
+
window.attachEvent('onload',callbackFunction);
|
|
37
|
+
}else{
|
|
38
|
+
window.addEventListener('load',callbackFunction,false);
|
|
55
39
|
}
|
|
40
|
+
|
|
41
|
+
document.removeEventListener('scroll', start);
|
|
42
|
+
document.removeEventListener('mousedown', start);
|
|
43
|
+
document.removeEventListener('mousemove', start);
|
|
44
|
+
document.removeEventListener('touchstart', start);
|
|
45
|
+
document.removeEventListener('scroll', start);
|
|
46
|
+
document.removeEventListener('keydown', start);
|
|
47
|
+
}
|
|
56
48
|
|
|
57
49
|
|
|
58
50
|
}
|