tool.user.js

tool.user

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greasyfork.org/scripts/525123/1528092/tooluserjs.js

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

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

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ć!)

function getRandomNum(min, max) {
  if (min >= max) {
    throw new Error("Min must be less than max");
  }
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

/**
 * 模拟用户输入填充input元素
 * @param {HTMLInputElement} inputElement - 输入框元素
 * @param {string|number} value - 要填充的值
 */
function fillFormInput(inputElement, value) {
  let index = 0;
  value = value.toString();
  inputElement.value = "";

  // 使用文档片段减少DOM操作
  const docFragment = document.createDocumentFragment();
  const intervalId = setInterval(() => {
    if (index < value.length) {
      docFragment.textContent += value[index];
      inputElement.value = docFragment.textContent;
      const inputEvent = new Event("input", { bubbles: true });
      inputElement.dispatchEvent(inputEvent);
      index++;
    } else {
      clearInterval(intervalId);
    }
  }, 100);
}

function getRandomCharFrom(str) {
  const randomIndex = Math.floor(Math.random() * str.length);
  return str.charAt(randomIndex);
}

const leftKeyboardChars = "1234567890qwertyuiop[]asdfghjkl;'zxcvbnm,./";

function getRandomLeftKeyboardChar() {
  return getRandomCharFrom(leftKeyboardChars);
}