小编Cri*_*ero的帖子

SetimeOut间隔失败,并显示“无法将未定义或null转换为对象”

我正在使用tampermonkey进入用户脚本编写,并且无法解决此错误,我们将不胜感激。

我检测到很好的按键,只要按键保持在向下位置,空格键就会触发此功能,该功能会重复执行。控制台通常在大约30秒内写入输出,然后出现TypeError。

根据声誉限制,以下是屏幕截图:

用户脚本:

// ==UserScript==
// @name         TEST STUFF--------------------
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @run-at         document-start
// @include        http://*
// @include        https://*
// @grant        none
// ==/UserScript==

( function()
{
    'use strict';
    window.addEventListener ( "keydown", CaptureKeyPress );
    window.addEventListener ( "keyup", CaptureKeyPress );
    var Hotkeys =
    {
        perform: 32
    };
    var HotkeyToggle = false;
    function CaptureKeyPress ( a )
    {
        if ( a.keyCode == Hotkeys.perform )
        { …
Run Code Online (Sandbox Code Playgroud)

javascript userscripts tampermonkey

5
推荐指数
1
解决办法
504
查看次数

标签 统计

javascript ×1

tampermonkey ×1

userscripts ×1