From 69a0003e8bf0e800d4e2db2eac41778b2a6818d1 Mon Sep 17 00:00:00 2001 From: bt0r Date: Sat, 1 Aug 2020 10:47:00 +0200 Subject: [PATCH] fix: Observe appMountPoint DOM node than .mainView because mainView is created dynamically --- manifest_chrome.json | 2 +- manifest_firefox.json | 2 +- src/index.js | 4 +++- webpack_chrome.config.js | 16 ++++++++-------- webpack_firefox.config.js | 16 ++++++++-------- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/manifest_chrome.json b/manifest_chrome.json index cfed78c..3345959 100644 --- a/manifest_chrome.json +++ b/manifest_chrome.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "NoteFlix", - "version": "1.2.1", + "version": "1.2.3", "description": "Permet d'avoir les scores et avis AlloCiné/SensCritique sur Netflix", "icons": { "48": "images/logo-48.png", diff --git a/manifest_firefox.json b/manifest_firefox.json index 8328a60..b24b3d0 100644 --- a/manifest_firefox.json +++ b/manifest_firefox.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "NoteFlix", - "version": "1.2.1", + "version": "1.2.3", "description": "Permet d'avoir les scores et avis AlloCiné/SensCritique sur Netflix", "icons": { "48": "images/logo-48.png", diff --git a/src/index.js b/src/index.js index 03640bf..67595a7 100644 --- a/src/index.js +++ b/src/index.js @@ -39,6 +39,7 @@ const isLoaded = (mutation) => { } const observer = new MutationObserver((mutations) => { + console.log(mutations) // Only listen mutation of added jawBones const jawboneMutation = mutations.filter(mutation => { return clickedOnVideoJawBone(mutation) || @@ -50,4 +51,5 @@ const observer = new MutationObserver((mutations) => { manager.refreshRatings() } }) -observer.observe(document.querySelector('.mainView'), observerConfig) + +observer.observe(document.getElementById('appMountPoint'), observerConfig) diff --git a/webpack_chrome.config.js b/webpack_chrome.config.js index 21cbc00..53980e3 100644 --- a/webpack_chrome.config.js +++ b/webpack_chrome.config.js @@ -1,19 +1,19 @@ -const path = require('path'); -const CopyPlugin = require('copy-webpack-plugin'); +const path = require('path') +const CopyPlugin = require('copy-webpack-plugin') module.exports = { entry: { - index: './src/index.js', - background: './src/background.js', + index: './src/index.js', + background: './src/background.js' }, plugins: [ new CopyPlugin([ { from: 'images/logo*', to: '.' }, - { from: 'manifest_chrome.json', to: 'manifest.json'} - ]), + { from: 'manifest_chrome.json', to: 'manifest.json' } + ]) ], output: { path: path.resolve(__dirname, 'dist/chrome/main'), - filename: '[name]/index.js', + filename: '[name]/index.js' } -}; +} diff --git a/webpack_firefox.config.js b/webpack_firefox.config.js index cd1e405..4078439 100644 --- a/webpack_firefox.config.js +++ b/webpack_firefox.config.js @@ -1,19 +1,19 @@ -const path = require('path'); -const CopyPlugin = require('copy-webpack-plugin'); +const path = require('path') +const CopyPlugin = require('copy-webpack-plugin') module.exports = { entry: { - index: './src/index.js', - background: './src/background.js', + index: './src/index.js', + background: './src/background.js' }, plugins: [ new CopyPlugin([ { from: 'images/logo*', to: '.' }, - { from: 'manifest_firefox.json', to: 'manifest.json'} - ]), + { from: 'manifest_firefox.json', to: 'manifest.json' } + ]) ], output: { path: path.resolve(__dirname, 'dist/firefox/main'), - filename: '[name]/index.js', + filename: '[name]/index.js' } -}; +}