machsix / Super-preloader

Userscript to enable autopagerizing as well as preloading
https://machsix.github.io/Super-preloader/Super_preloaderPlus_one_New.user.js
GNU General Public License v3.0
575 stars 83 forks source link

Use an "opt-in" model for the script #428

Closed alexolog closed 3 years ago

alexolog commented 3 years ago

I only use the script for autopaging (not preloading) but it would automatically use the preloading functionality if a URLmatches one of the built-in rules.

The problem is that the preloading can break the functionality of important sites, such as financial institutions, government services, etc. I have encountered issues with online banking, tax preparation and submitting, etc.

An old Autopager eddon that I used to use before the WebExtensions switch would pop up a dialog when navigating to new sites saying that a rule was found that matches the site and ask me if I wanted to enable autopaging on that site (it was also possible to change the decision later)

It would be great if this script could likewise have an "opt in" mode in which sites will not be processed at all unless explicitly told to use either preloading or autopaging (as appropriate)

machsix commented 3 years ago
Capture

Configure it as the above should work. I can also add an option to disable rules in this file https://github.com/machsix/Super-preloader/blob/master/src/rules/jsGeneralRule.js . But I'm too lazy to do it now.

Capture

In addition, you can always disable a rule for a website.

I don't like the idea of a popup dialog to confirm whether you want to enable the rule for a website (whitelist mode). First, popup dialog itself is annoying. Second, it's hard to handle the storage of user configurations for whitelists. If you store that with GM_setValue api, it can be unpredictable when you reinstall the script (trust me, I have been though this when I refactored the script. https://greasyfork.org/en/scripts/33522-super-preloaderplus-one-new/discussions/33898 Many people completely failed to use the script due to script manager's handling). If you store in localStorage, someone who are very serious about privacy and clean cookie/localstorage frequently can run into trouble.

LurkerHub commented 3 years ago

Is the "enable" checkbox per domain?

machsix commented 3 years ago

It's per origin. Check https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage for detail

LurkerHub commented 3 years ago

Thanks.

LurkerHub commented 3 years ago

I don't like the idea of a popup dialog to confirm whether you want to enable the rule for a website (whitelist mode). First, popup dialog itself is annoying. Second, it's hard to handle the storage of user configurations for whitelists. If you store that with GM_setValue api, it can be unpredictable when you reinstall the script (trust me, I have been though this when I refactored the script. https://greasyfork.org/en/scripts/33522-super-preloaderplus-one-new/discussions/33898 Many people completely failed to use the script due to script manager's handling). If you store in localStorage, someone who are very serious about privacy and clean cookie/localstorage frequently can run into trouble.

Where do you store the enabled/disabled status of different origins then?

machsix commented 3 years ago

If you made any modifications through the float window and save it, a variable named spfwset is saved in the localStorage

You can use JSON.parse(localStorage.getItem('spfwset')) to view it. Key enable determines whether the rule is enabled or not. a_enable determines whether Autopager mode is enabled

LurkerHub commented 3 years ago

Evaluating JSON.parse(localStorage.getItem('spfwset')) in the console returns null I definitely disabled the script on some sites. What am I missing?

LurkerHub commented 3 years ago
Capture

Configure it as the above should work.

When I configure it as the above and go to, for example, https://www.simplemachines.org/community/index.php?board=1.0, I see no way to enable it for that origin since the floating window disappears.

It would be better to leave the floating window (but color it black) to allow whitelisting.

heroboy commented 3 years ago

I can also add an option to disable rules in this file https://github.com/machsix/Super-preloader/blob/master/src/rules/jsGeneralRule.js . But I'm too lazy to do it now.

The "disable builtin rules" may do this. It disables both siterules and generalrules.

And "disable rule subscription" disabled the rules that are from a downloaded json file.

LurkerHub commented 3 years ago

The problem with the disable options is that they seem to prevent the floating window from appearing, which does not allow an easy "opt in" for a site.

This is an important part -- we need to be able to enable a rule on a site in the "default off" mode as easily as we can disable it in the current "default on" mode.

machsix commented 3 years ago

Close the issue since I have no interest for whitelist mode in the script at all.

If you need the function, you can edit the website where the script is enabled in the meta data part of the script.