Greasy Fork

一木禾/DUFile/乱斗/巴士云净化

屏蔽广告/优化下载流程

目前为 2020-09-01 提交的版本。查看 最新版本

// ==UserScript==
// @icon         http://www.yimuhe.com/favicon.ico
// @name         一木禾/DUFile/乱斗/巴士云净化
// @namespace    http://tampermonkey.net/
// @version      0.2.6
// @description  屏蔽广告/优化下载流程
// @author       Avral
// @match        *://www.yimuhe.com/*
// @match        *://dufile.com/*
// @match        *://www.tadaigou.com/*
// @match        *://www.66disk.com/*
// @match        *://www.77file.com/*
// @match        *://www.89file.com/*
// @match        *://www.meleeyun.com/*
// @match        *://www.567pan.com/*
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @require      https://unpkg.com/[email protected]/dist/tesseract.min.js
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
  'use strict';
  var window_url = window.location.href;
  var website_host = window.location.host;
  if(window_url.indexOf("/file")!=-1){
	if(website_host == 'dufile.com')
	{
	  $(document).ready(function(){
		if($('#down_interval_tag')[0]==null){
		  window.location.href = window_url.replace("/file", "/down");
		}
	  });
	  return;
	}
	console.log("jump");
	window.location.href = window_url.replace("/file", "/down");
	return;
  }
  window.adsbygoogle = [];
  document.onclick = function(){}
  document.onkeydown = function(){}
  document.write = function(){}
  document.writeln = function(){}
  window.__qy_pop_up_tg = {}
  window.setTimeout_bak = window.setTimeout;
  window.setTimeout = function(str,delay){
	if (str == 'down_file_link()'){
	  delay = 1;
	}
	window.setTimeout_bak(str,delay);
  }
  $(document).ready(function(){
	setInterval(function(){
	  setTimeout(function() { $('#code').focus() }, 1000);
	  $("#code").blur();
	  $("#code").focus();
	  $('#code').click();
	},3000);
	var vcode = $('#vcode_img')[0];
	if (!vcode){
	  return;
	}
	vcode.onload = function(){
	  const worker = new Tesseract.TesseractWorker();
	  var canvas = testcanvas($('#vcode_img')[0]);
	  worker.recognize(canvas, 'eng', {
		/*tessedit_ocr_engine_mode:0,
	  tessedit_pageseg_mode:1,*/
		classify_bln_numeric_mode:1,
		tessedit_char_whitelist:"0123456789",
	  })
		.then(result => {
		var yzcodestr = result.text.replace(/[^0-9]/ig,"");
		$('#code')[0].value = yzcodestr;
	  });
	  setTimeout(function() { $('#code').focus() }, 1000);
	  $("#code").blur();
	  $('#code').focus();
	  $('#code').click();
	}
	if (website_host == 'dufile.com')
	{
	}
	else if (website_host == 'www.yimuhe.com')
	{
	  var yzmdiv = $('#yzm')[0];
	  if (yzmdiv != null){
		yzmdiv.style.display = '';
	  }
	  var loaddiv = $('#loading')[0];
	  if (loaddiv != null){
		loaddiv.style.display = 'none';
	  }
	}
	else if (website_host == 'www.tadaigou.com')
	{
	  window.load_down_addr1 = function(file_id,vipd){
		$.ajax({
		  type : 'post',
		  url : 'ajax.php',
		  data : 'action=load_down_addr1&file_id='+file_id+'&vipd='+vipd,
		  dataType : 'text',
		  success:function(msg){
			var arr = msg.split('|');
			if(arr[0] == 'true'){
			  $('#addr_list'+vipd).html(arr[1]);
			  if (vipd == 0){
				$('#addr_list'+vipd).click();
			  }
			}else{
			  $('#addr_list'+vipd).html(msg);
			}
		  },
		  error:function(){
		  }
		});
	  }
	}
  });
  document.putcode = function(id) {
	function mydown_file (id) {
	  var u = document.createElement("iframe");
	  if (website_host == 'dufile.com'){
		u.src = '/dd.php?file_key=' + id + '&p=1';
	  }else if (website_host == 'www.yimuhe.com'){
		u.src = "/n_dd.php?file_id=" + id + "&p=1&types=http&ser=99";// + "&userlogin=" + uploaduser + "&file_name=" + name;  + ser + "&file_key=" + key
	  }
	  u.style.display = "none";
	  var onl = function(){
		//console.log(u.contentWindow.document.getElementById("downs"));
		window.location.href = u.contentWindow.document.getElementById("downs").href;
	  }
	  if (u.attachEvent){
		u.attachEvent("onload", onl);
	  } else {
		u.onload = onl;
	  }
	  document.body.appendChild(u);
	}

	var code = $('#code')[0].value;
	if (code == '') {
	  alert("请填写验证码。");
	  return false
	}
	var url = "";
	if (website_host == 'dufile.com'){
	  url = '/downcode.php';
	}else if (website_host == 'www.yimuhe.com'){
	  url = '/n_downcode.php';
	}
	$.ajax({
	  url: url,
	  type: "post",
	  data: {
		action: "yz",
		id: id,
		code: code
	  },
	  dataType: "text",
	  error: function() {
		alert('提交失败。');
		return false;
	  },
	  success: function(result) {
		if (result == 1) {
		  mydown_file(id, '1', 'http');
		} else {
		  if (result == 0) {
			alert("验证码不正确")
		  } else {
			alert("下载地址已超时,请重新下载。");
			if (website_host == 'dufile.com'){
			  window.location.href = ('/file/' + result + '.html')
			}else if (website_host == 'www.yimuhe.com'){
			  window.location.href = ('/file-' + result + '.html');
			}
		  }
		}
	  }
	})
  }
  document.load_down_addr1 = function(file_id){
	$.ajax({
	  type : 'post',
	  url : 'ajax.php',
	  data : 'action=load_down_addr1&file_id='+file_id,
	  dataType : 'text',
	  success:function(msg){
		var arr = msg.split('|');
		if(arr[0] == 'true'){
		  $('#addr_list').html(arr[1]);
		  $('#addr_list a').click();
		}else{
		  $('#addr_list').html(msg);
		}
	  },
	  error:function(){
	  }
	});
  }
})();