第一次提交
This commit is contained in:
commit
c787a2cd3a
5
.idea/.gitignore
vendored
Normal file
5
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
8
.idea/AIfuzhuchajian.iml
Normal file
8
.idea/AIfuzhuchajian.iml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (text translation)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
7
.idea/inspectionProfiles/Project_Default.xml
Normal file
7
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (text translation)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/AIfuzhuchajian.iml" filepath="$PROJECT_DIR$/.idea/AIfuzhuchajian.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
117
background.js
Normal file
117
background.js
Normal file
@ -0,0 +1,117 @@
|
||||
// Chrome扩展后台脚本 - 移除验证功能版
|
||||
// 版本: 1.2.0
|
||||
|
||||
// 图标状态管理
|
||||
let currentIconState = 'default';
|
||||
let iconTimeout = null;
|
||||
|
||||
// 扩展安装时的初始化
|
||||
chrome.runtime.onInstalled.addListener((details) => {
|
||||
console.log('AI助手增强工具扩展已安装');
|
||||
|
||||
if (details.reason === 'install') {
|
||||
console.log('首次安装完成');
|
||||
} else if (details.reason === 'update') {
|
||||
console.log('扩展已更新到版本', chrome.runtime.getManifest().version);
|
||||
}
|
||||
|
||||
// 初始化默认状态
|
||||
updateExtensionIcon('default');
|
||||
});
|
||||
|
||||
// 监听来自content script的消息
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
if (request.action === 'resetComplete') {
|
||||
// 记录增强功能启用
|
||||
console.log(`增强功能已启用: ${request.site}`, request);
|
||||
|
||||
// 更新扩展图标
|
||||
updateExtensionIcon('success');
|
||||
|
||||
// 3秒后恢复默认图标
|
||||
if (iconTimeout) clearTimeout(iconTimeout);
|
||||
iconTimeout = setTimeout(() => {
|
||||
updateExtensionIcon('default');
|
||||
}, 3000);
|
||||
|
||||
sendResponse({ received: true });
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 监听标签页更新
|
||||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
// 只在页面加载完成时处理
|
||||
if (changeInfo.status === 'complete' && tab.url) {
|
||||
handleTabUrlChange(tab.url);
|
||||
}
|
||||
});
|
||||
|
||||
// 监听标签页切换
|
||||
chrome.tabs.onActivated.addListener(async (activeInfo) => {
|
||||
try {
|
||||
const tab = await chrome.tabs.get(activeInfo.tabId);
|
||||
if (tab.url) {
|
||||
handleTabUrlChange(tab.url);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取标签页信息失败:', error);
|
||||
// 出错时重置为默认状态
|
||||
updateExtensionIcon('default');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 处理标签页URL变化
|
||||
* @param {string} url - 标签页URL
|
||||
*/
|
||||
function handleTabUrlChange(url) {
|
||||
try {
|
||||
const urlObj = new URL(url);
|
||||
const supportedSites = ['matrix.tencent.com', 'www.badstudent.ai'];
|
||||
|
||||
if (supportedSites.includes(urlObj.hostname)) {
|
||||
console.log(`检测到支持的网站: ${urlObj.hostname}`);
|
||||
updateExtensionIcon('active');
|
||||
} else {
|
||||
// 只有当前状态不是默认状态时才更新
|
||||
if (currentIconState !== 'default') {
|
||||
updateExtensionIcon('default');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('解析URL失败:', error);
|
||||
// URL无效时重置为默认状态
|
||||
if (currentIconState !== 'default') {
|
||||
updateExtensionIcon('default');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新扩展标题
|
||||
* @param {string} state - 状态: 'default', 'active', 'success'
|
||||
*/
|
||||
function updateExtensionIcon(state) {
|
||||
// 避免不必要的更新
|
||||
if (currentIconState === state) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentIconState = state;
|
||||
let title;
|
||||
|
||||
switch (state) {
|
||||
case 'active':
|
||||
title = "AI增强助手 - 可用";
|
||||
break;
|
||||
case 'success':
|
||||
title = "AI增强助手 - 功能已启用";
|
||||
break;
|
||||
default:
|
||||
title = "AI增强助手";
|
||||
}
|
||||
|
||||
chrome.action.setTitle({ title: title })
|
||||
.catch(error => console.error('设置扩展标题失败:', error));
|
||||
}
|
||||
98
content.js
Normal file
98
content.js
Normal file
@ -0,0 +1,98 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// === 核心功能 ===
|
||||
function initEnhancements() {
|
||||
try {
|
||||
const hostname = window.location.hostname;
|
||||
console.log(`[Enhancement] 检测到网站: ${hostname}`);
|
||||
|
||||
if (hostname === 'matrix.tencent.com') {
|
||||
const key = 'fp';
|
||||
const value = generateRandomHex(32);
|
||||
setStorageItem(key, value, 'Zhuque');
|
||||
} else if (hostname === 'www.badstudent.ai') {
|
||||
const key = 'deviceId';
|
||||
const value = generateUUID();
|
||||
setStorageItem(key, value, 'BadStudentAI');
|
||||
} else {
|
||||
console.log('[Enhancement] 当前网站不在支持列表中');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[Enhancement] 初始化增强功能时出错:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 随机十六进制生成
|
||||
function generateRandomHex(length) {
|
||||
try {
|
||||
// 优先使用crypto API
|
||||
if (window.crypto && crypto.getRandomValues) {
|
||||
const array = new Uint8Array(length);
|
||||
crypto.getRandomValues(array);
|
||||
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
|
||||
// 回退到Math.random()
|
||||
const hex = '0123456789abcdef';
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += hex[Math.floor(Math.random() * 16)];
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('[Enhancement] 生成随机十六进制时出错:', error);
|
||||
return '00000000000000000000000000000000'; // 默认值
|
||||
}
|
||||
}
|
||||
|
||||
// UUID生成
|
||||
function generateUUID() {
|
||||
try {
|
||||
// 优先使用crypto API
|
||||
if (window.crypto && crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
// 回退实现
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
const r = Math.random() * 16 | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[Enhancement] 生成UUID时出错:', error);
|
||||
return '00000000-0000-0000-0000-000000000000'; // 默认值
|
||||
}
|
||||
}
|
||||
|
||||
// 存储设置
|
||||
function setStorageItem(key, value, site) {
|
||||
try {
|
||||
localStorage.setItem(key, value);
|
||||
console.log(`[${site} Enhancement] 已启用增强功能,${key}: ${value}`);
|
||||
|
||||
// 通知background
|
||||
if (chrome && chrome.runtime && chrome.runtime.sendMessage) {
|
||||
chrome.runtime.sendMessage({
|
||||
action: 'resetComplete',
|
||||
site: site,
|
||||
key: key,
|
||||
value: value
|
||||
}).catch(error => {
|
||||
console.error('[Enhancement] 发送消息到background失败:', error);
|
||||
});
|
||||
}
|
||||
} catch(error) {
|
||||
console.error('[Enhancement] 设置存储项失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后初始化增强功能
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initEnhancements);
|
||||
} else {
|
||||
initEnhancements();
|
||||
}
|
||||
|
||||
})();
|
||||
1
icons/icon.svg
Normal file
1
icons/icon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 24 24"><path fill="currentColor" d="M21 11V9h-2V7a2.006 2.006 0 0 0-2-2h-2V3h-2v2h-2V3H9v2H7a2.006 2.006 0 0 0-2 2v2H3v2h2v2H3v2h2v2a2.006 2.006 0 0 0 2 2h2v2h2v-2h2v2h2v-2h2a2.006 2.006 0 0 0 2-2v-2h2v-2h-2v-2Zm-4 6H7V7h10Z"/><path fill="currentColor" d="M11.361 8h-1.345l-2.01 8h1.027l.464-1.875h2.316L12.265 16h1.062Zm-1.729 5.324L10.65 8.95h.046l.983 4.374ZM14.244 8h1v8h-1z"/></svg>
|
||||
|
After Width: | Height: | Size: 465 B |
38
manifest.json
Normal file
38
manifest.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "AI 增强助手",
|
||||
"version": "1.2.0",
|
||||
"description": "提升用户使用AI的体验体验",
|
||||
|
||||
"permissions": [
|
||||
"storage",
|
||||
"activeTab",
|
||||
"tabs",
|
||||
"alarms"
|
||||
],
|
||||
|
||||
"host_permissions": [
|
||||
"https://matrix.tencent.com/*",
|
||||
"https://www.badstudent.ai/*"
|
||||
],
|
||||
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"https://matrix.tencent.com/*",
|
||||
"https://www.badstudent.ai/*"
|
||||
],
|
||||
"js": ["content.js"],
|
||||
"run_at": "document_start"
|
||||
}
|
||||
],
|
||||
|
||||
"background": {
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_title": "AI 增强助手"
|
||||
}
|
||||
}
|
||||
499
popup.css
Normal file
499
popup.css
Normal file
@ -0,0 +1,499 @@
|
||||
/* Chrome扩展弹窗样式 - 重构版 */
|
||||
:root {
|
||||
/* 颜色变量 */
|
||||
--primary-color: #667eea;
|
||||
--secondary-color: #764ba2;
|
||||
--success-color: #00c851;
|
||||
--danger-color: #ff4444;
|
||||
--warning-color: #ffbb33;
|
||||
--info-color: #33b5e5;
|
||||
--text-color: #333;
|
||||
--text-light: #666;
|
||||
--bg-white: #ffffff;
|
||||
--bg-light: #f8f9fa;
|
||||
--border-color: #e1e5e9;
|
||||
--border-light: #f0f0f0;
|
||||
|
||||
/* 尺寸变量 */
|
||||
--border-radius-sm: 4px;
|
||||
--border-radius-md: 8px;
|
||||
--border-radius-lg: 12px;
|
||||
--spacing-xs: 4px;
|
||||
--spacing-sm: 8px;
|
||||
--spacing-md: 12px;
|
||||
--spacing-lg: 16px;
|
||||
--spacing-xl: 20px;
|
||||
|
||||
/* 阴影变量 */
|
||||
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
--shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.15);
|
||||
|
||||
/* 动画变量 */
|
||||
--transition-fast: 0.2s ease;
|
||||
--transition-normal: 0.3s ease;
|
||||
--transition-slow: 0.5s ease;
|
||||
}
|
||||
|
||||
/* 暗色模式变量 */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--text-color: #f0f0f0;
|
||||
--text-light: #cccccc;
|
||||
--bg-white: #2a2a2a;
|
||||
--bg-light: #3a3a3a;
|
||||
--border-color: #444444;
|
||||
--border-light: #555555;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 380px;
|
||||
min-height: 500px;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
||||
color: var(--text-color);
|
||||
transition: background var(--transition-normal), color var(--transition-normal);
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: var(--spacing-xl);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
/* 头部样式 */
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 0;
|
||||
color: var(--bg-white);
|
||||
animation: fadeIn 0.8s ease;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(-10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 32px;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
transition: transform var(--transition-normal);
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.logo:hover {
|
||||
transform: scale(1.1) rotate(5deg);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.version {
|
||||
font-size: 12px;
|
||||
opacity: 0.8;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* 状态卡片 */
|
||||
.status-section {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.status-card {
|
||||
background: var(--bg-white);
|
||||
border-radius: var(--border-radius-lg);
|
||||
padding: var(--spacing-lg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.status-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.status-card.activated {
|
||||
border-left: 4px solid var(--success-color);
|
||||
}
|
||||
|
||||
.status-card.not-activated {
|
||||
border-left: 4px solid var(--danger-color);
|
||||
}
|
||||
|
||||
.status-icon {
|
||||
font-size: 24px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: var(--bg-light);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.status-card:hover .status-icon {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.status-text {
|
||||
flex: 1;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 网站列表 */
|
||||
.sites-section {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
color: var(--bg-white);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin-bottom: var(--spacing-md);
|
||||
opacity: 0.9;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.sites-list {
|
||||
background: var(--bg-white);
|
||||
border-radius: var(--border-radius-lg);
|
||||
overflow: hidden;
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.sites-list:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.site-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
gap: var(--spacing-md);
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.site-item:hover {
|
||||
background-color: rgba(102, 126, 234, 0.05);
|
||||
}
|
||||
|
||||
.site-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.site-icon {
|
||||
font-size: 20px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--border-radius-md);
|
||||
background: var(--bg-light);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.site-item:hover .site-icon {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.site-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.site-name {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.site-url {
|
||||
font-size: 11px;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.site-status {
|
||||
font-size: 11px;
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--border-radius-sm);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.site-status.active {
|
||||
background: #d4f5d4;
|
||||
color: #00875a;
|
||||
}
|
||||
|
||||
.site-status.inactive {
|
||||
background: #ffebe6;
|
||||
color: #de350b;
|
||||
}
|
||||
|
||||
/* 按钮样式 */
|
||||
.actions-section {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
border: none;
|
||||
border-radius: var(--border-radius-md);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--spacing-sm);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.btn:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--success-color);
|
||||
color: var(--bg-white);
|
||||
box-shadow: 0 4px 12px rgba(0, 200, 81, 0.3);
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
background: #00a844;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.btn-primary:disabled {
|
||||
background: #ccc;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: var(--bg-white);
|
||||
color: var(--primary-color);
|
||||
border: 2px solid var(--primary-color);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: var(--primary-color);
|
||||
color: var(--bg-white);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.btn-activate {
|
||||
background: var(--primary-color);
|
||||
color: var(--bg-white);
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 10px 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-activate:hover {
|
||||
background: #5a6fd8;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
font-size: 16px;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.btn:hover .btn-icon {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
/* 激活区域 */
|
||||
.activation-section {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.activation-input {
|
||||
flex: 1;
|
||||
padding: 10px 12px;
|
||||
border: 2px solid #e1e5e9;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
text-transform: uppercase;
|
||||
outline: none;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
.activation-input:focus {
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
/* 已激活信息 */
|
||||
.activated-info {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.info-value.success {
|
||||
color: #00c851;
|
||||
}
|
||||
|
||||
/* 消息提示 */
|
||||
.message {
|
||||
padding: 10px 12px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.message.success {
|
||||
background: #d4f5d4;
|
||||
color: #00875a;
|
||||
border: 1px solid #79e2f2;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
background: #ffe6e6;
|
||||
color: #d93651;
|
||||
border: 1px solid #ffc6cb;
|
||||
}
|
||||
|
||||
/* 帮助区域 */
|
||||
.help-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.help-details {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.help-summary {
|
||||
padding: 12px 16px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
list-style: none;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.help-summary:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.help-summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.help-summary::before {
|
||||
content: '▶';
|
||||
margin-right: 8px;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.help-details[open] .help-summary::before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.help-content {
|
||||
padding: 0 16px 16px;
|
||||
color: white;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.help-content ol {
|
||||
margin-bottom: 12px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.help-content li {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.help-note {
|
||||
padding: 10px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.footer {
|
||||
text-align: center;
|
||||
color: white;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.footer-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 动画 */
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
.loading {
|
||||
animation: pulse 1.5s infinite;
|
||||
}
|
||||
61
popup.html
Normal file
61
popup.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AI 增强助手</title>
|
||||
<link rel="stylesheet" href="popup.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- 头部 -->
|
||||
<header class="header">
|
||||
<div class="logo">🔑</div>
|
||||
<h1 class="title">AI 增强助手</h1>
|
||||
<div class="version">v1.2.0</div>
|
||||
</header>
|
||||
|
||||
<!-- 状态显示 -->
|
||||
<div class="status-section">
|
||||
<div id="activation-status" class="status-card">
|
||||
<div class="status-icon">⏳</div>
|
||||
<div class="status-text">加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 已激活信息 -->
|
||||
<div id="activated-info" class="activated-info" style="display: none;">
|
||||
<div class="info-item">
|
||||
<span class="info-label">状态:</span>
|
||||
<span id="current-status" class="info-value success">已启用</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">使用限制:</span>
|
||||
<span id="expiry-date" class="info-value">无限制</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 帮助信息 -->
|
||||
<div class="help-section">
|
||||
<details class="help-details">
|
||||
<summary class="help-summary">使用说明</summary>
|
||||
<div class="help-content">
|
||||
<ol>
|
||||
<li>访问支持的AI网站</li>
|
||||
<li>扩展会自动启用增强功能</li>
|
||||
</ol>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- 底部 -->
|
||||
<footer class="footer">
|
||||
<div class="footer-text">
|
||||
Chrome Extension v1.2.0
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
60
popup.js
Normal file
60
popup.js
Normal file
@ -0,0 +1,60 @@
|
||||
// 安全popup脚本 - 移除验证功能版
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
console.log('Popup模块已加载');
|
||||
|
||||
// 显示状态信息
|
||||
function showStatus(message, isSuccess = true) {
|
||||
const statusDiv = document.getElementById('activation-status');
|
||||
if (!statusDiv) {
|
||||
console.error('未找到状态元素');
|
||||
return;
|
||||
}
|
||||
|
||||
const icon = isSuccess ? '✅' : '❌';
|
||||
statusDiv.innerHTML = `
|
||||
<div class="status-icon">${icon}</div>
|
||||
<div class="status-text">${message}</div>
|
||||
`;
|
||||
statusDiv.className = `status-card ${isSuccess ? 'activated' : 'not-activated'}`;
|
||||
}
|
||||
|
||||
// 显示已激活信息
|
||||
function showActivatedInfo() {
|
||||
// 隐藏激活相关区域
|
||||
const activationSection = document.getElementById('activation-section');
|
||||
if (activationSection) activationSection.style.display = 'none';
|
||||
|
||||
// 显示已激活信息
|
||||
const activatedInfo = document.getElementById('activated-info');
|
||||
if (activatedInfo) {
|
||||
activatedInfo.style.display = 'block';
|
||||
|
||||
// 更新信息显示
|
||||
const statusSpan = document.getElementById('current-status');
|
||||
const expirySpan = document.getElementById('expiry-date');
|
||||
|
||||
if (statusSpan) statusSpan.textContent = '已启用';
|
||||
if (expirySpan) expirySpan.textContent = '无限制';
|
||||
}
|
||||
|
||||
// 隐藏重新激活按钮
|
||||
const reactivateBtn = document.getElementById('reactivate-btn');
|
||||
if (reactivateBtn) reactivateBtn.style.display = 'none';
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('DOMContentLoaded事件触发');
|
||||
|
||||
try {
|
||||
// 直接显示已激活状态
|
||||
showStatus('功能已启用', true);
|
||||
showActivatedInfo();
|
||||
} catch (error) {
|
||||
console.error('Popup初始化失败:', error);
|
||||
showStatus('初始化失败', false);
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
25
安装说明.txt
Normal file
25
安装说明.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# AI 助手增强工具
|
||||
|
||||
## 安装步骤:
|
||||
|
||||
1. 打开Chrome浏览器
|
||||
2. 访问 chrome://extensions/
|
||||
3. 开启"开发者模式"(右上角开关)
|
||||
4. 点击"加载已解压的扩展程序"
|
||||
5. 选择这个文件夹(chrome-extension)
|
||||
6. 安装完成!
|
||||
|
||||
## 使用方法:
|
||||
|
||||
1. 访问支持的AI网站
|
||||
2. 启动后扩展会自动启用增强功能
|
||||
3. 许可证状态会自动保存
|
||||
|
||||
## 注意事项:
|
||||
- 如有问题请联系技术支持
|
||||
|
||||
## 版本信息:
|
||||
|
||||
- 版本:1.2.0
|
||||
- 支持:Chrome Manifest V3
|
||||
- 更新日期:2025年
|
||||
Loading…
Reference in New Issue
Block a user