Skip to content

Commit aa3795f

Browse files
committed
up-qbit. 外部引入 html 及 css,界面细节调整,使用说明补充
1 parent f9726c3 commit aa3795f

4 files changed

Lines changed: 66 additions & 31 deletions

File tree

packages/qBit/src/_def.js

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
} from "./_base";
88
import DefForm from "./_defForm";
99
import { http } from "./_http";
10+
import tplEdt from "./tpl/edt.html";
11+
import "./style/style.css"
1012

1113
if (typeof __GM_api !== "undefined") {
1214
_log(__GM_api);
@@ -167,24 +169,6 @@ $n("#desktopNavbar ul").insertAdjacentHTML(
167169
"<li><a class=\"js-modal\"><b>→批量替换 Tracker←</b></a></li>",
168170
);
169171

170-
// 构建编辑框
171-
const strHtml = `
172-
<div style="padding:13px 23px;">\
173-
<div class="act-tab" style="display: flex;">操作模式:</div>\
174-
<hr>
175-
<h2>「标签」或「分类」: (区分大小写)<h2><input class="js-input" type="text" name="filter" style="width: 97%;" placeholder="包含要修改项目的「标签」或「分类」,或新建一个">\
176-
<h2>Tracker: <span class="js-tip-btn"></span></h2>\
177-
<div class="act-body"></div>\
178-
<hr>
179-
「<a target="_blank" title="投喂支持" href="https://www.wdssmq.com/guestbook.html#h3-u6295u5582u652Fu6301" rel="nofollow">投喂支持</a>」\
180-
「<a target="_blank" title="QQ 群 - 我的咸鱼心" href="https://jq.qq.com/?_wv=1027&k=SRYaRV6T" rel="nofollow">QQ 群 - 我的咸鱼心</a>」\
181-
<p>注:
182-
<span>「替换」时请使用完整地址,或者使用「子串替换」;</span>\
183-
<span>特殊需求可「删除」→填入「****」清空旧的后「添加」新的;</span>\
184-
</p>\
185-
</div>\
186-
`;
187-
188172
// js-modal 绑定点击事件
189173
$n(".js-modal").addEventListener("click", () => {
190174
const _modal = new MochaUI.Window({
@@ -193,18 +177,18 @@ $n(".js-modal").addEventListener("click", () => {
193177
loadMethod: "iframe",
194178
contentURL: "",
195179
scrollbars: true,
196-
resizable: false,
180+
resizable: true,
197181
maximizable: false,
198182
closable: true,
199183
paddingVertical: 0,
200184
paddingHorizontal: 0,
201185
width: 500,
202-
height: 250,
186+
height: 360,
203187
});
204188
// console.log(modal);
205189

206190
const modalContent = $n("#js-modal_content");
207-
modalContent.innerHTML = strHtml;
191+
modalContent.innerHTML = tplEdt;
208192
const modalContentWrapper = $n("#js-modal_contentWrapper");
209193
modalContentWrapper.style.height = "auto";
210194
gob.data.modalShow = true;
@@ -223,8 +207,12 @@ $n(".js-modal").addEventListener("click", () => {
223207
// $n(".js-input[name=matchSubstr]").click();
224208
});
225209

226-
// // 自动点击
227-
// $n(".js-modal").click();
210+
// 自动点击
211+
if (process.env.NODE_ENV === "dev") {
212+
setTimeout(() => {
213+
$n(".js-modal").click();
214+
}, 1500);
215+
}
228216

229217
function fnCheckUrl(name, url) {
230218
// 判断是否以 udp:// 或 http(s):// 开头
@@ -240,10 +228,10 @@ document.addEventListener("click", (event) => {
240228
gob.act = gob.formObj.curSelect;
241229
gob.urlCheck = [];
242230
const formData = gob.formObj.getFormData();
243-
// 判断分类或 tag
244-
if (!formData.filter || formData.filter === "全部" || formData.filter === "未分类") {
231+
// 判断筛选条件
232+
if (!formData.filter || /||/.test(formData.filter)) {
245233
gob.upTips("btn", {
246-
msg: "「分类或 tag」字段错误",
234+
msg: "「标签」或「分类」错误,请重新输入",
247235
});
248236
return;
249237
}

packages/qBit/src/_defForm.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,9 @@ class DefForm {
129129
inputField.classList.add("js-input");
130130
inputField.style = "width: 95%;";
131131

132-
const label = document.createElement("label");
133-
// label.textContent = input.text;
134-
label.appendChild(inputField);
135-
this.$body.appendChild(label);
136-
this.$body.appendChild(document.createElement("br"));
132+
const p = document.createElement("p");
133+
p.appendChild(inputField);
134+
this.$body.appendChild(p);
137135
});
138136

139137
const $submit = document.createElement("input");

packages/qBit/src/style/style.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.mz-edt {
2+
padding: 13px 23px;
3+
font-size: 14px;
4+
line-height: 20px
5+
}
6+
7+
.mz-edt .text-16 {
8+
font-size: 16px;
9+
line-height: 24px
10+
}
11+
12+
.mz-edt .p-bold {
13+
font-weight: 700;
14+
border-bottom: 1px solid currentColor;
15+
margin-bottom: 4px;
16+
padding-bottom: 0;
17+
}
18+
19+
.mz-edt p.pb-less {
20+
padding-bottom: 3px
21+
}

packages/qBit/src/tpl/edt.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<div class="mz-edt">
2+
<div class="act-tab"
3+
style="display: flex;">操作模式:</div>
4+
<hr>
5+
<h2>「标签」或「分类」(区分大小写): </h2>
6+
<p>
7+
<input class="js-input"
8+
type="text"
9+
name="filter"
10+
style="width: 97%;"
11+
placeholder="包含要修改项目的「标签」或「分类」,或新建一个" />
12+
</p>
13+
<h2>Tracker: <span class="js-tip-btn"></span></h2>
14+
<div class="act-body"></div>
15+
<p class="pb-less text-16"><a target="_blank"
16+
title="投喂支持"
17+
href="https://afdian.com/a/wdssmq"
18+
rel="nofollow">打钱给作者-爱发电</a>
19+
<a target="_blank"
20+
title="QQ 群 - 我的咸鱼心"
21+
href="https://jq.qq.com/?_wv=1027&k=SRYaRV6T"
22+
rel="nofollow">QQ 群 - 我的咸鱼心</a>
23+
</p>
24+
<hr>
25+
<p class="pb-less p-bold">选中要操作的 Torrent 任务(可多选),右键里「标签」或「分类」添加或指定,建议用「标签」;</p>
26+
<p class="pb-less">「替换」时请使用完整地址,或者使用「子串替换」;</p>
27+
<p class="pb-less">特殊需求可「删除」→填入「****」清空旧的后「添加」新的;</p>
28+
</div>

0 commit comments

Comments
 (0)