From 626013dc0755ba016c26a820ed2749d0cfb01309 Mon Sep 17 00:00:00 2001 From: Joe Jarvis Date: Thu, 28 Jun 2018 21:39:59 -0400 Subject: [PATCH] Style changes, changed default padding to 5px --- extension/notes.css | 22 ++++------------------ extension/notes.js | 29 ++++++++++++----------------- extension/options.html | 2 +- extension/setup.js | 2 +- 4 files changed, 18 insertions(+), 37 deletions(-) diff --git a/extension/notes.css b/extension/notes.css index 6dffd2c..ac44621 100644 --- a/extension/notes.css +++ b/extension/notes.css @@ -9,6 +9,7 @@ textarea { color: inherit; resize: none; height: 100%; + width: 100%; } table { @@ -27,7 +28,7 @@ table { border-bottom: none; } -#buttons, #overlay, #confirmDelete { +#buttons, #overlay, #confirmDelete, #tabstrip { background-color: inherit; color: inherit; font-family: sans-serif; @@ -73,7 +74,6 @@ table { #buttons > .mdi { padding-left: 5px; - /* padding-right: 5px; */ } #buttons > .mdi:first-child { @@ -88,19 +88,6 @@ table { flex-grow: 1; } -/* .left { */ -/* float: left; */ -/* overflow-x: hidden; */ -/* text-align: left; */ -/* width: 66%; */ -/* } */ - -/* .right { */ -/* float: right; */ -/* text-align: right; */ -/* width: 33%; */ -/* } */ - .mdi:hover { cursor: pointer; } @@ -172,18 +159,17 @@ table { select { border: none; - /* background-color: #EEEEEE; */ } /* https://stackoverflow.com/questions/90178/make-a-div-fill-the-height-of-the-remaining-screen-space */ .box { display: flex; flex-flow: column; - height: 100vh; + height: 100%; } .box .row.header { - flex: 0 1 auto; + flex: 0 1 20px; } .box .row.content { diff --git a/extension/notes.js b/extension/notes.js index a33b582..7959283 100644 --- a/extension/notes.js +++ b/extension/notes.js @@ -68,6 +68,7 @@ async function loadGeneralNotes() { var res = await browser.storage.local.get("general_notes"); textarea.value = res.general_notes[tabstrip.dataset.activeTab] || ""; back.innerText = "General Notes"; + back.title = "General Notes"; textarea.addEventListener("input", saveGeneralNotes); } @@ -86,11 +87,12 @@ async function siteNoteSetup(site) { } textarea.value = text; back.innerText = site; + back.title = site; textarea.addEventListener("input", saveSiteNotes); } function removeNoteFromList(name) { - var deleteButton = noteList.querySelector("span[data-delete-site='" + name + "']"); + var deleteButton = noteList.querySelector(`span[data-delete-site=${name}]`); deleteButton.parentNode.parentNode.removeChild(deleteButton.parentNode); } @@ -134,40 +136,31 @@ async function loadSiteNotes(manualClick = false, mode = "") { var tabs = await browser.tabs.query({active: true, currentWindow: true}); if (!tabs[0].incognito || manualClick || (res.options.private_browsing && tabs[0].incognito)) { var url = tabs[0].url; - var site = await siteParser(url, mode); + var site = await siteParser(url, mode || res.options.default_display); if (site === "general_notes") { loadGeneralNotes(); } else { siteNoteSetup(site); + toggle.value = mode || res.options.default_display; } } else { loadGeneralNotes(); } } -function changeNoteMode() { +async function changeNoteMode() { + var tabs = await browser.tabs.query({active: true, currentWindow: true}); switch (this.value) { case "url": - loadSiteNotes(true, "url"); - break; case "domain": - loadSiteNotes(true, "domain"); + // back.dataset[tabs[0].id] = await siteParser(tabs[0].url, this.value); + loadSiteNotes(true, this.value); break; case "general_notes": + // back.dataset[tabs[0].id] = "General Notes"; loadGeneralNotes(); break; } - // switch (this.className) { - // case "mdi mdi-web": - // loadSiteNotes(true, "url"); - // break; - // case "mdi mdi-domain": - // loadSiteNotes(true); - // break; - // case "mdi mdi-note": - // loadGeneralNotes(); - // break; - // } } async function setTheme(mode) { @@ -189,6 +182,7 @@ async function setTheme(mode) { confirmDelete.style.backgroundColor = bg_color; document.body.style.color = font_color; search.style.color = font_color; + toggle.style.color = font_color; } async function changeTheme() { @@ -214,6 +208,7 @@ function addNoteToList(site) { cont.className = "container"; var name = document.createElement("span"); name.innerText = site; + name.title = site; name.className = "name"; var del = document.createElement("span"); del.dataset.deleteSite = site; diff --git a/extension/options.html b/extension/options.html index 6ef00c4..8583d57 100644 --- a/extension/options.html +++ b/extension/options.html @@ -216,7 +216,7 @@
- + (Please export notes and options before downloading from sync, just in case.)
diff --git a/extension/setup.js b/extension/setup.js index 32cc51c..3d37368 100644 --- a/extension/setup.js +++ b/extension/setup.js @@ -24,7 +24,7 @@ function setOpts() { res.options.bullet_types = res.options.hasOwnProperty("bullet_types") ? res.options.bullet_types : ["*", "-", "+"]; res.options.get_params = res.options.hasOwnProperty("get_params") ? res.options.get_params : ["q", "v"]; res.options.tabnos = res.options.hasOwnProperty("tabnos") ? res.options.tabnos : 1; - res.options.padding = res.options.hasOwnProperty("padding") ? res.options.padding : 0; + res.options.padding = res.options.hasOwnProperty("padding") ? res.options.padding : 5; res.site_notes = res.hasOwnProperty("site_notes") ? res.site_notes : {}; if (!Array.isArray(res.general_notes)) { res.general_notes = [res.general_notes];