Derpibooru - Sort by Score & No Scope

Adds a button to automatically sort by score after a search. Also, remove pointless scope stuff from URLs.

Stan na 14-10-2016. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Derpibooru - Sort by Score & No Scope
// @namespace   Selbi
// @include     http*://*derpiboo.ru/*
// @include     http*://*derpibooru.org/*
// @version     1.5
// @description Adds a button to automatically sort by score after a search. Also, remove pointless scope stuff from URLs.
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant       none
// ==/UserScript==


// Make sure the script gets excecuted only once
	if (window.top != window.self) return;


// Display Sort-by-Score button next to search prompt
	$("button.header__search__button").after('<a title="Search and sort by score" id="sortbyscore" class="header__search__button" style="padding-left:8px;padding-right:8px"><i class="fa fa-sort-amount-desc"></i></a>');	
	
	$("#sortbyscore").click(function(){
		var tags = document.getElementById("sbq").value;
		var newurl = "/search?utf8=%E2%9C%93&sbq=" + tags + "&sf=score&sd=desc";
		window.location.href = newurl;
	});


// Remove "Scope" crap from URLs
	var allA = document.getElementsByTagName("a");
	for (var i=0; i<allA.length; i++) {
		if (allA[i].href != "") {
			allA[i].href = allA[i].href.replace(/(&|\?)?scope=scpe\w+/g, "");
		}
	}