Auto reload Vivaldi Forum only when there is a new post or thread {AHK script}
-
For those that have installed AHK, this is a script to auto reload Vivaldi Forum only when there is a new post or thread:
; AUTO RELOAD VIVALDI FORUM #Persistent SendMode Input target := "Home | Vivaldi Forum - Vivaldi", color := "0xD8D8D8" CoordMode, Pixel, Screen Loop { WinGetActiveTitle, active If active contains %target% { PixelGetColor, thisColor, 248, 311 Sleep, 500 If (thisColor = color) Send ^r Else Sleep, 1000 } Sleep, 3000 continue }
You have to change the values of X and Y : 248 and 311, and the color 0xD8D8D8 according to your theme. The position and the color of one of the pixels of the text in "There are 3 new posts. Click here to reload"; or could be the color of the highlight if you don't use a theme:
Enjoy.
-
You’ve now pushed me to finally write this idea as old as the notice. Here’s the userJS to achieve the same (w/o userJS headers)
(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")) { ajaxify.refresh(); } } } } 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, #category-no-topics"); 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()); }); })();
-
@potmeklecbohdan You welcome.
-
@potmeklecbohdan Your UserJS works like a charm.
It works in any page of Vivaldi Forum even though there is no "new-topics-alert" display?
You have to open a new thread because my thread say {AHK script}, so many people could use it !!
-
@barbudo2005 said in Auto reload Vivaldi Forum only when there is a new post or thread {AHK script}:
It works in any page of Vivaldi Forum even though there is no "new-topics-alert" display?
It doesn’t. When you see a new post appear while you’re reading a thread, it’s a normal feature of the forum.
#new-topics-alert
is only in/unread
(or maybe a few other pages). -
@potmeklecbohdan
If you have the Vivaldi Forum open and links open from it, the children auto reload if there is a new post.
-
@barbudo2005 Doesn’t happen for me, sorry.
-
@potmeklecbohdan
Could you check over your userJS, because I think don't make a "complete" reload.
I have a userJS to rename the tab and I use EzLinkPreview; and both don't work after an autoreload. I have to click the Reload button.
Thank you in advance.
-
@barbudo2005 Replace that
ajaxify.refresh
withlocation.reload
-
@potmeklecbohdan Thank you very much.
-
@potmeklecbohdan The script not works any more. ( I changed ajaxify.refresh with location.reload)
Could you take a look?
Thank you very much in advance.
-
@barbudo2005 For some reason
/unread
now uses#category-no-topics
while/recent
keeps using#new-topics-alert
. Thus the selector now must be#new-topics-alert, #category-no-topics
. -
@potmeklecbohdan Thank you very much.
-
To make it work with the new forum, change:
This:
#new-topics-alert
With this:
#new-topics-alert.alert.alert-warning
-
To install it follow this instructions:
1.- Install the extension Tampermonkey:
https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
2.- Click the icon of the extension:
and click "Create a new script.."
3.- Delete the template:
// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... })();
4.- Paste this script:
// ==UserScript== // @name Auto reload Vivaldi Forum // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://forum.vivaldi.net/* // @grant none // ==/UserScript== (function() { 'use strict'; (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"); 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()); }); })(); })();
5.- In the File Menu:
Click "Save":
With this script you forget to click the banner, because automatically auto reload Vivaldi Forum when there is a new post or thread.
-
This post is deleted!