creating messanger for content scripst

to pass messages to overlay
This commit is contained in:
wompmacho
2020-11-12 06:05:32 -05:00
parent c8fda4aac9
commit fb13e2f056
9 changed files with 14516 additions and 17 deletions

View File

@@ -2,8 +2,6 @@ import Emotes from './Emotes';
import Message from './Message';
import PersistentSyncStorage from 'src/helpers/PersistentSyncStorage';
class ChatWatcher {
constructor() {
@@ -14,7 +12,6 @@ class ChatWatcher {
}
init() {
return new Promise((res, rej) => {
this.getChatContainer().then(Emotes.init).then(() => {
this.addEmotePopup();
@@ -54,8 +51,6 @@ class ChatWatcher {
mutations.forEach(mutation => {
const { addedNodes, removedNodes } = mutation;
// Added nodes
@@ -186,8 +181,6 @@ class ChatWatcher {
emoteAppend(keysITer);
}
// add div to doc
chatButtonSelectionList.appendChild(popUpDiv);

View File

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