aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-04-07 12:17:38 +1000
committerYuchen Pei <hi@ypei.me>2022-04-07 12:17:38 +1000
commitae25ad78906179e1448ff7d97957810e2be40206 (patch)
treeca56b583f36ccd317900e6b51c4fcd86f161bc56 /common
parent52398eafaf99ebbba7ff5a28b832830be394bf1d (diff)
nop whitespace formatting change.
- ran eglot-format using typescript-language-server on all js files in the repo except those under /hash_script/ - verify only whitespace changed: git diff --word-diff-regex=. 62d6a71 62d6a71~1
Diffstat (limited to 'common')
-rw-r--r--common/Storage.js16
-rw-r--r--common/Test.js6
2 files changed, 11 insertions, 11 deletions
diff --git a/common/Storage.js b/common/Storage.js
index 62b7b19..47261c5 100644
--- a/common/Storage.js
+++ b/common/Storage.js
@@ -34,7 +34,7 @@ var Storage = {
return array ? new Set(array) : new Set();
},
async save(key, list) {
- return await browser.storage.local.set({[key]: [...list]});
+ return await browser.storage.local.set({ [key]: [...list] });
},
},
@@ -45,7 +45,7 @@ var Storage = {
},
async save(key, list) {
- return await browser.storage.local.set({[key]: [...list].join(",")});
+ return await browser.storage.local.set({ [key]: [...list].join(",") });
}
}
};
@@ -70,8 +70,8 @@ class ListStore {
// here we simplify and hash inline script references
return url.startsWith("inline:") ? url
: url.startsWith("view-source:")
- && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/,"inline://$1#")
- .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim()));
+ && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/, "inline://$1#")
+ .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim()));
}
static hashItem(hash) {
return hash.startsWith("(") ? hash : `(${hash})`;
@@ -133,10 +133,10 @@ class ListStore {
}
}
-function hash(source){
- var shaObj = new jssha("SHA-256","TEXT")
- shaObj.update(source);
- return shaObj.getHash("HEX");
+function hash(source) {
+ var shaObj = new jssha("SHA-256", "TEXT")
+ shaObj.update(source);
+ return shaObj.getHash("HEX");
}
if (typeof module === "object") {
diff --git a/common/Test.js b/common/Test.js
index e272d1e..7acbfa0 100644
--- a/common/Test.js
+++ b/common/Test.js
@@ -40,11 +40,11 @@ var Test = (() => {
async getTab(activate = false) {
let url = await this.getURL();
- let tab = url ? (await browser.tabs.query({url}))[0] ||
- (await browser.tabs.create({url}))
+ let tab = url ? (await browser.tabs.query({ url }))[0] ||
+ (await browser.tabs.create({ url }))
: null;
if (tab && activate) {
- await browser.tabs.update(tab.id, {active: true});
+ await browser.tabs.update(tab.id, { active: true });
}
return tab;
}