-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsfd-compare-utils.js
45 lines (42 loc) · 1.05 KB
/
csfd-compare-utils.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
let Glob = {
popupCounter: 0,
popup: function (htmlContent, timeout = 3, width = 150, slideTime = 100) {
var id = Glob.popupCounter++;
if (!htmlContent) {
return;
}
// Destroy the current popup by classname
var popup = document.getElementsByClassName("SNPopup");
if (popup.length > 0) {
popup[0].remove();
}
var yOffset = 10;
let $popup = $(`<div>`, {
id: `SNPopup${id}`,
"class": "SNPopup",
html: htmlContent,
})
.css({
border: "1px solid black",
borderRadius: "4px",
display: "none",
padding: "10px",
opacity: "0.95",
background: "#820001",
color: "white",
position: "absolute",
left: "45%",
width: `${width}px`,
zIndex: "999",
top: `${yOffset}px`,
right: "10px"
});
$(".header-search").append($popup);
$popup.slideDown(slideTime);
(function ($popup) {
setTimeout(function () {
$popup.slideUp(slideTime);
}, timeout * 1000);
})($popup);
}
};