diff --git a/.DS_Store b/.DS_Store index 897bbc2..7c4e5d1 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/notify-link-clicks-i18n/background-script.js b/notify-link-clicks-i18n/background-script.js index fad6458..698fbf1 100644 --- a/notify-link-clicks-i18n/background-script.js +++ b/notify-link-clicks-i18n/background-script.js @@ -9,7 +9,7 @@ function notify(message) { var content = chrome.i18n.getMessage("notificationContent", message.url); chrome.notifications.create({ "type": "basic", - "iconUrl": chrome.extension.getURL("icons/link-48.png"), + "iconUrl": chrome.extension.getURL("icons/__MSG_@@ui_locale__/link-48-__MSG_@@ui_locale__.png"), "title": title, "message": content }); diff --git a/notify-link-clicks-i18n/icons/de/link-48-de.png b/notify-link-clicks-i18n/icons/de/link-48-de.png new file mode 100644 index 0000000..9f39e96 Binary files /dev/null and b/notify-link-clicks-i18n/icons/de/link-48-de.png differ diff --git a/notify-link-clicks-i18n/icons/en/link-48-en.png b/notify-link-clicks-i18n/icons/en/link-48-en.png new file mode 100644 index 0000000..2effc6f Binary files /dev/null and b/notify-link-clicks-i18n/icons/en/link-48-en.png differ diff --git a/notify-link-clicks-i18n/icons/ja/link-48-ja.png b/notify-link-clicks-i18n/icons/ja/link-48-ja.png new file mode 100644 index 0000000..6aebbee Binary files /dev/null and b/notify-link-clicks-i18n/icons/ja/link-48-ja.png differ diff --git a/notify-link-clicks-i18n/icons/nl/link-48-nl.png b/notify-link-clicks-i18n/icons/nl/link-48-nl.png new file mode 100644 index 0000000..014b60a Binary files /dev/null and b/notify-link-clicks-i18n/icons/nl/link-48-nl.png differ diff --git a/quicknote/icons/quicknote-32.png b/quicknote/icons/quicknote-32.png new file mode 100644 index 0000000..94af0b4 Binary files /dev/null and b/quicknote/icons/quicknote-32.png differ diff --git a/quicknote/icons/quicknote-48.png b/quicknote/icons/quicknote-48.png new file mode 100644 index 0000000..f06b80c Binary files /dev/null and b/quicknote/icons/quicknote-48.png differ diff --git a/quicknote/manifest.json b/quicknote/manifest.json new file mode 100644 index 0000000..2e53151 --- /dev/null +++ b/quicknote/manifest.json @@ -0,0 +1,24 @@ +{ + + "description": "Allows the user to make quick notes by clicking a button and entering text into the resulting popup. The notes are saved in storage and synced across the user's sync login, even across different devices. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#quicknote", + "manifest_version": 1, + "name": "Quicknote", + "version": "1.0", + "homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/quicknote", + "icons": { + "48": "icons/quicknote-48.png" + }, + + "applications": { + "gecko": { + "id": "quicknote@mozilla.org", + "strict_min_version": "45.0.0" + } + }, + + "browser_action": { + "default_icon": "icons/quicknote-32.png", + "default_title": "Quicknote", + "default_popup": "popup/quicknote.html" + }, +} diff --git a/quicknote/popup/quicknote.css b/quicknote/popup/quicknote.css new file mode 100644 index 0000000..7aad2a1 --- /dev/null +++ b/quicknote/popup/quicknote.css @@ -0,0 +1,109 @@ +/* General styling */ + +* { + box-sizing: border-box; +} + +html { + font-family: sans-serif; + font-size: 10px; + background: white; +} + +body { + width: 300px; + background: rgb(240,240,240); + border: 1px solid #ccc; + margin: 0 auto; + padding: 2px; +} + +.outer-wrapper { + overflow: auto; + width: 100%; + height: 300px; +} + +.clearfix { + clear: both; +} + +/* form control styling */ + +input, textarea, button { + border: 1px solid rgb(218,218,218); + padding: 4px; + background: white; + border-radius: 3px; +} + +button { + background: #ccc; + box-shadow: inset -2px -2px 1px rgba(0,0,0,0.2); + transition: 0.1s all; +} + +button:hover, button:focus { + background: #ddd; +} + +button:active { + box-shadow: inset -2px -2px 1px rgba(0,0,0,0.05); +} + +input, textarea { + font-family: sans-serif; + box-shadow: inset 2px 2px 1px rgba(0,0,0,0.10); +} + +/* Typography */ + +h2 { + font-size: 1.3rem; +} + +p, input, textarea { + font-size: 1.2rem; + line-height: 1.5; +} + +/* New notes entry box */ + +.new-note { + width: 100%; + margin-bottom: 5px; + padding: 2px; +} + +.new-note input { + width: 100%; + margin-bottom: 2px; +} + +.new-note textarea { + width: 100%; + margin-bottom: 4px; + resize: none; +} + +.clear { + float: left; +} + +.add { + float: right; +} + +/* Notes display box(es) */ + +.note { + padding: 2px; +} + +.delete { + float: right; +} + +p { + margin: 0; +} \ No newline at end of file diff --git a/quicknote/popup/quicknote.html b/quicknote/popup/quicknote.html new file mode 100644 index 0000000..d816f55 --- /dev/null +++ b/quicknote/popup/quicknote.html @@ -0,0 +1,27 @@ + + + + + + + + + +
+
+ + + + +
+
+ +
+ +
+
+ + + + + diff --git a/quicknote/popup/quicknote.js b/quicknote/popup/quicknote.js new file mode 100644 index 0000000..6848e16 --- /dev/null +++ b/quicknote/popup/quicknote.js @@ -0,0 +1,72 @@ +var inputTitle = document.querySelector('.new-note input'); +var inputBody = document.querySelector('.new-note textarea'); + +var noteContainer = document.querySelector('.note-container'); + + +var clearBtn = document.querySelector('.clear'); +var addBtn = document.querySelector('.add'); + +addBtn.addEventListener('click', addNote); +clearBtn.addEventListener('click', clearAll); + +initialize(); + +function initialize() { + var length = localStorage.length; + for(i = 0; i < length; i++) { + var item = localStorage.getItem(localStorage.key(i)); + displayNote(localStorage.key(i),item); + } +} + +function addNote() { + var noteTitle = inputTitle.value; + var noteBody = inputBody.value; + + if(!localStorage.getItem(noteTitle) && noteTitle !== '' && noteBody !== '') { + inputTitle.value = ''; + inputBody.value = ''; + displayNote(noteTitle,noteBody); + storeNote(noteTitle,noteBody); + } +} + +function displayNote(title, body) { + var note = document.createElement('div'); + var noteH = document.createElement('h2'); + var notePara = document.createElement('p'); + var deleteBtn = document.createElement('button'); + var clearFix = document.createElement('div'); + + note.setAttribute('class','note'); + noteH.textContent = title; + notePara.textContent = body; + deleteBtn.setAttribute('class','delete'); + deleteBtn.textContent = 'Delete note'; + clearFix.setAttribute('class','clearfix'); + + note.appendChild(noteH); + note.appendChild(notePara); + note.appendChild(deleteBtn); + note.appendChild(clearFix); + + noteContainer.appendChild(note); + + deleteBtn.addEventListener('click',function(e){ + evtTgt = e.target; + evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode); + localStorage.removeItem(title); + }) +} + +function storeNote(title, body) { + localStorage.setItem(title, body); +} + +function clearAll() { + while (noteContainer.firstChild) { + noteContainer.removeChild(noteContainer.firstChild); + } + localStorage.clear(); +} \ No newline at end of file