tsdm_dagong

tsdm的自动打工脚本

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        tsdm_dagong
// @namespace   https://greatest.deepsurf.us/users/14059
// @author      setycyas
// @homepage    http://blog.sina.com.cn/u/1365265583
// @description tsdm的自动打工脚本
// @include     http://www.tsdm.net/plugin.php?id=np_cliworkdz:work
// @version     1.2
// @require     http://code.jquery.com/jquery-2.1.1.min.js
// @run-at      document-end
// @grant       none
// @license     MIT
// ==/UserScript==

//页面广告个数,全局变量
var adnum=0;
//自动执行
console.log('tsdm打工开始运行');
tsdm_dagong();

//打工开始,寻找所有广告并模拟点击
function tsdm_dagong(){
  adnum=$('.npadv').length;
  if(adnum<1){
    console.log('没有发现广告');
    return;
  }else{
    console.log('有'+adnum+'个广告.'+'无论点击广告是否有响应,35秒后都先领奖再说,看不到响应也不要刷新');
  }
  for(var i=1;i<adnum+1;i++)
  $.post("plugin.php?id=np_cliworkdz:work",
    {
      act:"clickad"
    },
    function(data){
      console.log('post响应,data= '+data);
      var clicknum=parseInt(data);
      if(clicknum==adnum){
        console.log('模拟点击全部响应完毕,可以领奖了');
        tsdm_lingjiang();
      }
    }
  );
  setTimeout(tsdm_lingjiang,35000); //35秒后,无论如何领奖再说
  setTimeout('window.location.href="http://www.tsdm.net/plugin.php?id=np_cliworkdz:work";',45000); //有广告时指定45秒刷新一次
  console.log('发现广告,已模拟打工,1分钟后刷新');
}

//领奖
function tsdm_lingjiang(){
  console.log('现在尝试领奖!')
  $.post("plugin.php?id=np_cliworkdz:work",
    {
      act:'getcre'
    },
    function(data){
      console.log('领奖响应:'+data);
      //alert(get_info(data));
    }
  );
}

//获取提示信息,data可以是页面html或返回的文档
function get_info(data){
  var info=data.match(/class="alert_info">[\s]{0,4}<p>([^<]*)</)[1];
  return info;
}