您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
use `ctrl + e` to jump to the arXiv homepage when in pdf page.
// ==UserScript== // @name arXiv paper homepage // @namespace http://tampermonkey.net/ // @version 0.1 // @description use `ctrl + e` to jump to the arXiv homepage when in pdf page. // @author W.Wen // @match https://arxiv.org/pdf/* // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... var home_url = window.location.href.slice(0, -4).replace('pdf', 'abs'); document.addEventListener('keydown', (event) => { const keyName = event.key; if (keyName === 'Control') { // do not alert when only Control key is pressed. return; } if (event.ctrlKey) { // Even though event.key is not 'Control' (i.e. 'a' is pressed), // event.ctrlKey may be true if Ctrl key is pressed at the time. // alert(`Combination of ctrlKey + ${keyName}`); var thekey = `${keyName}`; if (thekey == 'e') { // alert(home_url); // window.location.replace(home_url); // window.location.href = home_url; // window.navigate(home_url); window.open(home_url); } } }, false); })();