Jump to content

User:Guarapiranga/search-shortcuts

From Wikipedia, the free encyclopedia
search-shortcuts
DescriptionAdds configurable shortcuts to the search bar to namespaces that don't have namespace aliases, and to subpages that don't have shortcuts of pages that do
Author(s)Guarapiranga
UpdatedJune 3, 2022; 2 years ago (2022-06-03)
SourceGuarapiranga/search-shortcuts.js

Adds configurable shortcuts to the search bar:

  • To namespaces that don't have namespace aliases such as WP: and WT: (e.g. Template, Category, User, Help, etc);
  • To subpages that don't have shortcuts of pages that do (e.g. Wikipedia:Village pump (technical)/Archive 197 can be accessed simply typing WP:VPT/Archive 187);
  • To modules and templates by simply pasting {{#invoke:module (|…)}} for Module:module and {{template (|…)}} for Template:template

The shortcuts are immediately substituted as soon as a colon (:) or a slash (/) is typed in, and need to be declared wherever the script is imported (typically common.js or skin.js) in this fashion:

var expansions = {
	"wp:afd": "WP:Articles for deletion",
	"wp:tfd": "WP:Templates for discussion/Log",
	"wp:cfd": "WP:Categories for discussion/Log",
	"wp:rfd": "WP:Redirects for discussion/Log",
	"wp:ffd": "WP:Files for discussion/Log",
	"wp:mfd": "WP:Miscellany for deletion",
	"wp:drv": "WP:Deletion review",
	"wp:mrv": "WP:Move review",
	"wp:pr" : "WP:Peer review",
	"wp:gar": "WP:Good article reassessment",
	"wp:fac": "WP:Featured article candidates",
	"wp:rfa": "WP:Requests for adminship",
	"wp:rfb": "WP:Requests for bureaucratship",
	"wp:rfc": "WP:Requests for comment",
	"wp:brfa": "WP:Bots/Requests for approval",
	"template:dykn": "Template:Did you know nominations",

	// namespaces
	"t": "Template",
	"c": "Category",
	"u": "User",
	"h": "Help"
    };

Credit

[edit]

This script was forked from SD0001, who in turn forked it from Enterprisey (Enterprisey's script only handles shortcuts to subpages; SD0001's script added shortcuts to namespaces, but didn't allow its users to set their own shorcuts).