summaryrefslogtreecommitdiff
path: root/extension/background.js
diff options
context:
space:
mode:
Diffstat (limited to 'extension/background.js')
-rw-r--r--extension/background.js34
1 files changed, 26 insertions, 8 deletions
diff --git a/extension/background.js b/extension/background.js
index c885d45..d2e2ac8 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -613,9 +613,33 @@ Routes["/runtime/background.js"] = {
}
};
+Routes["/runtime/routes.html"] = routeWithContents(async () => {
+ return `
+<html>
+ <body>
+ <dl>
+ ${Object.entries(Routes).map(([path, {usage}]) => {
+ const usages = usage ? (Array.isArray(usage) ? usage : [usage]) : [];
+ return `
+ <dt>${path}</dt>
+ <dd>Usage:
+ <ul>
+ ${usages.map(u => `<li>${u}</li>`).join('\n')}
+ </ul>
+ </dd>
+ `;
+ }).join('\n')}
+ </dl>
+ </body>
+</html>
+`;
+});
+
Routes["/runtime/background.js.html"] = routeWithContents(async () => {
+ // WIP
const classes = [
- [/Routes\["[^\]]+"\] = /, 'route']
+ [/Routes\["[^\]]+"\] = /, 'route'],
+ [/usage:/, 'usage']
];
const js = await window.backgroundJS;
@@ -645,12 +669,6 @@ Routes["/runtime/background.js.html"] = routeWithContents(async () => {
</style>
</head>
<body>
- <!-- <dl>
- ${Object.entries(Routes).map(([a, b]) => `
- <dt>${a}</dt>
- <dd>${b}</dd>
- `).join('\n')}
- </dl> -->
<pre><code>${classedJs}</code></pre>
<script>
@@ -658,7 +676,7 @@ Routes["/runtime/background.js.html"] = routeWithContents(async () => {
function render() {
let y = 0;
for (let line of lines) {
- if (line.classList.contains('route') || line.dataset.expand == 'true') {
+ if (line.classList.contains('route') || line.classList.contains('usage')) {
line.style.height = '15px';
line.style.transform = 'translate(0px, ' + y + 'px)';
y += 15;