not happening

change name - wompchat
overlay attempt was made. turns out cant link obs to chrome extension web page. added greenscreen option instead. best i can do until chat bot is made. need a web page hosted that can be manipulated and can be linked into obs.
some other unrelated fixes - minor bugs
added escape key for popup
expanded pupup window to full width of chat
This commit is contained in:
wompmacho
2020-11-13 05:16:24 -05:00
parent fb13e2f056
commit 1826dce523
15 changed files with 59648 additions and 14509 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "WompChat", "name": "WompChat",
"version": "1.0.4", "version": "1.0.3",
"description": "Enhances the YouTube Live Streaming experience with Emotes, Custom Styling and quality of life improvements.", "description": "Enhances the YouTube Live Streaming experience with Emotes, Custom Styling and quality of life improvements.",
"scripts": { "scripts": {
"start": "webpack --progress --watch", "start": "webpack --progress --watch",

View File

@@ -1,12 +1,50 @@
import './stylus/content.styl';
import './stylus/chat_overlay.styl';
const message_container = document.getElementById("message_container"); const message_container = document.getElementById("message_container");
chrome.runtime.onMessage.addListener( chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) { function(request, sender, sendResponse) {
if (request.message == "messageNode"){ if(sender.origin == "https://www.youtube.com"){
message_container.innerHTML += request.node;
message_container.scrollBy(message_container.scrollHeight); if (request.message == "preloadMessages"){
return; message_container.prepend(convertToHTMLElm(request.node));
message_container.scrollIntoView({block: 'end'});
} }
});
if (request.message == "newMessage"){
message_container.append(convertToHTMLElm(request.node));
message_container.scrollIntoView({block: 'end'});
}
if (request.message == "removeMessage"){
destroyMessage(convertToHTMLElm(request.node));
}
}
}
);
function convertToHTMLElm(node){
//var node = new DOMParser().parseFromString(node, 'text/html').documentElement;
var temp = document.createElement('div');
temp.innerHTML = node;
node = temp.firstChild;
return node;
}
function destroyMessage(node){
const messageId = node.getAttribute('message-id');
console.log(messageId);
console.log(message);
const message = document.querySelectorAll(`[message-id=${messageId}]`);
if(message != undefined){
message.destroy();
}
}

View File

@@ -17,6 +17,7 @@ const CONFIG = {
setTwitchColors: false, setTwitchColors: false,
setLiveChat: true, setLiveChat: true,
allowTextSlider: false, allowTextSlider: false,
setGreenScreen: false,
// Var // Var
textSizeSlider: 'inherit', textSizeSlider: 'inherit',

View File

@@ -29,7 +29,7 @@ class ChatScroller {
} }
scroll() { scroll() {
this.scroller.scrollTop = 9999; this.scroller.scrollIntoView({block: 'end'});
} }
getScroller() { getScroller() {

View File

@@ -41,6 +41,10 @@ class ChatWatcher {
const node = messages[i]; const node = messages[i];
if(this.isMessageNode(node)) { if(this.isMessageNode(node)) {
const message = new Message(node); const message = new Message(node);
// chrome.runtime.sendMessage({message: "preloadMessages", node: node.outerHTML}, function(response) {
// // dont need to do anything
// });
} }
} }
} }
@@ -59,6 +63,11 @@ class ChatWatcher {
const node = addedNodes[i]; const node = addedNodes[i];
if(this.isMessageNode(node)) { if(this.isMessageNode(node)) {
this.onNewMessage(node); this.onNewMessage(node);
// send message
// chrome.runtime.sendMessage({message: "newMessage", node: node.outerHTML}, function(response) {
// // dont need to do anything
// });
} }
} }
} }
@@ -190,6 +199,14 @@ class ChatWatcher {
console.log('emote popup button clicked'); console.log('emote popup button clicked');
}); });
// escape for popup div
document.onkeydown = function(evt) {
if (evt.key === "Escape" && !popUpDiv.classList.contains('hideElement')) {
popUpDiv.classList.toggle('hideElement');
return;
}
};
// get input area // get input area
var inputArea = document.querySelector('#input.yt-live-chat-text-input-field-renderer'); var inputArea = document.querySelector('#input.yt-live-chat-text-input-field-renderer');
var inputAreaLabel = document.querySelector('#label.yt-live-chat-text-input-field-renderer'); var inputAreaLabel = document.querySelector('#label.yt-live-chat-text-input-field-renderer');
@@ -211,6 +228,7 @@ class ChatWatcher {
} }
console.log((keysITer.length+1) + " Emotes Added"); console.log((keysITer.length+1) + " Emotes Added");
}// end addEmotePopup }// end addEmotePopup
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////

View File

@@ -105,6 +105,10 @@ class Emotes {
url = urls[1]; url = urls[1];
} }
// fix for overlay, remove "//" at start of url
var protocol = "https:";
url = protocol.concat(url);
this.dictionary.set(name, new Emote({ code: name, url })); this.dictionary.set(name, new Emote({ code: name, url }));
this.franker_Dictionary.set(name, new Emote({ code: name, url })); this.franker_Dictionary.set(name, new Emote({ code: name, url }));
} }

View File

@@ -1,9 +1,6 @@
import Emotes from './Emotes'; import Emotes from './Emotes';
import PersistentSyncStorage from 'src/helpers/PersistentSyncStorage'; import PersistentSyncStorage from 'src/helpers/PersistentSyncStorage';
let chat_overlay_enabled = false;
class Message { class Message {
constructor(messageNode) { constructor(messageNode) {
this.node = messageNode; this.node = messageNode;
@@ -20,10 +17,6 @@ class Message {
this.setHtml(); this.setHtml();
this.watch(); this.watch();
} }
chrome.runtime.sendMessage({message: "messageNode", node: messageNode.outerHTML}, function(response) {
// dont need to do anything
});
} }
get textNode() { get textNode() {

View File

@@ -74,6 +74,14 @@ class Main {
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
//Live Chat Default Option
if (PersistentSyncStorage.data.options.setGreenScreen) {
var chat = document.querySelector('yt-live-chat-item-list-renderer');
chat.classList.add('green_sceen');
} else {
// do nothing, let user pick option if not set as default in options menu
}
} }
init() { init() {

View File

@@ -5,14 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Chat Overlay</title> <title>Chat Overlay</title>
<link rel="stylesheet" href="./youtube_styling.css"> <link rel="stylesheet" href="./youtube.css">
</head> </head>
<body> <body>
<style>
yt-live-chat-text-message-renderer{
background-color: transparent !important;
}
</style>
<div id="message_container"></div> <div id="message_container"></div>
<script src="../chat_overlay.js"></script> <script src="../chat_overlay.js"></script>
</body> </body>

View File

@@ -115,6 +115,13 @@
</div> </div>
</div> </div>
<div class="options-table">
<div class="option-row">
<div class="option-cell"><label for="setGreenScreen">Green Screen Chat</label></div>
<div class="option-cell"><input disabled type="checkbox" id="setGreenScreen" class="option-input"></div>
</div>
</div>
</div> </div>
<hr> <hr>
@@ -138,7 +145,8 @@
</span> </span>
<hr> <hr>
<button class="chat_overlay" id="chat_overlay" >Chat Overlay</button>
<!-- <button class="chat_overlay" id="chat_overlay" >Chat Overlay</button> -->
<div id="save-status">&nbsp;</div> <div id="save-status">&nbsp;</div>
</div> </div>

59488
src/html/youtube.css Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -113,16 +113,20 @@ PersistentSyncStorage.on('ready', () => {
input.addEventListener('change', inputOnChange); input.addEventListener('change', inputOnChange);
switch (input.id) { switch (input.id) {
case 'enableBTTVEmotes': case 'enableBTTVEmotes':
input.removeAttribute('disabled'); input.removeAttribute('disabled');
break; break;
if(PersistentSyncStorage.data.options.allowTextSlider == true){ case 'enableFrankerEmotes':
textSizeSlider.disabled = false; input.removeAttribute('disabled');
}else{ break;
textSizeSlider.disabled = true;
} case 'enableTwitchEmotes':
input.removeAttribute('disabled');
break;
case 'kappaFix':
input.removeAttribute('disabled');
break; break;
case 'theaterModeFix': case 'theaterModeFix':
@@ -157,10 +161,6 @@ PersistentSyncStorage.on('ready', () => {
input.removeAttribute('disabled'); input.removeAttribute('disabled');
break; break;
case 'allowTextSlider' :
//
break;
case 'allowTextSlider': case 'allowTextSlider':
input.removeAttribute('disabled'); input.removeAttribute('disabled');
if(PersistentSyncStorage.data.options.allowTextSlider == true){ if(PersistentSyncStorage.data.options.allowTextSlider == true){
@@ -170,6 +170,10 @@ PersistentSyncStorage.on('ready', () => {
} }
break; break;
case 'setGreenScreen':
input.removeAttribute('disabled');
break;
default: default:
// shouldn't get hete if handled // shouldn't get hete if handled
break; break;
@@ -182,7 +186,7 @@ infoButton.addEventListener('click', function(){
chrome.tabs.create({ url: 'https://wompmacho.com/wompchat' }); chrome.tabs.create({ url: 'https://wompmacho.com/wompchat' });
}); });
var chat_overlay = document.getElementById('chat_overlay'); // var chat_overlay = document.getElementById('chat_overlay');
chat_overlay.addEventListener('click', function(){ // chat_overlay.addEventListener('click', function(){
chrome.tabs.create({ url: 'html/chat_overlay.html' }); // chrome.tabs.create({ url: 'html/chat_overlay.html' });
}); // });

View File

@@ -0,0 +1,40 @@
html
overflow: scroll;
overflow-x: hidden;
background-color:#00ff00 !important
::-webkit-scrollbar
width: 0px;
background: transparent;
::-webkit-scrollbar-thumb
background: #FF0000;
yt-live-chat-text-message-renderer
font-family: Impact, Charcoal, sans-serif !important
background-color: transparent !important
#timestamp
font-size: 1.5em !important
vertical-align: middle !important
color: white !important
font-weight: 700 !important
img
vertical-align: middle !important
height: 2em !important;
width: auto !important;
#author-name
font-size: 1.5em !important
vertical-align: middle !important
color: white !important
font-weight: 700 !important
#message
font-size: 2em !important
color: white !important
#Emote
vertical-align: middle
.message_container
overflow-y: scroll !important;
scroll-behavior: smooth

View File

@@ -42,22 +42,22 @@
#content #content
display: inline-block display: inline-block
vertical-align: middle vertical-align: middle
#timestamp.yt-live-chat-text-message-renderer
font-size: 1em
display: inline-block
vertical-align: middle
.showTimeStamp .showTimeStamp
#timestamp.yt-live-chat-text-message-renderer #timestamp.yt-live-chat-text-message-renderer
display: inline-block display: inline-block
vertical-align: middle
.Emote .Emote
height: 100%;
vertical-align: bottom;
img img
height: 1.75em height: 1.75em
align-self: center align-self: center
vertical-align: sub;
display:inline-block display:inline-block
vertical-align: middle vertical-align: middle !important
emote_div:hover emote_div:hover
background-size: 100% //100% background-size: 100% //100%
@@ -213,3 +213,10 @@ emote_div:hover
right: 0px !important right: 0px !important
top: 0px !important top: 0px !important
border: 1px solid #4e4e4e border: 1px solid #4e4e4e
.green_sceen
background-color: #00ff00 !important
font-weight: 700 !important
-webkit-text-stroke: 1px #000000
yt-live-chat-text-message-renderer:nth-child(odd)
background-color: #00ff00 !important