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 [ -d js ] || mkdir -p js
$(BROWSERIFY) -o js/inject.dist.js inject.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 .PHONY: clean
clean: clean:
rm -rf $(CLEAN_FILES) rm -rf $(CLEAN_FILES)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -141,10 +141,14 @@ async function withLogin(action) {
break; 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 // hand off action to background script
var response = await chrome.runtime.sendMessage({ var response = await chrome.runtime.sendMessage({
action: action, action: action,
login: this.login login: login
}); });
if (response.status != "ok") { if (response.status != "ok") {
throw new Error(response.message); throw new Error(response.message);

View File

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