Add SuperRPA integration guide, simple extension and standalone replay page
Some checks failed
Tests / Tests (push) Has been cancelled
ESLint Check / ESLint Check and Report Upload (push) Has been cancelled
Prettier Check / Format Check (push) Has been cancelled
Prettier Check / Format Code (push) Has been cancelled
ESLint Check / Build Base for Bundle Size Comparison (push) Has been cancelled
Some checks failed
Tests / Tests (push) Has been cancelled
ESLint Check / ESLint Check and Report Upload (push) Has been cancelled
Prettier Check / Format Check (push) Has been cancelled
Prettier Check / Format Code (push) Has been cancelled
ESLint Check / Build Base for Bundle Size Comparison (push) Has been cancelled
- docs/integration/superrpa-integration.zh_CN.md: complete integration guide - rrweb-simple-ext/: minimal Chrome extension for page recording - replay.html: standalone drag-and-drop replay viewer - CLAUDE.md: project instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
46
rrweb-simple-ext/content.js
Normal file
46
rrweb-simple-ext/content.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// content.js - content script (runs in content script world)
|
||||
(function() {
|
||||
// Inject the record library + inject script into page
|
||||
function loadScripts(callback) {
|
||||
// Load record.umd.cjs first
|
||||
const script1 = document.createElement('script');
|
||||
script1.src = chrome.runtime.getURL('record.umd.cjs');
|
||||
script1.onload = function() {
|
||||
script1.remove();
|
||||
// Then load inject.js
|
||||
const script2 = document.createElement('script');
|
||||
script2.src = chrome.runtime.getURL('inject.js');
|
||||
script2.onload = function() {
|
||||
script2.remove();
|
||||
};
|
||||
(document.head || document.documentElement).appendChild(script2);
|
||||
};
|
||||
(document.head || document.documentElement).appendChild(script1);
|
||||
}
|
||||
|
||||
// Listen for messages from inject.js (page context)
|
||||
window.addEventListener('message', function(event) {
|
||||
if (event.source !== window) return;
|
||||
const data = event.data;
|
||||
if (!data || !data.__rrweb_action) return;
|
||||
|
||||
if (data.__rrweb_action === 'event') {
|
||||
// Forward event to background
|
||||
chrome.runtime.sendMessage({ action: 'event', data: data.__rrweb_data });
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for messages from background
|
||||
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
|
||||
if (msg.action === 'startRecord') {
|
||||
loadScripts();
|
||||
sendResponse({ ok: true });
|
||||
} else if (msg.action === 'stopRecord') {
|
||||
window.postMessage({ __rrweb_action: 'stop' }, '*');
|
||||
sendResponse({ ok: true });
|
||||
}
|
||||
// Don't return true for unrelated messages
|
||||
});
|
||||
|
||||
console.log('[rrweb] Content script loaded');
|
||||
})();
|
||||
Reference in New Issue
Block a user