// ==UserScript== // @name APA Label - derstandard.at // @namespace Violentmonkey Scripts // @match https://www.derstandard.at/story/* // @grant none // @version 1.0 // @author oodeagleoo // @license MIT // @description 10/02/2022, 13:08:42 // @require https://cdn.jsdelivr.net/npm/@ryanmorr/ready@1.4.0 // @downloadURL none // ==/UserScript== function isApaArticle(article) { const paragraphs = article.querySelectorAll('p'); for (const paragraph of paragraphs) { if (/APA,/.test(paragraph.innerText)) { return true; } } return false; } (async () => { waitFor = (selector) => new Promise((resolve) => ready(selector, resolve)); const article = await waitFor('div.story article'); if (isApaArticle(article)) { const h1 = await waitFor('h1.article-title'); h1.innerHTML = `APA: ${h1.innerText}`; } })();