From 6b474eaf8a06e23ebbccd06ef1586167ba89575f Mon Sep 17 00:00:00 2001 From: shinigami-eyes <43276258+shinigami-eyes@users.noreply.github.com> Date: Sun, 14 Mar 2021 14:22:07 +0000 Subject: [PATCH] Support for wiki redlinks --- extension/content.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/content.ts b/extension/content.ts index 19413f2..c937408 100644 --- a/extension/content.ts +++ b/extension/content.ts @@ -520,7 +520,7 @@ function getIdentifierFromURLImpl(url: URL): string { return 'disqus.com' + getPartialPath(url.pathname, 2); } else if (domainIs(host, 'medium.com')) { const hostParts = host.split('.'); - if (hostParts.length == 3 && hostParts[0] != 'www') { + if (hostParts.length == 3 && hostParts[0] != 'www') { return host; } return 'medium.com' + getPartialPath(url.pathname.replace('/t/', '/'), 1); @@ -536,6 +536,12 @@ function getIdentifierFromURLImpl(url: URL): string { } else if (domainIs(host, 'wikipedia.org') || domainIs(host, 'rationalwiki.org')) { const pathname = url.pathname; if (url.hash) return null; + if (pathname == '/w/index.php' && searchParams.get('action') == 'edit') { + const title = searchParams.get('title'); + if (title && title.startsWith('User:')) { + return 'wikipedia.org/wiki/' + title; + } + } if (pathname.startsWith('/wiki/Special:Contributions/') && url.href == window.location.href) return 'wikipedia.org/wiki/User:' + pathArray[3]; if (pathname.startsWith('/wiki/User:'))