Skip to content

Commit 88dc6dd

Browse files
committed
Refacotor GM API and work a bit on popup
1 parent f6b24c9 commit 88dc6dd

File tree

19 files changed

+173
-123
lines changed

19 files changed

+173
-123
lines changed

build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cpSync('src/dashboard', join(outdir, 'dashboard'), { recursive: true });
1717
cpSync('src/editor', join(outdir, 'editor'), { recursive: true });
1818
cpSync('src/offscreen', join(outdir, 'offscreen'), { recursive: true });
1919
cpSync('src/popup', join(outdir, 'popup'), { recursive: true });
20+
cpSync('src/GM', join(outdir, 'GM'), { recursive: true });
2021

2122
cpSync('src/manifest.json', join(outdir, 'manifest.json'));
2223

@@ -33,10 +34,10 @@ build({
3334
'src/background/background.js',
3435
'src/utils/content_bridge.js',
3536
'src/utils/elementSelector.js',
36-
'src/utils/gm_core.js',
37+
'src/GM/gm_core.js',
3738
'src/utils/greasyfork_interceptor.js',
3839
'src/utils/inject.js',
39-
'src/utils/urlMatchPattern.js',
40+
'src/utils/urls.js',
4041
'src/popup/popup.js',
4142
'src/editor/editor.js',
4243
'src/dashboard/dashboard.js',
File renamed without changes.

src/assets/styles/d_script_list.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
text-overflow: ellipsis;
3939
}
4040

41+
.script-urls {
42+
font-size: var(--font-xs);
43+
color: var(--text-muted);
44+
margin-top: 4px;
45+
}
46+
4147
.script-actions {
4248
display: flex;
4349
align-items: center;

src/assets/styles/popup.css

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ header .buttons button span:not(.btn-icon) {
173173
flex: 1;
174174
min-width: 0;
175175
overflow: hidden;
176+
display: flex;
177+
flex-direction: column;
178+
justify-content: center;
179+
padding: 4px 0;
176180
}
177181

178182
.script-name {
@@ -182,14 +186,29 @@ header .buttons button span:not(.btn-icon) {
182186
white-space: nowrap;
183187
overflow: hidden;
184188
text-overflow: ellipsis;
189+
line-height: 1.2;
185190
}
186191

187192
.script-target {
188193
display: flex;
189194
align-items: center;
190-
gap: 6px;
195+
gap: 8px;
191196
font-size: 10px;
192197
color: var(--text-secondary);
198+
width: 100%;
199+
min-height: 16px;
200+
line-height: 1.2;
201+
}
202+
203+
.script-description {
204+
color: var(--text-secondary);
205+
font-size: 10px;
206+
opacity: 0.8;
207+
white-space: nowrap;
208+
overflow: hidden;
209+
text-overflow: ellipsis;
210+
max-width: 100%;
211+
display: inline;
193212
}
194213

195214
.script-type {
@@ -204,14 +223,11 @@ header .buttons button span:not(.btn-icon) {
204223
}
205224

206225
/* Toggle Switch */
207-
.script-toggle {
208-
flex-shrink: 0;
209-
}
210-
211226
.toggle-switch {
212227
position: relative;
213-
width: 36px;
228+
width: 38px;
214229
height: 20px;
230+
flex-shrink: 0;
215231
}
216232

217233
.toggle-switch input {
@@ -220,36 +236,36 @@ header .buttons button span:not(.btn-icon) {
220236
height: 0;
221237
}
222238

223-
.slider {
239+
.toggle-slider {
224240
position: absolute;
241+
cursor: pointer;
225242
inset: 0;
226243
background: var(--bg-tertiary);
244+
border-radius: var(--radius-full);
245+
transition: var(--transition-all);
227246
border: 1px solid var(--border-primary);
228-
border-radius: 10px;
229-
cursor: pointer;
230-
transition: all 0.2s;
231247
}
232248

233-
.slider:before {
234-
content: "";
249+
.toggle-slider:before {
235250
position: absolute;
236-
width: 14px;
251+
content: "";
237252
height: 14px;
253+
width: 14px;
238254
left: 2px;
239255
bottom: 2px;
240-
background: white;
256+
background: var(--text-secondary);
241257
border-radius: 50%;
242-
transition: all 0.2s;
243-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
258+
transition: var(--transition-transform);
244259
}
245260

246-
input:checked + .slider {
247-
background: var(--success);
248-
border-color: var(--success);
261+
.toggle-switch input:checked + .toggle-slider {
262+
background: var(--primary);
263+
border-color: var(--primary);
249264
}
250265

251-
input:checked + .slider:before {
252-
transform: translateX(16px);
266+
.toggle-switch input:checked + .toggle-slider:before {
267+
background: white;
268+
transform: translateX(18px);
253269
}
254270

255271
/* Dropdowns */

src/background/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { urlMatchesPattern } from "../utils/urlMatchPattern.js";
1+
import { urlMatchesPattern } from "../utils/urls.js";
22
import { injectScriptsForStage, INJECTION_TYPES } from "../utils/inject.js";
33

44
// State management

0 commit comments

Comments
 (0)