Pocket-goto-Original

Opens the original link instead of the pocket View! (please use Ctrl+click)

当前为 2017-12-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Pocket-goto-Original
// @namespace   garyli.rocks
// @description Opens the original link instead of the pocket View! (please use Ctrl+click)
// @include     http://getpocket.com/*
// @include     https://getpocket.com/*
// @version     1.1
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function(){
        // add a new style
        var style = $('<style> .original_new { font-weight: bold; color: green !important; } .original_new:hover {font-size: 1.2em !important; } </style>');
        $('html > head').append(style);
        
        $(document).on('mouseover', '.item_content', function() {
            var $this = $(this);
            
            // check whether already done
            if ($this.hasClass('original_converted')) {return;}
            
            // get the original url
            var $originalLink = $this.find('.original_url');
            var url = $originalLink.attr('href');
            var originalUrl = decodeURIComponent(url.replace("https://getpocket.com/redirect?url=", ""));
            originalUrl = originalUrl.replace(/&formCheck=.*$/, '');
            console.log(originalUrl);
            
            // update link href and styles
            $originalLink.attr('href', originalUrl).addClass('original_new');
            $this.find('a.item_link').attr('href', originalUrl);
            $this.find('a.title').attr('href', originalUrl).addClass('original_new');

            // mark this one as done
            $this.addClass('original_converted');
        });
    });
})();