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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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']});
  }
}