Skip to content

Commit

Permalink
improved on-boarding workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
quaintdev committed Dec 12, 2021
1 parent 68aff34 commit 1e0bf31
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/web-ext-artifacts
uuid
snippet-box.zip
13 changes: 7 additions & 6 deletions internal/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<meta charset="utf-8">
</head>

<body>

<form>
<label>Snippet Box Instance Url<input type="text" id="instance-url"></label>
<button type="submit">Save</button>
</form>
<body style="margin:30px;">
<div style="margin:0 auto; display:block;">
<form>
<label>Snippet Box URL: <input type="text" id="instance-url"></label>
<button type="submit">Save</button>
</form>
</div>

<script src="options.js"></script>

Expand Down
1 change: 1 addition & 0 deletions internal/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ function saveOptions(e) {
browser.storage.sync.set({
url: document.querySelector("#instance-url").value
});
browser.sidebarAction.setPanel({ panel: browser.runtime.getURL(document.querySelector("#instance-url").value) });
}

function restoreOptions() {
Expand Down
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"manifest_version": 2,
"name": "snippet-box",
"description": "Save snippets from sidebar to your selfhosted snippet-box instance",
"version": "0.3",
"version": "0.5",
"browser_specific_settings": {
"gecko": {
"strict_min_version": "54.0a1"
"id": "{b5ba7858-f8af-4065-9472-e3370b43efa7}",
"strict_min_version": "80.0"
}
},
"sidebar_action": {
Expand Down
7 changes: 5 additions & 2 deletions sidebar/panel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

window.addEventListener('load', (event) => {
browser.storage.sync.get("url").then((item) => {
console.log(item)
browser.sidebarAction.setPanel({ panel: browser.runtime.getURL(item.url) });
if (item.url == "") {
browser.sidebarAction.setPanel({ panel: browser.runtime.getURL("/internal/options.html") })
} else {
browser.sidebarAction.setPanel({ panel: browser.runtime.getURL(item.url) });
}
}, (error) => {
console.log(error)
});
Expand Down

0 comments on commit 1e0bf31

Please sign in to comment.