Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request //@ Mobile #2174

Open
cyber-sec0 opened this issue Sep 17, 2024 · 8 comments
Open

Feature Request //@ Mobile #2174

cyber-sec0 opened this issue Sep 17, 2024 · 8 comments

Comments

@cyber-sec0
Copy link

cyber-sec0 commented Sep 17, 2024

Expected Behavior

// @ Mobile true (or enabled)
This should define if a script can run on mobile/desktop or not. When // @ Mobile is false/disabled then only allow the script to run on desktop
(similar to #2102 )

Actual Behavior

This doesn't exist

Specifications

  • Edge: Latest
  • TM: Latest
  • OS: W11

Now with Kiwi browser and many other mobile browsers adding support to tampermonkey, it's time to consider having a way to let script devs set if the script is mobile or not.

Issue = I've Edge/Win11 and Kiwi Browser/Android, I often have to export my Edge scripts to my phone, so I can have the same data and scripts on both.
The issue is that many scripts others/I made to TM were made only for desktop websites, like they only work if the user holds CTRL/SHIFT or hovers/selects/middle-clicks on something, so on mobile, these scripts are impossible to use, and I have to take a long time disabling them and enabling mobile only scripts (like scripts to disable YT autopause, that I keep disabled on desktop), or even though they don't work on mobile websites, they do crash many mobile websites, causing big issues.
It's hard to manually do that for over 200 scripts...

@derjanb
Copy link
Member

derjanb commented Sep 18, 2024

These scripts work when you enable "Desktop view" in your mobile browsers. So unconditionally not let them run might also be wrong.

@cyber-sec0
Copy link
Author

cyber-sec0 commented Sep 18, 2024

I barely ever enable "Desktop view" in my mobile browser.
As a script developer, I really want to have this option.
Even if a script works on "Desktop view", I only enable this mode to see hidden parts of the site, that can't be seen/used on mobile, never because I want to use a "Desktop" script...

I actually really would like to disable desktop scripts while on "Desktop view", because I don't use any external mouse/keyboards with my android phone, so even though these desktop scripts may work, I don't have a CTRL/SHIFT etc keys anyway.

I would like to keep my desktop only apps, disabled on mobile, even if desktop view is enabled.

"unconditionally not let them run might also be wrong." I agree, but if a dev that made a script clearly wants it disabled at all times (like me), then not even giving this option to devs is wrong as well.

I think that most devs would understand how this feature works, so they wouldn't mistakenly disable scripts on mobile, then want to use them with the "desktop view", but we could add a 3rd option as well:
1 totally disable on mobile
2 fully enable on mobile
3 enable on mobile only on "desktop view" mode

@7nik
Copy link

7nik commented Sep 18, 2024

The definition of mobile compatibility is really fuzzy: it is not only about using keyboard/mouse/touch events (by the way, you can connect the mouse and keyboard to a smartphone) but also about compatibility with a site's mobile layout (if it has one) and not crashing due to a lack of some Web API (mobile browsers tend to lack various features, though mostly uncommon ones).

You can do something like this to avoid running userscripts:

if (window.navigator.platform.startsWith("Android")) return;

though the userscript will still be loaded onto the site.

Another solution is to

  1. mark all the scripts you want to keep enabled/disabled, e.g. set @namespace mobile,
  2. in the TM Dashboard enable filtering (click the filter icon in the header of the first column)
  3. select everything and disable
  4. filter by @namespace is mobile
  5. select all the filtered scripts and enable

Or you can mark them as pc-only and then select scripts only once.

@derjanb
Copy link
Member

derjanb commented Sep 19, 2024

As a script developer, I really want to have this option.

I'm not opposed to it. I'm just thinking about how it could work to give as much benefit as possible to the users.

The definition of mobile compatibility is really fuzzy

What I found so far: https://stackoverflow.com/a/76012165/1896125

Another solution is to [...]

Tampermonkey now has @tag support. Script authors could also flag their script with a mobile tag to show that it is compatible to mobile web pages.

@cyber-sec0
Copy link
Author

@7nik

It's not fuzzy, mobile browsers show IOS/Android, so that is an easy catch.

I know that someone can connect these devices to a smartphone, but barely anyone actually knows/does it.

Yes, I know that I can use that code to do it myself, but TM should be more trustworthy, since it's an extension, while JS by itself lacks the power and access permissions that an extension has.
My main point is that I don't even want to see it loaded, I want it totally hidden from the user view in that case as if the script didn't even exist, because as I dev, that is what I want for some of my scripts. So coding it in JS and having it loaded, would still be an issue.

I've 200+ scripts, and most sites show that 20+ different scripts loaded, so when a site has an issue, it's hard to disable 20+ scripts just to figure out which one caused the problem, excluding the fact that I've another let's say 10 disabled, so I've to keep track of which 20 were enabled and which 10 were disabled originally.

Your other solution is still hard to do because mobile browsers suck to be used and have me/users click on extremely small buttons to set up things...

@derjanb

Alright, I'm glad that you are not opposed to it.

I know about the new tag support, but that is totally not what I want and what I'm talking about...

@cyber-sec0
Copy link
Author

cyber-sec0 commented Nov 9, 2024

@derjanb

Regarding your tag suggestion, I was about to implement it, but then I saw that "add tags to your script which will be visible in the script list if this tag is part of your system's tag list" which defeats the whole purpose of tags.

Most user script users are already very scared of installing an extension, and even more about installing a user script, above that would be reading a "documentation" in the script installation page begging users to add a tag to their TM extension settings.

I would like to understand the reason behind this requirement... I can't see @tag being helpful or useful at all for users with that requirement, it would make it helpful only for devs.

Another issue is that @tag isn't @tags.
I've tried to use
@tag, Desktop, GitHub and it doesn't work... I really would like to be able to add @tags or at least multiple comma-separated tags... instead of needing multiple lines to achieve that
// @tag games
// @tag news

Most of my scripts are a bit old but they're still working perfectly... Updating the script just to add 1 single tag seems pointless to me.
If @tag was created with the purpose of keeping the dashboard more organized, the inability to fold tags as if they were folders defeats that purpose because tags look cool and organized with their colors, but it is still only more text added to the dashboard.

@derjanb
Copy link
Member

derjanb commented Nov 9, 2024

I think you misunderstood the feature.

The intended @tag workflow might look like this:

  1. You installed scripts:

image

  1. You want to categorize them, so you add tags to your Tampermonkey

image

  1. You assign them to your scripts

image

or

image

  1. Now you can filter the scripts by clicking at a tag:

image

  1. Bonus: you can enable/disable a tags list at the action menu:

image

Updating the script just to add 1 single tag seems pointless to me.

You don't have to. Just mass-assign tags according to you needs.

if this tag is part of your system's tag list" which defeats the whole purpose of tags

@tag might be used by userscript developers to add a "realm", a suggestion.
But the system tag list makes it ultimately your choice which ones are shown by Tampermonkey.

the inability to fold tags as if they were folders defeats that purpose

As mentioned above: you can filter by tags by simply clicking at it.

I was about to implement it,

So no need to implement something, just configure your Tampermonkey dashboard according to your needs.

@cyber-sec0
Copy link
Author

@derjanb

Thank you, this is much cooler than I thought then!

I'm glad that this built-in feature doesn't just add the tag code in the script code, so it doesn't affect the "Check for updates" setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants