commit
1341bae562
5 changed files with 103 additions and 0 deletions
@ -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('直播隐身窗口已打开'); |
|||
}); |
|||
} |
|||
}); |
|||
@ -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" |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>抖音圣火</title> |
|||
<style> |
|||
body { |
|||
width: 200px; |
|||
padding: 10px; |
|||
} |
|||
input, button { |
|||
width: 100%; |
|||
margin-top: 5px; |
|||
margin-bottom: 10px; |
|||
} |
|||
label { |
|||
display: block; |
|||
margin-top: 10px; |
|||
font-weight: bold; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<label for="username">账号:</label> |
|||
<input type="text" id="username" placeholder="输入账号"> |
|||
|
|||
<label for="password">密码:</label> |
|||
<input type="password" id="password" placeholder="输入密码"> |
|||
|
|||
<button id="openIncognito">打开抖音隐身窗口</button> |
|||
|
|||
<label for="liveId">直播间ID:</label> |
|||
<input type="text" id="liveId" placeholder="输入直播间ID"> |
|||
|
|||
<button id="openLive">打开直播窗口</button> |
|||
<script src="popup.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -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 }); |
|||
} |
|||
}); |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
chrome 插件 |
|||
Loading…
Reference in new issue