Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeq6X committed May 27, 2020
1 parent 952c216 commit 6eb03ef
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jquery.min.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"manifest_version": 2,
"version": "1.0",
"name": "NicoStyleMeet",
"content_scripts": [
{
"js": ["jquery.min.js","script.js"],
"css": ["style.css"],
"matches": ["https://meet.google.com/*"],
"run_at": "document_start"
}
]
}
72 changes: 72 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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)
});
6 changes: 6 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.comment {
position: absolute;
color: #fff;
white-space: nowrap;
z-index: 2147483647;
}

0 comments on commit 6eb03ef

Please sign in to comment.