|
1 | 1 | // ==UserScript== |
2 | | -// @version 2.4.26329.50904 |
| 2 | +// @version 2.4.26333.53069 |
3 | 3 | // @author Write |
4 | 4 | // @name OphirofoxScript |
5 | 5 | // @grant GM.getValue |
|
134 | 134 | // @include https://www.knack.be/* |
135 | 135 | // @include https://www.demorgen.be/* |
136 | 136 | // @include https://www.standaard.be/* |
137 | | -// @include https://www.economist.com/* |
138 | 137 | // @include https://www.ft.com/* |
139 | | -// @include https://www.washingtonpost.com/* |
140 | 138 | // @include https://www.gva.be/* |
141 | 139 | // @include https://www.nieuwsblad.be/* |
142 | 140 | // @include https://www.hln.be/* |
|
2874 | 2872 | `); |
2875 | 2873 | } |
2876 | 2874 |
|
2877 | | - if ("https://www.economist.com/*".includes(hostname)) { |
2878 | | - |
2879 | | - window.addEventListener("load", function(event) { |
2880 | | - function extractKeywords() { |
2881 | | - return document.querySelector("h1").textContent; |
2882 | | - } |
2883 | | - |
2884 | | - async function createLink() { |
2885 | | - const a = await ophirofoxEuropresseLink(extractKeywords()); |
2886 | | - return a; |
2887 | | - } |
2888 | | - |
2889 | | - async function onLoad() { |
2890 | | - const callback = (mutationsList, observer) => { |
2891 | | - for (const mutation of mutationsList) { |
2892 | | - if (mutation.type === 'childList') { |
2893 | | - for (let node of mutation.addedNodes) { |
2894 | | - const subscriptionElem = document.querySelector('section[data-body-id*="cp"]'); |
2895 | | - if (node === subscriptionElem) { |
2896 | | - const subtitle = document.querySelector('#new-article-template h1'); |
2897 | | - createLink().then(function(data) { |
2898 | | - subtitle.after(data); |
2899 | | - }); |
2900 | | - observer.disconnect(); |
2901 | | - } |
2902 | | - } |
2903 | | - } |
2904 | | - } |
2905 | | - }; |
2906 | | - |
2907 | | - const htmlElement = document.querySelector('#new-article-template'); |
2908 | | - const observer = new MutationObserver(callback); |
2909 | | - observer.observe(htmlElement, { |
2910 | | - childList: true, |
2911 | | - subtree: true |
2912 | | - }); |
2913 | | - } |
2914 | | - |
2915 | | - onLoad().catch(console.error); |
2916 | | - }); |
2917 | | - |
2918 | | - pasteStyle(` |
2919 | | - .ophirofox-europresse{ |
2920 | | - display: inline-block; |
2921 | | - margin-top: 1rem; |
2922 | | - padding: 0.25rem 1rem; |
2923 | | - border-radius: 0.3rem; |
2924 | | - background-color: #ffc700; |
2925 | | - color: #000; |
2926 | | - text-decoration: none; |
2927 | | - } |
2928 | | - `); |
2929 | | - } |
2930 | | - |
2931 | 2875 | if ("https://www.ft.com/*".includes(hostname)) { |
2932 | 2876 |
|
2933 | 2877 | window.addEventListener("load", function(event) { |
|
2963 | 2907 | `); |
2964 | 2908 | } |
2965 | 2909 |
|
2966 | | - if ("https://www.washingtonpost.com/*".includes(hostname)) { |
2967 | | - |
2968 | | - window.addEventListener("load", function(event) { |
2969 | | - function extractKeywords() { |
2970 | | - const titleElem = document.querySelector("h1#main-content"); |
2971 | | - return titleElem.textContent; |
2972 | | - } |
2973 | | - |
2974 | | - async function createLink() { |
2975 | | - const a = await ophirofoxEuropresseLink(extractKeywords()); |
2976 | | - return a; |
2977 | | - } |
2978 | | - |
2979 | | - async function onLoad() { |
2980 | | - let linkAdded = false; |
2981 | | - const callback = (mutationsList, observer) => { |
2982 | | - for (const mutation of mutationsList) { |
2983 | | - if (!linkAdded) { |
2984 | | - const paywall_modal = document.querySelector('[data-qa="overlay-container"]'); |
2985 | | - const paywall_bottom = document.querySelector('#wall-bottom-drawer'); |
2986 | | - if (paywall_modal !== null || paywall_bottom !== null) { |
2987 | | - const title_bottom = document.querySelector('h1#HEADER'); |
2988 | | - createLink().then(function(data) { |
2989 | | - title_bottom.after(data); |
2990 | | - }); |
2991 | | - linkAdded = true; |
2992 | | - observer.disconnect(); |
2993 | | - } |
2994 | | - } |
2995 | | - } |
2996 | | - }; |
2997 | | - |
2998 | | - const htmlElement = document.querySelector('body'); |
2999 | | - const observer = new MutationObserver(callback); |
3000 | | - observer.observe(htmlElement, { |
3001 | | - attributes: true, |
3002 | | - subtree: true |
3003 | | - }); |
3004 | | - } |
3005 | | - |
3006 | | - onLoad().catch(console.error); |
3007 | | - }); |
3008 | | - |
3009 | | - pasteStyle(` |
3010 | | - .ophirofox-europresse { |
3011 | | - display: flex; |
3012 | | - justify-content: center; |
3013 | | - margin: 1rem auto; |
3014 | | - padding: 0.25rem 1rem; |
3015 | | - width: 12vw; |
3016 | | - border-radius: 0.3rem; |
3017 | | - background-color: #ffc700; |
3018 | | - color: #000; |
3019 | | - text-decoration: none; |
3020 | | - } |
3021 | | - `); |
3022 | | - } |
3023 | | - |
3024 | 2910 | if ("https://www.gva.be/*".includes(hostname)) { |
3025 | 2911 |
|
3026 | 2912 | window.addEventListener("load", function(event) { |
|
0 commit comments