Update grouped sites (popup-toggle)
This commit is contained in:
parent
c49ebcbe92
commit
f037108f6b
@ -907,7 +907,6 @@ function updateBadge(activeTab) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function site_switch() {
|
||||
ext_api.tabs.query({
|
||||
active: true,
|
||||
@ -916,6 +915,11 @@ function site_switch() {
|
||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
||||
let currentUrl = tabs[0].url;
|
||||
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
||||
if (!isDefaultSite) {
|
||||
let isDefaultSiteGroup = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
if (isDefaultSiteGroup)
|
||||
isDefaultSite = Object.keys(grouped_sites).find(key => grouped_sites[key].includes(isDefaultSiteGroup));
|
||||
}
|
||||
let defaultSite_title = isDefaultSite ? Object.keys(defaultSites).find(key => defaultSites[key] === isDefaultSite) : '';
|
||||
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
||||
let customSite_title = isCustomSite ? Object.keys(customSites).find(key => customSites[key].domain === isCustomSite) : '';
|
||||
@ -955,7 +959,7 @@ function popup_show_toggle_tab(callback) {
|
||||
}, function (tabs) {
|
||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
||||
let currentUrl = tabs[0].url;
|
||||
let isDefaultSiteGrouped = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
||||
let isDefaultSiteGrouped = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
||||
let domain = isDefaultSiteGrouped || (!isDefaultSite && isCustomSite);
|
||||
|
@ -7,6 +7,7 @@ Add Groupe La Dépêche (France)
|
||||
Add Madsack Mediengruppe (Germany)
|
||||
Fix-update Bloomberg (inline articles/adblocker)
|
||||
Fix-update Funke Medien (obfuscated)
|
||||
Update grouped sites (popup-toggle)
|
||||
|
||||
* v1.9.8.0 (2020-12-06)
|
||||
Add El Comercio, Ideal & La Voz de Cadiz (Spain)
|
||||
|
@ -645,8 +645,6 @@ else if (matchDomain("afr.com")) {
|
||||
if (data_src)
|
||||
hidden_image.setAttribute('src', data_src);
|
||||
}
|
||||
if (hidden_images)
|
||||
csDone = true;
|
||||
let plista = document.querySelector('div[data-plista-placement="underArticle_Group"]');
|
||||
removeDOMElement(plista);
|
||||
}
|
||||
|
4
popup.js
4
popup.js
@ -18,7 +18,7 @@ function popup_show_toggle(domain) {
|
||||
site_switch_span.appendChild(labelEl);
|
||||
document.getElementById("site_switch").addEventListener('click', function () {
|
||||
ext_api.extension.getBackgroundPage().site_switch();
|
||||
try {open(location, '_self').close()} catch(err) {false}
|
||||
open(location).close();
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -26,5 +26,5 @@ ext_api.extension.getBackgroundPage().popup_show_toggle_tab(popup_show_toggle);
|
||||
|
||||
document.getElementById("clear_cookies").addEventListener('click', function () {
|
||||
ext_api.extension.getBackgroundPage().clear_cookies();
|
||||
try {open(location, '_self').close()} catch(err) {false}
|
||||
open(location).close();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user