-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhatsApp.js
84 lines (69 loc) · 2.25 KB
/
WhatsApp.js
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
// ==UserScript==
// @name WA-JS Core
// @namespace http://tampermonkey.net/
// @version 0.2
// @description WA-JS Core
// @author Fabio L. 2024
// @match https://web.whatsapp.com/*
// @icon https://www.google.com/s2/favicons?domain=whatsapp.com
// @require https://github.com/wppconnect-team/wa-js/releases/download/nightly/wppconnect-wa.js
// @grant none
// ==/UserScript==
/* globals WPP */
window.WPUtils = {
init: () => {
let html = `<style>
#snackbar {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 9999999;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#snackbar.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@-webkit-keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}
@-webkit-keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
@keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
</style>
<div id="snackbar">Some text some message..</div>`;
window.document.body.insertAdjacentHTML('afterbegin', html);
},
toast: (message, timeout = 3000) => {
var x = document.getElementById("snackbar");
x.innerHTML = message;
x.className = "show";
setTimeout(function () { x.className = x.className.replace("show", ""); }, timeout);
}
};
(function () {
'use strict';
window.WPUtils.init();
WPP.webpack.onReady(function () {
window.WPUtils.toast('Ready to use WPPConnect WA-JS', 6000);
});
})();