-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
44 lines (40 loc) · 1.79 KB
/
script.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
var elementToObserve= document.getElementById('item-scroller'),
observer = new MutationObserver((e => { var message = ''; var username = '';
var authorType = ''; var Donation = '';
var authornameSet = false; var authorSet= false; var sentDonation = false;
for (var s = 0; s < e.length; ++s)
{
if(e[s].target.getAttribute('author-type')!=null && authorSet == false)
{ authorType = e[s].target.getAttribute('author-type'); authorSet = true;}
if(e[s].target.nodeName == 'YT-LIVE-CHAT-PAID-MESSAGE-RENDERER' && authornameSet == false)
{
username = e[s].target.$['author-name'].innerText;
authornameSet = true;
for(var j= s; j< e.length; ++j)
{
if(e[j].target.id == 'message' && t.length==0){
message = e[j].target.innerText;
}
if(e[j].target.className == 'style-scope yt-live-chat-paid-message-renderer' &&
(e[j].target.innerText.length>0 || e[j].target.innerText) && D.length==0){
Donation = e[j].target.innerText;
}
}
break;
}
if ('author-name' == e[s].target.firstElementChild.id && authornameSet == false) {
username = e[s].target.firstElementChild.innerText;
authornameSet = true;
for(var j= s; j< e.length; ++j)
{
if('message' == e[j].target.id){
message = e[j].target.textContent;
break;
}
}
break;
}
}
if(r!='' && t!='') { var n = authorType + '&' + username + ':' + message + ':' + Donation; console.log(n);}
}));
observer.observe(elementToObserve,{ subtree: !0,childList: !0});