Greasy Fork

来自缓存

Greasy Fork is available in English.

Macapp download helper

Add a download button for macapp.so

当前为 2015-10-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Macapp download helper
// @namespace    http://nobelliu.github.io/
// @version      0.2
// @description  Add a download button for macapp.so
// @author       NobelLiu
// @match        http://www.macapp.so/*/
// @grant        none
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==
'use strict';
$(setTimeout(function () {
        if (document.getElementById("code")) {
            var download = document.getElementsByClassName("download")[0];
            var codeElement = document.getElementById("code");
            var dlButton = document.createElement('a');
            var code = document.body.innerHTML.match(/document.getElementById\("code"\).innerHTML="\w\w\w\w/).toString().match(/\w\w\w\w$/);
            dlButton.innerHTML = code;
            var href = "/go" + window.location.pathname;
            dlButton.setAttribute("href", href);
            dlButton.setAttribute("target", "_blank");
            dlButton.style.cssText = "color:gray;background-color:white;width:40px;height:24px;padding:2px 8px;border:1px solid #ccc;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius:5px;";
            download.insertBefore(dlButton, codeElement);
            codeElement.removeAttribute("id")
        }
    }
    , 100));