commit 1341bae5622e8d016e4ca5e2b10d7c4811d3932e Author: 453530270@qq.com Date: Sat Oct 5 18:40:32 2024 +0800 项目初始化 diff --git a/douyin/background.js b/douyin/background.js new file mode 100644 index 0000000..95ebb56 --- /dev/null +++ b/douyin/background.js @@ -0,0 +1,24 @@ +console.log('抖音扩展背景脚本已加载'); + +chrome.runtime.onInstalled.addListener(() => { + console.log("抖音扩展已安装"); +}); + +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.action === 'openIncognitoDouyin') { + chrome.windows.create({ + incognito: true, + url: "https://www.douyin.com" + }, function(window) { + console.log('抖音隐身窗口已打开'); + // 这里可以添加自动登录的逻辑 + }); + } else if (request.action === 'openLiveIncognito') { + chrome.windows.create({ + incognito: true, + url: request.url + }, function(window) { + console.log('直播隐身窗口已打开'); + }); + } +}); \ No newline at end of file diff --git a/douyin/manifest.json b/douyin/manifest.json new file mode 100644 index 0000000..0800d70 --- /dev/null +++ b/douyin/manifest.json @@ -0,0 +1,16 @@ +{ + "manifest_version": 3, + "name": "抖音圣火", + "version": "1.0", + "description": "控制浏览器打开抖音隐身窗口和指定直播窗口的扩展", + "permissions": [ + "tabs", + "storage" + ], + "background": { + "service_worker": "background.js" + }, + "action": { + "default_popup": "popup.html" + } +} \ No newline at end of file diff --git a/douyin/popup.html b/douyin/popup.html new file mode 100644 index 0000000..1c50e2b --- /dev/null +++ b/douyin/popup.html @@ -0,0 +1,38 @@ + + + + + 抖音圣火 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/douyin/popup.js b/douyin/popup.js new file mode 100644 index 0000000..2089189 --- /dev/null +++ b/douyin/popup.js @@ -0,0 +1,24 @@ +document.addEventListener('DOMContentLoaded', function() { + var openIncognitoButton = document.getElementById('openIncognito'); + var usernameInput = document.getElementById('username'); + var passwordInput = document.getElementById('password'); + + openIncognitoButton.addEventListener('click', function() { + const username = usernameInput.value; + const password = passwordInput.value; + + chrome.runtime.sendMessage({ + action: 'openIncognitoDouyin', + username: username, + password: password + }); + }); + + document.getElementById('openLive').addEventListener('click', () => { + const liveId = document.getElementById('liveId').value; + if (liveId) { + const liveUrl = `https://live.douyin.com/${liveId}`; + chrome.runtime.sendMessage({ action: 'openLiveIncognito', url: liveUrl }); + } + }); +}); \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..53fe6fc --- /dev/null +++ b/readme.md @@ -0,0 +1 @@ +chrome 插件 \ No newline at end of file