Fix BusinessPost.ie (json)

merge-requests/15/head
magnolia1234 1 year ago
parent 5980cbafab
commit 47866f50cf

@ -409,7 +409,7 @@ Grouped in options:\
##### United Kingdom/Ireland
[Belfast Telegraph](https://www.belfasttelegraph.co.uk) -
[Business Post (link to archive.is)](https://www.businesspost.ie) -
[Business Post](https://www.businesspost.ie) -
[Citywire](https://www.citywire.com) -
[Euromoney](https://www.euromoney.com) -
[Evening Standard](https://www.standard.co.uk) -

@ -9,6 +9,7 @@ Add Stuttgarter-zeitung.de
Remove Golem.de (fix obsolete)
Remove LeFigaro.fr (fix obsolete)
Remove Tagesspiegel.de (fix obsolete)
Fix BusinessPost.ie (json)
Fix Hearst Communications magazines (js)
Fix Midi-Olympique.fr (new domain Rugbyrama.fr)

@ -266,6 +266,27 @@ if (ext_api.runtime) {
})
}
window.addEventListener('message', function (event) {
if (event.data) {
if (event.data.type === 'from_page') {
if (matchDomain('businesspost.ie')) {
let data = event.data.data;
let article = document.querySelector('div.article-body-section');
if (data && article && dompurify_loaded && !msg_once) {
msg_once = true;
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(data) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new) {
article.innerHTML = '';
article.appendChild(article_new);
}
}
}
}
}
}, false);
var div_bpc_done = document.querySelector('div#bpc_done');
if (!div_bpc_done) {
@ -2611,14 +2632,47 @@ if (matchDomain(['belfasttelegraph.co.uk', 'independent.ie'])) {
}
else if (matchDomain('businesspost.ie')) {
let url = window.location.href;
let paywall = document.querySelector('div#bp_paywall_content');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.article-body-section');
if (article)
article.firstChild.before(archiveLink(url));
function bpie_main() {
if ($) {
let article_id_dom = document.querySelector('article[id]');
let article_id;
if (article_id_dom)
article_id = article_id_dom.id;
if (article_id) {
let bp_ajaxurl = 'https://www.businesspost.ie/wp-admin/admin-ajax.php';
let data_ajax = {
action: 'fetch_article_content',
type: 'POST',
data: {
id: article_id
},
dataType: 'json',
contentType: 'application/json'
};
$.ajax({
type: 'POST',
url: bp_ajaxurl,
data: data_ajax,
success: function (data) {
window.postMessage({type: 'from_page', data: data});
}
});
}
} else
window.location.reload(true);
}
csDoneOnce = true;
window.setTimeout(function () {
let paywall = document.querySelector('div#bp_paywall_content');
let article_id_dom = document.querySelector('article[id]');
let article_id;
if (article_id_dom)
article_id = article_id_dom.id;
if (paywall || article_id) {
removeDOMElement(paywall);
insert_script(bpie_main);
}
}, 500);
}
else if (matchDomain('citywire.com')) {

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.2.3.3"
"version": "3.2.3.4"
}

@ -761,5 +761,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.2.3.3"
"version": "3.2.3.4"
}

@ -277,10 +277,11 @@ var defaultSites = {
allow_cookies: 1,
block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/
},
"Business Post.ie (link to archive.is)": {
"Business Post.ie": {
domain: "businesspost.ie",
allow_cookies: 1,
block_regex: /\.piano\.io\//
block_regex: /\.piano\.io\//,
cs_dompurify: 1
},
"California Business Journals": {
domain: "###_usa_cbj",

Loading…
Cancel
Save