linux.do.cq.auto.fire

auto fire wall

当前为 2024-12-15 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         linux.do.cq.auto.fire
// @namespace    https://linux.do/u/io.oi/cq.auto.fire
// @version      1.0.0
// @author       io.oi
// @description  auto fire wall
// @icon         https://www.google.com/s2/favicons?sz=64&domain=e-hai.one
// @match        http://cq.e-hai.one/play?*
// @match        http://chuanqi.proxy2world.com/play?*
// @license      MIT
// @grant        GM_addStyle
// ==/UserScript==

(o=>{if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const t=document.createElement("style");t.textContent=o,document.head.append(t)})(" .control-panel{position:fixed;bottom:0;left:0;min-width:auto}.control-panel .control-group{display:flex}.control-panel .control-group .button{color:#ece6cf;background-color:#084552;padding:.4rem;border:none;cursor:pointer;border-radius:.1rem} ");

(function () {
  'use strict';

  var __defProp = Object.defineProperty;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  class Icons {
  }
  __publicField(Icons, "startIcon", '<svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024"  xmlns="http://www.w3.org/2000/svg"><path d="M823.8 603.5l-501.2 336c-50.7 34-119.3 20.4-153.2-30.2-12.2-18.2-18.7-39.6-18.7-61.5v-672c0-61 49.5-110.4 110.4-110.4 21.9 0 43.3 6.5 61.5 18.7l501.1 336c50.7 34 64.2 102.6 30.2 153.2-7.8 11.9-18.1 22.2-30.1 30.2z m0 0"></path></svg>');
  __publicField(Icons, "stopIcon", '<svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M941.967463 109.714286v804.571428q0 14.857143-10.857143 25.714286t-25.714286 10.857143H100.824606q-14.857143 0-25.714286-10.857143t-10.857143-25.714286V109.714286q0-14.857143 10.857143-25.714286t25.714286-10.857143h804.571428q14.857143 0 25.714286 10.857143t10.857143 25.714286z"></path></svg>');
  function createControlPanel(clicked) {
    const controlPanel = document.createElement("div");
    controlPanel.id = "control-panel";
    controlPanel.className = "control-panel";
    controlPanel.innerHTML = `
    <div class="control-group">
    <button id="toggle" class="button" title="将火墙技能放在快捷键4上,点击开始自动释放火墙">${Icons.startIcon}</button>
</div>`;
    const btn = controlPanel.querySelector("#toggle");
    if (btn) {
      btn.addEventListener("click", () => {
        clicked(btn);
      });
    }
    return controlPanel;
  }
  window.addEventListener("load", () => {
    let timer = void 0;
    const buttonColor = "#55b47d";
    const buttonColor2 = "#084552";
    const event4 = new KeyboardEvent("keydown", {
      key: "4",
      bubbles: true,
      keyCode: 52,
      which: 52
    });
    function passKey4() {
      document.dispatchEvent(event4);
    }
    const panel = createControlPanel((btn) => {
      if (timer) {
        clearInterval(timer);
        timer = void 0;
        btn.style.backgroundColor = buttonColor2;
        btn.innerHTML = Icons.startIcon;
      } else {
        passKey4();
        timer = setInterval(() => {
          passKey4();
        }, 9e3);
        btn.style.backgroundColor = buttonColor;
        btn.innerHTML = Icons.stopIcon;
      }
    });
    document.body.appendChild(panel);
  });

})();