Greasy Fork 还支持 简体中文。

Go To Review

Adds a "G+R" shortcut to go to review

2015-03-19 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           Go To Review
// @namespace      http://greasyfork.org
// @author         Cameron Bernhardt (AstroCB)
// @version        1.1
// @description    Adds a "G+R" shortcut to go to review
// @include        *://*.stackexchange.com/*
// @include        *://*stackoverflow.com/*
// @include        *://*serverfault.com/*
// @include        *://*superuser.com/*
// @include        *://*askubuntu.com/*
// @include        *://*stackapps.com/*
// @include        *://*mathoverflow.net/*
// ==/UserScript==

function listenForKeys(e) {
	if (e.keyCode === 114 && lastKey === 103) {
		var review;
		var links = $(".topbar-menu-links")[0].children;
		for (var i = 0; i < links.length; i++) {
			if (links[i].href && (links[i].href.indexOf("review") + 6 === links[i].href.length)) {
				review = links[i];
			}
		}
		review.click();
	}
	lastKey = e.keyCode;
}

function stopListeningForKeys() {
	$("body").unbind("keypress", listenForKeys);
};

function attachListener() {
	var lastKey;
	$("body").keypress(listenForKeys);
}

var main = function () {
	attachListener();
	window.setInterval(function () { // Some text fields are created dynamically
		$("input").focus(stopListeningForKeys).keypress(stopListeningForKeys);
		$("input").blur(attachListener);

		$("textarea").focus(stopListeningForKeys).keypress(stopListeningForKeys);
		$("textarea").blur(attachListener);
	}, 1000);
};

var listen = document.createElement("script");
listen.type = "text/javascript";
listen.textContent = listenForKeys.toString();
document.body.appendChild(listen);

var stop = document.createElement("script");
stop.type = "text/javascript";
stop.textContent = stopListeningForKeys.toString();
document.body.appendChild(stop);

var attach = document.createElement("script");
attach.type = "text/javascript";
attach.textContent = attachListener.toString();
document.body.appendChild(attach);

var script = document.createElement("script");
script.type = "text/javascript";
script.textContent = "(" + main.toString() + ")();";
document.body.appendChild(script);