Add pop-up and images

This commit is contained in:
Julien Lengrand-Lambert
2019-02-08 16:00:56 +01:00
parent 80dca3458f
commit a37b12b005
7 changed files with 59 additions and 1 deletions

View File

@@ -23,4 +23,8 @@ Ideas and Merge Requests are more than welcome!
## LICENSE
See LICENSE for full text, but the license is [Creative Commons Attribution NonCommercial ShareAlike (CC-NC-SA)](https://tldrlegal.com/license/creative-commons-attribution-noncommercial-sharealike-(cc-nc-sa)).
See LICENSE for full text, but the license is [Creative Commons Attribution NonCommercial ShareAlike (CC-NC-SA)](https://tldrlegal.com/license/creative-commons-attribution-noncommercial-sharealike-(cc-nc-sa)).
## Resources
* [Icon](https://www.flaticon.com/free-icon/cancel_128397#term=sign&page=1&position=59)

BIN
images/cancel_128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/cancel_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

BIN
images/cancel_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View File

@@ -10,5 +10,19 @@
}
],
"permissions": ["storage"],
"browser_action": {
"default_popup": "popup.html",
"default_title": "CloseMe autocloses all those annoying Medium ads for you!",
"default_icon": {
"16": "images/cancel_16.png",
"32": "images/cancel_32.png",
"128": "images/cancel_128.png"
}
},
"icons": {
"16": "images/cancel_16.png",
"32": "images/cancel_32.png",
"128": "images/cancel_128.png"
},
"manifest_version": 2
}

32
popup.html Normal file
View File

@@ -0,0 +1,32 @@
<html>
<head>
<title>CloseMe</title>
<style>
body{
width: 300px;
height: 16px;
font-family: 'Raleway', sans-serif;
}
div{
display: inline-block;
}
span{
font-weight: bolder;
}
img{
margin-right: 15px;
vertical-align: middle;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<script src="popup.js"></script>
</head>
<body>
<div>
<img src="./images/cancel_16.png" alt="closeme logo"/>CloseMe closed <span id="amount">X</span> pop-up(s) for you so far!
</div>
</body>
</html>

8
popup.js Normal file
View File

@@ -0,0 +1,8 @@
const storageKey = "popups_closed";
const elementId = "amount";
chrome.storage.sync.get([storageKey], (result) => {
console.log(result.popups_closed);
const value = ((result.popups_closed === undefined) ? 0 : result.popups_closed);
document.getElementById(elementId).textContent = value;
});