46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
(() => {
|
||
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 })
|
||
})()
|