diff --git a/background.js b/background.js
new file mode 100644
index 0000000..0977326
--- /dev/null
+++ b/background.js
@@ -0,0 +1,24 @@
+/**
+ * Share Current Tab
+ * @return {void} -
+ */
+function shareCurrentTab() {
+ browser.tabs.query({
+ active: true,
+ currentWindow: true,
+ }).then((tabs) => {
+ const url = tabs[0].url;
+ const title = tabs[0].title || url;
+ browser.storage.local.get('url').then((storage) => {
+ const shareUrl = `${storage.url}?post=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}&source=bookmarklet`;
+
+ browser.windows.create({
+ url: shareUrl,
+ type: 'popup',
+ allowScriptsToClose: true,
+ });
+ });
+ });
+}
+
+browser.browserAction.onClicked.addListener(shareCurrentTab);
diff --git a/options/options.css b/options/options.css
new file mode 100644
index 0000000..19f36be
--- /dev/null
+++ b/options/options.css
@@ -0,0 +1,18 @@
+
+body {
+ width: 25em;
+ font-family: "Open Sans Light", sans-serif;
+ font-size: 0.9em;
+ font-weight: 300;
+}
+
+input#url {
+ margin: 0.5em;
+ width: 50em;
+ height: 2.5em;
+}
+
+input {
+ width: 20em;
+ height: 2.5em;
+}
diff --git a/options/options.html b/options/options.html
new file mode 100644
index 0000000..681b6de
--- /dev/null
+++ b/options/options.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+ URL:
+
+
+
+
+
+
diff --git a/options/options.js b/options/options.js
new file mode 100644
index 0000000..481e2f5
--- /dev/null
+++ b/options/options.js
@@ -0,0 +1,38 @@
+/*
+Store options UI using browser.storage.local.
+*/
+function storeSettings() {
+ const url = document.querySelector("#url");
+ // console.log('storeSettings url');
+ // console.log(url);
+ browser.storage.local.set({
+ url: url.value,
+ });
+}
+
+/*
+Update the options UI with the settings values retrieved from storage,
+or the default settings if the stored settings are empty.
+*/
+function updateUI(restoredSettings) {
+ const url = document.querySelector("#url");
+ // console.log('restoredSettings url');
+ // console.log(url);
+ url.value = restoredSettings.url || "";
+}
+
+function onError(e) {
+ console.error(e);
+}
+
+/*
+On opening the options page, fetch stored settings and update the UI with them.
+*/
+const gettingStoredSettings = browser.storage.local.get();
+gettingStoredSettings.then(updateUI, onError);
+
+/*
+On clicking the save button, save the currently selected settings.
+*/
+const saveButton = document.querySelector("#save-button");
+saveButton.addEventListener("click", storeSettings);
diff --git a/storage.js b/storage.js
new file mode 100644
index 0000000..20ae517
--- /dev/null
+++ b/storage.js
@@ -0,0 +1,26 @@
+/*
+Default settings. Initialize storage to these values.
+*/
+var storage = {
+ url: '',
+}
+
+/*
+Generic error logger.
+*/
+function onError(e) {
+ console.error(e);
+}
+
+/*
+On startup, check whether we have stored settings.
+If we don't, then store the default settings.
+*/
+function checkStoredSettings(storedSettings) {
+ if (!storedSettings.storage) {
+ browser.storage.local.set({storage});
+ }
+}
+
+const gettingStoredSettings = browser.storage.local.get();
+gettingStoredSettings.then(checkStoredSettings, onError);