-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase.min.js
65 lines (65 loc) · 4.13 KB
/
firebase.min.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
$['getScript']('https://www.gstatic.com/firebasejs/5.8.3/firebase.js')['done'](function() {
function _0x780dx1(_0x780dx1, _0x780dx2, _0x780dx3, _0x780dx4) {
var _0x780dx5, _0x780dx6 = _0x780dx4['find'](_0x780dx1)['eq'](0),
_0x780dx7 = _0x780dx6['attr'](_0x780dx3);
if (null !== localStorage['getItem'](_0x780dx2)) {
var _0x780dx8 = JSON['parse'](localStorage[_0x780dx2]);
for (i = 0; i < _0x780dx8['length']; i++) {
_0x780dx8[i] === _0x780dx7 && _0x780dx6['addClass'](_0x780dx2)
}
};
firebase['database']()['ref'](_0x780dx2 + '/' + _0x780dx7 + '/total')['on']('value', function(_0x780dx1) {
_0x780dx5 = _0x780dx1['val']() || 0, _0x780dx6['find']('.total')['eq'](0)['html'](_0x780dx5)
}), _0x780dx6['on']('click', function(_0x780dx1) {
if (_0x780dx1['preventDefault'](), $(this)['toggleClass'](_0x780dx2), $(this)['hasClass'](_0x780dx2)) {
if (null === localStorage['getItem'](_0x780dx2)) {
localStorage['setItem'](_0x780dx2, JSON['stringify']([_0x780dx7]))
} else {
var _0x780dx3 = JSON['parse'](localStorage[_0x780dx2]);
_0x780dx3['filter'](function(_0x780dx1) {
return _0x780dx1 == _0x780dx7
})['length'] || (_0x780dx3['push'](_0x780dx7), localStorage['setItem'](_0x780dx2, JSON['stringify'](_0x780dx3)))
};
_0x780dx5++
} else {
for (var _0x780dx4 = JSON['parse'](localStorage[_0x780dx2]), _0x780dx9 = 0; _0x780dx9 < _0x780dx4['length']; _0x780dx9++) {
_0x780dx4[_0x780dx9] === _0x780dx7 && _0x780dx4['splice'](_0x780dx9, 1)
};
localStorage['setItem'](_0x780dx2, JSON['stringify'](_0x780dx4)), _0x780dx5--
};
firebase['database']()['ref'](_0x780dx2 + '/' + _0x780dx7 + '/total')['set'](_0x780dx5)
})
}
firebase['initializeApp']({
apiKey: 'AIzaSyDEb0x2A0lG-wmWWfrmbWAvEpY34vRWI6k',
authDomain: 'nguyen-tinh.firebaseapp.com',
databaseURL: 'https://nguyen-tinh.firebaseio.com',
projectId: 'nguyen-tinh',
storageBucket: 'nguyen-tinh.appspot.com',
messagingSenderId: '509791360495'
}), $('.post-reaction')['each'](function() {
_0x780dx1('.like-button', 'like', 'data-post-id', $(this)), _0x780dx1('.love-button', 'love', 'data-post-id', $(this)), _0x780dx1('.haha-button', 'haha', 'data-post-id', $(this)), _0x780dx1('.wow-button', 'wow', 'data-post-id', $(this)), _0x780dx1('.sad-button', 'sad', 'data-post-id', $(this)), _0x780dx1('.angry-button', 'angry', 'data-post-id', $(this))
}), $('.reaction-label')['each'](function() {
var _0x780dx1 = $(this),
_0x780dx2 = _0x780dx1['attr']('data-post-id');
firebase['database']()['ref']('like/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx3) {
var _0x780dx4 = _0x780dx3['val']();
firebase['database']()['ref']('love/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx3) {
var _0x780dx5 = _0x780dx3['val']();
firebase['database']()['ref']('haha/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx3) {
var _0x780dx9 = _0x780dx3['val']();
firebase['database']()['ref']('wow/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx3) {
var _0x780dx6 = _0x780dx3['val']();
firebase['database']()['ref']('sad/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx3) {
var _0x780dx7 = _0x780dx3['val']();
firebase['database']()['ref']('angry/' + _0x780dx2 + '/total')['on']('value', function(_0x780dx2) {
var _0x780dx3 = _0x780dx2['val']();
_0x780dx1['find']('#totallike')['html'](_0x780dx4 + _0x780dx5 + _0x780dx9 + _0x780dx6 + _0x780dx7 + _0x780dx3)
})
})
})
})
})
})
})
})