From 9de89955bd40f52438759933f92edab8c41eeec0 Mon Sep 17 00:00:00 2001 From: Kenny Diaz Date: Tue, 28 Nov 2017 22:46:43 -0500 Subject: [PATCH] fix(chrome): add some styling to chrome extension --- chrome_extension/Popup/popup.css | 11 +++++++++++ chrome_extension/Popup/popup.html | 18 +++++++++--------- chrome_extension/Popup/popup.js | 26 ++++++++++++++++++-------- public/appcache/manifest.appcache | 2 +- public/sw.js | 4 ++-- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/chrome_extension/Popup/popup.css b/chrome_extension/Popup/popup.css index e69de29..2cb0694 100644 --- a/chrome_extension/Popup/popup.css +++ b/chrome_extension/Popup/popup.css @@ -0,0 +1,11 @@ +#app { + text-align: center; + align-content: center; + padding-top: 2px; + margin-bottom: 1px; + background-color: rgb(244,244,246) +} + +#addbookmark { + margin-top: 20px; +} diff --git a/chrome_extension/Popup/popup.html b/chrome_extension/Popup/popup.html index cf9e550..b5ac6be 100644 --- a/chrome_extension/Popup/popup.html +++ b/chrome_extension/Popup/popup.html @@ -13,25 +13,25 @@ - -

MarcaMe

-

title

+ +

marca!

+
+

title

+
- Add Tag +
Add Tag
-

+
-

- - +
- \ No newline at end of file + diff --git a/chrome_extension/Popup/popup.js b/chrome_extension/Popup/popup.js index b2a3c08..b62c784 100644 --- a/chrome_extension/Popup/popup.js +++ b/chrome_extension/Popup/popup.js @@ -8,17 +8,23 @@ window.addEventListener('load', function () { var destroy = document.getElementsByClassName('destroy'); let status = document.getElementById('status'); - document.getElementById('addBtn').addEventListener('click', event => { + document.getElementById('myInput').addEventListener('keypress', event => { + console.log(event.keyCode) + if (event.keyCode === 13) { event.preventDefault(); var li = document.createElement('a'); var inputValue = document.getElementById('myInput').value; var text = document.createTextNode(inputValue); li.appendChild(text); - if (status.innerHTML === 'Tags must contain text!') status.innerHTML = ''; + if (status.innerHTML === 'Don\'t forget to enter tags!') status.innerHTML = ''; if (inputValue === '') { - status.innerHTML = 'Tags must contain text!'; + const messages = ['Don\'t forget to enter tags!', 'Press Add to Submit'] + const getRandomMessage = () => { + return Math.floor(Math.random() * (2 - 0) + 0) + } + status.innerHTML = messages[getRandomMessage()]; } else { document.getElementById('myUL').appendChild(li); li.className = 'ui label tags'; @@ -37,9 +43,11 @@ window.addEventListener('load', function () { div.style.display = 'none'; } } + } }) - document.getElementById('save').addEventListener('click', event => { + let saveButton = document.getElementById('save'); + saveButton.addEventListener('click', event => { event.preventDefault(); let allTags = document.getElementsByClassName('tags'); @@ -53,13 +61,15 @@ window.addEventListener('load', function () { data }) .done(() => { - chrome.tabs.query({ title: 'MarcaMe' }, marca => { + chrome.tabs.query({ title: 'marca' }, marca => { chrome.tabs.reload(marca[0].id); + saveButton.innerHTML = 'Saved!' }); }) - .fail(response => console.log('ERROR', response)); + .fail(response => { + saveButton.innerHTML = 'Error Saving!' + console.log('ERROR', response) + }); }); - - }); }); diff --git a/public/appcache/manifest.appcache b/public/appcache/manifest.appcache index 87748de..3ba61f2 100644 --- a/public/appcache/manifest.appcache +++ b/public/appcache/manifest.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -#ver:2017-11-28 17:11:42 +#ver:2017-11-28 22:23:52 #plugin:4.8.4 CACHE: diff --git a/public/sw.js b/public/sw.js index 689f348..6d992e1 100644 --- a/public/sw.js +++ b/public/sw.js @@ -11,13 +11,13 @@ var __wpo = { "/" ], "hashesMap": { - "69c61d6d01210d15f052f63572bcb3073b6a09be": "/bundle.js" + "45ef3d592f4701dfbdff8e73cb16916f9cba743e": "/bundle.js" }, "navigateFallbackURL": "/", "navigateFallbackForRedirects": true, "strategy": "changed", "responseStrategy": "cache-first", - "version": "2017-11-28 17:11:42", + "version": "2017-11-28 22:23:52", "name": "webpack-offline", "pluginVersion": "4.8.4", "relativePaths": false