Merge pull request #23 from wompmacho/add-stream-overlay-option
unable to Add stream overlay option, alternatives and fixes, also rename project
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
50
src/chat_overlay.js
Normal file
50
src/chat_overlay.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import './stylus/content.styl';
|
||||||
|
import './stylus/chat_overlay.styl';
|
||||||
|
|
||||||
|
|
||||||
|
const message_container = document.getElementById("message_container");
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener(
|
||||||
|
function(request, sender, sendResponse) {
|
||||||
|
|
||||||
|
if(sender.origin == "https://www.youtube.com"){
|
||||||
|
|
||||||
|
if (request.message == "preloadMessages"){
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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',
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ChatScroller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scroll() {
|
scroll() {
|
||||||
this.scroller.scrollTop = 9999;
|
this.scroller.scrollIntoView({block: 'end'});
|
||||||
}
|
}
|
||||||
|
|
||||||
getScroller() {
|
getScroller() {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import Emotes from './Emotes';
|
|||||||
import Message from './Message';
|
import Message from './Message';
|
||||||
import PersistentSyncStorage from 'src/helpers/PersistentSyncStorage';
|
import PersistentSyncStorage from 'src/helpers/PersistentSyncStorage';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ChatWatcher {
|
class ChatWatcher {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -14,7 +12,6 @@ class ChatWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
this.getChatContainer().then(Emotes.init).then(() => {
|
this.getChatContainer().then(Emotes.init).then(() => {
|
||||||
this.addEmotePopup();
|
this.addEmotePopup();
|
||||||
@@ -44,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
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,8 +55,6 @@ class ChatWatcher {
|
|||||||
|
|
||||||
mutations.forEach(mutation => {
|
mutations.forEach(mutation => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { addedNodes, removedNodes } = mutation;
|
const { addedNodes, removedNodes } = mutation;
|
||||||
|
|
||||||
// Added nodes
|
// Added nodes
|
||||||
@@ -64,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
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,8 +190,6 @@ class ChatWatcher {
|
|||||||
emoteAppend(keysITer);
|
emoteAppend(keysITer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// add div to doc
|
// add div to doc
|
||||||
chatButtonSelectionList.appendChild(popUpDiv);
|
chatButtonSelectionList.appendChild(popUpDiv);
|
||||||
|
|
||||||
@@ -197,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');
|
||||||
@@ -218,6 +228,7 @@ class ChatWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log((keysITer.length+1) + " Emotes Added");
|
console.log((keysITer.length+1) + " Emotes Added");
|
||||||
|
|
||||||
}// end addEmotePopup
|
}// end addEmotePopup
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -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 }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,15 +202,7 @@ class Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// removes color attr
|
|
||||||
removelternateLineColor(){
|
|
||||||
this.node.classList.remove("set-background-color-one");
|
|
||||||
this.node.classList.remove("set-background-color-two");
|
|
||||||
}
|
|
||||||
|
|
||||||
}// end Message
|
}// end Message
|
||||||
|
|
||||||
export default Message;
|
export default Message;
|
||||||
@@ -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() {
|
||||||
|
|||||||
14
src/html/chat_overlay.html
Normal file
14
src/html/chat_overlay.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Chat Overlay</title>
|
||||||
|
<link rel="stylesheet" href="./youtube.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="message_container"></div>
|
||||||
|
<script src="../chat_overlay.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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>
|
||||||
@@ -136,6 +143,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- <button class="chat_overlay" id="chat_overlay" >Chat Overlay</button> -->
|
||||||
|
|
||||||
<div id="save-status"> </div>
|
<div id="save-status"> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
59488
src/html/youtube.css
Normal file
59488
src/html/youtube.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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':
|
||||||
@@ -156,10 +160,6 @@ PersistentSyncStorage.on('ready', () => {
|
|||||||
case 'setLiveChat' :
|
case 'setLiveChat' :
|
||||||
input.removeAttribute('disabled');
|
input.removeAttribute('disabled');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'allowTextSlider' :
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'allowTextSlider':
|
case 'allowTextSlider':
|
||||||
input.removeAttribute('disabled');
|
input.removeAttribute('disabled');
|
||||||
@@ -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;
|
||||||
@@ -180,4 +184,9 @@ PersistentSyncStorage.on('ready', () => {
|
|||||||
var infoButton = document.getElementById('infoButton');
|
var infoButton = document.getElementById('infoButton');
|
||||||
infoButton.addEventListener('click', function(){
|
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');
|
||||||
|
// chat_overlay.addEventListener('click', function(){
|
||||||
|
// chrome.tabs.create({ url: 'html/chat_overlay.html' });
|
||||||
|
// });
|
||||||
40
src/stylus/chat_overlay.styl
Normal file
40
src/stylus/chat_overlay.styl
Normal 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
|
||||||
@@ -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%
|
||||||
@@ -212,4 +212,11 @@ emote_div:hover
|
|||||||
position: absolute !important
|
position: absolute !important
|
||||||
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
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ module.exports = {
|
|||||||
content: './content/',
|
content: './content/',
|
||||||
background: './background/',
|
background: './background/',
|
||||||
options: './options.js',
|
options: './options.js',
|
||||||
welcomePage: './welcomePage.js'
|
welcomePage: './welcomePage.js',
|
||||||
|
chat_overlay: './chat_overlay.js'
|
||||||
|
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ module.exports = {
|
|||||||
content: './content/',
|
content: './content/',
|
||||||
background: './background/',
|
background: './background/',
|
||||||
options: './options.js',
|
options: './options.js',
|
||||||
welcomePage: './welcomePage.js'
|
welcomePage: './welcomePage.js',
|
||||||
|
chat_overlay: './chat_overlay.js'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: distPath,
|
path: distPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user