Open advanc3dUA opened 1 month ago
This extension uses Chrome's built-in timer to notify you when a refresh is needed. It appears that Chrome's scheduling may be inaccurate in your case. In the latest commit, I've added a method for the visual counter to alert the worker when the countdown is complete. Please try the "v3" directory of this repository in the developer mode and report back.
I want to get full automation of the refresh process
The extension supports "Policy Code". You can write a simple JS to let the extension know if the refresh is needed or not. You can use the "new Date()" to find if the time is in the range or not.
With v3 I get updates in time, whenever the timer hits 0:00. Looks good but Chrome says (on the extension's page) that there is a problem with the extension on line 117 of worker.js. The line is: "api.tabs.countdown(tab.id, request.profile.period).catch(e => console.error(e));".
UPDATE: I have found the solution, I need the page to be permitted to access.
Regarding my schedule problem: I try something like this:
{
"www.mydomain.com/*": {
"date": "(function() { const currentDate = new Date(); const day = currentDate.getDay(); const hours = currentDate.getHours(); const isWorkingDay = day >= 1 && day <= 6; const isWorkingHours = hours >= 7 && hours < 21; return isWorkingDay && isWorkingHours; })()"
}
}
Unfortunately, it doesn't work. Do I have to put it in another place or I got your hint wrong? :)
Ooooookey. I have all understood. At first, I tried to add the code to the "code" key in the "Custom Jobs" section. It works but after the page is reloaded. Then I found in FAQ that if I want to preload the code, I have to add it to the "Run Policy Code" and to use it, I need to activate it in the popup. After saving it as the custom job I have found, that the code should be saved in "pre-code". So, it seems to be good for now because today is Sunday and the Tab Reloader is skipping reloads.
Btw, in the FAQ there is no information about the "pre-code" key, only that I can add it in the popup. Should it be there? Up to you.
Maybe someone will find it useful, so here is my example. Works only from 7:00 until 21:00, Sunday is a day off:
[
{
"blocked-words": "",
"cache": false,
"current": false,
"discarded": false,
"form": false,
"hh": 0,
"hostname": "put_the_domain_here",
"mm": 0,
"nodiscard": false,
"nofocus": false,
"offline": false,
"pre-code": "(function() { const currentDate = new Date(); const day = currentDate.getDay(); const hours = currentDate.getHours(); const isWorkingDay = day >= 1 && day <= 6; const isWorkingHours = hours >= 7 && hours < 21; console.log('Current day: ' + day + ', Current hour: ' + hours); console.log('Is working day: ' + isWorkingDay + ', Is working hours: ' + isWorkingHours); document.currentScript.dataset.continue = (isWorkingDay && isWorkingHours) ? 'true' : 'false'; })();",
"randomize": false,
"scroll-to-end": false,
"sound": false,
"sound-value": "1",
"ss": 10,
"switch": false,
"variation": 0,
"visual-countdown": true
}
]
there is a problem with the extension on line 117 of worker.js
Do you have the error log?
Btw, in the FAQ there is no information about the "pre-code" key, only that I can add it in the popup. Should it be there? Up to you.
Since the extension's popup now creates the code for the user, there is no need for manually generating the JSON object. Anyhow, I'll update the FAQs page.
there is a problem with the extension on line 117 of worker.js
Do you have the error log?
That is not necessary. The small problem is that for some reason the v3 version doesn't ask for the permissions automatically (both at MacOS + Chrome and Raspberry OS + Chromium), therefore I got that error. However after the "Host permission" button is clicked manually, the error no longer appears.
Since the extension's popup now creates the code for the user, there is no need for manually generating the JSON object. Anyhow, I'll update the FAQs page.
As for me, writing a long script in the popup window is not very comfortable. Having information about the "pre-code" key in the FAQ will make it clearer for weirdos like me :).
Hello,
First, I want to say that the flexibility of the extension is right I was searching for. Thanks a lot for your work.
But I have a few things which I can't get over by myself:
Here is my simple example:
If the day of the week is not supported yet, then it would be awesome to see this in the next updates. If it is already supported, please explain how it should be used.
Cheers.