您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows to open links that are presented in the article. Press `:` (`;`) to select a link, then press `'` (`"`) to open it in a new tab. Press `/` (`?`) to open in a new background tab.
当前为
- // ==UserScript==
- // @name InoReader follow inner links
- // @namespace http://tampermonkey.net/
- // @version 0.0.2
- // @description Allows to open links that are presented in the article. Press `:` (`;`) to select a link, then press `'` (`"`) to open it in a new tab. Press `/` (`?`) to open in a new background tab.
- // @author Kenya-West
- // @require https://unpkg.com/hotkeys-js@3.13.7/dist/hotkeys.js
- // @match https://*.inoreader.com/feed*
- // @match https://*.inoreader.com/article*
- // @match https://*.inoreader.com/folder*
- // @icon https://inoreader.com/favicon.ico?v=8
- // @license MIT
- // ==/UserScript==
- (function () {
- "use strict";
- document.head.insertAdjacentHTML("beforeend", `<style>a:focus { outline: 2px solid white; }</style>`);
- let firstStart = true;
- let currentLinkIndex = 0;
- let links = []
- hotkeys('\:,\;', function (event, handler){
- event.preventDefault();
- if (links.length === 0 && currentLinkIndex === 0) {
- currentLinkIndex = -1; // because on first start we need to start from 0
- }
- links = getLinks();
- firstStart = false;
- if (links.length) {
- currentLinkIndex = (currentLinkIndex + 1) % links.length;
- links[currentLinkIndex]?.focus();
- }
- });
- hotkeys('\',\"', function (event, handler){
- // all the same as in previous code block but in reverse order
- event.preventDefault();
- links = getLinks();
- if (links.length) {
- currentLinkIndex = (currentLinkIndex - 1 + links.length) % links.length;
- links[currentLinkIndex]?.focus();
- }
- });
- hotkeys('\],\},\{,\[', function (event, handler){
- if (links. Length) {
- links[currentLinkIndex]?.click();
- }
- });
- function getLinks() {
- const links = document.querySelectorAll('.article_content a');
- return links;
- }
- })();