forked from Yeq6X/NicoStyleMeet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
72 lines (59 loc) · 2.08 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
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
var prevThread;
var observer = new MutationObserver(records=>{
try {
const thread = document.getElementsByClassName('z38b6 CnDs7d hPqowe')[0];
if (prevThread != undefined && thread.isEqualNode(prevThread)) return;
if (thread.getElementsByClassName('gYckH').length == 1) return;
prevThread = thread.cloneNode(true);
const messages = thread.getElementsByClassName('oIy2qc');
const message = messages[messages.length-1].innerText;
var screen = document.body; // よくない
var screenHeight = screen.offsetHeight;
var screenWidth = screen.offsetWidth;
var comment = document.createElement('span');
comment.textContent = message;
document.getElementsByTagName('body')[0].appendChild(comment);
var letterSize = screenHeight*0.05;
comment.setAttribute('class', 'comment');
var commentStyle = {
left: screenWidth + 'px',
top: Math.floor((screenHeight - letterSize) * Math.random()) + 'px',
fontSize: letterSize + 'px',
}
for(var prop in commentStyle) {
comment.style[prop] = commentStyle[prop];
}
$(comment).animate(
{
'left': -comment.offsetWidth + 'px'
},
{
'duration': 6000,
'easing': 'linear',
'complete': function() {
document.getElementsByTagName('body')[0].removeChild(comment);
}
});
}
catch(e) {
return;
}
});
const config = {
attributes: true,
subtree: true,
childList: true,
characterData: true
}
document.addEventListener('DOMContentLoaded', () => {
var elem = document.body; // ほんとはチャットボックスを監視するべきだけどmeetに参加画面と判断するのめんどくさい これのせいで重い
observer.observe(elem, config);
var cas = document.createElement('iframe');
cas.setAttribute('src', 'https://river.tango-gacha.com/')
cas.setAttribute('width', '100%')
cas.setAttribute('height', '100%')
cas.setAttribute('frameborder', '0')
cas.setAttribute('style', "position:absolute;border:0;width:100%;filter:invert(100%);-webkit-filter:invert(100%);z-index:2147483647;pointer-events:none;")
var elem = document.body;
elem.appendChild(cas)
});