Skip to content

Commit

Permalink
Make changes to image detection
Browse files Browse the repository at this point in the history
thanks to @ikeblaster for some suggestions here.

Bumps version to 3.3.0
  • Loading branch information
bijij committed Feb 3, 2020
1 parent f83b0e8 commit 88faaaa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = {
],
"indent": [
"error",
4
4,
{ "SwitchCase": 1 }
],
"linebreak-style": [
"error",
Expand Down
15 changes: 12 additions & 3 deletions js/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function getContainer(node) {
[
['.irc_c[style*="visibility: visible;"][style*="transform: translate3d(0px, 0px, 0px);"]', VERSIONS.FEB18],
['.irc_c[data-ved]', VERSIONS.JUL19],
['.A8mJGd', VERSIONS.OCT19]
['.tvh9oe', VERSIONS.OCT19]
].forEach(element => {
if (node.closest(element[0])) {
[container, version] = [node.closest(element[0]), element[1]];
Expand Down Expand Up @@ -330,12 +330,20 @@ var observer = new MutationObserver(function (mutations) {
for (var node of mutation.addedNodes) {
if (node.classList) {
// Check for new image nodes
if (['irc_mi', 'irc_mut', 'irc_ris', 'A8mJGd', 'n3VNCb'].some(className => node.classList.contains(className))) {
if (['irc_mi', 'irc_mut', 'irc_ris', 'n3VNCb'].some(className => node.classList.contains(className))) {
addLinks(node);
}
}
}
}

if (mutation.target.classList && mutation.target.classList.contains('n3VNCb')) {
var node = mutation.target.closest('.tvh9oe');

if (!node.hasAttribute('aria-hidden')) {
addLinks(node);
}
}
}
});

Expand All @@ -349,7 +357,8 @@ chrome.storage.sync.get(['options', 'defaultOptions'], function (storage) {

observer.observe(document.body, {
childList: true,
subtree: true
subtree: true,
attributes: true
});
});

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_appName__",
"version": "3.2.2",
"version": "3.3.0",
"description": "__MSG_appDesc__",
"default_locale": "en",
"icons": {
Expand Down

0 comments on commit 88faaaa

Please sign in to comment.