我试图注入一个链接到ChatGBT的左侧菜单栏使用Chrome扩展,类似于AIPRM for ChatGBT Chrome扩展正在插入额外的菜单项.
我正在使用以下内容,但不工作.
menifest.json:个
{
"name": "Auto Snippet AI",
"version": "1.0",
"description": "Inject a URL called 'https://autosnippet.ai/' to the left navigation bar of 'https://chat.openai.com/'",
"manifest_version": 3,
"permissions": [
"activeTab",
"tabs"
],
"icons": {
"16": "icon.png",
"32": "icon.png",
"48": "icon.png",
"128": "icon.png"
},
"content_scripts": [
{
"js": [
"content.js"
],
"matches": [
"https://chat.openai.com/*"
]
}
]
}
content.js:个
document.addEventListener('DOMContentLoaded', function () {
// Find the nav div
const nav = document.querySelector("#__next > div.overflow-hidden.w-full.h-full.relative.flex > div.dark.hidden.bg-gray-900.md\\:flex.md\\:w-\\[260px\\].md\\:flex-col > div > div > nav");
// Check if the nav div exists
if (nav) {
// Create a new link for the Auto Snippet AI website
const a = document.createElement('a');
a.classList.add('nav-item');
a.href = 'https://autosnippet.ai/';
a.target = '_blank';
a.innerText = 'Auto Snippet AI';
// Insert the link into the nav div
nav.insertBefore(a, nav.lastChild);
}
});
所以,我想注入一个链接"自动代码片断AI"在左侧菜单栏类似于AIPRM是注入一个链接"AIPRM for SEO Powered"时安装.任何建议和帮助都将受到高度赞赏.