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

I want this on Google image search, but not any other part of Google #594

Open
FailSafeNow opened this issue May 25, 2024 · 2 comments
Open
Labels
Pagetual 東方永頁機 issue

Comments

@FailSafeNow
Copy link

Here is an example URL:
https://www.google.com/search?q=image&udm=2

There is a very big problem. I only want to enable this for Google image search. I don't want to enable it for regular Google searches or any other kind of Google searches. Just image searches, and nothing else. And I can't do that. I can enable the script for all of Google, or disable it for all of Google, but restricting the script to only certain URLs can't be done.

I tried this:
[{
"name": "Google Search",
"nextLink": [
"id('pnnext')|id('navbar navcnt nav')//td[span]/following-sibling::td[1]/a|id('nn')/parent::a",
"id('pnprev')|id('navbar navcnt nav')//td[span]/following-sibling::td[1]/a|id('nn')/parent::a"
],
"pageElement": "id('rso')|id('center_col')/style[contains(.,'relative')][id('rso')]|id('search')/div/div/style[1]",
"action": 1,
"pageNum": "&start={10*($p-1)}",
"pageBarTop": 55,
"url": "^https?://[^./]+\.google(?:\.[^./]{2,3}){1,2}/(?:c(?:se|ustom)|search|webhp|m|#)(?:\?.\budm=2\b.)?$",
"replaceElement": "[role='navigation']>[role='presentation']",
"css": "ol>li{display: inline-flex;}"
}]

And then I tried this:

[
{
"name": "Google Search",
"nextLink": [
"id('pnnext')|id('navbar navcnt nav')//td[span]/following-sibling::td[1]/a|id('nn')/parent::a",
"id('pnprev')|id('navbar navcnt nav')//td[span]/following-sibling::td[1]/a|id('nn')/parent::a"
],
"pageElement": "id('rso')|id('center_col')/style[contains(.,'relative')][id('rso')]|id('search')/div/div/style[1]",
"action": 1,
"pageNum": "&start={10*($p-1)}",
"pageBarTop": 55,
"url": "^https?://[^./]+\.google(?:\.[^./]{2,3}){1,2}/(?:c(?:se|ustom)|search|webhp|m|#)(?:\?.\budm=2(?:&|$).)?$",
"replaceElement": "[role='navigation']>[role='presentation']",
"css": "ol>li{display: inline-flex;}"
}
]

The process for making rules is impossibly complex. I should be able to simply set rules that say "Work on this URL"/"Don't work on this URL". The advertising on GreasyFork that says "You can also configure your own rules for any site on config page easily." is false. It isn't easy. It's impossible. And if I spend another second on the rules page, I'll have a stroke. This is one of the most frustrating processes I've ever encountered.

@skofkyo
Copy link
Contributor

skofkyo commented May 25, 2024

RegExp for JSON string

\ to \\
\? to \\?

@hoothin
Copy link
Owner

hoothin commented May 26, 2024

To ensure performance, the url will be truncated to the first 500 characters for comparison. As a result, 'udm=2' will be discarded.
So don't use url to limit it, use include and exclude instead. For example:

{
    "name": "Google disable",
    "url":  "^https://(?:www\\.)?google\\..*/search",
    "exclude": "[data-id=mosaic]",
    "enable": 0
}

It means that all sites without an element with the attribute "[data-id=mosaic]" inside will be disabled.

@hoothin hoothin added the Pagetual 東方永頁機 issue label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pagetual 東方永頁機 issue
Projects
None yet
Development

No branches or pull requests

3 participants