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

Include example in README for Wikipedia Vector 2022 #336

Open
seanpm2001 opened this issue Jan 19, 2023 · 21 comments
Open

Include example in README for Wikipedia Vector 2022 #336

seanpm2001 opened this issue Jan 19, 2023 · 21 comments

Comments

@seanpm2001
Copy link

I began to try out this extension today after the Wikipedia Vector 2022 update, as I don't want to have to add ?useskin=vector or ?useskin=monobook every time I visit a page. Can we have an example in the README? There are so many examples already listed, I feel this one is important and should be listed as well.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

Regex pattern: (https?://\w+.wikipedia.org/wiki/.*)
Redirect to: $1?useskin=vector
Exclude: https?://\w+.wikipedia.org/wiki/.*?\?useskin=.*

@seanpm2001
Copy link
Author

It isn't working. I tried 3 different ways:
Screenshot from 2023-01-19 14-24-33
It still redirects to the new design.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

Because you didn't copy exactly what I wrote
image

EDIT: actually strictly speaking it should be:

Include pattern: (https?://\w+\.wikipedia\.org/wiki/.*)
Exclude pattern: https?://\w+\.wikipedia\.org/wiki/.*?\?useskin=.*

EDIT: simpler one with just wildcard match:

Include pattern: http*://*.wikipedia.org/wiki/*
Redirect to: http$1://$2.wikipedia.org/wiki/$3?useskin=timeless
Exclude pattern: http*://*.wikipedia.org/wiki/*?useskin=*

@seanpm2001
Copy link
Author

seanpm2001 commented Jan 19, 2023

Thank you for the help. This worked.

EDIT:

Note Refreshing the page will add an additional pattern to the end, causing it to revert to the new theme again.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

I can't get that to happen for me. Did you make sure to add the exclude pattern as well?

Also I forgot there are other forms for article urls, like https://en.wikipedia.org/w/index.php?title=Cat, this wildcard pattern will do:

Include: http*://*.wikipedia.org/w/index.php?title=*
Redirect: http$1://$2.wikipedia.org/wiki/$3?useskin=timeless

@seanpm2001
Copy link
Author

seanpm2001 commented Jan 19, 2023

I don't have much more info. I did apply the exclude pattern. Basically, when I refresh the page, the link goes from:

https://en.wikipedia.org/wiki/Main_Page?useskin=monobook

to:

https://en.wikipedia.org/wiki/Main_Page?useskin=monobook?useskin=monobook

Which causes the theme to break. Additionally, this filter doesn't apply to viewing/editing the source for an article, but it works with talk pages.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

That does not happen for me. I am using the wildcard filter:

image

On another note, I just noticed it doesn't work if you have a URL with a chapter suffix like https://en.wikipedia.org/wiki/Cat#Taxonomy, apparently the skin part has to be between the article name and the chapter .. sigh. more complicated than I thought

@seanpm2001
Copy link
Author

I am also using the wildcard type. I couldn't get the regex option to work.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

I don't know what the problem is then.

For the section title URLs, this wildcard works for me:

Include: http*://*.wikipedia.org/wiki/*#*
Redirect: http$1://$2.wikipedia.org/wiki/$3?useskin=timeless#$4
Exclude: http*://*.wikipedia.org/*?useskin=*

It needs to be placed before the other rule in the list.

@ckp95
Copy link

ckp95 commented Jan 19, 2023

Can you send a screenshot of the exact filter you are using @seanpm2001

@seanpm2001
Copy link
Author

If this helps, here is my JSON configuration file.
GitHub isn't letting me import it, so here is the source:

{
    "createdBy": "Redirector v3.5.3",
    "createdAt": "2023-01-19T23:53:57.174Z",
    "redirects": [
        {
            "description": "Anti-Google",
            "exampleUrl": "https://google.com",
            "exampleResult": "https://duckduckgo.com",
            "error": null,
            "includePattern": "https://google.com",
            "excludePattern": "",
            "patternDesc": "In case you ever make the mistake",
            "redirectUrl": "https://duckduckgo.com",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": false,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "De-mobilize Wikipedia links",
            "exampleUrl": "https://en.m.wikipedia.org/",
            "exampleResult": "https://en.wikipedia.org",
            "error": null,
            "includePattern": "https://en.m.wikipedia.org/",
            "excludePattern": "",
            "patternDesc": "Wikipedia De-Mobilizer",
            "redirectUrl": "https://en.wikipedia.org",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia fix 2023 (2)",
            "exampleUrl": "https://en\\.wikipedia\\.org/([^?]*)$",
            "exampleResult": "https://en.wikipedia.org/*?useskin=vector",
            "error": null,
            "includePattern": "https://en\\.wikipedia\\.org/([^?]*)$",
            "excludePattern": "",
            "patternDesc": "",
            "redirectUrl": "https://en.wikipedia.org/$1?useskin=vector",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia redirect test 2",
            "exampleUrl": "https://en.wikipedia.org/wiki/",
            "exampleResult": "?useskin=monobook",
            "error": null,
            "includePattern": "https://en.wikipedia.org/wiki/",
            "excludePattern": "",
            "patternDesc": "",
            "redirectUrl": "?useskin=monobook",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "https://https://en.wikipedia.org/wiki/",
            "exampleUrl": "https://en.wikipedia.org/wiki/",
            "exampleResult": "https://en.wikipedia.org/wiki/?useskin=monobook",
            "error": null,
            "includePattern": "https://en.wikipedia.org/wiki/",
            "excludePattern": "",
            "patternDesc": "Wikipedia fix ",
            "redirectUrl": "https://en.wikipedia.org/wiki/?useskin=monobook",
            "patternType": "R",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia fix 2023",
            "exampleUrl": "^https://en\\.wikipedia\\.org/([^?]*)$",
            "exampleResult": "https://en.wikipedia.org/*?useskin=vector",
            "error": null,
            "includePattern": "^https://en\\.wikipedia\\.org/([^?]*)$",
            "excludePattern": "",
            "patternDesc": "",
            "redirectUrl": "https://en.wikipedia.org/$1?useskin=vector",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia vector 2022 fix (2023, January 19th)",
            "exampleUrl": "(https?://\\w+.en.wikipedia.org/wiki/.*)",
            "exampleResult": "(https?://\\w+.wikipedia.org/wiki/.*?useskin=monobook*)",
            "error": null,
            "includePattern": "(https?://\\w+.en.wikipedia.org/wiki/.*)",
            "excludePattern": "https?://\\w+.wikipedia.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Attempted fix from a GitHub user",
            "redirectUrl": "(https?://\\w+.wikipedia.org/wiki/.$1?useskin=monobook*)",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia vector 2022 fix (2023, January 19th) (v2)",
            "exampleUrl": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "exampleResult": "*?useskin=monobook",
            "error": null,
            "includePattern": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "excludePattern": "https?://\\w+.wikipedia.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Attempted fix from a GitHub user",
            "redirectUrl": "$1?useskin=monobook",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia vector 2022 fix (2023, January 19th) (v3)",
            "exampleUrl": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "exampleResult": "(https?://\\w+.wikipedia.org/*?useskin=monobook",
            "error": null,
            "includePattern": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "excludePattern": "https?://\\w+.wikipedia.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Attempted fix from a GitHub user",
            "redirectUrl": "(https?://\\w+.wikipedia.org/$1?useskin=monobook",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia monobook theme",
            "exampleUrl": "https://en.wikipedia.org/wiki/cat/",
            "exampleResult": "https://en.wikipedia.org/wiki/cat/?useskin=monobook",
            "error": null,
            "includePattern": "http*://*.wikipedia.org/wiki/*",
            "excludePattern": "https?://\\w+\\.wikipedia\\.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Wikipedia Monobook theme",
            "redirectUrl": "http$1://$2.wikipedia.org/wiki/$3?useskin=monobook",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": false,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia vector (old) theme",
            "exampleUrl": "https://en.wikipedia.org/wiki/cat/",
            "exampleResult": "https://en.wikipedia.org/wiki/cat/?useskin=vector",
            "error": null,
            "includePattern": "http*://*.wikipedia.org/wiki/*",
            "excludePattern": "https?://\\w+\\.wikipedia\\.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Wikipedia old vector theme",
            "redirectUrl": "http$1://$2.wikipedia.org/wiki/$3?useskin=vector",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia timeless theme",
            "exampleUrl": "https://en.wikipedia.org/wiki/cat/",
            "exampleResult": "https://en.wikipedia.org/wiki/cat/?useskin=timeless",
            "error": null,
            "includePattern": "http*://*.wikipedia.org/wiki/*",
            "excludePattern": "https?://\\w+\\.wikipedia\\.org/wiki/.*?\\?useskin=.*",
            "patternDesc": "Wikipedia timeless theme",
            "redirectUrl": "http$1://$2.wikipedia.org/wiki/$3?useskin=timeless",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        },
        {
            "description": "Wikipedia vector 2022 fix (2023, January 19th) (v3)",
            "exampleUrl": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "exampleResult": "(https?://\\w+.wikipedia.org/*?useskin=monobook",
            "error": null,
            "includePattern": "(https?://\\w+.wikipedia.org/wiki/.*)",
            "excludePattern": "(https?://\\w+.wikipedia.org/wiki/.*?\\?useskin=.*)",
            "patternDesc": "Attempted fix from a GitHub user",
            "redirectUrl": "(https?://\\w+.wikipedia.org/$1?useskin=monobook",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": true,
            "grouped": false,
            "appliesTo": [
                "main_frame"
            ]
        }
    ]
}

@ckp95
Copy link

ckp95 commented Jan 19, 2023

I'm not a developer on this project, idk what all the config stuff does.

@seanpm2001
Copy link
Author

Here is a screenshot:
Screenshot from 2023-01-19 15-58-21

@ckp95
Copy link

ckp95 commented Jan 20, 2023

your exclude is still a regex, it needs to be the wildcard one i gave

@seanpm2001
Copy link
Author

I don't know what you mean. It is a wildcard
image

@ckp95
Copy link

ckp95 commented Jan 20, 2023

look again

@seanpm2001
Copy link
Author

seanpm2001 commented Jan 20, 2023

Like this? It is still acting the same.
image
Edit: nevermind, it fixed the reload problem, but not the talk page/source code problem

@ckp95
Copy link

ckp95 commented Jan 20, 2023

i just read the article pages so it's enough for me. i don't want to spend more time fiddling with it

@seanpm2001
Copy link
Author

OK, that sounds good enough. Thank you for all of the help!

@JustAnotherArchivist
Copy link

JustAnotherArchivist commented Jan 20, 2023

Here's a more solid approach that handles fragments and other query parameters (e.g. action=history pages):

Regex pattern: ^(https?://(?:[^/]*\.)?wikipedia\.org/[^?#]*)(?:\?([^#]*))?(#.*)?$
Target: $1?$2&useskin=vector$3
Exclude: ^[^#]*[?&]useskin=

@seanpm2001
Copy link
Author

seanpm2001 commented Jan 20, 2023

Thank you. Will try it out tomorrow.
Edit: I just went through and tested it. It works flawlessly on all parts of Wikipedia. Thank you @JustAnotherArchivist
My setup:
image

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

No branches or pull requests

3 participants