Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chrome): add some styling to chrome extension #106

Merged
merged 1 commit into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions chrome_extension/Popup/popup.css
Original file line number Diff line number Diff line change
@@ -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;
}
18 changes: 9 additions & 9 deletions chrome_extension/Popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
<script src="popup.js"></script>
</head>

<body>
<h1>MarcaMe</h1>
<h3 id="article-title">title</h3>
<body id="app">
<h1>marca!</h1>
<div>
<h3 id="article-title">title</h3>
</div>
<form id="addbookmark">
<div class="ui right labeled left icon input">
<input type="text" id="myInput" name="tags" value="" placeholder="Enter tags">
<a type="button" id="addBtn" class="ui tag label">Add Tag</a>
<div class="ui grey tag label">Add Tag</div>
</div>

<br /><br />
<!-- <br /><br /> -->

<div class="ui blue labels" id="myUL"></div>

<br /><br />

<p id="status"></p>

<button class="ui teal label" id="save" type="submit">Save Bookmark</button>
<button class="ui primary button" id="save" type="button">Add Bookmark</button>
</form>
</body>

</html>
</html>
26 changes: 18 additions & 8 deletions chrome_extension/Popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');

Expand All @@ -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)
});
});


});
});
2 changes: 1 addition & 1 deletion public/appcache/manifest.appcache
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down