dsh-qianchuan-toolkit 1.0.21 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -0
- package/README.md +6 -4
- package/assets/live-control/scripts/account-lib.mjs +35 -11
- package/assets/live-control/scripts/cdp-lib.mjs +11 -4
- package/assets/live-control/scripts/control.mjs +14 -3
- package/assets/live-control/scripts/expr/cancel-modal-sq.js +11 -0
- package/assets/live-control/scripts/expr/close-dialog-sq.js +12 -0
- package/assets/live-control/scripts/expr/dialog-open-sq.js +7 -0
- package/assets/live-control/scripts/expr/dismiss-overlays-sq.js +37 -0
- package/assets/live-control/scripts/expr/fill-sq.js +68 -0
- package/assets/live-control/scripts/expr/log-rows.js +10 -0
- package/assets/live-control/scripts/expr/log-tab-click.js +9 -0
- package/assets/live-control/scripts/expr/manifest.json +144 -0
- package/assets/live-control/scripts/expr/open-plus-sq.js +40 -0
- package/assets/live-control/scripts/expr/page-state-sq.js +15 -0
- package/assets/live-control/scripts/expr/pause-info-sq.js +57 -0
- package/assets/live-control/scripts/expr/pick-sq.js +51 -0
- package/assets/live-control/scripts/expr/plus-rect-sq.js +24 -0
- package/assets/live-control/scripts/expr/result-sq.js +21 -0
- package/assets/live-control/scripts/expr/row-mode-sq.js +23 -0
- package/assets/live-control/scripts/expr/row-state-sq.js +72 -0
- package/assets/live-control/scripts/expr/submit-dom-sq.js +16 -0
- package/assets/live-control/scripts/expr/submit-rect-sq.js +15 -0
- package/assets/live-control/scripts/expr-util.mjs +18 -1
- package/assets/live-control/scripts/hourly.mjs +70 -18
- package/assets/material-align/SKILL.md +88 -0
- package/assets/material-align/references/01-/345/214/271/351/205/215/350/247/204/345/210/231/344/270/216/345/255/227/346/256/265/345/217/243/345/276/204.md +60 -0
- package/assets/material-align/scripts/align.mjs +284 -0
- package/assets/material-align/scripts/db.mjs +154 -0
- package/assets/material-align/scripts/xlsx.mjs +304 -0
- package/assets/plan-copy/SKILL.md +24 -4
- package/assets/plan-copy/references/01-/345/256/214/346/225/264/346/223/215/344/275/234/346/211/213/345/206/214.md +3 -3
- package/assets/plan-copy/references/04-/346/265/217/350/247/210/345/231/250/344/274/232/350/257/235.md +3 -3
- package/assets/plan-copy/references/05-/345/274/271/347/252/227/346/270/205/345/215/225.md +58 -0
- package/assets/plan-copy/scripts/capture.mjs +67 -1
- package/assets/plan-copy/scripts/cdp.mjs +3 -1
- package/assets/plan-copy/scripts/copy.mjs +130 -20
- package/assets/plan-copy/scripts/newmat.mjs +399 -0
- package/assets/plan-copy/scripts/pick-all.mjs +110 -4
- package/assets/plan-copy/scripts/readmat.mjs +2 -0
- package/assets/plan-copy/scripts/start-qc-copy.cmd +49 -0
- package/lib/index.js +6 -0
- package/package.json +5 -3
|
@@ -19,6 +19,24 @@
|
|
|
19
19
|
],
|
|
20
20
|
"placeholders": []
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"name": "log-rows",
|
|
24
|
+
"file": "expr/log-rows.js",
|
|
25
|
+
"purpose": "纯读详情页日志表格(不点击不等待),配合 log-tab-click 两段式读日志",
|
|
26
|
+
"usedBy": [
|
|
27
|
+
"hourly.mjs"
|
|
28
|
+
],
|
|
29
|
+
"placeholders": []
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "log-tab-click",
|
|
33
|
+
"file": "expr/log-tab-click.js",
|
|
34
|
+
"purpose": "只点「日志」tab 后立刻返回(点击会换路由销毁执行上下文,不能在同一 evaluate 里等结果)",
|
|
35
|
+
"usedBy": [
|
|
36
|
+
"hourly.mjs"
|
|
37
|
+
],
|
|
38
|
+
"placeholders": []
|
|
39
|
+
},
|
|
22
40
|
{
|
|
23
41
|
"name": "cancel-modal",
|
|
24
42
|
"file": "expr/cancel-modal.js",
|
|
@@ -208,6 +226,132 @@
|
|
|
208
226
|
"control-lib.mjs"
|
|
209
227
|
],
|
|
210
228
|
"placeholders": []
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "cancel-modal-sq",
|
|
232
|
+
"file": "expr/cancel-modal-sq.js",
|
|
233
|
+
"purpose": "乘方变体:关含「调控方式」的弹窗(弹窗类名 aurora-qc-modal*)",
|
|
234
|
+
"usedBy": [
|
|
235
|
+
"control-lib.mjs"
|
|
236
|
+
],
|
|
237
|
+
"placeholders": []
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "close-dialog-sq",
|
|
241
|
+
"file": "expr/close-dialog-sq.js",
|
|
242
|
+
"purpose": "乘方变体:同上,更宽松,返回 none/no-cancel/canceled",
|
|
243
|
+
"usedBy": [
|
|
244
|
+
"hourly.mjs",
|
|
245
|
+
"control-lib.mjs"
|
|
246
|
+
],
|
|
247
|
+
"placeholders": []
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "dialog-open-sq",
|
|
251
|
+
"file": "expr/dialog-open-sq.js",
|
|
252
|
+
"purpose": "乘方变体:判断控量弹窗是否已出现(认 aurora-qc-modal*)",
|
|
253
|
+
"usedBy": [
|
|
254
|
+
"control-lib.mjs"
|
|
255
|
+
],
|
|
256
|
+
"placeholders": []
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "dismiss-overlays-sq",
|
|
260
|
+
"file": "expr/dismiss-overlays-sq.js",
|
|
261
|
+
"purpose": "乘方变体:关无关弹窗,同时认 aurora-qc-modal 遮罩",
|
|
262
|
+
"usedBy": [
|
|
263
|
+
"page-lib.mjs"
|
|
264
|
+
],
|
|
265
|
+
"placeholders": []
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "fill-sq",
|
|
269
|
+
"file": "expr/fill-sq.js",
|
|
270
|
+
"purpose": "乘方变体:选「一键控量」并填预算/时长;文案是「调控总预算」,okMode 用正则兼容",
|
|
271
|
+
"usedBy": [
|
|
272
|
+
"control-lib.mjs"
|
|
273
|
+
],
|
|
274
|
+
"placeholders": ["{{BUDGET}}", "{{HOURS}}"]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "page-state-sq",
|
|
278
|
+
"file": "expr/page-state-sq.js",
|
|
279
|
+
"purpose": "乘方变体:页面就绪度/弹窗/遮罩快照(认 aurora-qc-modal*)",
|
|
280
|
+
"usedBy": [
|
|
281
|
+
"page-lib.mjs"
|
|
282
|
+
],
|
|
283
|
+
"placeholders": []
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "pause-info-sq",
|
|
287
|
+
"file": "expr/pause-info-sq.js",
|
|
288
|
+
"purpose": "乘方变体:读「停止控量」弹窗里的起止时间与预算",
|
|
289
|
+
"usedBy": [
|
|
290
|
+
"hourly.mjs"
|
|
291
|
+
],
|
|
292
|
+
"placeholders": ["{{BUDGET}}", "{{HOURS}}"]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "result-sq",
|
|
296
|
+
"file": "expr/result-sq.js",
|
|
297
|
+
"purpose": "乘方变体:读提交后的 toast 与弹窗是否消失",
|
|
298
|
+
"usedBy": [
|
|
299
|
+
"control-lib.mjs"
|
|
300
|
+
],
|
|
301
|
+
"placeholders": []
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"name": "submit-dom-sq",
|
|
305
|
+
"file": "expr/submit-dom-sq.js",
|
|
306
|
+
"purpose": "乘方变体:DOM 点击「提交」",
|
|
307
|
+
"usedBy": [
|
|
308
|
+
"control-lib.mjs"
|
|
309
|
+
],
|
|
310
|
+
"placeholders": []
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "submit-rect-sq",
|
|
314
|
+
"file": "expr/submit-rect-sq.js",
|
|
315
|
+
"purpose": "乘方变体:「提交」按钮坐标(坐标兜底路径)",
|
|
316
|
+
"usedBy": [
|
|
317
|
+
"control-lib.mjs"
|
|
318
|
+
],
|
|
319
|
+
"placeholders": []
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"name": "pick-sq",
|
|
323
|
+
"file": "expr/pick-sq.js",
|
|
324
|
+
"purpose": "乘方变体:读「一键调速」组(认 liveSpeedContent-*)判断可加号/控量中",
|
|
325
|
+
"usedBy": ["hourly.mjs","control.mjs","control-lib.mjs"],
|
|
326
|
+
"placeholders": []
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"name": "plus-rect-sq",
|
|
330
|
+
"file": "expr/plus-rect-sq.js",
|
|
331
|
+
"purpose": "乘方变体:「+」按钮坐标",
|
|
332
|
+
"usedBy": ["control-lib.mjs"],
|
|
333
|
+
"placeholders": []
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"name": "open-plus-sq",
|
|
337
|
+
"file": "expr/open-plus-sq.js",
|
|
338
|
+
"purpose": "乘方变体:DOM 点「+」打开调控弹窗",
|
|
339
|
+
"usedBy": ["control-lib.mjs"],
|
|
340
|
+
"placeholders": []
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "row-state-sq",
|
|
344
|
+
"file": "expr/row-state-sq.js",
|
|
345
|
+
"purpose": "乘方变体:整行状态(消耗/ROI/预算/模式),认 liveSpeedContent-* 组",
|
|
346
|
+
"usedBy": ["hourly.mjs"],
|
|
347
|
+
"placeholders": []
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "row-mode-sq",
|
|
351
|
+
"file": "expr/row-mode-sq.js",
|
|
352
|
+
"purpose": "乘方变体:单行 mode(plus/pause/none/unknown)",
|
|
353
|
+
"usedBy": ["control-lib.mjs"],
|
|
354
|
+
"placeholders": []
|
|
211
355
|
}
|
|
212
356
|
]
|
|
213
357
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
6
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
7
|
+
const heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
8
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
9
|
+
const iAweme = col('抖音号', 1), iStatus = col('投放状态', 2), iTool = col('调控工具', 4)
|
|
10
|
+
const isData = (t) => t !== head && !/^共\d+条计划/.test(c(t.innerText))
|
|
11
|
+
const dataRows = all.filter(isData)
|
|
12
|
+
const groupsOf = (td) => [...(td ? td.querySelectorAll('[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]') : [])]
|
|
13
|
+
const labelOf = (g) => c((g.querySelector('[class*="taskLabel"],.title') || g).innerText).slice(0, 20)
|
|
14
|
+
const DISABLED = /icon-not-allowed|actionIconDisabled/
|
|
15
|
+
// 「一键调速」组类名不稳定(.interfere-tool-wrapper / .assist-task / .assistTask-*),按组内文案定位
|
|
16
|
+
const speedGroup = (td) => {
|
|
17
|
+
if (!td) return null
|
|
18
|
+
const gs = [...td.querySelectorAll('.interfere-tool-wrapper,[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]')]
|
|
19
|
+
const byText = gs.find((g) => /一键调速/.test(c(g.innerText)))
|
|
20
|
+
if (byText) return byText
|
|
21
|
+
// 绝不退回「第一个含图标的组」:素材/人群追投组里也有 iconpark-icon(含 ⏸),
|
|
22
|
+
// 退回去会把「素材追投暂停」当成「控量中」,点它还弹不出控量弹窗(2026-11-20 11:15 事故根因)
|
|
23
|
+
const byCls = td.querySelector('.interfere-tool-wrapper')
|
|
24
|
+
if (byCls && !/素材|人群|搜索/.test(c(byCls.innerText))) return byCls
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
const want = '{{AWEME}}'
|
|
28
|
+
const hit = dataRows.filter((t) => { const td = t.querySelectorAll('td'); return td[iAweme] && c(td[iAweme].innerText).includes(want) })[0]
|
|
29
|
+
if (!hit) return 'NO_ROW'
|
|
30
|
+
const toolCell = hit.querySelectorAll('td')[iTool]
|
|
31
|
+
// 只点「一键调速」组里的加号,别落到「素材/人群追投」组
|
|
32
|
+
const g0 = speedGroup(toolCell)
|
|
33
|
+
if (!g0) return 'NO_SPEED_GROUP'
|
|
34
|
+
const plus = g0.querySelector('iconpark-icon[name="oc-icon-plus"]')
|
|
35
|
+
if (g0.querySelector('iconpark-icon[name="iconPauseFilled"]')) return 'PAUSE_RUNNING'
|
|
36
|
+
if (!plus) return 'NO_PLUS'
|
|
37
|
+
if (DISABLED.test(plus.className || '')) return 'PLUS_DISABLED'
|
|
38
|
+
plus.click()
|
|
39
|
+
return 'CLICKED'
|
|
40
|
+
})()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const vis = (e) => { const b = e.getBoundingClientRect(); const cs = getComputedStyle(e); return b.width > 20 && b.height > 20 && cs.display !== 'none' && cs.visibility !== 'hidden' }
|
|
6
|
+
const overlays = [...document.querySelectorAll('.ovui-modal,[role=dialog],[class*="aurora-qc-modal"]')].filter(vis).map((e) => c(e.innerText).slice(0, 36))
|
|
7
|
+
return JSON.stringify({
|
|
8
|
+
readyState: document.readyState,
|
|
9
|
+
hasBody: !!document.body,
|
|
10
|
+
url: location.href.slice(0, 80),
|
|
11
|
+
overlays,
|
|
12
|
+
spins: [...document.querySelectorAll('.ovui-spin-spinning,[class*="spin-dot"]')].filter(vis).length,
|
|
13
|
+
mask: [...document.querySelectorAll('.ovui-popup__mask, [class*="aurora-qc-modal-mask"]')].filter(vis).length
|
|
14
|
+
})
|
|
15
|
+
})()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(async () => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
6
|
+
// 「一键调速」组类名不稳定(.interfere-tool-wrapper / .assist-task / .assistTask-*),按组内文案定位
|
|
7
|
+
const speedGroup = (td) => {
|
|
8
|
+
if (!td) return null
|
|
9
|
+
const gs = [...td.querySelectorAll('.interfere-tool-wrapper,[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]')]
|
|
10
|
+
const byText = gs.find((g) => /一键调速/.test(c(g.innerText)))
|
|
11
|
+
if (byText) return byText
|
|
12
|
+
// 绝不退回「第一个含图标的组」:素材/人群追投组里也有 iconpark-icon(含 ⏸),
|
|
13
|
+
// 退回去会把「素材追投暂停」当成「控量中」,点它还弹不出控量弹窗(2026-11-20 11:15 事故根因)
|
|
14
|
+
const byCls = td.querySelector('.interfere-tool-wrapper')
|
|
15
|
+
if (byCls && !/素材|人群|搜索/.test(c(byCls.innerText))) return byCls
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
19
|
+
let heads = [...document.querySelectorAll('th')].map((t) => c(t.innerText))
|
|
20
|
+
if (!heads.includes('抖音号')) {
|
|
21
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
22
|
+
heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
23
|
+
}
|
|
24
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
25
|
+
const iAweme = col('抖音号', 1), iTool = col('调控工具', 4)
|
|
26
|
+
const isData = (t) => !/^共\d+条计划/.test(c(t.innerText)) && ![...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号')
|
|
27
|
+
const want = '{{AWEME}}'
|
|
28
|
+
const hit = all.filter(isData).find((t) => { const td = t.querySelectorAll('td'); return td[iAweme] && c(td[iAweme].innerText).includes(want) })
|
|
29
|
+
if (!hit) return JSON.stringify({ ok: false, reason: 'NO_ROW' })
|
|
30
|
+
const toolCell = hit.querySelectorAll('td')[iTool]
|
|
31
|
+
const g = speedGroup(toolCell)
|
|
32
|
+
if (!g) return JSON.stringify({ ok: false, anomaly: true, reason: 'NO_SPEED_GROUP(页面里找不到「一键调速」组,疑似改版)' })
|
|
33
|
+
const pause = g.querySelector('iconpark-icon[name="iconPauseFilled"]')
|
|
34
|
+
if (!pause) return JSON.stringify({ ok: false, anomaly: true, reason: 'NO_PAUSE(行上显示控量中,但组里没有 ⏸ 图标,前后矛盾)' })
|
|
35
|
+
pause.click()
|
|
36
|
+
let modal = null
|
|
37
|
+
const t0 = Date.now()
|
|
38
|
+
while (Date.now() - t0 < 8000) {
|
|
39
|
+
modal = [...document.querySelectorAll('.ovui-modal, [class*="aurora-qc-modal"]')].find((e) => /停止控量/.test(c(e.innerText)))
|
|
40
|
+
if (modal) break
|
|
41
|
+
await wait(150)
|
|
42
|
+
}
|
|
43
|
+
if (!modal) return JSON.stringify({ ok: false, reason: 'DIALOG_NOT_FOUND' })
|
|
44
|
+
const text = c(modal.innerText)
|
|
45
|
+
const m = text.match(/控量时间\s*(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s*~\s*(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})/)
|
|
46
|
+
const bud = (text.match(/控量预算\s*([\d.]+)\s*元/) || [])[1] || null
|
|
47
|
+
const toMs = (s) => { const t = s.replace(/\s+/, 'T'); const d = new Date(t); return isNaN(d.getTime()) ? null : d.getTime() }
|
|
48
|
+
const startText = m ? m[1] : null
|
|
49
|
+
const endText = m ? m[2] : null
|
|
50
|
+
// 只读:读完立刻用右上角 X 关掉,绝不点「确定」(那是终止控量)
|
|
51
|
+
const x = modal.querySelector('.ovui-modal__close-icon') || modal.querySelector('[class*=close]')
|
|
52
|
+
if (x) x.click()
|
|
53
|
+
await wait(300)
|
|
54
|
+
const stillOpen = [...document.querySelectorAll('.ovui-modal, [class*="aurora-qc-modal"]')].some((e) => /停止控量/.test(c(e.innerText)))
|
|
55
|
+
if (stillOpen && x) { x.click(); await wait(300) }
|
|
56
|
+
return JSON.stringify({ ok: !!m, startText, endText, budget: bud, startAt: startText ? toMs(startText) : null, endAt: endText ? toMs(endText) : null, closed: ![...document.querySelectorAll('.ovui-modal, [class*="aurora-qc-modal"]')].some((e) => /停止控量/.test(c(e.innerText))), text: text.slice(0, 200) })
|
|
57
|
+
})()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
6
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
7
|
+
const heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
8
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
9
|
+
const iAweme = col('抖音号', 1), iStatus = col('投放状态', 2), iTool = col('调控工具', 4)
|
|
10
|
+
const isData = (t) => t !== head && !/^共\d+条计划/.test(c(t.innerText))
|
|
11
|
+
const dataRows = all.filter(isData)
|
|
12
|
+
const groupsOf = (td) => [...(td ? td.querySelectorAll('[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]') : [])]
|
|
13
|
+
const labelOf = (g) => c((g.querySelector('[class*="taskLabel"],.title') || g).innerText).slice(0, 20)
|
|
14
|
+
const DISABLED = /icon-not-allowed|actionIconDisabled/
|
|
15
|
+
// 「一键调速」组类名不稳定(.interfere-tool-wrapper / .assist-task / .assistTask-*),按组内文案定位
|
|
16
|
+
const speedGroup = (td) => {
|
|
17
|
+
if (!td) return null
|
|
18
|
+
const gs = [...td.querySelectorAll('.interfere-tool-wrapper,[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]')]
|
|
19
|
+
const byText = gs.find((g) => /一键调速/.test(c(g.innerText)))
|
|
20
|
+
if (byText) return byText
|
|
21
|
+
// 绝不退回「第一个含图标的组」:素材/人群追投组里也有 iconpark-icon(含 ⏸),
|
|
22
|
+
// 退回去会把「素材追投暂停」当成「控量中」,点它还弹不出控量弹窗(2026-11-20 11:15 事故根因)
|
|
23
|
+
const byCls = td.querySelector('.interfere-tool-wrapper')
|
|
24
|
+
if (byCls && !/素材|人群|搜索/.test(c(byCls.innerText))) return byCls
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
const want = '{{AWEME}}'
|
|
28
|
+
const hits = dataRows.filter((t) => { const td = t.querySelectorAll('td'); return td[iAweme] && c(td[iAweme].innerText).includes(want) })
|
|
29
|
+
if (!hits.length) return JSON.stringify({ err: 'NO_ROW' })
|
|
30
|
+
if (hits.length > 1) return JSON.stringify({ err: 'MULTI_ROW', n: hits.length })
|
|
31
|
+
const tds = hits[0].querySelectorAll('td')
|
|
32
|
+
const status = c(tds[iStatus].innerText)
|
|
33
|
+
const toolCell = tds[iTool]
|
|
34
|
+
// 必须取「一键调速」那一组,否则会落到「素材/人群追投」组去点加号,弹出的是另一套弹窗。
|
|
35
|
+
const g0 = speedGroup(toolCell)
|
|
36
|
+
const plus = g0 ? g0.querySelector('iconpark-icon[name="oc-icon-plus"]') : null
|
|
37
|
+
const pauseIcon = g0 ? g0.querySelector('iconpark-icon[name="iconPauseFilled"]') : null
|
|
38
|
+
const box = g0 ? g0.getBoundingClientRect() : null
|
|
39
|
+
return JSON.stringify({
|
|
40
|
+
ok: true,
|
|
41
|
+
nick: c(tds[iAweme].innerText).slice(0, 20),
|
|
42
|
+
status,
|
|
43
|
+
live: /投放中/.test(status) && !/未开播/.test(status),
|
|
44
|
+
hasPlus: !!plus,
|
|
45
|
+
plusDisabled: !!(plus && DISABLED.test(plus.className || '')),
|
|
46
|
+
hasPause: !!pauseIcon,
|
|
47
|
+
mode: pauseIcon ? 'pause' : plus ? 'plus' : 'none',
|
|
48
|
+
group: box ? { x: Math.round(box.x), y: Math.round(box.y), w: Math.round(box.width), h: Math.round(box.height) } : null,
|
|
49
|
+
groups: groupsOf(toolCell).map(labelOf),
|
|
50
|
+
})
|
|
51
|
+
})()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
6
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
7
|
+
const heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
8
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
9
|
+
const iAweme = col('抖音号', 1), iStatus = col('投放状态', 2), iTool = col('调控工具', 4)
|
|
10
|
+
const isData = (t) => t !== head && !/^共\d+条计划/.test(c(t.innerText))
|
|
11
|
+
const dataRows = all.filter(isData)
|
|
12
|
+
const groupsOf = (td) => [...(td ? td.querySelectorAll('[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]') : [])]
|
|
13
|
+
const labelOf = (g) => c((g.querySelector('[class*="taskLabel"],.title') || g).innerText).slice(0, 20)
|
|
14
|
+
const DISABLED = /icon-not-allowed|actionIconDisabled/
|
|
15
|
+
const want = '{{AWEME}}'
|
|
16
|
+
const hit = dataRows.filter((t) => { const td = t.querySelectorAll('td'); return td[iAweme] && c(td[iAweme].innerText).includes(want) })[0]
|
|
17
|
+
if (!hit) return 'null'
|
|
18
|
+
const groups = groupsOf(hit.querySelectorAll('td')[iTool])
|
|
19
|
+
const g0 = groups.find((g) => labelOf(g).startsWith('一键调速')) || groups[0]
|
|
20
|
+
const p = g0 && g0.querySelector('iconpark-icon[name="oc-icon-plus"]')
|
|
21
|
+
if (!p) return 'null'
|
|
22
|
+
const b = p.getBoundingClientRect()
|
|
23
|
+
return JSON.stringify({ x: Math.round(b.x + b.width / 2), y: Math.round(b.y + b.height / 2), w: Math.round(b.width) })
|
|
24
|
+
})()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 提交后乘方弹窗是淡出动画(aurora-qc-fade-leave),900ms 时往往还在 DOM 里,所以这里轮询到 3.5s。
|
|
3
|
+
(async () => {
|
|
4
|
+
const clean = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
6
|
+
const shown = (e) => { const b = e.getBoundingClientRect(); return b.width > 100 && b.height > 100 && getComputedStyle(e).display !== 'none' && getComputedStyle(e).visibility !== 'hidden' }
|
|
7
|
+
const toastOf = () => [...document.querySelectorAll('[class*=message], [class*=toast], [class*=notice]')]
|
|
8
|
+
.filter((e) => e.getBoundingClientRect().width > 0).map((e) => clean(e.innerText)).filter((s) => s && s.length < 40)
|
|
9
|
+
const dlgOf = () => [...document.querySelectorAll('.ovui-modal, [role=dialog], [class*=drawer], [class*="aurora-qc-modal"]')]
|
|
10
|
+
.filter((d) => shown(d) && /调控方式|新建调控任务/.test(clean(d.innerText)))[0] || null
|
|
11
|
+
let toast = toastOf()
|
|
12
|
+
let gone = !dlgOf()
|
|
13
|
+
const t0 = Date.now()
|
|
14
|
+
while (Date.now() - t0 < 3500) {
|
|
15
|
+
if (gone || toast.includes('操作成功')) break
|
|
16
|
+
await wait(250)
|
|
17
|
+
toast = toastOf()
|
|
18
|
+
gone = !dlgOf()
|
|
19
|
+
}
|
|
20
|
+
return JSON.stringify({ toast: [...new Set(toast)].slice(0, 4), dialogGone: gone, ms: Date.now() - t0 })
|
|
21
|
+
})()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
// 只看一行「一键调速」组的图标:plus=可创建 / pause=控量中 / unknown=找不到组
|
|
5
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
6
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
7
|
+
let heads = [...document.querySelectorAll('th')].map((t) => c(t.innerText))
|
|
8
|
+
if (!heads.includes('抖音号')) {
|
|
9
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
10
|
+
heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
11
|
+
}
|
|
12
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
13
|
+
const iAweme = col('抖音号', 1), iTool = col('调控工具', 4)
|
|
14
|
+
const want = '{{AWEME}}'
|
|
15
|
+
const hit = all.find((t) => { const td = t.querySelectorAll('td'); return td[iAweme] && c(td[iAweme].innerText).includes(want) })
|
|
16
|
+
if (!hit) return JSON.stringify({ mode: 'norow' })
|
|
17
|
+
const cell = hit.querySelectorAll('td')[iTool]
|
|
18
|
+
const gs = cell ? [...cell.querySelectorAll('.interfere-tool-wrapper,[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]')] : []
|
|
19
|
+
const g = gs.find((x) => /一键调速/.test(c(x.innerText))) || gs.find((x) => x.querySelector('iconpark-icon')) || null
|
|
20
|
+
const icons = g ? [...g.querySelectorAll('iconpark-icon')].map((i) => i.getAttribute('name')) : []
|
|
21
|
+
const mode = !g ? 'unknown' : icons.includes('iconPauseFilled') ? 'pause' : icons.includes('oc-icon-plus') ? 'plus' : 'none'
|
|
22
|
+
return JSON.stringify({ mode, icons })
|
|
23
|
+
})()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const all = [...document.querySelectorAll('tbody tr')].filter((t) => t.querySelectorAll('td').length >= 7)
|
|
6
|
+
// 表头两种形态:全域投放是真 <th>;乘方把 thead 克隆成了 tbody 里的一行 tr
|
|
7
|
+
let heads = [...document.querySelectorAll('th')].map((t) => c(t.innerText))
|
|
8
|
+
if (!heads.includes('抖音号')) {
|
|
9
|
+
const head = all.find((t) => [...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号'))
|
|
10
|
+
heads = head ? [...head.querySelectorAll('td')].map((td) => c(td.innerText)) : []
|
|
11
|
+
}
|
|
12
|
+
const col = (name, dflt) => { const i = heads.findIndex((h) => h === name); return i >= 0 ? i : dflt }
|
|
13
|
+
const iAweme = col('抖音号', 1), iStatus = col('投放状态', 2), iTool = col('调控工具', 4)
|
|
14
|
+
const isData = (t) => !/^共\d+条计划/.test(c(t.innerText)) && ![...t.querySelectorAll('td')].some((td) => c(td.innerText) === '抖音号')
|
|
15
|
+
const dataRows = all.filter(isData)
|
|
16
|
+
const groupsOf = (td) => [...(td ? td.querySelectorAll('[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]') : [])]
|
|
17
|
+
const labelOf = (g) => c((g.querySelector('[class*="taskLabel"],.title') || g).innerText).slice(0, 20)
|
|
18
|
+
// 「一键调速」组的类名在不同状态下会变(.interfere-tool-wrapper / .assist-task / .assistTask-*),
|
|
19
|
+
// 所以按组内文案「一键调速」定位,最后才退回「第一个含图标的组」。
|
|
20
|
+
// 组里只有 oc-icon-plus(+) → 此刻没有控量任务,可以创建;
|
|
21
|
+
// 组里是 iconPauseFilled(⏸) → 正在控量,点它会弹「确定要停止控量吗?控量时间 起 ~ 止」。
|
|
22
|
+
const speedGroup = (td) => {
|
|
23
|
+
if (!td) return null
|
|
24
|
+
const gs = [...td.querySelectorAll('.interfere-tool-wrapper,[class*="assistTask"],[class*="assist-task"],[class*="liveSpeedContent"]')]
|
|
25
|
+
const byText = gs.find((g) => /一键调速/.test(c(g.innerText)))
|
|
26
|
+
if (byText) return byText
|
|
27
|
+
// 绝不退回「第一个含图标的组」:素材/人群追投组里也有 iconpark-icon(含 ⏸),
|
|
28
|
+
// 退回去会把「素材追投暂停」当成「控量中」,点它还弹不出控量弹窗(2026-11-20 11:15 事故根因)
|
|
29
|
+
const byCls = td.querySelector('.interfere-tool-wrapper')
|
|
30
|
+
if (byCls && !/素材|人群|搜索/.test(c(byCls.innerText))) return byCls
|
|
31
|
+
return null
|
|
32
|
+
}
|
|
33
|
+
const rows = dataRows.map((t) => {
|
|
34
|
+
const td = t.querySelectorAll('td')
|
|
35
|
+
const toolCell = td[iTool]
|
|
36
|
+
const icons = [...(toolCell ? toolCell.querySelectorAll('iconpark-icon') : [])]
|
|
37
|
+
const names = icons.map((i) => i.getAttribute('name') || '')
|
|
38
|
+
const sp = speedGroup(toolCell)
|
|
39
|
+
const spIcons = sp ? [...sp.querySelectorAll('iconpark-icon')] : []
|
|
40
|
+
const spNames = spIcons.map((i) => i.getAttribute('name') || '')
|
|
41
|
+
const pauseIcon = spIcons.find((i) => i.getAttribute('name') === 'iconPauseFilled') || null
|
|
42
|
+
const plusIcon = spIcons.find((i) => i.getAttribute('name') === 'oc-icon-plus') || null
|
|
43
|
+
const hasPause = !!pauseIcon
|
|
44
|
+
const hasPlus = !!plusIcon
|
|
45
|
+
const plusDisabled = !!(plusIcon && /icon-not-allowed|actionIconDisabled/.test(plusIcon.className || ''))
|
|
46
|
+
const text = c(t.innerText)
|
|
47
|
+
return {
|
|
48
|
+
aweme: c(td[iAweme] && td[iAweme].innerText).slice(0, 26),
|
|
49
|
+
status: c(td[iStatus] && td[iStatus].innerText).slice(0, 26),
|
|
50
|
+
// 「已暂停」行常附带「有效投放中」这类诊断字样,必须用否定词兜住,否则会把暂停行当成在投
|
|
51
|
+
live: (() => { const s = c(td[iStatus] && td[iStatus].innerText); return /投放中/.test(s) && !/已暂停|未开播|审核中|预算不足|已结束/.test(s) })(),
|
|
52
|
+
hasPause,
|
|
53
|
+
hasPlus,
|
|
54
|
+
plusDisabled,
|
|
55
|
+
speedIcons: spNames,
|
|
56
|
+
// unknown = 连「一键调速」组都找不到(页面改版/未加载完),是异常,绝不能当「控量中」
|
|
57
|
+
mode: !sp ? 'unknown' : hasPause ? 'pause' : hasPlus ? 'plus' : 'none',
|
|
58
|
+
tools: groupsOf(toolCell).map(labelOf),
|
|
59
|
+
budget: (text.match(/每日预算\s*([\d.,]+)\s*元/) || [])[1] || null,
|
|
60
|
+
roiTarget: (text.match(/(?:ROI目标|综合营销ROI目标)\s*([\d.]+)/) || [])[1] || null,
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
const iconsReady = dataRows.length > 0 && dataRows.every((t) => { const td = t.querySelectorAll('td'); return td[iTool] && td[iTool].querySelectorAll('iconpark-icon').length > 0 })
|
|
64
|
+
return JSON.stringify({
|
|
65
|
+
url: location.href.slice(0, 90),
|
|
66
|
+
hasAwemeCol: heads.includes('抖音号'),
|
|
67
|
+
cols: heads.slice(0, 10),
|
|
68
|
+
layout: heads.includes('营销服务') ? 'square' : 'uni-prom',
|
|
69
|
+
iconsReady,
|
|
70
|
+
rows,
|
|
71
|
+
})
|
|
72
|
+
})()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
// 提交按钮:优先 DOM 点击,不依赖坐标(弹窗选定「一键控量」后会重新排版,坐标会漂)
|
|
5
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
6
|
+
const shown = (e) => { const b = e.getBoundingClientRect(); return b.width > 100 && b.height > 100 && getComputedStyle(e).display !== 'none' }
|
|
7
|
+
const dlg = [...document.querySelectorAll('.ovui-modal, [class*="aurora-qc-modal"]')].filter((d) => shown(d) && /调控方式|新建调控任务/.test(c(d.innerText))).pop()
|
|
8
|
+
if (!dlg) return JSON.stringify({ ok: false, reason: 'NO_DIALOG' })
|
|
9
|
+
const btns = [...dlg.querySelectorAll('button')].filter((b) => b.getBoundingClientRect().width > 0)
|
|
10
|
+
const submit = btns.filter((b) => c(b.innerText) === '提交').pop()
|
|
11
|
+
if (!submit) return JSON.stringify({ ok: false, reason: 'NO_BTN', btns: btns.map((b) => c(b.innerText)) })
|
|
12
|
+
if (submit.disabled || /disabled/.test(String(submit.className))) return JSON.stringify({ ok: false, reason: 'BTN_DISABLED' })
|
|
13
|
+
const r = submit.getBoundingClientRect()
|
|
14
|
+
submit.click()
|
|
15
|
+
return JSON.stringify({ ok: true, clicked: 'dom', x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), text: c(submit.innerText) })
|
|
16
|
+
})()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// 乘方(campaignType=1)专用变体:弹窗类名 aurora-qc-modal*;「一键调速」组在控量中/可调速时是 liveSpeedContent-*。
|
|
2
|
+
// 与同名全域版本并存,由 expr-util.setExprVariant("sq") 在乘方账号轮次自动选用。
|
|
3
|
+
(() => {
|
|
4
|
+
const c = (s) => (s || '').replace(/\s+/g, ' ').trim()
|
|
5
|
+
const shown = (e) => { const b = e.getBoundingClientRect(); return b.width > 100 && b.height > 100 && getComputedStyle(e).display !== 'none' }
|
|
6
|
+
const dlg = [...document.querySelectorAll('.ovui-modal, [class*="aurora-qc-modal"]')].filter((d) => shown(d) && /调控方式|新建调控任务/.test(c(d.innerText))).pop()
|
|
7
|
+
if (!dlg) return 'null'
|
|
8
|
+
const foot = dlg.querySelector('.ovui-modal__footer, [class*="footer-"]')
|
|
9
|
+
const btns = foot ? [...foot.querySelectorAll('button')] : [...dlg.querySelectorAll('button')]
|
|
10
|
+
const live = btns.filter((b) => b.getBoundingClientRect().width > 0)
|
|
11
|
+
const submit = live.filter((b) => c(b.innerText) === '提交').pop()
|
|
12
|
+
if (!submit) return 'null'
|
|
13
|
+
const r = submit.getBoundingClientRect()
|
|
14
|
+
return JSON.stringify({ x: Math.round(r.x + r.width / 2), y: Math.round(r.y + r.height / 2), w: Math.round(r.width), label: c(submit.innerText) })
|
|
15
|
+
})()
|
|
@@ -4,9 +4,26 @@ import { fileURLToPath } from 'node:url'
|
|
|
4
4
|
|
|
5
5
|
export const HERE = path.dirname(fileURLToPath(import.meta.url))
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 页面注入片段的「变体」开关。
|
|
9
|
+
* 千川两条产品线的调控弹窗 DOM 类名不同:
|
|
10
|
+
* 全域(uni-prom)→ .ovui-modal
|
|
11
|
+
* 乘方(overall-prom?campaignType=1)→ .aurora-qc-modal*
|
|
12
|
+
* 基础片段只认全域;乘方账号轮次由 setExprVariant('sq') 切到 expr/<name>-sq.js。
|
|
13
|
+
* 没有对应变体文件时自动回退到基础片段(例如日志核对类片段,两条线共用)。
|
|
14
|
+
*/
|
|
15
|
+
let VARIANT = ''
|
|
16
|
+
export function setExprVariant(v) { VARIANT = String(v || '') }
|
|
17
|
+
export function exprVariant() { return VARIANT }
|
|
18
|
+
|
|
7
19
|
/** 读 expr/<name> 并按 {{KEY}} 替换占位符。 */
|
|
8
20
|
export function expr(name, subs) {
|
|
9
|
-
let
|
|
21
|
+
let file = name
|
|
22
|
+
if (VARIANT) {
|
|
23
|
+
const cand = String(name).replace(/\.js$/, '-' + VARIANT + '.js')
|
|
24
|
+
if (fs.existsSync(path.join(HERE, 'expr', cand))) file = cand
|
|
25
|
+
}
|
|
26
|
+
let src = fs.readFileSync(path.join(HERE, 'expr', file), 'utf8')
|
|
10
27
|
for (const [k, v] of Object.entries(subs || {})) src = src.split(k).join(String(v))
|
|
11
28
|
return src
|
|
12
29
|
}
|