Greasy Fork

来自缓存

Greasy Fork is available in English.

豌豆荚直接下载

在app名字下面添加 直接下载按钮

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @id             e64cfa11-ff2f-4d8e-a0c5-71637d0a71ad
// @name           豌豆荚直接下载
// @version        1.3
// @namespace      
// @author         liangsai12
// @description   在app名字下面添加 直接下载按钮
// @grant none
// @include        *www.wandoujia.com/apps/*

// @run-at         document-end
// ==/UserScript==

var downUrl = '/download';
var url = window.location.toString();

var downloadStr1 = '直接下载';
var download = document.createElement('a');
download.setAttribute('href', url+downUrl);
download.setAttribute('id', 'CASHARE');
download.setAttribute('target', '_blank');
download.innerHTML = downloadStr1;
var CASHARE;
function insertAfter(newEl, targetEl)
{
  var parentEl = targetEl.parentNode;
  if (parentEl.lastChild == targetEl) {
    parentEl.appendChild(newEl);
  } else {
    parentEl.insertBefore(newEl, targetEl.nextSibling);
  }
}
function setInnerHtml() {
  if (url.indexOf('wandoujia.com') >= 0) {
    var pushBtn = document.getElementsByClassName('app-name') [0];  
    download.setAttribute('class', 'install-btn i-source');
    insertAfter(download, pushBtn);
 
  } 
}
function insertRun() {
  setInterval(function () {
    try {
      CASHARE = document.getElementById('CASHARE');
    } catch (e) {
      CASHARE = null;
    }
    if (CASHARE == null) {
      setInnerHtml();
    }
  }, 1000);
}
 insertRun();