mohamedmansour / reload-all-tabs-extension

Reload All Tabs Google Chrome Extension
https://chrome.google.com/extensions/detail/midkcinmplflbiflboepnahkboeonkam
80 stars 23 forks source link

Reload at fixed time intervals #10

Open reasonlogic opened 7 years ago

reasonlogic commented 7 years ago

Mohammed, a neat little extension. Well done. I would find it even more useful if automatically reloaded every N (say 5, 10, 30, 60, 300) minutes, rather than needing to manually click the button.

mohamedmansour commented 7 years ago

@reasonlogic what would be a good UI to introduce this?

reasonlogic commented 7 years ago

Mohamed

The kind of interface I've used before is to right click on the button, and this gives a number of standard intervals (eg 1 min, 2 mins, 5 mins, 10 mins, 30 mins, 1 hr, 6 hrs, 1 day) with radio buttons to select the interval you want. I'm happy with the same interval for all tabs, but I have seen it implekmented in a different browser where you are able to select a different interval for each tab.

Ian

On Sat, 28 Jan 2017, at 20:24, Mohamed Mansour wrote:

@reasonlogic[1] what would be a good UI to introduce this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub[2], or mute the thread[3].

Links:

  1. https://github.com/reasonlogic
  2. https://github.com/mohamedmansour/reload-all-tabs-extension/issues/10#issuecomment-275872308
  3. https://github.com/notifications/unsubscribe-auth/AX6wKg5TIpUCZCDsojR8CeZ6TbSaarU4ks5rW6QNgaJpZM4Lhtw6
bondjw07 commented 5 years ago

+1 for this. Looks like you have the only extension out there that reloads all tabs, all I need now is for it to work on a schedule! Would love to see that implemented.

mohamedmansour commented 5 years ago

Let me ask the designer who is working with me to figure out the best UX for this @erensong if you have ideas let us know

mohamedmansour commented 5 years ago

@bondjw07 two thought processes:

we could introduce a pop up, when you click on it, it opens a detailed view letting the user figure out what to do with reloading. It could have an optional option to specify the reloading interval. You click on it again, you can cancel that schedule.

I think that would be ideal and be friendly to many scenarios!

@erensong can you help with designing this?

I am in a middle of reimplementing many extensions so it would be better :) with webpack and such.

I can invest more time in 10 days, currently on vacation with no PC

mohamedmansour commented 5 years ago

Closing #20 in favor of this design

leao-nardo commented 3 years ago

@reasonlogic what would be a good UI to introduce this?

the simpler way i see to do this is : to put this option in the right click menu as like "auto-reload tab in set interval" then when clicked a poup-up or alert open and the user type the interval he wants in minutes

mohamedmansour commented 3 years ago

@reasonlogic what would be a good UI to introduce this?

the simpler way i see to do this is : to put this option in the right click menu as like "auto-reload tab in set interval" then when clicked a poup-up or alert open and the user type the interval he wants in minutes

I made this extension more secure by removing as much permissions as I can, to be minimal. For example, adding a popup inline in the webpage is not allowed anymore otherwise I have to expand permissions to "read browsing data".

I think a better approach might be creating a UI for the extension popup, right now it is a default action, I think I can make a small hack to enable this so that if the user wants to enable "interval" updates, I can make it work. This will be a bit tricky since tabs need to be tracked in case user deletes that tab, but it is easy.

leao-nardo commented 3 years ago

i don't see the need for UI or poup-ups . just an alert can be enough. the user click "set interval" entry in the menu > then alert open > user type the interval ex.: 5 ,10 ,60 and enter > done

mohamedmansour commented 3 years ago

@leao-nardo an alert is not possible cause I didn't give that permission to this extension cause it means the extension can read history.

@sniemetz did a PR #38 which added context menus with custom intervals to refresh. I have updated the extension to Manifest V3 since Google requires all extension developers to do that. If you fetch the new code you will see it changed a bit. Basically extensions should now be event driven via service worker due to new performance tweaks Chromium is doing. We can no longer use setInterval or setTimeout because the background script / service worker can die. So to make this work we need to leverage chrome.alarms API

When creating fixed intervals, I want to implement it with the right user experience. If a user wants to do fixed intervals, it would be nice to:

  1. See which tabs are currently reloading at some interval, and turn it off
  2. Set any time the user wants, even dynamic time (to bypass user behavior when websites block you due to botting)

We could solve the first one by modifying the context menu to have "currently run intevals" but that becomes messy because a context menu should only show what is relevant for that webpage not all webpages. For the second one, we could let the user define the time they want to refresh the page and then it will construct the menu dynamically that way, but that is tedious as well.

What I believe the right solution would be (would love to get your insights on this)

  1. Add a single entry to the context menu to "Refresh at a Fixed Interval"
  2. When the user clicks it, it will open a popup, or activate the existing popup if it exists. This popup will be the fixed time interval manager. 3.That manager popup will manage all running intervals, such as stopping them, looking at how many times it was reloaded, and perhaps in the future, we can allow users to get notified when a specific section has changed.
  3. When that manager popup is closed, all intervals are stopped.
leao-nardo commented 3 years ago

that solution seems very good ,also more time comsuming as u say. maybe divide in baby steps would be good in the implementation like first doing the 1 Add a single entry to the context menu to "Refresh at a Fixed Interval" and put the interval in 5min like .,

then make the time editable ,>then make the poup-ups then maybe adding those logs like how many times it was reloaded then the get notified when change .

and about the permissions i think your project being with open source code and small it become less of a problem because the person can see and revise themselves . and you can also divide making a lightweight version and a complete version with more permissons.

mohamedmansour commented 3 years ago

@sniemetz I say the minimum refresh we support is 1 minute, via chrome.alarms API. On top of that, we should not fire more than one alarm every minute. That is unfortunately the limitation we have to live by.

I have added chrome.alarms to my other extension https://github.com/mohamedmansour/prayer-times-extension/commit/dee9bbe173916aed1ba20e850b386935cfc9a018 and it works great as long as you schedule them in the future. I say we should not allow any alarm under 1 minute and we should only allow the minutes unit of measurement.

I believe Chrome throttles alarms too if you have to alarms in the same extension being fired, so we should be smarter. When registering an alarm on two websites, the data structure of setting it up should be an array, so "every minute, refresh these N sites" instead of firing N alarms, one for each site.

mohamedmansour commented 3 years ago

Another thing, after implementing this, the codebase will be double the size :) Which is not necessary bad, but we need to do some refactor. Hopefully soon, we can work on this: #42 so that we will have a better foundation and nicer codebase to work with.

sniemetz commented 3 years ago

Yep - I follow and was thinking in same direction. I like your take on the data structure. What we lose is the animated icon and badge as countdown but oh well.

Needless to say that requires a complete redo of my approach :p

On Thu, May 13, 2021 at 1:04 AM Mohamed Mansour @.***> wrote:

@sniemetz https://github.com/sniemetz I say the minimum refresh we support is 1 minute, via chrome.alarms API. On top of that, we should not fire more than one alarm every minute. That is unfortunately the limitation we have to live by.

I have added chrome.alarms to my other extension @.*** https://github.com/mohamedmansour/prayer-times-extension/commit/dee9bbe173916aed1ba20e850b386935cfc9a018 and it works great as long as you schedule them in the future. I say we should not allow any alarm under 1 minute and we should only allow the minutes unit of measurement.

I believe Chrome throttles alarms too if you have to alarms in the same extension being fired, so we should be smarter. When registering an alarm on two websites, the data structure of setting it up should be an array, so "every minute, refresh these N sites" instead of firing N alarms, one for each site.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mohamedmansour/reload-all-tabs-extension/issues/10#issuecomment-840393651, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEU3PDPAKZQ7NTIKWMMYN3TNOBY3ANCNFSM4C4G3Q5A .

--

Sven Niemetz cell 415 407 2133 http://www.linkedin.com/in/sniemetz efax 435 603-2133

sniemetz commented 3 years ago

I like it :) And honestly - this will be interesting for me to get acquainted with. The last "real" web dev i did was PHP, CSS2 and jQuery-level JS.

I need to spend some time thinking through the new v3 approach, so won't have any PRs anytime soon. Did you want to first refactor v5.0.0 before i add the timed reloads?

On Thu, May 13, 2021 at 1:12 AM Mohamed Mansour @.***> wrote:

Another thing, after implementing this, the codebase will be double the size :) Which is not necessary bad, but we need to do some refactor. Hopefully soon, we can work on this: #42 https://github.com/mohamedmansour/reload-all-tabs-extension/issues/42 so that we will have a better foundation and nicer codebase to work with.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mohamedmansour/reload-all-tabs-extension/issues/10#issuecomment-840398094, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEU3PGNZXT7CSVXVJ2GU4LTNOCWXANCNFSM4C4G3Q5A .

--

Sven Niemetz cell 415 407 2133 http://www.linkedin.com/in/sniemetz efax 435 603-2133