Greasy Fork

Greasy Fork is available in English.

杂兵专用活动领取器

try to take over the world!

当前为 2020-08-14 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/*
 * @Author: tian.gao
 * @Date: 2020-08-14 11:03:26
 * @LastEditors: tian.gao
 * @LastEditTime: 2020-08-14 16:25:34
 * @Description:
 */
// ==UserScript==
// @name         杂兵专用活动领取器
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *://wg-event.9you.com/*
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// ==/UserScript==
(function() {

   var posJosn=[]
    const pages=`<div class="mys-page">
    <button class="lin" >
      一键领取
    </button>
    <div class="sid">

    </div>
  </div>`
  $(".main").append(pages)
  var style = document.createElement("style");
  style.type = "text/css";
  var text = document.createTextNode(`  .mys-page{
    width: 200px;
    height: 500px;
    position: fixed;
    right: 10px;
    top: 200px;
    background-color: #fff;
    overflow: scroll;
    z-index:9999
  }
  .lin{
    width: 200px;
    height: 30px;
    background-color: #a6dfa8;
  }`); /* 这里编写css代码 */
  style.appendChild(text);
  var head = document.getElementsByTagName("head")[0];
  head.appendChild(style);
  GM_xmlhttpRequest({
  method: "GET",
  url: "http://gaotianvb.gitee.io/mobile_soldier_ol__json/py.json",
  onload: function(response) {
     let a=response.response
     posJosn=JSON.parse(a)
    }
  });
  $.ajaxSettings.async = false; //关闭异步
  let postlist=[]
  function post(a1,a2) {
    postlist.push([a1,a2])
  }
  setInterval(() => {
    if(postlist.length){
      let quer=postlist.shift()
      $.post(quer[0],quer[1],function(result){
      let res=JSON.parse(result)
    $('.sid').prepend('<p>'+res.desc+'</p>')
  })
    }
  }, 1000);
  $('.lin').click(function () {

      for (let i = 0; i < posJosn.length; i++) {
        const element = posJosn[i];
        if(element[2]){
          let key=Object.keys(element[1])
          for (let x = element[2][0]; x <= element[2][1]; x++) {
            let q={}

            if(element[3]){
              for (let y = element[3][0]; y <= element[3][1]; y++) {
                q[key[0]]=x
                q[key[1]]=y
                // sleep(1000)
                post(element[0],q)
              }
            }else{
              q[key[0]]=x
              // sleep(1000)
              post(element[0],q)
            }

          }
        }else{
          // sleep(1000)
          post(element[0],element[1])
          // $.post(element[0],element[1])
        }
      }
      // $.post("http://wg-event.9you.com/msact_202017912/do10",{itemkey: '1,3,4,5,8'})
  })


    // Your code here...
})();