Code quality

This commit is contained in:
Carlos Quintana
2022-05-18 15:39:51 +02:00
parent 5da4fedf26
commit 13a4836b9d
4 changed files with 10 additions and 7 deletions
+5 -3
View File
@@ -64,9 +64,10 @@ async function handleExtensionSetup() {
* @returns boolean
*/
const isMessageAllowed = (url) => {
console.log("Received message from " + url);
const requestUrl = new URL(url);
const apiUrl = new URL(SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.API_URL]);
const apiUrl = new URL(
SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.API_URL]
);
let allowedSources = [
new RegExp(apiUrl.hostname),
@@ -75,7 +76,8 @@ const isMessageAllowed = (url) => {
new RegExp("^.*\\.protonmail\\.com$"),
];
const extraAllowedDomains = SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS];
const extraAllowedDomains =
SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS];
for (const extra of extraAllowedDomains) {
allowedSources.push(new RegExp(extra));
}
-1
View File
@@ -2,7 +2,6 @@ import browser from "webextension-polyfill";
import SLStorage from "../popup/SLStorage";
function initService() {
browser.runtime.onInstalled.addListener(async function ({ reason }) {
if (reason === "install") {
await SLStorage.clear();
+4 -2
View File
@@ -90,7 +90,8 @@ if (!window._hasExecutedSlExtension) {
addSLButtonToInput(inputElem) {
// create wrapper for SL button
const btnWrapper = InputTools.newDiv("sl-button-wrapper");
const inputSumHeight = inputElem.getBoundingClientRect().height + "px";
const inputSumHeight =
inputElem.getBoundingClientRect().height + "px";
btnWrapper.style.height = inputSumHeight;
btnWrapper.style.width = inputSumHeight;
document.body.appendChild(btnWrapper);
@@ -145,7 +146,8 @@ if (!window._hasExecutedSlExtension) {
-inputStyle.paddingRight,
]) + "px";
const top = InputTools.sumPixel([inputCoords.top, pageYOffset]) + "px";
const top =
InputTools.sumPixel([inputCoords.top, pageYOffset]) + "px";
if (btnWrapper.style.left !== left) {
btnWrapper.style.left = left;
+1 -1
View File
@@ -23,7 +23,7 @@ class SLStorage {
[SLStorage.SETTINGS.SL_BUTTON_POSITION]: "right-inside",
[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS]: devConfig
? devConfig.EXTRA_ALLOWED_DOMAINS
: []
: [],
};
static set(key, value) {