@WildEnte
Not the same but similar:
If this script detect the "Load new posts" button in Vivaldi Forum, the page reload automatically:
70a61440-0427-428f-a67b-5aae8171ccc3-image.png
// ==UserScript==
// @name Auto reload Vivaldi Forum
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author @potmeklecbohdan
// @match https://forum.vivaldi.net/*
// @grant none
// ==/UserScript==
(function(){
let observers = [];
function callback(mutationList, observer) {
for (let mut of mutationList) {
if (mut.type === "attributes" && mut.attributeName === "class") {
if (mut.oldValue.split(" ").includes("hide")
&& !mut.target.className.split(" ").includes("hide")) {
location.reload();
}
}
}
}
function watch() {
for (let obs of observers) {
obs.disconnect();
let idx = observers.indexOf(obs);
if (idx > -1)
observers.splice(idx, 1);
}
let node = document.querySelector("#new-topics-alert.alert.alert-warning.h-100.m-0.px-2.py-1.d-flex.align-items-center");
if (!node)
return;
let cfg = { attributes: true, attributeFilter: [ "class" ], attributeOldValue: true };
let obs = new MutationObserver(callback);
observers.push(obs);
obs.observe(node, cfg);
}
window.addEventListener("load", () => {
watch();
// Have to use jQuery coz otherwise it doesn't work
if (window.$)
$(window).on('action:ajaxify.end', () => watch());
});
})();
Written by @potmeklecbohdan in this post https://forum.vivaldi.net/topic/50529/auto-reload-vivaldi-forum-only-when-there-is-a-new-post-or-thread-ahk-script