Injects a floating panel on sefaria.org / sefaria.org.il. The panel lists plugins and loads the selected plugin inside an iframe. The extension exchanges postMessage events with the iframe to pass the current sref as navigation changes.
- Extract this zip.
- In Chrome, open
chrome://extensions. - Enable Developer mode.
- Click Load unpacked and choose the
extensionfolder. - Visit https://www.sefaria.org and click the toolbar icon to toggle the panel.
Edit the hard-coded PLUGINS array in extension/content.js:
[{
"name": "YUtorah Plugin",
"url": "https://yutorah.com.sefariaPlugin",
"icon": "https://example.com/icon.png",
"description": "A YUtorah Sefaria plugin"
},{
"name": "Example Local Plugin",
"url": "http://localhost:8000/index.html",
"icon": "https://via.placeholder.com/96",
"description": "Local dev plugin for testing postMessage bridge"
}]An example plugin is provided in example-plugin/. To run it locally:
cd example-plugin
python3 -m http.server 8000Then, load the extension and select Example Local Plugin in the panel. The iframe will open http://localhost:8000/index.html and start receiving sref updates via postMessage.
From extension → plugin (iframe):
sref:update—{ type: "sref:update", sref }sent on route changes and after plugin signals ready.sref:response— response to a request with{ type: "sref:response", sref }.
From plugin → extension:
plugin:ready— ask the extension to send the currentsref.plugin:request-sref— request the currentsrefon demand.plugin:log— log debug messages to the page console.
This approach is Chrome Web Store compliant because the plugin code runs on its own origin in an iframe; the extension does not execute remote code.
A lightweight Flask app in server.py serves everything in plugins/ (including index.json and the HTML plugins) as static files at http://127.0.0.1:5000.
- Install Flask (ideally in a virtualenv):
pip install Flask - Start the server from the repo root:
python server.py - Visit a plugin directly (e.g.,
http://127.0.0.1:5000/screen_reader.html) or fetchhttp://127.0.0.1:5000/index.jsonfor the plugin list.