Skip to content

Commit c5ed049

Browse files
authored
Add files via upload
0 parents  commit c5ed049

File tree

14 files changed

+2972
-0
lines changed

14 files changed

+2972
-0
lines changed

background.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* 拖拽即走 Chrome 插件 - 背景脚本
3+
* 处理标签页操作和消息传递
4+
*/
5+
6+
/**
7+
* 监听来自内容脚本的消息
8+
*/
9+
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
10+
if (request.action === 'openTab') {
11+
openNewTab(request.url);
12+
sendResponse({ success: true });
13+
}
14+
return true; // 保持消息通道开放
15+
});
16+
17+
/**
18+
* 在新标签页中打开URL
19+
* @param {string} url - 要打开的URL
20+
*/
21+
async function openNewTab(url) {
22+
try {
23+
// 创建新标签页并激活
24+
await chrome.tabs.create({
25+
url: url,
26+
active: true // 在前台打开并激活
27+
});
28+
} catch (error) {
29+
// 错误处理已移除调试信息
30+
}
31+
}
32+
33+
/**
34+
* 插件安装时的初始化
35+
*/
36+
chrome.runtime.onInstalled.addListener((details) => {
37+
if (details.reason === 'install') {
38+
// 首次安装时设置默认配置
39+
chrome.storage.sync.set({
40+
blacklist: [
41+
'*.trello.com/*',
42+
'*.figma.com/*',
43+
'*.miro.com/*',
44+
'*.draw.io/*'
45+
]
46+
});
47+
48+
// 打开选项页面
49+
chrome.runtime.openOptionsPage();
50+
}
51+
});

content.css

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
/**
2+
* 拖拽即走 Chrome 插件 - 样式文件
3+
* 为拖拽提示和视觉反馈提供样式
4+
*/
5+
6+
/* 通用变量定义 */
7+
:root {
8+
--primary-gradient: linear-gradient(135deg, #667eea, #764ba2);
9+
--primary-shadow: 0 8px 32px rgba(102, 126, 234, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
10+
--primary-color: rgba(102, 126, 234, 0.95);
11+
--secondary-color: rgba(118, 75, 162, 0.95);
12+
--border-radius-sm: 8px;
13+
--border-radius-md: 12px;
14+
--border-radius-lg: 16px;
15+
--transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
16+
--font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
17+
}
18+
19+
.drag-to-go-tooltip {
20+
position: fixed !important;
21+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
22+
color: white !important;
23+
padding: 8px 16px !important;
24+
border-radius: var(--border-radius-md) !important;
25+
font: 600 13px/1.3 var(--font-system) !important;
26+
z-index: 2147483647 !important;
27+
pointer-events: none !important;
28+
display: none !important;
29+
box-shadow: var(--primary-shadow) !important;
30+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
31+
backdrop-filter: blur(12px) !important;
32+
-webkit-backdrop-filter: blur(12px) !important;
33+
white-space: nowrap !important;
34+
max-width: 320px !important;
35+
overflow: hidden !important;
36+
text-overflow: ellipsis !important;
37+
letter-spacing: 0.5px !important;
38+
transform: translateY(-2px) !important;
39+
transition: var(--transition-smooth) !important;
40+
}
41+
42+
/* 拖拽时的鼠标样式 */
43+
body.drag-to-go-dragging {
44+
cursor: grabbing !important;
45+
user-select: none !important;
46+
-webkit-user-select: none !important;
47+
}
48+
49+
/* 拖拽预览元素 */
50+
.drag-to-go-preview {
51+
position: fixed !important;
52+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95)) !important;
53+
border: 2px solid transparent !important;
54+
background-clip: padding-box !important;
55+
border-radius: var(--border-radius-lg) !important;
56+
padding: 12px 16px !important;
57+
font: 600 13px var(--font-system) !important;
58+
z-index: 2147483647 !important;
59+
pointer-events: none !important;
60+
display: flex !important;
61+
align-items: center !important;
62+
gap: 12px !important;
63+
box-shadow: 0 12px 40px rgba(102, 126, 234, 0.25), 0 4px 16px rgba(0, 0, 0, 0.1) !important;
64+
backdrop-filter: blur(16px) !important;
65+
-webkit-backdrop-filter: blur(16px) !important;
66+
max-width: 320px !important;
67+
transform: rotate(-1deg) scale(1.02) !important;
68+
transition: var(--transition-smooth) !important;
69+
}
70+
71+
/* 为预览元素添加渐变边框效果 */
72+
.drag-to-go-preview::before {
73+
content: '' !important;
74+
position: absolute !important;
75+
top: -2px !important;
76+
left: -2px !important;
77+
right: -2px !important;
78+
bottom: -2px !important;
79+
background: linear-gradient(135deg, #667eea, #764ba2, #667eea) !important;
80+
border-radius: 18px !important;
81+
z-index: -1 !important;
82+
opacity: 0.6 !important;
83+
}
84+
85+
.drag-to-go-preview:hover {
86+
transform: rotate(0deg) scale(1.08) !important;
87+
box-shadow: 0 16px 48px rgba(102, 126, 234, 0.35), 0 6px 20px rgba(0, 0, 0, 0.15) !important;
88+
}
89+
90+
/* 预览图标 */
91+
.drag-to-go-preview .preview-icon {
92+
font-size: 20px !important;
93+
flex-shrink: 0 !important;
94+
line-height: 1 !important;
95+
background: linear-gradient(135deg, #667eea, #764ba2) !important;
96+
-webkit-background-clip: text !important;
97+
-webkit-text-fill-color: transparent !important;
98+
background-clip: text !important;
99+
filter: drop-shadow(0 1px 2px rgba(102, 126, 234, 0.3)) !important;
100+
}
101+
102+
/* 预览文本 */
103+
.drag-to-go-preview .preview-text {
104+
color: #1a202c !important;
105+
white-space: nowrap !important;
106+
overflow: hidden !important;
107+
text-overflow: ellipsis !important;
108+
max-width: 260px !important;
109+
line-height: 1.4 !important;
110+
font-weight: 600 !important;
111+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
112+
}
113+
114+
/* 预览图片 */
115+
.drag-to-go-preview .preview-image {
116+
width: 36px !important;
117+
height: 36px !important;
118+
object-fit: cover !important;
119+
border-radius: 8px !important;
120+
border: 2px solid rgba(255, 255, 255, 0.8) !important;
121+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
122+
transition: all 0.2s ease !important;
123+
}
124+
125+
.drag-to-go-preview .preview-image:hover {
126+
transform: scale(1.05) !important;
127+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
128+
}
129+
130+
/* 拖拽时预览元素的动画 */
131+
@keyframes drag-preview-appear {
132+
0% {
133+
opacity: 0;
134+
transform: scale(0.6) rotate(-8deg) translateY(20px);
135+
filter: blur(4px);
136+
}
137+
50% {
138+
opacity: 0.8;
139+
transform: scale(1.1) rotate(-2deg) translateY(-5px);
140+
filter: blur(1px);
141+
}
142+
100% {
143+
opacity: 1;
144+
transform: scale(1.02) rotate(-1deg) translateY(0);
145+
filter: blur(0);
146+
}
147+
}
148+
149+
.drag-to-go-preview {
150+
animation: drag-preview-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
151+
}
152+
153+
/* 拖拽时选中文本的样式 */
154+
.drag-to-go-selected-text {
155+
background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25)) !important;
156+
border-radius: 4px !important;
157+
box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.3) !important;
158+
animation: text-selection-pulse 1.5s ease-in-out infinite !important;
159+
}
160+
161+
/* 拖拽时图片的样式 */
162+
img.drag-to-go-dragging {
163+
opacity: 0.8 !important;
164+
transform: scale(0.98) rotate(-1deg) !important;
165+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
166+
filter: brightness(1.1) saturate(1.2) !important;
167+
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
168+
border-radius: 1px !important;
169+
}
170+
171+
/* 拖拽时链接的样式 */
172+
a.drag-to-go-dragging {
173+
opacity: 0.9 !important;
174+
text-decoration: none !important;
175+
background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15)) !important;
176+
border-radius: 6px !important;
177+
padding: 2px 4px !important;
178+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
179+
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2) !important;
180+
transform: translateY(-1px) !important;
181+
}
182+
183+
/* 动画效果 */
184+
@keyframes drag-to-go-pulse {
185+
0% {
186+
transform: scale(1) translateY(-2px);
187+
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
188+
}
189+
50% {
190+
transform: scale(1.08) translateY(-4px);
191+
box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
192+
}
193+
100% {
194+
transform: scale(1) translateY(-2px);
195+
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
196+
}
197+
}
198+
199+
/* 文本选中脉冲动画 */
200+
@keyframes text-selection-pulse {
201+
0%, 100% {
202+
box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.3);
203+
}
204+
50% {
205+
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5), 0 0 8px rgba(102, 126, 234, 0.3);
206+
}
207+
}
208+
209+
/* 拖拽状态下的全局动画 */
210+
@keyframes drag-glow {
211+
0%, 100% {
212+
filter: drop-shadow(0 0 4px rgba(102, 126, 234, 0.3));
213+
}
214+
50% {
215+
filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.6));
216+
}
217+
}
218+
219+
.drag-to-go-tooltip.show {
220+
animation: drag-to-go-pulse 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
221+
}

0 commit comments

Comments
 (0)