(() => { const config = { platform: 'xiaohongshu', platformName: '小红书', preserveContentLineBreaks: true, videoModeLabels: ['上传视频', '视频笔记'], imageModeLabels: ['上传图文', '图文笔记'], uploadSelectors: [ 'input[type="file"][accept*="video"]', 'input[type="file"][accept*="image"]', 'input[type="file"]' ], videoInputSelectors: ['input[type="file"][accept*="video"]'], imageInputSelectors: ['input[type="file"][accept*="image"]'], 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 }) })()