v1.2 原始版本 - UI重设计前的备份

This commit is contained in:
Developer
2026-03-10 23:12:18 +08:00
commit 0a834cb9f6
6 changed files with 3070 additions and 0 deletions
+1165
View File
File diff suppressed because it is too large Load Diff
+1800
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

+45
View File
@@ -0,0 +1,45 @@
{
"manifest_version": 3,
"name": "涩花塘磁力助手",
"version": "1.2",
"description": "一键获取当前页所有帖子的磁力链接",
"permissions": [
"activeTab",
"clipboardWrite",
"storage",
"unlimitedStorage"
],
"host_permissions": [
"http://sehuatang.net/*",
"http://www.sehuatang.net/*",
"http://sehuatang.org/*",
"http://www.sehuatang.org/*",
"https://sehuatang.net/*",
"https://www.sehuatang.net/*",
"https://sehuatang.org/*",
"https://www.sehuatang.org/*"
],
"content_scripts": [
{
"matches": [
"http://sehuatang.net/*",
"http://www.sehuatang.net/*",
"http://sehuatang.org/*",
"http://www.sehuatang.org/*",
"https://sehuatang.net/*",
"https://www.sehuatang.net/*",
"https://sehuatang.org/*",
"https://www.sehuatang.org/*"
],
"js": ["content.js"],
"run_at": "document_idle"
}
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_title": "涩花塘磁力助手",
"default_popup": "popup.html"
}
}
+27
View File
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<style>
body { width: 200px; padding: 15px; font-family: Arial; }
h3 { margin: 0 0 10px; font-size: 14px; }
p { font-size: 12px; color: #666; margin: 5px 0; }
button {
width: 100%;
padding: 8px;
background: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
button:hover { background: #45a049; }
</style>
</head>
<body>
<h3>磁力链接复制助手</h3>
<p>在论坛页面提取当前页磁力链接并复制到剪贴板</p>
<button id="copyBtn">手动复制当前页面</button>
<script src="popup.js"></script>
</body>
</html>
+33
View File
@@ -0,0 +1,33 @@
document.getElementById('copyBtn').addEventListener('click', function() {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
var activeTab = tabs && tabs[0];
if (!activeTab || typeof activeTab.id !== 'number') {
alert('未找到当前标签页');
return;
}
chrome.tabs.sendMessage(activeTab.id, { action: 'getMagnets' }, function(response) {
if (chrome.runtime.lastError) {
alert('当前页面不支持,请在涩花塘论坛页面使用');
return;
}
var magnets = response && Array.isArray(response.magnets) ? response.magnets : [];
magnets = Array.from(new Set(magnets));
if (magnets.length === 0) {
alert('当前页面未找到磁力链接');
return;
}
navigator.clipboard.writeText(magnets.join('\n'))
.then(function() {
alert('已复制 ' + magnets.length + ' 个磁力链接!');
})
.catch(function(err) {
var errorMsg = err && err.message ? err.message : '复制失败';
alert('复制失败:' + errorMsg);
});
});
});
});