MCPcopy Create free account
hub / github.com/Yantesoft/LinuxdoAssistant / jumpWithRandomDelay

Function jumpWithRandomDelay

linuxdo-helper.user.js:781–791  ·  view source on GitHub ↗

* 随机延时后跳转 * @param {string} url - 目标地址 * @param {number} minDelay - 最小延时 * @param {number} maxDelay - 最大延时 * @param {string} message - 日志信息

(url, minDelay, maxDelay, message = '准备跳转')

Source from the content-addressed store, hash-verified

779 * @param {string} message - 日志信息
780 */
781 function jumpWithRandomDelay(url, minDelay, maxDelay, message = '准备跳转') {
782 const delay = randomDelay(minDelay, maxDelay);
783
784 console.log(`${message},${delay}ms 后执行`);
785
786 setTimeout(() => {
787 if (getSwitchState()) {
788 window.location.href = url;
789 }
790 }, delay);
791 }
792
793 /**
794 * 加载并跳转到新页面

Callers 1

loadPageFunction · 0.85

Calls 2

randomDelayFunction · 0.85
getSwitchStateFunction · 0.85

Tested by

no test coverage detected