Skip to content

Commit

Permalink
fix the script to account for mutation on page
Browse files Browse the repository at this point in the history
  • Loading branch information
joshparkerj committed Jan 22, 2024
1 parent bfdfa5d commit f555b0b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pairai/update-copyright.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// @match https://pairai.com/
// ==/UserScript==
(function updateCopyright() {
const copyrightElement = document.querySelector('[data-framer-name=links]').parentElement.children[0].querySelector('p');
const updatedText = copyrightElement.textContent.replace('2023', '2024');
copyrightElement.textContent = updatedText;
const mutationObserver = new MutationObserver(() => {
const copyrightElement = document.querySelector('[data-framer-name=links]').parentElement.children[0].querySelector('p');
const updatedText = copyrightElement.textContent.replace('2023', '2024');
copyrightElement.textContent = updatedText;
});

mutationObserver.observe(document.querySelector('#main'), { childList: true, subtree: true });
}());

0 comments on commit f555b0b

Please sign in to comment.