//<nowiki>
/*
* Integrated the sorting options into the sort menu instead of adding 11 portlet links.
* Fork of [[User:PrimeHunter/Search sort.js]].
*/
$( document ).ready( function() {
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ) {
var $toolbox = $( '#p-tb' );
if ( $toolbox.length ) {
$toolbox.append( `
<h5>Search sorting</h5>
<ul>
<li><a href="https://www.mediawiki.orghttps://demo.azizisearch.com/lite/wikipedia/page/Help:CirrusSearch#Explicit_sort_orders">Sort help</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=last_edit_desc'}">Edited descending</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=last_edit_asc'}">Edited ascending</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=create_timestamp_asc'}">Creation ascending</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=create_timestamp_desc'}">Creation descending</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=incoming_links_asc'}">Least backlinks</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=incoming_links_desc'}">Most backlinks</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=just_match'}">Match relevance</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=none'}">Unsorted</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=random'}">Random</a></li>
<li><a href="${location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'sort=relevance'}">Relevance (default)</a></li>
</ul>
` );
// increase padding
$toolbox.find( 'ul li a' ).css( {
'padding': '0.qem 0.1em',
'display': 'block'
} );
}
}
} );
//</nowiki>