您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Use left and right arrows to navigate Piazza post history
当前为
// ==UserScript== // @name Piazza History Keybindings // @namespace https://piazza.com // @version 0.2 // @description Use left and right arrows to navigate Piazza post history // @author David Harris, Yuto Takano // @match https://piazza.com/* // @grant none // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js // ==/UserScript== // Avoid conflicts this.$ = this.jQuery = jQuery.noConflict(true); function moveHistorySlider(increment) { // `P` is a Piazza internal variable // I discovered this while exploring their scripts var newVal = P.history_slider.slider.value[0] + increment; if(newVal < P.history_slider.slider.min) newVal = P.history_slider.slider.min; if(newVal > P.history_slider.slider.max) newVal = P.history_slider.slider.max; P.history_slider.slider.element.slider("setValue", newVal).trigger("slide"); } $(document).ready(function () { $(document).keydown(function(e) { var element; if(e.target) element = e.target; else if(e.srcElement) element = e.srcElement; if(element.nodeType == 3) element = element.parentNode; if(element.tagName.toLowerCase() == "input" || element.tagName.toLowerCase() == "textarea") return; switch(e.which) { case 37: moveHistorySlider(-1); break; case 39: moveHistorySlider(1); break; default: return; } e.preventDefault(); }); });