Skip to content

Commit

Permalink
Update eslint styles
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 committed Feb 3, 2024
1 parent 382c5ca commit 1a393e8
Show file tree
Hide file tree
Showing 42 changed files with 268 additions and 268 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
presets: ["@vue/cli-plugin-babel/preset"],
};
30 changes: 15 additions & 15 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
onUpdatedListener,
onRemovedListener,
onRequestOpenIntel,
onToggleIITC
onToggleIITC,
} from "./intel";
import "./requests";
import { strToBase64 } from "@/strToBase64";
Expand All @@ -18,26 +18,26 @@ const manager = new Manager({
browser.runtime
.sendMessage({
type: "showMessage",
message: _(message, args)
message: _(message, args),
})
.then();
} catch {
// If popup is closed, message goes nowhere and an error occurs. Ignore.
}
},
progressbar: is_show => {
progressbar: (is_show) => {
try {
browser.runtime
.sendMessage({
type: "showProgressbar",
value: is_show
value: is_show,
})
.then();
} catch {
// If popup is closed, message goes nowhere and an error occurs. Ignore.
}
},
inject_plugin: plugin => inject_plugin(plugin).then()
inject_plugin: (plugin) => inject_plugin(plugin).then(),
});

manager.run().then();
Expand All @@ -48,7 +48,7 @@ onUpdated.addListener((tabId, status, tab) =>
);
onRemoved.addListener(onRemovedListener);

browser.runtime.onMessage.addListener(async request => {
browser.runtime.onMessage.addListener(async (request) => {
switch (request.type) {
case "requestOpenIntel":
await onRequestOpenIntel();
Expand All @@ -62,7 +62,7 @@ browser.runtime.onMessage.addListener(async request => {
}
});

browser.runtime.onMessage.addListener(async function(request) {
browser.runtime.onMessage.addListener(async function (request) {
switch (request.type) {
case "managePlugin":
await manager.managePlugin(request.uid, request.action);
Expand All @@ -83,7 +83,7 @@ browser.runtime.onMessage.addListener(async function(request) {
browser.runtime
.sendMessage({
type: "resolveAddUserScripts",
scripts: await manager.addUserScripts(request.scripts)
scripts: await manager.addUserScripts(request.scripts),
})
.then();
} catch {
Expand All @@ -95,7 +95,7 @@ browser.runtime.onMessage.addListener(async function(request) {
browser.runtime
.sendMessage({
type: "resolveGetPluginInfo",
info: await manager.getPluginInfo(request.uid)
info: await manager.getPluginInfo(request.uid),
})
.then();
} catch {
Expand All @@ -107,7 +107,7 @@ browser.runtime.onMessage.addListener(async function(request) {
browser.runtime
.sendMessage({
type: "resolveGetBackupData",
data: await manager.getBackupData(request.params)
data: await manager.getBackupData(request.params),
})
.then();
} catch {
Expand All @@ -122,7 +122,7 @@ browser.runtime.onMessage.addListener(async function(request) {
data: await manager.setBackupData(
request.params,
request.backup_data
)
),
})
.then();
} catch {
Expand All @@ -144,7 +144,7 @@ async function xmlHttpRequestHandler(data) {
const detail_stringify = JSON.stringify({
task_uuid: data.task_uuid,
task_type: data.task_type,
response: JSON.stringify(response)
response: JSON.stringify(response),
});

const injectedCode = `
Expand All @@ -155,21 +155,21 @@ async function xmlHttpRequestHandler(data) {

try {
await browser.tabs.executeScript(data.tab_id, {
code: injectedCode
code: injectedCode,
});
} catch (error) {
console.error(`An error occurred while execute script: ${error.message}`);
}
}

const req = new XMLHttpRequest();
req.onload = function() {
req.onload = function () {
const response = {
readyState: this.readyState,
responseHeaders: this.responseHeaders,
responseText: this.responseText,
status: this.status,
statusText: this.statusText
statusText: this.statusText,
};
xmlResponse(data.tab_id, data.onload, response);
};
Expand Down
6 changes: 3 additions & 3 deletions src/background/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { check_matching } from "lib-iitc-manager";
export async function inject_plugin(plugin) {
const tabs = await getTabsToInject();

const is_ingress_tab = url => {
const is_ingress_tab = (url) => {
return /https:\/\/(intel|missions).ingress.com\/*/.test(url);
};

Expand All @@ -26,7 +26,7 @@ export async function inject_plugin(plugin) {
try {
await browser.tabs.executeScript(tab.id, {
code: inject,
runAt: "document_end"
runAt: "document_end",
});
} catch (error) {
console.error(`An error occurred while reloading tabs: ${error.message}`);
Expand All @@ -38,7 +38,7 @@ export async function inject_plugin(plugin) {
export async function getTabsToInject() {
let allTabs = await browser.tabs.query({ status: "complete" });

return allTabs.filter(function(tab) {
return allTabs.filter(function (tab) {
return tab.status === "complete" && tab.url;
});
}
4 changes: 2 additions & 2 deletions src/background/intel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function onRequestOpenIntel() {
try {
const tab = await browser.tabs.create({
url: "https://intel.ingress.com/",
pinned: true
pinned: true,
});
lastIITCTab = tab.id;
} catch (error) {
Expand Down Expand Up @@ -62,7 +62,7 @@ async function initialize(manager) {

async function setTabActive(tabId) {
const tab = await browser.tabs.update(tabId, {
active: true
active: true,
});

try {
Expand Down
18 changes: 9 additions & 9 deletions src/background/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const IS_CHROME = !!global.chrome.app;
const whitelist = [
"^https://github.com/[^/]*/[^/]*/raw/[^/]*/[^/]*?\\.user\\.js([?#]|$)",
"^https://gist.github.com/.*?/[^/]*?.user.js([?#]|$)",
"^https://gitlab.com/[^/]*/[^/]*/(|-/)raw/[^/]*/[^/]*?\\.user\\.js([?#]|$)"
].map(re => new RegExp(re));
"^https://gitlab.com/[^/]*/[^/]*/(|-/)raw/[^/]*/[^/]*?\\.user\\.js([?#]|$)",
].map((re) => new RegExp(re));
const blacklist = ["//(?:(?:gist.|)github.com|gitlab.com)/"].map(
re => new RegExp(re)
(re) => new RegExp(re)
);

const cache = {};
Expand Down Expand Up @@ -66,7 +66,7 @@ async function bypass(tabId, url) {
async function maybeInstallUserJs(tabId, url) {
const IITC_is_enabled = await browser.storage.local
.get(["IITC_is_enabled"])
.then(data => data.IITC_is_enabled);
.then((data) => data.IITC_is_enabled);
if (IITC_is_enabled === false) {
await bypass(tabId, url);
return;
Expand Down Expand Up @@ -107,7 +107,7 @@ async function confirmInstall(url, code) {
await browser.storage.local.set(cache);

await browser.tabs.create({
url: await browser.runtime.getURL(`/jsview.html?uniqId=${uniqId}`)
url: await browser.runtime.getURL(`/jsview.html?uniqId=${uniqId}`),
});
}

Expand All @@ -119,7 +119,7 @@ function matches(re) {
/**
* Set autoclose if userscript was opened in a new tab
*/
browser.tabs.onCreated.addListener(tab => {
browser.tabs.onCreated.addListener((tab) => {
const url =
tab.url === "about:blank" ? tab.title : tab.url || tab.pendingUrl || "";
if (
Expand All @@ -133,7 +133,7 @@ browser.tabs.onCreated.addListener(tab => {
/**
* Deleting status when closing a tab
*/
browser.tabs.onRemoved.addListener(tabId => {
browser.tabs.onRemoved.addListener((tabId) => {
delete cache[tabId];
});

Expand All @@ -149,9 +149,9 @@ if (browser.webRequest) {
"*://*/*.user.js",
"*://*/*.user.js?*",
"file://*/*.user.js",
"file://*/*.user.js?*"
"file://*/*.user.js?*",
],
types: ["main_frame"]
types: ["main_frame"],
},
["blocking"]
);
Expand Down
12 changes: 6 additions & 6 deletions src/content-scripts/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ export async function bridgeAction(e) {
}
}

const xmlResponseBridge = async data => {
const xmlResponseBridge = async (data) => {
browser.runtime
.sendMessage({
type: "xmlHttpRequestHandler",
value: data
value: data,
})
.then();
};

// Sends the entire plugins scoped storage to the page context
const getStorageBridge = async req => {
const getStorageBridge = async (req) => {
const all_storage = await browser.storage.local.get(null);
const plugins_storage = {};
for (const key in all_storage) {
Expand All @@ -44,7 +44,7 @@ const getStorageBridge = async req => {
}
const detail_stringify = JSON.stringify({
task_type: req.task_type,
response: JSON.stringify(plugins_storage)
response: JSON.stringify(plugins_storage),
});

const injectedCode = `
Expand All @@ -56,13 +56,13 @@ const getStorageBridge = async req => {
};

// Saves the value in the persistent storage in order to synchronize the data with the storage in the page context
const setValueBridge = async req => {
const setValueBridge = async (req) => {
const set_data = {};
set_data[req.key] = req.value;
await browser.storage.local.set(set_data);
};

// Deletes the value in the persistent storage in order to synchronize the data with the storage in the page context
const delValueBridge = async req => {
const delValueBridge = async (req) => {
await browser.storage.local.remove(req.key);
};
Loading

0 comments on commit 1a393e8

Please sign in to comment.