Files
RuoYi-Vue/browser-extension/multi-platform-publisher-1.1.15/content/douyin.js
2026-09-14 17:40:52 +08:00

46 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(() => {
const config = {
platform: 'douyin',
platformName: '抖音',
preserveContentLineBreaks: true,
useAtomicHtmlLineBreaks: true,
looseContentVerification: true,
videoModeLabels: [],
imageModeLabels: [],
uploadSelectors: [
'input[type="file"][accept*="video"]',
'input[type="file"]'
],
videoInputSelectors: ['input[type="file"][accept*="video"]'],
imageInputSelectors: [],
coverInputSelectors: [
'[class*="cover"] input[type="file"][accept*="image"]',
'[class*="poster"] input[type="file"][accept*="image"]'
],
titleSelectors: [
'input[placeholder*="标题"]',
'textarea[placeholder*="标题"]',
'[class*="title"] input'
],
contentSelectors: [
'[contenteditable="true"][data-placeholder*="作品描述"]',
'[contenteditable="true"][data-placeholder*="描述"]',
'textarea[placeholder*="作品描述"]',
'textarea[placeholder*="描述"]',
'[class*="editor"] [contenteditable="true"]'
],
progressSelectors: ['[class*="progress"]', '[role="progressbar"]'],
successTexts: [/^发布成功[!!。]?$/, /^作品发布成功[!!。]?$/],
failureTexts: [/^发布失败/, /^作品发布失败/]
}
chrome.runtime.onMessage.addListener(message => {
if (message && message.type === 'RUN_PUBLISH') {
globalThis.YidaimaPublisher.run(config, message.payload)
} else if (message && message.type === 'WATCH_PUBLISH_OUTCOME') {
globalThis.YidaimaPublisher.watch(config, message.payload)
}
})
chrome.runtime.sendMessage({ type: 'PLATFORM_READY', platform: config.platform })
})()