如何修复 tampermonkey 脚本的问题

How to fix issue on tampermonkey script

我正在使用 tampermonkey 脚本,但出现此错误。我不知道如何解决这个问题。

来源

document.onkeypress = async function(e) {
    e = e || window.event;
    var charCode = (typeof e.which == "number") ? e.which : e.keyCode;
    if (String.fromCharCode(charCode) === '=') {
        const {
            value: formValues
        } = await Swal.fire({
            title: 'Enter your credentials ',
            html: '<input id="swal-input1" class="swal2-input" placeholder="email"
            type = "text"
            value = "kor@gmail.com" > ' +
            '<input id="swal-input2" class="swal2-input" placeholder="password"
            type = "password"
            value = "A23@" > ',
            focusConfirm: false,
            preConfirm: () => {
                return [
                    document.getElementById('swal-input1').value,
                    document.getElementById('swal-input2').value
                ][![enter image description here][1]][1]
            }
        })

脚本似乎缺少 + 个符号 ...

document.onkeypress = async function(e) {
    e = e || window.event;
    var charCode = (typeof e.which == "number") ? e.which : e.keyCode;
    if (String.fromCharCode(charCode) === '=') {
        const {
            value: formValues
        } = await Swal.fire({
            title: 'Enter your credentials ',
            html: '<input id="swal-input1" class="swal2-input"' + 'placeholder="email"' 
            +'type = "text"'
            +'value = "kor@gmail.com" > ' +
            '<input id="swal-input2" class="swal2-input" placeholder="password"'+
            'type = "password"'+
            'value = "A23@" > ',
            focusConfirm: false,
            preConfirm: () => {
                return [
                    document.getElementById('swal-input1').value,
                    document.getElementById('swal-input2').value
                ]
            }
        })

尝试使用 ` ... ` ;
您可以在 javascript 中搜索模板字符串。
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

document.onkeypress = async function(e) {
        e = e || window.event;
        var charCode = (typeof e.which == "number") ? e.which : e.keyCode;
        if (String.fromCharCode(charCode) === '=') {
            const {
                value: formValues
            } = await Swal.fire({
                title: 'Enter your credentials ',
                html: `<input id="swal-input1" class="swal2-input" placeholder="email" type = "text" value = "kor@gmail.com" >
                       <input id="swal-input2" class="swal2-input" placeholder="password" type = "password" value = "A23@" > `,
                focusConfirm: false,
                preConfirm: () => {
                    return [
                        document.getElementById('swal-input1').value,
                        document.getElementById('swal-input2').value
                    ]
                }
            })

另外,您可以像下面这样尝试;

html: '<input id="swal-input1" class="swal2-input" placeholder="email" type="text" value="kor@gmail.com"> <input id="swal-input2" class="swal2-input" placeholder="password" type="password" value="A23@" > ',