diff options
author | Omar Rizwan <omar@omar.website> | 2020-12-25 00:38:55 -0800 |
---|---|---|
committer | Omar Rizwan <omar@omar.website> | 2020-12-25 00:38:55 -0800 |
commit | b64c0f7016ae226659be00f03b617f483641603b (patch) | |
tree | 60a4140427adc0797416fb7d999fc6b4cf08f004 /extension | |
parent | 462a657bfd61840ea05f615bc38759d8832c49c1 (diff) |
add .txt extensions (it screenshots better)
Diffstat (limited to 'extension')
-rw-r--r-- | extension/background.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/extension/background.js b/extension/background.js index ecba875..8c09ff9 100644 --- a/extension/background.js +++ b/extension/background.js @@ -213,20 +213,20 @@ router["/tabs/by-id"] = { return (await browser.tabs.executeScript(tabId, {code}))[0]; }); - router["/tabs/by-id/*/url"] = withTab(tab => tab.url + "\n", buf => ({ url: buf })); - router["/tabs/by-id/*/title"] = withTab(tab => tab.title + "\n"); - router["/tabs/by-id/*/text"] = fromScript(`document.body.innerText`); - router["/tabs/by-id/*/console"] = { - open() { - // inject the console - }, - read() { - - }, - write() { - // what does this even do? - } - } + router["/tabs/by-id/*/url.txt"] = withTab(tab => tab.url + "\n", buf => ({ url: buf })); + router["/tabs/by-id/*/title.txt"] = withTab(tab => tab.title + "\n"); + router["/tabs/by-id/*/text.txt"] = fromScript(`document.body.innerText`); + // router["/tabs/by-id/*/console"] = { + // open() { + // // inject the console + // }, + // read() { + // + // }, + // write() { + // // what does this even do? + // } + // } })(); router["/tabs/by-id/*/screenshot.png"] = defineFile(async path => { const tabId = parseInt(pathComponent(path, -2)); @@ -389,11 +389,11 @@ for (let i = 10; i >= 0; i--) { if (TESTING) { // I wish I could color this section with... a pink background, or something. const assert = require('assert'); (async () => { - assert.deepEqual(await router['/tabs/by-id/*'].readdir(), { entries: ['.', '..', 'url', 'title', 'text', 'screenshot.png', 'resources', 'scripts', 'control'] }); + assert.deepEqual(await router['/tabs/by-id/*'].readdir(), { entries: ['.', '..', 'url.txt', 'title.txt', 'text.txt', 'screenshot.png', 'resources', 'scripts', 'control'] }); assert.deepEqual(await router['/'].readdir(), { entries: ['.', '..', 'extensions', 'tabs', 'runtime'] }); assert.deepEqual(await router['/tabs'].readdir(), { entries: ['.', '..', 'create', 'by-id', 'by-title', 'last-focused'] }); - assert.deepEqual(findRoute('/tabs/by-id/TABID/url'), router['/tabs/by-id/*/url']); + assert.deepEqual(findRoute('/tabs/by-id/TABID/url.txt'), router['/tabs/by-id/*/url.txt']); })() } |