User:JAAqqO/EnhancedSearchPage

From Wikipedia, the free encyclopedia
EnhancedSearchPage
A screenshot of a page with EnhancedSearchPage installed
DescriptionAdds features to Special:Search
Author(s)JAAqqO
StatusStable
First released29 October 2021; 2 years ago (2021-10-29)
Updated12 April 2024; 0 days ago (2024-04-12)
Browser supportFirefox, Chrome
Skin supportDefault skin (Vector 2022), Vector
SourceUser:JAAqqO/EnhancedSearchPage.js

EnhancedSearchPage (source) is a script that adds useful features to the search page Special:Search. Most importantly, it adds buttons to copy the search results to the clipboard.

Installation[edit]

You can use script-installer to install this script.

Alternatively, you can also just add the following line:

{{subst:Install user script|User:JAAqqO/EnhancedSearchPage.js}}

to Special:MyPage/common.js

If the "The document contains errors. Are you sure you want to publish?" warning appears when trying to save the page, just click "OK".


It is possible to install this script in other wikis too. Also, it's possible to use it without having to be logged in. See this section for instructions.

What it does[edit]

1.  Adds "Show 5000 results" into the two "Show x results" menus
2.  Adds a shortened results list and four copy buttons to quickly copy the results to the clipboard (either plain text, wikitext or PetScan links):
2.1.  "Copy plain text" results in:
Article
Article 2
Article 3
2.2.  "Copy wikitext" results in:
* [[Article]]
* [[Article 2]]
* [[Article 3]]
2.3.  "Copy PetScan (1st)" uses the results shown on the current search page and results in:
https://petscan.wmflabs.org/?active_tab=tab_other_sources&manual_list=Article%0AArticle%202%0AArticle%203&manual_list_wiki=enwiki&project=wikipedia&language=en&doit=
I.e. https://petscan.wmflabs.org/?active_tab=tab_other_sources&manual_list=Article%0AArticle%202%0AArticle%203&manual_list_wiki=enwiki&project=wikipedia&language=en&doit=
2.4.  "Copy PetScan (2nd)" uses the search query and results in:
https://petscan.wmflabs.org/?active_tab=tab_other_sources&ns%5B0%5D=1&search_query=Article&search_wiki=enwiki&search_max_results=10000&project=wikipedia&language=en&doit=
I.e. https://petscan.wmflabs.org/?active_tab=tab_other_sources&ns%5B0%5D=1&search_query=Article&search_wiki=enwiki&search_max_results=10000&project=wikipedia&language=en&doit=
3.  Adds buttons to quickly scroll up and down
4.  Adds "x results shown on the page" next to the results info
5.  Adds (or brings back?) the red color and slightly bigger font for the "No results found for/Did you mean" notification

Gallery[edit]

Contribute[edit]

Leave bug reports or feature suggestions on the talk page.

Further installation options[edit]

Other wikis[edit]

Install this script in other wikis by adding the following line:

importScript( 'en:User:JAAqqO/EnhancedSearchPage.js' ); // Backlink: [[:en:User:JAAqqO/EnhancedSearchPage.js]]

to your common.js page in that wiki, i.e. change the XY in the following URL to correspond your wiki:

https://XY.wikipedia.org/wiki/Special:MyPage/common.js

Note that the script might not work perfectly in other wikis since this script is tested only on en-wiki and fi-wiki.

Logged out[edit]

You don't have to be logged in to use this script: First install the browser extension Tampermonkey, then click the extension's "Create a new script", and then add this code to that new script page:

// ==UserScript==
// @name         EnhancedSearchPage.js
// @namespace    https://en.wikipedia.org/w/index.php?title=User:JAAqqO/EnhancedSearchPage.js
// @match        https://en.wikipedia.org/w/*
// ==/UserScript==

mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:JAAqqO/EnhancedSearchPage.js&action=raw&ctype=text/javascript' );

After you save the script page, the script should work.

Note that you can alter the following line:

// @match        https://en.wikipedia.org/w/*

to use the script in other wikis too, e.g.

// @match        https://en.wikipedia.org/w/*
// @match        https://fi.wikipedia.org/w/*

Note that the script might not work perfectly in other wikis since this script is tested only on en-wiki and fi-wiki.

See also[edit]