User:JAAqqO/EnhancedSearchPage

EnhancedSearchPage
A screenshot of a page with EnhancedSearchPage installed
DescriptionAdds features to Special:Search
Author(s)JAAqqO
StatusStable
First released29 October 2021; 3 years ago (2021-10-29)
Updated12 April 2024; 7 months ago (2024-04-12)
BrowsersFirefox, Chrome
SkinsDefault 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. If you don't have script-installer installed yet:

  1. In your preferences, go to Preferences → Gadgets.
  2. At the bottom of the "Advanced" section, click the "Install scripts without having to manually edit JavaScript files (documentation)" checkbox, then click the "Save" button.
  3. Then, on this page, click the blue "Install" button in the infobox to the right (refresh this page if you can't see the button).
  4. And now the script should work: test it.


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".

And now the script should work: test it.


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
These plain text results are compatible with useful tools like AutoWikiBrowser (AWB) and PetScan. For example, you can paste them to:
  • In AWB, right click the empty page list in the bottom left corner and choose "Paste".
  • In PetScan, paste the results to the "Manual list" field in the "Other sources" tab (pre-filled search).
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
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