您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Eine nützliche Bibliothek für verschiedene Funktionen
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/528459/1545384/UTILS_FUNCTION%20Library.js
- // ==UserScript==
- // @name UTILS_FUNCTION Library
- // @namespace dannysaurus.epik
- // @version 1.0
- // @description library to modify functions and arrow functions
- //
- // @license MIT
- // ==/UserScript==
- /* jslint esversion: 11 */
- /* global unsafeWindow */
- (() => {
- 'use strict';
- unsafeWindow.dannysaurus_epik ||= {};
- unsafeWindow.dannysaurus_epik.libraries ||= {};
- unsafeWindow.dannysaurus_epik.libraries.UTILS_FUNCTION = (() => {
- /**
- * Throttle function calls with a timeOut between calls.
- *
- * The timeout is not reset if the function is called again before the timeout has expired.
- *
- * @param {Function} func - The function to throttle.
- * @param {number} waitMs - The time to wait between function calls in milliseconds.
- * @returns {Function} The throttled function.
- */
- const throttle = (func, waitMs) => {
- let timeout = null;
- let argumnentsForNextCall = null;
- // Funktion, die später aufgerufen wird
- const runAfterTimeout = () => {
- if (argumnentsForNextCall) {
- func.apply(null, argumnentsForNextCall);
- argumnentsForNextCall = null;
- timeout = setTimeout(runAfterTimeout, waitMs);
- } else {
- timeout = null;
- }
- };
- return (...args) => {
- if (!timeout) {
- func.apply(null, args);
- timeout = setTimeout(runAfterTimeout, waitMs);
- } else {
- argumnentsForNextCall = args;
- }
- };
- };
- return {
- throttle,
- };
- })();
- })();