-
-
Notifications
You must be signed in to change notification settings - Fork 238
Add inject_scripts option #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
0af1404
35d4533
b8e6616
6e2be54
f287864
96091ce
1400df7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| class WabacReplay | ||
| { | ||
| constructor(prefix, url, ts, staticPrefix, coll, swScopePrefix) { | ||
| constructor(prefix, url, ts, staticPrefix, coll, swScopePrefix, injectScripts) { | ||
| this.prefix = prefix; | ||
| this.url = url; | ||
| this.ts = ts; | ||
| this.staticPrefix = staticPrefix; | ||
| this.collName = coll; | ||
| this.isRoot = coll === "$root"; | ||
| this.swScope = swScopePrefix; | ||
| this.injectScripts = injectScripts; | ||
| this.adblockUrl = undefined; | ||
|
|
||
| this.queryParams = {"replayPrefix": ""}; | ||
|
|
@@ -54,6 +55,7 @@ class WabacReplay | |
| archiveMod: "ir_", | ||
| adblockUrl: this.adblockUrl, | ||
| noPostToGet: true, | ||
| injectScripts: this.injectScripts.map(src => "../" + src), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pywb supports static files from the root static directory or per-collection static directories: https://pywb.readthedocs.io/en/latest/manual/ui-guide.html#static-files. It might be worth applying that same logic to the injected scripts, in case users want e.g. Ruffle enabled but only on one collection?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is exactly what you meant, but I've updated it so you can do this: inject_scripts:
- all.js
- other.js
collections:
mycoll:
inject_scripts:
- all.js # static/all.js
- _/mycoll/tweaks.js # collections/mycoll/static/tweaks.js
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh and the |
||
| }, | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,6 @@ enable_memento: true | |
|
|
||
| # enable new transclusion system | ||
| transclusions_version: 2 | ||
|
|
||
| inject_scripts: | ||
| - inject.js | ||
Uh oh!
There was an error while loading. Please reload this page.