summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2021-02-19 11:26:33 -0800
committerOmar Rizwan <omar@omar.website>2021-02-19 11:26:33 -0800
commit9827b089c1491ab2cbf81ea3d56b68b74243d37b (patch)
tree48c92488d74844afc5e01b7a086b2dd30f1a8c28
parent07da85e36bd50eb5f328b7cf989e528e4b49e5d2 (diff)
downloadTabFS-9827b089c1491ab2cbf81ea3d56b68b74243d37b.tar.gz
TabFS-9827b089c1491ab2cbf81ea3d56b68b74243d37b.zip
change TAB/textareas to TAB/inputs, add support for text inputs
-rw-r--r--extension/background.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/extension/background.js b/extension/background.js
index eef6939..6d836ec 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -437,16 +437,16 @@ router["/tabs/by-id/*/control"] = {
});
})();
-router["/tabs/by-id/*/textareas"] = {
+router["/tabs/by-id/*/inputs"] = {
async readdir({path}) {
const tabId = parseInt(pathComponent(path, -2));
- // TODO: assign new IDs to textareas without them?
- const code = `Array.from(document.querySelectorAll('textarea')).map(e => e.id).filter(id => id)`
+ // TODO: assign new IDs to inputs without them?
+ const code = `Array.from(document.querySelectorAll('textarea, input[type=text]')).map(e => e.id).filter(id => id)`
const ids = (await browser.tabs.executeScript(tabId, {code}))[0];
return { entries: [".", "..", ...ids.map(id => `${id}.txt`)] };
}
};
-router["/tabs/by-id/*/textareas/*"] = defineFile(async path => {
+router["/tabs/by-id/*/inputs/*"] = defineFile(async path => {
const [tabId, textareaId] = [parseInt(pathComponent(path, -3)), pathComponent(path, -1).slice(0, -4)];
const code = `document.getElementById('${textareaId}').value`;
const textareaValue = (await browser.tabs.executeScript(tabId, {code}))[0];