lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.35k stars 71 forks source link

安装的server:xxx脚本无法把__vite-plugin-monkey.entry.js的script元素挂载到document.head元素上 #157

Closed WhiteSevs closed 4 months ago

WhiteSevs commented 4 months ago

环境

浏览器:百分浏览器 扩展:篡改猴(5.1.1)

@match https://www.douyin.com/search/*
@run-at document-start

截图

02b972dc318da5804e200962c10cca01

8b0c66398b39976b06778d9a39de190e

lisonge commented 4 months ago

使用 chrome 是否出现此问题?

WhiteSevs commented 4 months ago

使用 chrome 是否出现此问题?

chrome倒是挺正常的

lisonge commented 4 months ago

那就是 百分浏览器 的问题了,你换 chrome 就行

WhiteSevs commented 4 months ago

ok,还有其他问题在讨论区了,麻烦大佬看看能否解决😄 https://github.com/lisonge/vite-plugin-monkey/discussions/165

WhiteSevs commented 3 months ago

今天用Edge和篡改猴最新的测试版又试出来了 @lisonge

if (document.head) {
    if (document.head.firstChild) {
        document.head.insertBefore(entryScript, document.head.firstChild);
    } else {
        document.head.appendChild(entryScript);
    }
} else {
    if (document.documentElement.firstChild) {
        document.documentElement.insertBefore(
            entryScript,
            document.documentElement.firstChild
        );
    } else {
        document.documentElement.appendChild(entryScript);
    }
}

https://github.com/lisonge/vite-plugin-monkey/assets/50544447/03c2f287-b76c-458b-971a-bea4b92d31db