Skip to content

Commit 38c4f33

Browse files
author
github-actions
committed
Release from Ophirofox v2.5.250326.2302
1 parent 265a03c commit 38c4f33

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

ophirofox.user.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==UserScript==
2-
// @version 2.5.250319.1643
2+
// @version 2.5.250326.2302
33
// @author Write
44
// @name OphirofoxScript
55
// @grant GM.getValue
@@ -2231,6 +2231,7 @@
22312231
if (match(hostname, "https://www.leparisien.fr/*")) {
22322232

22332233
window.addEventListener("load", function(event) {
2234+
22342235
function extractKeywords() {
22352236
return document.querySelector("h1").textContent;
22362237
}
@@ -2246,29 +2247,22 @@
22462247
head.after(await createLink());
22472248
}
22482249

2249-
function findPremiumBanner(bannerSelector) {
2250-
if (!bannerSelector) return null;
2251-
const elems = bannerSelector.parentElement.querySelectorAll("div");
2252-
return [...elems].find(d => d.textContent.includes("Cet article est réservé aux abonnés"));
2253-
}
2254-
22552250
async function onLoad() {
2256-
const bannerSelector = document.querySelector(".paywall-sticky.width_full.d_flex.pt_3_m.pb_3_m.pt_4_nm.pb_4_nm.pos_stick.ff_gct.fw_r.justify_center");
2257-
if (findPremiumBanner(bannerSelector)) {
2251+
const bannerSelector = document.querySelector(".btn-subscribe");
2252+
if (bannerSelector) {
22582253
addEuropresseButton();
22592254
} else {
2255+
// console.log("Premium banner couldn't be found")
22602256
/* Premium banner couldn't be found, use MutationObserver as fallback */
22612257
var elementFound = false;
22622258
const callback = (mutationList, observer) => {
22632259
for (const mutation of mutationList) {
22642260
for (const e of mutation.addedNodes) {
2265-
const bannerSelectorString = 'paywall-sticky width_full d_flex pt_3_m pb_3_m pt_4_nm pb_4_nm pos_stick ff_gct fw_r justify_center';
2261+
const bannerSelectorString = 'btn-subscribe';
22662262
if (e.className == bannerSelectorString) {
22672263
observer.disconnect();
22682264
elementFound = true;
2269-
if (findPremiumBanner(e)) {
2270-
addEuropresseButton();
2271-
}
2265+
addEuropresseButton();
22722266
break;
22732267
}
22742268
}

0 commit comments

Comments
 (0)