Add Firefox support (#42)

This commit is contained in:
Maxim Baz
2019-03-16 02:41:16 +01:00
committed by GitHub
parent 7c2397bbfd
commit 1676b90187
8 changed files with 17 additions and 5 deletions

View File

@@ -40,6 +40,10 @@ js/inject.dist.js: $(BROWSERIFY) inject.js
[ -d js ] || mkdir -p js
$(BROWSERIFY) -o js/inject.dist.js inject.js
# Firefox requires the last command to evaluate to something serializable
# https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript#Return_value
echo ";undefined" >> js/inject.dist.js
.PHONY: clean
clean:
rm -rf $(CLEAN_FILES)

View File

@@ -492,7 +492,7 @@ async function parseFields(settings, login) {
lines.forEach(function(line) {
// split key / value
var parts = line
.split(/(?<=^[^:]+):/)
.split(":")
.map(value => value.trim())
.filter(value => value.length);
if (parts.length != 2) {

View File

@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="../css/options.dist.css" />
<script src="../js/options.dist.js"></script>
</head>

View File

@@ -69,9 +69,11 @@ h3:first-child {
.add-store {
cursor: pointer;
display: block;
display: inline-block;
margin-top: 8px;
margin-bottom: 30px;
color: rgb(17, 85, 204);
text-decoration: underline;
}
.error {

View File

@@ -24,7 +24,7 @@ function Interface(settings, logins) {
this.settings = settings;
this.logins = logins;
this.results = [];
this.currentDomainOnly = !settings.tab.url.match(/^chrome:\/\//);
this.currentDomainOnly = !settings.tab.url.match(/^(chrome|about):/);
this.searchPart = new SearchInterface(this);
// initialise with empty search

View File

@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="../css/popup.dist.css" />
<script src="../js/popup.dist.js"></script>
</head>

View File

@@ -141,10 +141,14 @@ async function withLogin(action) {
break;
}
// Firefox requires data to be serializable,
// this removes everything offending such as functions
const login = JSON.parse(JSON.stringify(this.login));
// hand off action to background script
var response = await chrome.runtime.sendMessage({
action: action,
login: this.login
login: login
});
if (response.status != "ok") {
throw new Error(response.message);

View File

@@ -30,7 +30,7 @@ body {
white-space: nowrap;
background-color: @bg-color;
color: @text-color;
font-weight: 200;
font-weight: 300;
}
html::-webkit-scrollbar,