This script provides a menu of enhancements to search results. See description in the user manual below.
![]() |
For all the standard skins except MinervaNeue, this script provides a menu of enhancements to search results:
* [[like this]]
, for easy copying/pasting of list itemsEach menu item is a toggle (an on/off switch), and the script remembers each switch's status across pages. If you turn a feature on (or off), it stays that way for all your searches until you click the menu item again.
The menu items appear on the side bar in the tools menu whenever you are on a search results page, which shows up after you've conducted a search.
The script also provides a (built-in) work-around for WP's "intitle:" bug, so that search results actually match the search string provided when using the "intitle:" parameter and enclosing your search term in quotes.
This script is far from finished. If you'd like to comment, or contribute ideas or advice, please post under discussions at the bottom of this page. Post bugs in the bug report section. Thank you.
To make SearchSuite work on your account, add this line to your common.js (or your skin.js) page:
importScript("User:The Transhumanist/SearchSuite.js");
Save the page and bypass your cache to make sure the changes take effect. By the way, only logged-in users can install scripts.
The script works on search results. To get a search results page, click on the magnifying glass in the search box and search for something. Or type intitle:
in the search box, followed by your search term in quotes.
When you are on a search results page, the script provides the following additional menu selections on the sidebar's tools menu:
"SR" stands for "search results". Each menu item includes a little note in parentheses indicating what clicking on it will do (either "(turn on)", or "(turn off)").
The script remembers each menu item's status between uses, and so each feature remains on or off for all of your searches until you click on its menu item again.
Turning this off strips out the extraneous details (the contents excerpt) between each entry, leaving the results displayed as one per line. This allows more results to be shown on the page at a time, and it is useful when copying/pasting to lists and outlines.
Turning it on brings the details back.
It is even more useful when used in combination with SR wikify.
Turning this off doesn't just remove the notes that say "redirect from", it removes the entire entries that include those notes. It also removes entries of items from related categories, and the results that match subheadings.
Turning it back on, adds those items back onto the list.
This feature helps narrow search results down to the topic entered.
This hides or shows the sister project results on the right side of the screen.
If you have the sister results turned off in Preferences, then this menu item has no effect.
When this feature is turned on, the search results will appear in alphabetical order. To return them to their original order, click on SR sort (turn off)
.
As I'm a list editor, this is my favorite feature. This adds or removes list item wikiformatting to the title link of each entry in the search results. This is the same formatting you would see while you are in an edit window. This makes it easy to copy and paste the search results as list items into list and outline articles.
When you have details off and wikify on, your search results will look like this:
* [[ List of English animal nouns]]
* [[ List of English terms of venery, by animal]]
* [[ List of Middle-earth animals]]
* [[ List of animal names]]
* [[ List of animal sounds]]
* [[ List of animals by common name]]
* [[ List of animals in Japan]]
* [[ List of animals that have been cloned]]
* [[ List of animals that produce silk]]
* [[ List of domesticated animals]]
* [[ List of extinct animals of India]]
* [[ List of films about animals]]
* [[ List of herbivorous animals]]
* [[ List of national animals]]
* [[ List of nocturnal animals]]
* [[ List of psychoactive plants, fungi, and animals]]
View (previous 20 | next 20) (20 | 50 | 100 | 250 | 500)
Notice that the links are still live, so that you can click on them.
Wikify is most useful when sort is turned on and the other features are turned off.
The script includes a workaround for a bug in Wikipedia's search. The buggy (or misnamed?) feature of search is the parameter intitle:. When you include that in a search, the specified string is supposed to return only titles containing that string. But WP search doesn't limit the results that way, including matches with page contents, redirects, and pages from matching categories, and also containing matches of related forms of a lone word. For example, intitle:Greece also matches "Greek".
That's a problem, if you only want titles with "Greece" in them.
TrueMatch, which is a function built-in to this script, checks the search for "intitle:" followed by a quoted string. If it finds one, it removes all results that do not match the quoted string. It makes sure the search results actually match the intitle search string you provided.
To take advantage of TrueMatch you must include "intitle:" followed by a string in quotes. Here are some examples:
Currently, TrueMatch only catches the first instance of intitle, and ignores everything else not within the quotes.
To get the largest output of search results possible for a given search string, add &limit=5000
to the url, and press ↵ Enter. (The max in MediaWiki is 5,000).
Important: the following section is still under development and is incomplete. I work on it as I find the time.
This section explains the source code, in detail. It is for JavaScript programmers, and for those who want to learn how to program in JavaScript. Hopefully, this will enable you to adapt existing source code into new user scripts with greater ease, and perhaps even compose user scripts from scratch.
You can only use so many comments in the source code before you start to choke or bury the programming itself. So, I've put short summaries in the source code, and have provided in-depth explanations here.
My intention is Threefold:
In addition to plain vanilla JavaScript code, this script relies heavily on the jQuery library.
If you have any comments or questions, feel free to post them at the bottom of this page under Discussions. Be sure to {{ ping}} me when you do.
The most challenging thing about writing this script (so far) was figuring out how to make each of the menu-item-controlled functions work on the output of the others...
For sort, that meant recording the original order as an id in each list item element, so that they could be sorted back to that order later.
For the rest of the menu-item-controlled features, hide and show were used.
It turns out that if you hide an element, and you later show some of its children, the parent element is forced out of hiding. That's what happens with the hidden redirected entries. At least, I think that's what happened. So, in the functions (SRDetails) that affect the children, I had to recheck the setting of the parent, and rehide the parent according to the setting. Not very elegant. If you have a better solution, I'm very interested in learning it.
For the details of each search result, there was this extra space below each item, that didn't respond to hide/show. That space needed to be controlled via css block and inline display attributes. That was harder to figure out than it looks, because the output on screen was routinely copy and pasted into WikEd for use on other pages, and WikEd made it seem like there was an extra newline (\n
in there by adding one in between each item, when there weren't any in the output, which led to a wild goose chase. The solution was to
DuckDuckGo the hell out of the situation until a clue was revealed by
Stack Overflow that mentioned something about list items being block elements with margin spacing rather than newlines. Then suspicion turned toward WikEd, so the script's output was then copied (from the screen via copy/paste) into Wikipedia's regular wiki editor instead where it was revealed that it was actually singlespaced, with no extra newlines in the script's output! Still, the extra spacing needed to be taken out for the list item views (to maximize how many are displayed on the screen at once), via injecting css code, but put back in along with the details, via more injected css code, so that the entries were restored back and forth to and from their original look.
More specifically, starting at the beginning of the source code...
An alias is one string defined to mean another. Another term for "alias" is "shortcut". In the script, the following aliases are used:
$
is the alias for
jQuery (the jQuery
library)
mw
is the alias for mediawiki (the mediawiki
library)
These two aliases are set up like this:
( function ( mw, $ ) {}( mediaWiki, jQuery ) );
That also happens to be a "bodyguard function", which is explained in the section below...
The bodyguard function assigns an alias for a name within the function, and reserves that alias for that purpose only. For example, if you want "t" to be interpreted only as "transhumanist".
Since the script uses jQuery, we want to defend jQuery's alias, the "$". The bodyguard function makes it so that "$" means only "jQuery" inside the function, even if it means something else outside the function. That is, it prevents other javascript libraries from overwriting the $() shortcut for jQuery within the function. It does this via scoping.
The bodyguard function is used like a wrapper, with the alias-containing source code inside it, typically, wrapping the whole rest of the script. Here's what a jQuery bodyguard function looks like:
1 ( function($) {
2 // you put the body of the script here
3 } ) ( jQuery );
See also: bodyguard function solution.
To extend that to lock in "mw" to mean "mediawiki", use the following (this is what the script uses):
1 ( function(mw, $) {
2 // you put the body of the script here
3 } ) (mediawiki, jQuery);
For the best explanation of the bodyguard function I've found so far, see: Solving "$(document).ready is not a function" and other problems (Long live Spartacus!)
The script makes much use of mw.util.addPortletLink.
In order for mw.util.addPortletLink to work, the script is dependent upon the core module mediawiki.util, which contains its programming. (View the source code at mediawiki.util.js, and for its documentation, see mw:ResourceLoader/Core modules#mediawiki.util).
Therefore, it is necessary to declare (load) the module as a dependency.
(Keep in mind that scripts will work by accident without declaring dependencies, when another user script that was loaded earlier has already declared them for itself. If your script was working, but no longer works for no apparent reason, it may be because it doesn't load its dependencies.)
Dependencies are loaded with mw.loader.
The script includes the following dependency declaration:
mw.loader.using( 'mediawiki.util'], function () {
// The rest of the script goes here
});
Let's break this down...
mw
is an alias that stands for mediaWiki
. So, mw.loader
is short for mediaWiki.loader
.
mediaWiki.loader is a part of MediaWiki, the program that runs Wikipedia.
It has a number of methods defined for it. Its
.using
method executes a function as soon as the specified dependencies are ready, in this case, mediawiki.util.
The function, "function ()", is an anonymous function.
The code to be executed by a function is placed inside curly brackets: {}
And in this case, it's the rest of the script.
The ready() event listener/handler makes the rest of the script wait until the page (and its DOM) is loaded and ready to be worked on. If the script tries to do its thing before the page is loaded, there won't be anything there for the script to work on (such as with scripts that will have nowhere to place the menu item mw.util.addPortletLink), and the script will fail.
In jQuery, it looks like this:
$( document ).ready(function() {});
You can do that in jQuery shorthand, like this:
$().ready( function() {} );
Or even like this:
$(function() {});
The part of the script that is being made to wait goes inside the curly brackets. But you would generally start that on the next line, and put the ending curly bracket, closing parenthesis, and semicolon following that on a line of their own), like this:
1 $(function() {
2 // Body of function (or even the rest of the script) goes here, such as a click handler.
3 });
This is all explained further at
the jQuery page for .ready()
For the plain vanilla version see: http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
This adds a menu item to one of MediaWiki's menus. Use "p-tb" to signify the toolbox menu on the sidebar menu.
First you stick it in a variable, for example, "portletlink":
var portletlink = mw.util.addPortletLink('p-tb', '#', 'Remove redlinks');
It has up to 7 parameters. Only 3 are used above.
General usage:
mw.util.addPortletLink( 'portletId', 'href', 'text', 'id', 'tooltip', 'accesskey', 'nextnode');
It's components:
mw.util.addPortletLink
: the ResourceLoader module to add links to the portlets.portletId
: the id of the portlet (that is, menu) where the new menu item is to be placed. The various menus ("portlets") are::
p-navigation
: Navigation section in left sidebarp-interaction
: Interaction section in left sidebarp-tb
: Toolbox section in left sidebarcoll-print_export
: Print/export section in left sidebarp-personal
Personal toolbar at the top of the pagep-views
Upper right tabs in Vector only (read, edit, history, watch, etc.)p-cactions
Drop-down menu containing move, etc. (in Vector); subject/talk links and action links in other skinshref
: Link to a Wikipedia or external page (the initial purpose of portletlink was to link somewhere)text
: Text that displays in the menu (the title of theid
: HTML id (optional)tooltip
: Tooltip to display on mouseover (optional)accesskey
: Shortcut key press (optional)nextnode
: id of the existing portlet link to place the new portlet link before (optional) (Don't forget: ids have a leading "#")The optional fields must be included in the above order. To skip a field without changing it, use the value null, that is, no space between the quotes for that parameter.
To place the menu items in alphabetical order, and so that they don't move around in the menu, for your last menu item specify the id of an existing menu item to anchor it. Then set "next node" for the next to last item as the id for the menu item you just set, and so on.
See the complete documentation at https://www.mediawiki.org/wiki/ResourceLoader/Modules#addPortletLink and Help:Customizing toolbars.
Important: All we've done so far above is assign mw.util.addPortletLink to a variable. It won't do anything until we bind the variable to a click handler (see below).
To make a menu item that does something when you click on it, you have to "bind" mw.util.addPortletLink, via its variable, to a handler. Like this:
(The variable used in this example is "portletlink").
1 $(portletlink).click( function(e) {
2 e.preventDefault();
3 //do some stuff
4 }
The "handler" is the part between the curly brackets.
To read about function(e), see
what does e mean in this function definition?
jQuery's event objects are explained here:
http://api.jquery.com/category/events/event-object/
e.preventDefault()
is short for
event.preventDefault()
, one of jQuery's event objects.
What is the default being prevented? Portletlink's default action is to link somewhere. We don't want it to do that, and so that is what e.preventDefault();
is for.
intitle: "(word)"
ignores the parentheses. (Reported by
Gonnym)
14:03, 15 September 2018 (UTC)Cities intitle:"List of"
returns zero results (you can see many before the filter kicks in). 04:12, 26 March 2018 (UTC)One of the toggles is to sort and unsort.
I'm not sure if the various other toggles will work with the StripSearchSorted approach. It "unsorts" by returning to a previous state.
Theoretically, it should, so I'll try it. But it needs the wikibracketing sequence stripped out, as I put that into its own function.
I seem to have scrambled everything. Took out too much, I think. Now Ill just try taking out the wikibracketing.
This will be the first approach, because it is already mostly in place.
Using a copy for the sort version, and the original or the unsorted version...
If the other menu items modified both, it shouldn't matter which one is being displayed.
Sort (turn off) would sort to original order.
Sort (turn on) would sort to alphabetical order.
(2017-11-12) Okay, the menu items work relative to each other, and now it is time to add guts to their subroutines so that clicking the menu items actually does something...
SRSisterOff() and SRSisterOn() are easy, as they show and hide the element #mw-interwiki-results (which lies outside the search results), respectively, and this is already implemented. The placement of the sister results however must not be changed by the re-generation of the search results as it currently does for some unknown reason -- this bug needs to be fixed.
For the rest to work, we need a behind-the-scenes function -- SRArray() -- that puts the search entries into an array (SRArray) and maps out a new array that rebuilds each entry along with new classes inserted, so that we can hide/show inter-entry spacing, details, and additional link delimiters.
SRSortOn will sort SRArray.
SRSortOff will restore the original order in SRArray.
SRDetailOff will hide the details in SRArray.
SRDetailOn will show the details in SRArray.
SRWikifyOn() and SRWikifyOff() will show and hide wikicode generated in the SRArray function, respectively. These functions should activate only when details are off. When details are turned off, SRWikify needs to be turned on. When details are turned on, SRWikify needs to be turned off.
If the entries can't be rebuilt without the extra line, then we'll have to do something more involved...
There are 4 combinations:
SRWikifyOn() and SRWikifyOff() will show and hide wikicode generated in the SRArray function, respectively. These functions should activate only when details are off. When details are turned off, SRWikify needs to be turned on. When details are turned on, SRWikify needs to be turned off.
Before anything has been changed:
Get display modes from local storage
The script needs to show the results in current display mode
The script needs to change the mode based on menu item clicks
The hard part is a pair of menu items, each with 2 states, that affect each other.
One pair is to turn sorting on and off:
The other pair is to turn details off and on:
intitle:"word1 word2"
(notice the space between the words) returns results that do not have the search string in the title.
It seems to happen for any search string with a space in it.
So, intitle:"Milan"
produces only items with Milan in their titles, while intitle:"in Milan"
includes items which has this in the title, but also includes items that have this only in the article contents and not in the title. This seriously waters down the search results.
What gives?
Is there a way to return only items with "in Milan" in their titles? The Transhumanist ( talk) 00:39, 22 October 2017 (UTC)
intitle:/in[ ]Milan/
none found. --
Green
C
00:52, 22 October 2017 (UTC)intitle:"in Milan"
and "in Milan" intitle:Milan
. The latter seems to be the actual search performed for both. intitle:"word1 word2"
works as expected in my tests with two uncommon words. For example, intitle:"Inter Milan"
gives me 56 hits, and all have the quote in the title.
PrimeHunter (
talk)
01:25, 22 October 2017 (UTC)SELECT * FROM page WHERE page_namespace = 0 AND page_title LIKE "%in_Milan%" LIMIT 500;
--
Green
C
02:29, 22 October 2017 (UTC)What I'd like to do is fork StripSearch.js to create User:The Transhumanist/SearchSuite.js and add some more toggles (as menu items).
The first one I would like to add is a menu item for turning the sorting of search results on/off. It will sort the results whether or not they've been stripped yet.
Another one will insert/remove wikilink formatting. (Not everyone will want the link delimiters displaying all the time).
And more.
My question for you is this: what do I need to think about in approaching the writing of this script, with its various menu item features (that are intended to work together)?
I look forward to reading your thoughts on this matter.
Sincerely, The Transhumanist 22:51, 8 November 2017 (UTC)
searchSuite-foo-show
and searchSuite-foo-hide
for elements that should be shown/hidden when foo is activated (and then reversed when foo is turned off). Sorting is going to more tricky to do/undo, but basically you would store data about the original order, then write functions like sortAlpha and sortOrig that would operate on the containing element, replacing it's contents with sorted contents. For a simpler example, to sort the links in the toolbox, you could do var sorted = $.makeArray( $("#p-tb").find('li') ).sort(function(a,b){return ( a.innerText < b.innerText ) ? -1 : 1; });
$("#p-tb").find('ul').empty().append(sorted);
var origsorted = $.makeArray( $("#p-tb").find('li') ).sort(function(a,b){return parseInt(a.dataset.origsort) - parseInt(b.dataset.origsort);});
$("#p-tb").find('ul').empty().append(origsorted);
On some of my scripts, I use an activation filter that checks the title and runs only if the namespace up there matches:
// Run this script only if "Book:" is in the page title
if (document.title.indexOf( "Book:") != -1) {
// (Body of script goes here)
};
Now I need to do this with articles in the main namespace, but there is no prefix up there in the title to work off of.
What to do? The Transhumanist 13:02, 11 February 2018 (UTC)
mw.config.get( 'wgNamespaceNumber' ) === 0
. —
JJMC89 (
T·
C)
17:17, 11 February 2018 (UTC)
// Run this script only for main namespace
if (mw.config.get('wgNamespaceNumber') !== 0) {
return;
};
// (Body of script goes here)
return
statement only works within functions, but that's generally not a problem – you're whole script is usually wrapped inside a function, assuming you need to wait for the document ready and/or wait for resource loader modules to be loaded. -
Evad37 [
talk
00:44, 12 February 2018 (UTC)
$( function($) {
...});
there's nothing more left to execute, and so the script ends. It doesn't matter if the "return" is within any number of "if"/"if-else" statements, "for" loops, "while" loops, etc – only having another (sub)function will change the scope it applies to. One thing to watch for, at deeper levels within your programs, is that when you are assigning a variable to a function call (var foo = someFunction(bar);
), the variable is set to the return value, which is specified with "return someValue;"
inside the function. Since we haven't explicitly set a return value, it would be undefined
– but that doesn't matter for our purpose, since the function is just there to make the script wait before executing, and is not assigning a value to a variable. -
Evad37 [
talk
02:09, 13 February 2018 (UTC)Based on your explanations above, I've written the following deactivation filters using return statements:
// ============== deactivation filters ==============
// End the script if Vector skin is not the user's skin
if ( mw.config.get( 'skin' ) !== 'vector' ) {
// use a return statement to end the local function and hence the program's body
// important: this approach does not work outside of a function
return;
}
// End the script if " - Search results - Wikipedia" is not in the page title
if (document.title.indexOf(" - Search results - Wikipedia") == -1) {
// use a return statement to end the local function and hence the program's body
// important: this approach does not work outside of a function
return;
}
Are these correct?
And am I using the correct terminology in my comments?
What is the common name for the above technique? The Transhumanist 10:39, 15 February 2018 (UTC)
What about doing the same thing for more than one namespace? Such as "run script if the page is in the article namespace or the template namespace"? The Transhumanist 18:03, 13 February 2018 (UTC)
return
. NOT( isArticle OR isTemplate ) is equivalent to isNotArticle AND isNotTemplate. So in script (and putting the actual namespace number into a variable to avoid duplication), you get something like: // Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
if ( namespaceNumber !== 0 && namespaceNumber !== 10 ) {
return;
};
// (Body of script goes here)
!
operator: // Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
var isArticleOrTemplate = (namespaceNumber === 0 || namespaceNumber === 10);
if ( !isArticleOrTemplate ) {
return;
};
// (Body of script goes here)
// Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
var allowedNamespaces = 0, 2, 10, 828]; // main, user, template, module
var isInAllowedNamespace = (allowedNamespaces.indexOf(namespaceNumber) !== -1);
if ( !isInAllowedNamespace ) {
return;
};
// (Body of script goes here)
...is now operational.
Thanks for your contributions and advice. The development of the script would have been substantially delayed without your support.
I did the best I could, though it is far from optimized.
What needs to be, or should be, done to it? The Transhumanist 18:26, 24 February 2018 (UTC)
try {
// Code that might generate an error goes here
// The script will execute up until an error occurs, at which point it moves to the catch block,
// or until the end of the try block, at which point it skips the catch block
} catch(e) {
// Code to execute if there is an error – i.e. if you can't read a value from localStorage, just assume a default value
// The error details are in the `e` parameter, which you can output the browser console like this:
console.warn(e);
}
// Script continues here, even if there was an error encountered in the try block
TrueMatch
, you could have something like removeResultsWithoutIntitleString()
This is a feature I would like to add, to let the user further hone down the search results. I think TrueMatch could be cloned and adapted to do this, but in order to parse an additional search string, the program will need an input form. I've never done one of those before. Any guidance would be most helpful. The Transhumanist 20:06, 24 February 2018 (UTC)
prompt()
method to request user input. W3Schools has a couple of good examples:
[1] -
Evad37 [
talk
04:36, 25 February 2018 (UTC)
The search results have links at the bottom for setting the number of items to be displayed to 20, 50, and so on, up to 500. But the API allows setting at any number up to 5,000, with &limit=5000
.
I'd like a menu item that allows the user to choose their own limit. Then the program would need to pass the &limit command to the API. I don't know how to do that.
Any pointers would certainly help. The Transhumanist 20:06, 24 February 2018 (UTC)
Been trying out this very useful tool & found these niggles with the "redirecteds" feature:
Hope this is helpful : Noyster (talk), 18:25, 26 February 2018 (UTC)
View (previous 20 | next 20) (20 | 50 | 100 | 250 | 500)
Hello and thanks again for
User:The Transhumanist/SearchSuite.js which I find very useful. May I suggest another switch, to turn off the suppression of non-matching entries? For example, I'm currently searching for linksto:"Adventure" intitle:"film"
(because many of those articles should link to
Adventure film instead), but I need to comment out SearchSuite in my common.js to see any results. Thanks,
Certes (
talk)
09:38, 27 July 2018 (UTC)
intitle
to linksto:"Adventure" film
, and line 151 doesn't find that string in any article titles. An extra .*
in line 145 might fix it, as in RegExp('.*intitle:"(.+?)".*','i')
, but I've not tested that change.
Certes (
talk)
23:41, 29 July 2018 (UTC)Great work on this. Amazing functionality. How about adding some screenshots so users can see what it looks like? – Lionel( talk) 01:51, 29 April 2018 (UTC)
Have you thought about moving the documentation to User:The_Transhumanist/SearchSuite.js/doc ? Then you could use this page as a real talk page. – Lionel( talk) 01:51, 29 April 2018 (UTC)
If you have any questions, feel free to ask. I hope you like the program. — The Transhumanist 13:04, 15 September 2018 (UTC)
intitle: "(word)"
but it ignores the parenthesis. Any idea why? --
Gonnym (
talk)
13:21, 15 September 2018 (UTC)
@ The Transhumanist: is it possible to enable search with for different cap styles? For instance, searching for "TV Series" and not getting "TV series" results? -- Gonnym ( talk) 23:22, 17 September 2018 (UTC)
intitle: "(TV Series)"
I get results for "TV series" as well (lower-case "s"). Is there a setting I need to enable to get only results for "Series" with an upper-case "S"? --
Gonnym (
talk)
00:17, 18 September 2018 (UTC)
limit=50
to limit=5000
, and press ↵ Enter.intitle:"TV Series"
If you have an intervening space, it will treat the search string as a normal entry. —
The Transhumanist
11:50, 18 September 2018 (UTC)
Hi. Checking the document title makes the script run only in english wikipedia. What if you make it checking if mw.config.get('wgCanonicalSpecialPageName') === 'Search' ? -- geraki (talk) 16:34, 14 August 2019 (UTC)
A few days ago, this script stopped working for me. It's not misbehaving; it just does nothing. Is it still working for anyone else? Certes ( talk) 11:59, 31 January 2021 (UTC)
{{
subst:js|User:Sam Sailor/Scripts/SearchSuite.js}}
for now.
Sam
Sailor
09:55, 7 June 2021 (UTC)
if(typeof SRFilter === 'undefined')
test so that, when false, it skips only line 121 SRFilter();
and still allows the rest of the code to execute.
Certes (
talk)
13:56, 7 June 2021 (UTC)CC BY-SA 4.0 ZinMin12300 ( talk) 19:53, 14 December 2023 (UTC)
Hello. I have found this script to be extremely helpful, especially with the redirecteds feature which I use often, but I've come across a strange bug where when intitle:
is used in a search, redirected entries seem to automatically be hidden, regardless of whether SR redirecteds
is toggled to on or off. Could you look into this? Thanks in advance!
InfiniteNexus (
talk)
22:39, 11 January 2024 (UTC)
Anderson has been installed on a machine that has the latest trends on his computer system
Wikibooks Is the most important things can be used for controlling your own creation @ The Transhumanist@ The Transhumanist 41.122.133.141 ( talk) 09:49, 16 May 2024 (UTC)
This script provides a menu of enhancements to search results. See description in the user manual below.
![]() |
For all the standard skins except MinervaNeue, this script provides a menu of enhancements to search results:
* [[like this]]
, for easy copying/pasting of list itemsEach menu item is a toggle (an on/off switch), and the script remembers each switch's status across pages. If you turn a feature on (or off), it stays that way for all your searches until you click the menu item again.
The menu items appear on the side bar in the tools menu whenever you are on a search results page, which shows up after you've conducted a search.
The script also provides a (built-in) work-around for WP's "intitle:" bug, so that search results actually match the search string provided when using the "intitle:" parameter and enclosing your search term in quotes.
This script is far from finished. If you'd like to comment, or contribute ideas or advice, please post under discussions at the bottom of this page. Post bugs in the bug report section. Thank you.
To make SearchSuite work on your account, add this line to your common.js (or your skin.js) page:
importScript("User:The Transhumanist/SearchSuite.js");
Save the page and bypass your cache to make sure the changes take effect. By the way, only logged-in users can install scripts.
The script works on search results. To get a search results page, click on the magnifying glass in the search box and search for something. Or type intitle:
in the search box, followed by your search term in quotes.
When you are on a search results page, the script provides the following additional menu selections on the sidebar's tools menu:
"SR" stands for "search results". Each menu item includes a little note in parentheses indicating what clicking on it will do (either "(turn on)", or "(turn off)").
The script remembers each menu item's status between uses, and so each feature remains on or off for all of your searches until you click on its menu item again.
Turning this off strips out the extraneous details (the contents excerpt) between each entry, leaving the results displayed as one per line. This allows more results to be shown on the page at a time, and it is useful when copying/pasting to lists and outlines.
Turning it on brings the details back.
It is even more useful when used in combination with SR wikify.
Turning this off doesn't just remove the notes that say "redirect from", it removes the entire entries that include those notes. It also removes entries of items from related categories, and the results that match subheadings.
Turning it back on, adds those items back onto the list.
This feature helps narrow search results down to the topic entered.
This hides or shows the sister project results on the right side of the screen.
If you have the sister results turned off in Preferences, then this menu item has no effect.
When this feature is turned on, the search results will appear in alphabetical order. To return them to their original order, click on SR sort (turn off)
.
As I'm a list editor, this is my favorite feature. This adds or removes list item wikiformatting to the title link of each entry in the search results. This is the same formatting you would see while you are in an edit window. This makes it easy to copy and paste the search results as list items into list and outline articles.
When you have details off and wikify on, your search results will look like this:
* [[ List of English animal nouns]]
* [[ List of English terms of venery, by animal]]
* [[ List of Middle-earth animals]]
* [[ List of animal names]]
* [[ List of animal sounds]]
* [[ List of animals by common name]]
* [[ List of animals in Japan]]
* [[ List of animals that have been cloned]]
* [[ List of animals that produce silk]]
* [[ List of domesticated animals]]
* [[ List of extinct animals of India]]
* [[ List of films about animals]]
* [[ List of herbivorous animals]]
* [[ List of national animals]]
* [[ List of nocturnal animals]]
* [[ List of psychoactive plants, fungi, and animals]]
View (previous 20 | next 20) (20 | 50 | 100 | 250 | 500)
Notice that the links are still live, so that you can click on them.
Wikify is most useful when sort is turned on and the other features are turned off.
The script includes a workaround for a bug in Wikipedia's search. The buggy (or misnamed?) feature of search is the parameter intitle:. When you include that in a search, the specified string is supposed to return only titles containing that string. But WP search doesn't limit the results that way, including matches with page contents, redirects, and pages from matching categories, and also containing matches of related forms of a lone word. For example, intitle:Greece also matches "Greek".
That's a problem, if you only want titles with "Greece" in them.
TrueMatch, which is a function built-in to this script, checks the search for "intitle:" followed by a quoted string. If it finds one, it removes all results that do not match the quoted string. It makes sure the search results actually match the intitle search string you provided.
To take advantage of TrueMatch you must include "intitle:" followed by a string in quotes. Here are some examples:
Currently, TrueMatch only catches the first instance of intitle, and ignores everything else not within the quotes.
To get the largest output of search results possible for a given search string, add &limit=5000
to the url, and press ↵ Enter. (The max in MediaWiki is 5,000).
Important: the following section is still under development and is incomplete. I work on it as I find the time.
This section explains the source code, in detail. It is for JavaScript programmers, and for those who want to learn how to program in JavaScript. Hopefully, this will enable you to adapt existing source code into new user scripts with greater ease, and perhaps even compose user scripts from scratch.
You can only use so many comments in the source code before you start to choke or bury the programming itself. So, I've put short summaries in the source code, and have provided in-depth explanations here.
My intention is Threefold:
In addition to plain vanilla JavaScript code, this script relies heavily on the jQuery library.
If you have any comments or questions, feel free to post them at the bottom of this page under Discussions. Be sure to {{ ping}} me when you do.
The most challenging thing about writing this script (so far) was figuring out how to make each of the menu-item-controlled functions work on the output of the others...
For sort, that meant recording the original order as an id in each list item element, so that they could be sorted back to that order later.
For the rest of the menu-item-controlled features, hide and show were used.
It turns out that if you hide an element, and you later show some of its children, the parent element is forced out of hiding. That's what happens with the hidden redirected entries. At least, I think that's what happened. So, in the functions (SRDetails) that affect the children, I had to recheck the setting of the parent, and rehide the parent according to the setting. Not very elegant. If you have a better solution, I'm very interested in learning it.
For the details of each search result, there was this extra space below each item, that didn't respond to hide/show. That space needed to be controlled via css block and inline display attributes. That was harder to figure out than it looks, because the output on screen was routinely copy and pasted into WikEd for use on other pages, and WikEd made it seem like there was an extra newline (\n
in there by adding one in between each item, when there weren't any in the output, which led to a wild goose chase. The solution was to
DuckDuckGo the hell out of the situation until a clue was revealed by
Stack Overflow that mentioned something about list items being block elements with margin spacing rather than newlines. Then suspicion turned toward WikEd, so the script's output was then copied (from the screen via copy/paste) into Wikipedia's regular wiki editor instead where it was revealed that it was actually singlespaced, with no extra newlines in the script's output! Still, the extra spacing needed to be taken out for the list item views (to maximize how many are displayed on the screen at once), via injecting css code, but put back in along with the details, via more injected css code, so that the entries were restored back and forth to and from their original look.
More specifically, starting at the beginning of the source code...
An alias is one string defined to mean another. Another term for "alias" is "shortcut". In the script, the following aliases are used:
$
is the alias for
jQuery (the jQuery
library)
mw
is the alias for mediawiki (the mediawiki
library)
These two aliases are set up like this:
( function ( mw, $ ) {}( mediaWiki, jQuery ) );
That also happens to be a "bodyguard function", which is explained in the section below...
The bodyguard function assigns an alias for a name within the function, and reserves that alias for that purpose only. For example, if you want "t" to be interpreted only as "transhumanist".
Since the script uses jQuery, we want to defend jQuery's alias, the "$". The bodyguard function makes it so that "$" means only "jQuery" inside the function, even if it means something else outside the function. That is, it prevents other javascript libraries from overwriting the $() shortcut for jQuery within the function. It does this via scoping.
The bodyguard function is used like a wrapper, with the alias-containing source code inside it, typically, wrapping the whole rest of the script. Here's what a jQuery bodyguard function looks like:
1 ( function($) {
2 // you put the body of the script here
3 } ) ( jQuery );
See also: bodyguard function solution.
To extend that to lock in "mw" to mean "mediawiki", use the following (this is what the script uses):
1 ( function(mw, $) {
2 // you put the body of the script here
3 } ) (mediawiki, jQuery);
For the best explanation of the bodyguard function I've found so far, see: Solving "$(document).ready is not a function" and other problems (Long live Spartacus!)
The script makes much use of mw.util.addPortletLink.
In order for mw.util.addPortletLink to work, the script is dependent upon the core module mediawiki.util, which contains its programming. (View the source code at mediawiki.util.js, and for its documentation, see mw:ResourceLoader/Core modules#mediawiki.util).
Therefore, it is necessary to declare (load) the module as a dependency.
(Keep in mind that scripts will work by accident without declaring dependencies, when another user script that was loaded earlier has already declared them for itself. If your script was working, but no longer works for no apparent reason, it may be because it doesn't load its dependencies.)
Dependencies are loaded with mw.loader.
The script includes the following dependency declaration:
mw.loader.using( 'mediawiki.util'], function () {
// The rest of the script goes here
});
Let's break this down...
mw
is an alias that stands for mediaWiki
. So, mw.loader
is short for mediaWiki.loader
.
mediaWiki.loader is a part of MediaWiki, the program that runs Wikipedia.
It has a number of methods defined for it. Its
.using
method executes a function as soon as the specified dependencies are ready, in this case, mediawiki.util.
The function, "function ()", is an anonymous function.
The code to be executed by a function is placed inside curly brackets: {}
And in this case, it's the rest of the script.
The ready() event listener/handler makes the rest of the script wait until the page (and its DOM) is loaded and ready to be worked on. If the script tries to do its thing before the page is loaded, there won't be anything there for the script to work on (such as with scripts that will have nowhere to place the menu item mw.util.addPortletLink), and the script will fail.
In jQuery, it looks like this:
$( document ).ready(function() {});
You can do that in jQuery shorthand, like this:
$().ready( function() {} );
Or even like this:
$(function() {});
The part of the script that is being made to wait goes inside the curly brackets. But you would generally start that on the next line, and put the ending curly bracket, closing parenthesis, and semicolon following that on a line of their own), like this:
1 $(function() {
2 // Body of function (or even the rest of the script) goes here, such as a click handler.
3 });
This is all explained further at
the jQuery page for .ready()
For the plain vanilla version see: http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
This adds a menu item to one of MediaWiki's menus. Use "p-tb" to signify the toolbox menu on the sidebar menu.
First you stick it in a variable, for example, "portletlink":
var portletlink = mw.util.addPortletLink('p-tb', '#', 'Remove redlinks');
It has up to 7 parameters. Only 3 are used above.
General usage:
mw.util.addPortletLink( 'portletId', 'href', 'text', 'id', 'tooltip', 'accesskey', 'nextnode');
It's components:
mw.util.addPortletLink
: the ResourceLoader module to add links to the portlets.portletId
: the id of the portlet (that is, menu) where the new menu item is to be placed. The various menus ("portlets") are::
p-navigation
: Navigation section in left sidebarp-interaction
: Interaction section in left sidebarp-tb
: Toolbox section in left sidebarcoll-print_export
: Print/export section in left sidebarp-personal
Personal toolbar at the top of the pagep-views
Upper right tabs in Vector only (read, edit, history, watch, etc.)p-cactions
Drop-down menu containing move, etc. (in Vector); subject/talk links and action links in other skinshref
: Link to a Wikipedia or external page (the initial purpose of portletlink was to link somewhere)text
: Text that displays in the menu (the title of theid
: HTML id (optional)tooltip
: Tooltip to display on mouseover (optional)accesskey
: Shortcut key press (optional)nextnode
: id of the existing portlet link to place the new portlet link before (optional) (Don't forget: ids have a leading "#")The optional fields must be included in the above order. To skip a field without changing it, use the value null, that is, no space between the quotes for that parameter.
To place the menu items in alphabetical order, and so that they don't move around in the menu, for your last menu item specify the id of an existing menu item to anchor it. Then set "next node" for the next to last item as the id for the menu item you just set, and so on.
See the complete documentation at https://www.mediawiki.org/wiki/ResourceLoader/Modules#addPortletLink and Help:Customizing toolbars.
Important: All we've done so far above is assign mw.util.addPortletLink to a variable. It won't do anything until we bind the variable to a click handler (see below).
To make a menu item that does something when you click on it, you have to "bind" mw.util.addPortletLink, via its variable, to a handler. Like this:
(The variable used in this example is "portletlink").
1 $(portletlink).click( function(e) {
2 e.preventDefault();
3 //do some stuff
4 }
The "handler" is the part between the curly brackets.
To read about function(e), see
what does e mean in this function definition?
jQuery's event objects are explained here:
http://api.jquery.com/category/events/event-object/
e.preventDefault()
is short for
event.preventDefault()
, one of jQuery's event objects.
What is the default being prevented? Portletlink's default action is to link somewhere. We don't want it to do that, and so that is what e.preventDefault();
is for.
intitle: "(word)"
ignores the parentheses. (Reported by
Gonnym)
14:03, 15 September 2018 (UTC)Cities intitle:"List of"
returns zero results (you can see many before the filter kicks in). 04:12, 26 March 2018 (UTC)One of the toggles is to sort and unsort.
I'm not sure if the various other toggles will work with the StripSearchSorted approach. It "unsorts" by returning to a previous state.
Theoretically, it should, so I'll try it. But it needs the wikibracketing sequence stripped out, as I put that into its own function.
I seem to have scrambled everything. Took out too much, I think. Now Ill just try taking out the wikibracketing.
This will be the first approach, because it is already mostly in place.
Using a copy for the sort version, and the original or the unsorted version...
If the other menu items modified both, it shouldn't matter which one is being displayed.
Sort (turn off) would sort to original order.
Sort (turn on) would sort to alphabetical order.
(2017-11-12) Okay, the menu items work relative to each other, and now it is time to add guts to their subroutines so that clicking the menu items actually does something...
SRSisterOff() and SRSisterOn() are easy, as they show and hide the element #mw-interwiki-results (which lies outside the search results), respectively, and this is already implemented. The placement of the sister results however must not be changed by the re-generation of the search results as it currently does for some unknown reason -- this bug needs to be fixed.
For the rest to work, we need a behind-the-scenes function -- SRArray() -- that puts the search entries into an array (SRArray) and maps out a new array that rebuilds each entry along with new classes inserted, so that we can hide/show inter-entry spacing, details, and additional link delimiters.
SRSortOn will sort SRArray.
SRSortOff will restore the original order in SRArray.
SRDetailOff will hide the details in SRArray.
SRDetailOn will show the details in SRArray.
SRWikifyOn() and SRWikifyOff() will show and hide wikicode generated in the SRArray function, respectively. These functions should activate only when details are off. When details are turned off, SRWikify needs to be turned on. When details are turned on, SRWikify needs to be turned off.
If the entries can't be rebuilt without the extra line, then we'll have to do something more involved...
There are 4 combinations:
SRWikifyOn() and SRWikifyOff() will show and hide wikicode generated in the SRArray function, respectively. These functions should activate only when details are off. When details are turned off, SRWikify needs to be turned on. When details are turned on, SRWikify needs to be turned off.
Before anything has been changed:
Get display modes from local storage
The script needs to show the results in current display mode
The script needs to change the mode based on menu item clicks
The hard part is a pair of menu items, each with 2 states, that affect each other.
One pair is to turn sorting on and off:
The other pair is to turn details off and on:
intitle:"word1 word2"
(notice the space between the words) returns results that do not have the search string in the title.
It seems to happen for any search string with a space in it.
So, intitle:"Milan"
produces only items with Milan in their titles, while intitle:"in Milan"
includes items which has this in the title, but also includes items that have this only in the article contents and not in the title. This seriously waters down the search results.
What gives?
Is there a way to return only items with "in Milan" in their titles? The Transhumanist ( talk) 00:39, 22 October 2017 (UTC)
intitle:/in[ ]Milan/
none found. --
Green
C
00:52, 22 October 2017 (UTC)intitle:"in Milan"
and "in Milan" intitle:Milan
. The latter seems to be the actual search performed for both. intitle:"word1 word2"
works as expected in my tests with two uncommon words. For example, intitle:"Inter Milan"
gives me 56 hits, and all have the quote in the title.
PrimeHunter (
talk)
01:25, 22 October 2017 (UTC)SELECT * FROM page WHERE page_namespace = 0 AND page_title LIKE "%in_Milan%" LIMIT 500;
--
Green
C
02:29, 22 October 2017 (UTC)What I'd like to do is fork StripSearch.js to create User:The Transhumanist/SearchSuite.js and add some more toggles (as menu items).
The first one I would like to add is a menu item for turning the sorting of search results on/off. It will sort the results whether or not they've been stripped yet.
Another one will insert/remove wikilink formatting. (Not everyone will want the link delimiters displaying all the time).
And more.
My question for you is this: what do I need to think about in approaching the writing of this script, with its various menu item features (that are intended to work together)?
I look forward to reading your thoughts on this matter.
Sincerely, The Transhumanist 22:51, 8 November 2017 (UTC)
searchSuite-foo-show
and searchSuite-foo-hide
for elements that should be shown/hidden when foo is activated (and then reversed when foo is turned off). Sorting is going to more tricky to do/undo, but basically you would store data about the original order, then write functions like sortAlpha and sortOrig that would operate on the containing element, replacing it's contents with sorted contents. For a simpler example, to sort the links in the toolbox, you could do var sorted = $.makeArray( $("#p-tb").find('li') ).sort(function(a,b){return ( a.innerText < b.innerText ) ? -1 : 1; });
$("#p-tb").find('ul').empty().append(sorted);
var origsorted = $.makeArray( $("#p-tb").find('li') ).sort(function(a,b){return parseInt(a.dataset.origsort) - parseInt(b.dataset.origsort);});
$("#p-tb").find('ul').empty().append(origsorted);
On some of my scripts, I use an activation filter that checks the title and runs only if the namespace up there matches:
// Run this script only if "Book:" is in the page title
if (document.title.indexOf( "Book:") != -1) {
// (Body of script goes here)
};
Now I need to do this with articles in the main namespace, but there is no prefix up there in the title to work off of.
What to do? The Transhumanist 13:02, 11 February 2018 (UTC)
mw.config.get( 'wgNamespaceNumber' ) === 0
. —
JJMC89 (
T·
C)
17:17, 11 February 2018 (UTC)
// Run this script only for main namespace
if (mw.config.get('wgNamespaceNumber') !== 0) {
return;
};
// (Body of script goes here)
return
statement only works within functions, but that's generally not a problem – you're whole script is usually wrapped inside a function, assuming you need to wait for the document ready and/or wait for resource loader modules to be loaded. -
Evad37 [
talk
00:44, 12 February 2018 (UTC)
$( function($) {
...});
there's nothing more left to execute, and so the script ends. It doesn't matter if the "return" is within any number of "if"/"if-else" statements, "for" loops, "while" loops, etc – only having another (sub)function will change the scope it applies to. One thing to watch for, at deeper levels within your programs, is that when you are assigning a variable to a function call (var foo = someFunction(bar);
), the variable is set to the return value, which is specified with "return someValue;"
inside the function. Since we haven't explicitly set a return value, it would be undefined
– but that doesn't matter for our purpose, since the function is just there to make the script wait before executing, and is not assigning a value to a variable. -
Evad37 [
talk
02:09, 13 February 2018 (UTC)Based on your explanations above, I've written the following deactivation filters using return statements:
// ============== deactivation filters ==============
// End the script if Vector skin is not the user's skin
if ( mw.config.get( 'skin' ) !== 'vector' ) {
// use a return statement to end the local function and hence the program's body
// important: this approach does not work outside of a function
return;
}
// End the script if " - Search results - Wikipedia" is not in the page title
if (document.title.indexOf(" - Search results - Wikipedia") == -1) {
// use a return statement to end the local function and hence the program's body
// important: this approach does not work outside of a function
return;
}
Are these correct?
And am I using the correct terminology in my comments?
What is the common name for the above technique? The Transhumanist 10:39, 15 February 2018 (UTC)
What about doing the same thing for more than one namespace? Such as "run script if the page is in the article namespace or the template namespace"? The Transhumanist 18:03, 13 February 2018 (UTC)
return
. NOT( isArticle OR isTemplate ) is equivalent to isNotArticle AND isNotTemplate. So in script (and putting the actual namespace number into a variable to avoid duplication), you get something like: // Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
if ( namespaceNumber !== 0 && namespaceNumber !== 10 ) {
return;
};
// (Body of script goes here)
!
operator: // Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
var isArticleOrTemplate = (namespaceNumber === 0 || namespaceNumber === 10);
if ( !isArticleOrTemplate ) {
return;
};
// (Body of script goes here)
// Run this script only for main and template namespaces
var namespaceNumber = mw.config.get('wgNamespaceNumber');
var allowedNamespaces = 0, 2, 10, 828]; // main, user, template, module
var isInAllowedNamespace = (allowedNamespaces.indexOf(namespaceNumber) !== -1);
if ( !isInAllowedNamespace ) {
return;
};
// (Body of script goes here)
...is now operational.
Thanks for your contributions and advice. The development of the script would have been substantially delayed without your support.
I did the best I could, though it is far from optimized.
What needs to be, or should be, done to it? The Transhumanist 18:26, 24 February 2018 (UTC)
try {
// Code that might generate an error goes here
// The script will execute up until an error occurs, at which point it moves to the catch block,
// or until the end of the try block, at which point it skips the catch block
} catch(e) {
// Code to execute if there is an error – i.e. if you can't read a value from localStorage, just assume a default value
// The error details are in the `e` parameter, which you can output the browser console like this:
console.warn(e);
}
// Script continues here, even if there was an error encountered in the try block
TrueMatch
, you could have something like removeResultsWithoutIntitleString()
This is a feature I would like to add, to let the user further hone down the search results. I think TrueMatch could be cloned and adapted to do this, but in order to parse an additional search string, the program will need an input form. I've never done one of those before. Any guidance would be most helpful. The Transhumanist 20:06, 24 February 2018 (UTC)
prompt()
method to request user input. W3Schools has a couple of good examples:
[1] -
Evad37 [
talk
04:36, 25 February 2018 (UTC)
The search results have links at the bottom for setting the number of items to be displayed to 20, 50, and so on, up to 500. But the API allows setting at any number up to 5,000, with &limit=5000
.
I'd like a menu item that allows the user to choose their own limit. Then the program would need to pass the &limit command to the API. I don't know how to do that.
Any pointers would certainly help. The Transhumanist 20:06, 24 February 2018 (UTC)
Been trying out this very useful tool & found these niggles with the "redirecteds" feature:
Hope this is helpful : Noyster (talk), 18:25, 26 February 2018 (UTC)
View (previous 20 | next 20) (20 | 50 | 100 | 250 | 500)
Hello and thanks again for
User:The Transhumanist/SearchSuite.js which I find very useful. May I suggest another switch, to turn off the suppression of non-matching entries? For example, I'm currently searching for linksto:"Adventure" intitle:"film"
(because many of those articles should link to
Adventure film instead), but I need to comment out SearchSuite in my common.js to see any results. Thanks,
Certes (
talk)
09:38, 27 July 2018 (UTC)
intitle
to linksto:"Adventure" film
, and line 151 doesn't find that string in any article titles. An extra .*
in line 145 might fix it, as in RegExp('.*intitle:"(.+?)".*','i')
, but I've not tested that change.
Certes (
talk)
23:41, 29 July 2018 (UTC)Great work on this. Amazing functionality. How about adding some screenshots so users can see what it looks like? – Lionel( talk) 01:51, 29 April 2018 (UTC)
Have you thought about moving the documentation to User:The_Transhumanist/SearchSuite.js/doc ? Then you could use this page as a real talk page. – Lionel( talk) 01:51, 29 April 2018 (UTC)
If you have any questions, feel free to ask. I hope you like the program. — The Transhumanist 13:04, 15 September 2018 (UTC)
intitle: "(word)"
but it ignores the parenthesis. Any idea why? --
Gonnym (
talk)
13:21, 15 September 2018 (UTC)
@ The Transhumanist: is it possible to enable search with for different cap styles? For instance, searching for "TV Series" and not getting "TV series" results? -- Gonnym ( talk) 23:22, 17 September 2018 (UTC)
intitle: "(TV Series)"
I get results for "TV series" as well (lower-case "s"). Is there a setting I need to enable to get only results for "Series" with an upper-case "S"? --
Gonnym (
talk)
00:17, 18 September 2018 (UTC)
limit=50
to limit=5000
, and press ↵ Enter.intitle:"TV Series"
If you have an intervening space, it will treat the search string as a normal entry. —
The Transhumanist
11:50, 18 September 2018 (UTC)
Hi. Checking the document title makes the script run only in english wikipedia. What if you make it checking if mw.config.get('wgCanonicalSpecialPageName') === 'Search' ? -- geraki (talk) 16:34, 14 August 2019 (UTC)
A few days ago, this script stopped working for me. It's not misbehaving; it just does nothing. Is it still working for anyone else? Certes ( talk) 11:59, 31 January 2021 (UTC)
{{
subst:js|User:Sam Sailor/Scripts/SearchSuite.js}}
for now.
Sam
Sailor
09:55, 7 June 2021 (UTC)
if(typeof SRFilter === 'undefined')
test so that, when false, it skips only line 121 SRFilter();
and still allows the rest of the code to execute.
Certes (
talk)
13:56, 7 June 2021 (UTC)CC BY-SA 4.0 ZinMin12300 ( talk) 19:53, 14 December 2023 (UTC)
Hello. I have found this script to be extremely helpful, especially with the redirecteds feature which I use often, but I've come across a strange bug where when intitle:
is used in a search, redirected entries seem to automatically be hidden, regardless of whether SR redirecteds
is toggled to on or off. Could you look into this? Thanks in advance!
InfiniteNexus (
talk)
22:39, 11 January 2024 (UTC)
Anderson has been installed on a machine that has the latest trends on his computer system
Wikibooks Is the most important things can be used for controlling your own creation @ The Transhumanist@ The Transhumanist 41.122.133.141 ( talk) 09:49, 16 May 2024 (UTC)