From 88faaaa2fa1ad75b69fee62ff90d4c80a1157965 Mon Sep 17 00:00:00 2001 From: Josh B Date: Mon, 3 Feb 2020 17:53:30 +1000 Subject: [PATCH] Make changes to image detection thanks to @ikeblaster for some suggestions here. Bumps version to 3.3.0 --- .eslintrc.js | 3 ++- js/content-script.js | 15 ++++++++++++--- manifest.json | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6fd1bcc..17b856e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,7 +17,8 @@ module.exports = { ], "indent": [ "error", - 4 + 4, + { "SwitchCase": 1 } ], "linebreak-style": [ "error", diff --git a/js/content-script.js b/js/content-script.js index 2ff060a..1f37305 100644 --- a/js/content-script.js +++ b/js/content-script.js @@ -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]]; @@ -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); + } + } } }); @@ -349,7 +357,8 @@ chrome.storage.sync.get(['options', 'defaultOptions'], function (storage) { observer.observe(document.body, { childList: true, - subtree: true + subtree: true, + attributes: true }); }); diff --git a/manifest.json b/manifest.json index 096b4a6..96823d2 100644 --- a/manifest.json +++ b/manifest.json @@ -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": {