--- /dev/null
+{
+
+ "manifest_version": 2,
+ "name": "ZakBrowse",
+ "version": "1.0",
+
+ "description": "Sync history between devices.",
+
+ "icons": {
+ "48": "icons/border-48.png"
+ },
+
+ "permissions": [
+ "storage",
+ "history"
+ ],
+
+ "options_ui": {
+ "page": "options.html",
+ "browser_style": true
+ }
+
+}
--- /dev/null
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ </head>
+
+ <body>
+ <form>
+ <label for="server">Server URL</label>
+ <input type="text" id="server" name="server" />
+ <button type="submit">Save</button>
+ </form>
+ <button id="btn_history">History</button>
+ <div id="history"></div>
+ <script src="options.js"></script>
+ </body>
+</html>
--- /dev/null
+function saveOptions(e) {
+ browser.storage.local.set({
+ server: document.querySelector("#server").value
+ });
+ e.preventDefault();
+}
+
+function restoreOptions() {
+ let gettingItem = browser.storage.local.get('server');
+ gettingItem.then((res) => {
+ document.querySelector("#server").value = res.server || 'https://127.0.0.1:9090';
+ });
+}
+
+function history() {
+ let list = document.getElementById('history');
+ list.innerHTML = "";
+
+ let li = document.createElement('p');
+ li.innerText = "HISTORY";
+ list.appendChild(li);
+
+ let searchingHistory = browser.history.search({text: "", maxResults: 5});
+ searchingHistory.then((results) => {
+ if (results.length < 1) {
+ let li = document.createElement('p');
+ li.innerText = "NO HISTORY";
+ list.appendChild(li);
+ } else {
+ for (let k in results) {
+ let history = results[k];
+ let li = document.createElement('p');
+ li.innerText = history.url;
+ list.appendChild(li);
+ }
+ }
+ });
+}
+
+document.addEventListener('DOMContentLoaded', restoreOptions);
+document.querySelector("form").addEventListener("submit", saveOptions);
+document.getElementById("btn_history").addEventListener("click", history);