68 lines
2.7 KiB
JavaScript
68 lines
2.7 KiB
JavaScript
|
|
(() => {
|
|||
|
|
const config = {
|
|||
|
|
platform: 'wechat_channels',
|
|||
|
|
platformName: '视频号',
|
|||
|
|
skipTitle: true,
|
|||
|
|
mergeTitleIntoContent: false,
|
|||
|
|
useMainWorldContent: true,
|
|||
|
|
titleMaxLength: 30,
|
|||
|
|
titleTransform: value => String(value || '')
|
|||
|
|
.replace(/[【】\[\]()(){}<>]/g, ' ')
|
|||
|
|
.replace(/[^\u3400-\u9fffA-Za-z0-9《》“”‘’"'::++??%%℃,,、。!!\s]/g, ' ')
|
|||
|
|
.replace(/\s+/g, ' '),
|
|||
|
|
batchUploadSettleTimeout: 30000,
|
|||
|
|
videoModeLabels: [],
|
|||
|
|
imageModeLabels: [],
|
|||
|
|
uploadSelectors: [
|
|||
|
|
'input[type="file"][accept*="video"]',
|
|||
|
|
'input[type="file"]'
|
|||
|
|
],
|
|||
|
|
uploadDropZoneSelectors: [
|
|||
|
|
'div.upload-content',
|
|||
|
|
'[class*="upload-content"]',
|
|||
|
|
'[class*="upload-wrapper"]'
|
|||
|
|
],
|
|||
|
|
videoInputSelectors: ['input[type="file"][accept*="video"]'],
|
|||
|
|
imageInputSelectors: [],
|
|||
|
|
coverInputSelectors: [
|
|||
|
|
'[class*="cover"] input[type="file"][accept*="image"]',
|
|||
|
|
'[class*="poster"] input[type="file"][accept*="image"]'
|
|||
|
|
],
|
|||
|
|
titleSelectors: [
|
|||
|
|
'input[type="text"][placeholder="填写短标题有机会获得更多流量"]',
|
|||
|
|
'input[type="text"][placeholder*="短标题"]',
|
|||
|
|
'input[placeholder*="标题"]',
|
|||
|
|
'textarea[placeholder*="标题"]',
|
|||
|
|
'[class*="title"] input'
|
|||
|
|
],
|
|||
|
|
contentSelectors: [
|
|||
|
|
'div.input-editor[contenteditable][data-placeholder="添加描述"]',
|
|||
|
|
'[contenteditable="true"][data-placeholder*="添加描述"]',
|
|||
|
|
'[contenteditable="true"][data-placeholder*="描述"]',
|
|||
|
|
'[contenteditable="true"][placeholder*="描述"]',
|
|||
|
|
'[contenteditable="true"][aria-label*="描述"]',
|
|||
|
|
'textarea[placeholder*="描述"]',
|
|||
|
|
'textarea[placeholder*="文案"]',
|
|||
|
|
'[class*="post-desc"] [contenteditable="true"]',
|
|||
|
|
'[class*="post_desc"] [contenteditable="true"]',
|
|||
|
|
'[class*="desc"] [contenteditable="true"]',
|
|||
|
|
'.post-desc-box [contenteditable]',
|
|||
|
|
'[class*="editor"][contenteditable="true"]',
|
|||
|
|
'[class*="editor"] [contenteditable="true"]',
|
|||
|
|
'.ProseMirror[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 })
|
|||
|
|
})()
|