Greasy Fork

Greasy Fork is available in English.

_Ex Add button Read in Pocket [getpocket.com]

add button "Read in Pocket" to panel

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         _Ex Add button Read in Pocket [getpocket.com]
// @version      0.2
// @namespace    132-421-129
// @description  add button "Read in Pocket" to panel
// @author       Vyacheslav Vasiliev
// @include      http://getpocket.com/a/*
// @include      https://getpocket.com/a/*
// @grant        none
// @run-at       document-end
// ==/UserScript==


window.event_for_read_in_pocket = true;
$(document).on('DOMNodeInserted', function () {
    if(window.event_for_read_in_pocket){
        window.event_for_read_in_pocket = false;
        console.log('+ change');
        var tmp_button = '<a class="read_in_pocket" href="/a/read/%ID_PAGE%" target="_blank" style="\
            position: absolute;\
            padding: 5px 10px;\
            right: 2em;\
            bottom: 0.5em;\
            background-color: #a5a5a5;\
            color: white;\
            border-radius: 5px;\
            z-index: 999;\
            ">Read in Pocket</a>';
        $('.item_type_normal').not(':has(.read_in_pocket)').each(function (ind, elem) {
            var id_page = $(elem).attr('id').match(/\d+/);
            var q = $(elem).find('.item_content');
            if(q.length){
                $(q).append(tmp_button.replace('%ID_PAGE%', id_page));
            }
        });
        window.event_for_read_in_pocket = true;
    }
});