Skip to content

Commit

Permalink
Fix selector for thread containers
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazar committed Apr 9, 2020
1 parent c5d207a commit 6b3540c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ function main() {
});

var buttonContainer = e.querySelector('div:nth-of-type(2) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > span:nth-of-type(1)');
if (buttonContainer) {
if (
buttonContainer &&
buttonContainer.children.length === 2 &&
buttonContainer.children[0].tagName === 'SPAN' &&
buttonContainer.children[1].tagName === 'SPAN'
) {
buttonContainer.style = 'display: inline-block;';

buttonContainer.parentElement.style = 'display: inline-block; width: unset; opacity: 1;';
Expand All @@ -210,10 +215,7 @@ function debounce(fn, delay) {
}
}

if(window.location.href.match(/^https:\/\/chat.google.com/)) {
addStyle();
main();
}

addStyle();
main();
var el = document.documentElement;
el.addEventListener('DOMSubtreeModified', debounce(main, 1000));
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"content_scripts": [
{
"matches": [
"*://*/*"
"https://chat.google.com/*"
],
"js": [
"content.js"
Expand Down

0 comments on commit 6b3540c

Please sign in to comment.