Greasy Fork镜像 支持简体中文。

Go To Review

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

目前為 2015-03-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name           Go To Review
// @namespace      http://gf.qytechs.cn
// @author         Cameron Bernhardt (AstroCB)
// @version        1.0
// @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/*
// ==/UserScript==

function listenForKeys(e) {
    if (e.keyCode === 114 && lastKey === 103) {
        $(".topbar-menu-links")[0].children[0].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);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址