Last active
April 6, 2022 10:33
-
-
Save vogler/d3b4622033837df8597fb2ab993888a8 to your computer and use it in GitHub Desktop.
mydealz: add rel=next/prev for Nächste/Vorherige Seite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name mydealz: add rel=next/prev for Nächste/Vorherige Seite | |
// @description mydealz: add rel=next/prev for Nächste/Vorherige Seite | |
// @namespace https://gist.github.com/vogler | |
// @downloadURL https://gist.github.com/vogler/d3b4622033837df8597fb2ab993888a8/raw/add-rel-next-prev.mydealz.de.tamper.js | |
// @version 0.1 | |
// @author Ralf Vogler | |
// @match https://www.mydealz.de/deals/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=mydealz.de | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const next = 'button[aria-label="Nächste Seite"'; | |
const prev = 'button[aria-label="Vorherige Seite"'; | |
(new MutationObserver(check)).observe(document.querySelector('#comments'), {childList: true, subtree: true}); | |
function check(changes, observer) { | |
console.log(changes); | |
if(document.querySelector(next)) { | |
observer.disconnect(); | |
// console.log(document.querySelector(next)); | |
document.querySelector(next).setAttribute('rel', 'next'); | |
document.querySelector(prev).setAttribute('rel', 'prev'); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment