Simple html numeric captcha solver

After you click "Slow download" button the script solves the numeric captcha, waits for the countdown to finish, clicks the download button

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          Simple html numeric captcha solver
// @description   After you click "Slow download" button the script solves the numeric captcha, waits for the countdown to finish, clicks the download button
// @include       http://www.rziz.net/*/*.html
// @include       http://file.up09.com/*
// @include       http://clicknupload.com/*
// @include       http://hulkload.com/*
// @include       http://up4.im/*
// @include       http://www.gboxes.com/*
// @include       http://mrfile.co/*.html
// @include       http://fileshd.net/*
// @include       http://nizfile.net/*.html
// @include       http://lynxshare.com/*
// @include       http://datasbit.com/*
// @include       http://idup.to/*
// @include       http://media4up.com/*
// @include       http://salefiles.com/*
// @include       http://cloudyfiles.org/*
// @version       1.1.3
// @author        wOxxOm
// @namespace     wOxxOm.scripts
// @license       MIT License
// @run-at        document-end
// ==/UserScript==

var x = document.evaluate(
  '//form//div/span[contains("0123456789",.) and contains(@style,"padding-left")]',
  document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
var btn = document.evaluate(
  '//form//*[not(*) and not(self::script) and (contains(@id,"btn") or contains(@id,"download") or contains(.,"download") or contains(.,"Download"))]',
  document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (x && btn) {
  var nodes = [];
  for (var i = 0; i < 4; i++)
    nodes.push(x.snapshotItem(i));
  var nodes = nodes.sort((a,b) => parseInt(a.style.paddingLeft) - parseInt(b.style.paddingLeft));
  document.forms.F1.code.value = nodes.map(n => n.textContent).join('');

  switch (location.hostname) {
    case 'clicknupload.com':
      document.forms.F1.submit();
      break;
    case 'media4up.com':
      new MutationObserver(mutations => mutations[0].target.style.visibility == 'hidden' && document.forms.F1.submit())
        .observe(document.querySelector('#countdown'), {attributes:true, attributeFilter:['style']});
      break;
    default:
      new MutationObserver(mutations => !btn.disabled && document.forms.F1.submit())
        .observe(btn, {attributes:true, attributeFilter:['disabled']});
  }
}