forked from namndwebdev/thiep-mung
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresent.js
52 lines (39 loc) · 1.52 KB
/
present.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
// Cần hỗ trợ hãy liên hệ:
// Mr-Nam http://facebook.com/nam.nodemy
// Các bạn muốn học lập trình thì tham gia Nhóm zalo tự học lập trình nhé: https://zalo.me/g/yhdkef092
var to = nameGirl;
var gift_url = giftUrl;
var gift_image_url = giftImage || giftImageBase64;
var nametag = document.getElementById("nametag");
var present = document.getElementById("present");
var presentImage = document.getElementById("present-image");
function init() {
var graphElem = document.querySelector('.present-box > .side.top .to');
graphElem.setAttribute('data-before', eventName);
document.querySelector('#card .title-card').innerHTML = `💘${titleCard}💘`;
document.querySelector('#card .content-card').innerHTML = `${contentCard}`;
document.querySelector('#card .honey').setAttribute('src', `${giftImage}`);
var _giftLink,
_giftImg;
if (gift_url) {
_giftLink = document.createElement("a");
_giftLink.href = gift_url;
_giftLink.target = "_blank";
presentImage.appendChild(_giftLink);
}
if (gift_image_url) {
_giftImg = document.createElement("img");
_giftImg.src = gift_image_url;
if(_giftLink) {
_giftLink.appendChild(_giftImg);
} else {
presentImage.appendChild(_giftImg);
}
}
present.addEventListener("click", function(e){
present.classList.toggle("open");
document.getElementById('card').classList.add('card-show');
}, false);
nametag.innerText = to;
}
init();