DO-Auto-Move

auto move players (it works 60% of the time every time)

当前为 2021-10-06 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name    DO-Auto-Move
// @version 4
// @description auto move players (it works 60% of the time every time)
// @author  holycrawler
// @include *dugout-online.com/players/*
// @update https://github.com/holycrawler/do-players-move/raw/main/DO-Auto-Move.user.js
// @namespace https://greasyfork.org/users/798407
// ==/UserScript==

if (document.querySelector(".top_positions") != null) {
  let postData;
  function movePlayers() {
    const table = document.querySelectorAll("tr[class*='matches_row']");
    table.forEach(function (e) {
      const id = e.cells[2].lastElementChild.id;
      const age = parseInt(e.cells[4].textContent);
      if (age < 19) {
        fetch("https://www.dugout-online.com/players/details/playerID/" + id, {
          method: "POST",
          headers: { "Content-Type": "application/x-www-form-urlencoded" },
          body: postData,
        })
          .then(() => e.remove());
      }
    });
  }

  const newcell = document
    .querySelector(".compare_players_wrapper tr")
    .insertCell(4);
  const newbutton = document.createElement("input");
  newcell.style.position = "absolute";
  newcell.style.paddingRight = "25px";
  newcell.style.right = "0px";
  newbutton.type = "button";
  newcell.append(newbutton);
  newbutton.addEventListener("click", movePlayers, true);
  [postData, newbutton.value] =
    document.querySelector("#first1") != null
      ? ["movetoyouth=1", "move to youth"]
      : ["moveto1st=1", "move to 1st"];
}