Derpibooru - Sort by Score & No Scope

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

当前为 2015-05-28 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Derpibooru - Sort by Score & No Scope
// @namespace   Selbi
// @include     http*://*derpiboo.ru/*
// @include     http*://*derpibooru.org/*
// @version     1.3
// @description Adds a button to automatically sort by score after a search. Also, remove pointless scope stuff from URLs.
// ==/UserScript==


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


// Display Sort-by-Score button next to search prompt
	$(".searchbox > form > a:eq(1)").after('<a title="Search and sort by score" id="sortbyscore">' + '<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, "");
		}
	}