-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.html
276 lines (265 loc) · 6.62 KB
/
popup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>网页内容修改器</title>
<style>
body {
width: 400px;
padding: 20px;
font-family: Arial, sans-serif;
}
.section {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"], textarea {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
select {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
margin-right: 10px;
}
button:hover {
background-color: #45a049;
}
button.secondary {
background-color: #666;
}
button.secondary:hover {
background-color: #555;
}
button.delete {
background-color: #f44336;
}
button.delete:hover {
background-color: #da190b;
}
.help-text {
font-size: 12px;
color: #666;
margin-top: 5px;
}
.current-url {
word-break: break-all;
padding: 8px;
background: #f5f5f5;
border-radius: 4px;
margin-bottom: 10px;
}
.color-section {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.color-preview {
width: 30px;
height: 30px;
border: 1px solid #ddd;
border-radius: 4px;
}
input[type="color"] {
width: 50px;
height: 30px;
padding: 0;
border: none;
border-radius: 4px;
}
.rules-list {
margin-top: 20px;
border-top: 2px solid #eee;
padding-top: 20px;
}
.rule-item {
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
padding: 10px;
margin-bottom: 10px;
}
.rule-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.rule-title {
font-weight: bold;
}
.rule-actions {
display: flex;
gap: 5px;
}
.rule-content {
font-size: 12px;
color: #666;
}
.button-group {
display: flex;
gap: 10px;
margin-top: 15px;
}
.tab-buttons {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.tab-button {
padding: 8px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
background: #eee;
color: #333;
}
.tab-button.active {
background: #4CAF50;
color: white;
}
#ruleForm, #rulesList {
display: none;
}
.show {
display: block !important;
}
.rules-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.rules-header h3 {
margin: 0;
color: #333;
}
.rules-actions {
display: flex;
gap: 10px;
}
.error-message {
color: #f44336;
font-size: 12px;
margin-top: 5px;
}
.global-settings {
background: #f5f5f5;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
border: 1px solid #ddd;
}
.toggle-label {
display: flex;
align-items: center;
gap: 10px;
cursor: pointer;
}
.toggle-text {
font-weight: normal;
}
input[type="checkbox"] {
width: 18px;
height: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="section">
<label>当前页面 URL:</label>
<div id="currentUrl" class="current-url"></div>
</div>
<div class="tab-buttons">
<button class="tab-button active" data-tab="ruleForm">创建规则</button>
<button class="tab-button" data-tab="rulesList">已保存规则</button>
</div>
<div class="section global-settings">
<label class="toggle-label">
<input type="checkbox" id="forceLoopEnabled">
<span class="toggle-text">启用强制循环(每250ms检查一次,可能影响性能)</span>
</label>
<div class="help-text">
启用后,循环修改规则将每250ms强制执行一次,可以解决某些页面的修改失效问题,但可能会增加CPU使用率。
</div>
</div>
<div id="ruleForm" class="show">
<div class="section">
<label>规则名称:</label>
<input type="text" id="ruleName" placeholder="为这条规则起个名字">
</div>
<div class="section">
<label>目标元素选择器:</label>
<input type="text" id="selector" placeholder="例如:#target-element 或 .content p">
<div class="help-text">提示:右键点击元素 -> 检查,可以在开发者工具中找到元素的选择器</div>
</div>
<div class="section">
<label>替换内容:</label>
<textarea id="newContent" rows="3" placeholder="输入要替换的新内容"></textarea>
</div>
<div class="section">
<label>文字颜色:</label>
<div class="color-section">
<input type="color" id="textColor" value="#000000">
<div class="color-preview" id="colorPreview"></div>
<label style="font-weight: normal;">
<input type="checkbox" id="enableColor"> 启用颜色修改
</label>
</div>
<div class="help-text">选择要修改的文字颜色,并勾选启用才会生效</div>
</div>
<div class="section">
<label>修改触发时机:</label>
<select id="triggerTiming">
<option value="immediate">元素出现后立即修改</option>
<option value="onload">页面加载完成后修改</option>
</select>
</div>
<div class="section">
<label>修改模式:</label>
<select id="modifyMode">
<option value="once">仅修改一次</option>
<option value="loop">循环修改(适用于动态内容)</option>
</select>
</div>
<div class="button-group">
<button id="saveButton">保存规则</button>
<button id="clearButton" class="secondary">清空表单</button>
</div>
</div>
<div id="rulesList">
<div class="rules-header">
<h3>已保存规则</h3>
<div class="rules-actions">
<input type="file" id="importInput" accept=".mrf" style="display: none;">
<button id="importButton" class="secondary">导入规则</button>
</div>
</div>
<div class="rules-container">
<!-- 规则列表将通过 JavaScript 动态生成 -->
</div>
</div>
<script src="crypto-js.min.js"></script>
<script src="popup.js"></script>
</body>
</html>