Greasy Fork

Greasy Fork is available in English.

Remove Pocket Redirect

点击Pocket列表项的查看原始文档链接时,直接访问网址而不经由Pocket网站的重定向

当前为 2018-10-17 提交的版本,查看 最新版本

// ==UserScript==
// @namespace   KiohPun
// @name        Remove Pocket Redirect
// @name:zh-CN  移除Pocket链接重定向
// @description 点击Pocket列表项的查看原始文档链接时,直接访问网址而不经由Pocket网站的重定向
// @version     1.0
// @match       https://getpocket.com/*
// @grant       none
// @run-at      document-idle
// ==/UserScript==

const container = document.getElementById('page_queue');
const observer = new MutationObserver(() => {
    const urls = document.querySelectorAll('[href^="https://getpocket.com/redirect"]');
    urls.forEach((url) => {
        url.href = decodeURIComponent(url.href.replace(/.+url=(.+)&.+/, '$1'));
    });
});
observer.observe(container, {
    attributes: true,
});