fix(browser-extension): minor bugs

This commit is contained in:
wanhose 2022-05-12 19:58:52 +02:00
parent 2aaae54267
commit 516afb1c25
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ const enablePopup = (tabId) => chrome.browserAction.setPopup({ popup: 'popup.htm
* @description Retrieves cache state
* @param {string} hostname
* @param {void} callback
* @returns {Promise<{ enabled: boolean }>}
* @returns {{ enabled: boolean }}
*/
const getCache = (hostname, callback) => {

View File

@ -30,7 +30,7 @@ const fixes = [];
* @description Hostname
*/
const hostname = document.location.hostname;
const hostname = document.location.hostname.split('.').slice(-2).join('.');
/**
* @description Is consent preview page?
@ -157,7 +157,7 @@ const promiseAll = () =>
document.addEventListener('readystatechange', () => {
dispatch({ hostname, type: 'GET_CACHE' }, null, async ({ enabled }) => {
if (document.readyState === 'complete' && enabled && !preview) {
if (document.readyState === 'complete' && enabled && !preview && selectors.length) {
const nodes = Array.from(document.querySelectorAll(selectors));
fix();