Skip to content

Commit

Permalink
fix notification on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
robinhuy committed Mar 17, 2017
1 parent ec1d28f commit 617a2d0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
78 changes: 39 additions & 39 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@
* Created by Robin Huy
*/

function eieShowToast(icon) {
// Create toast container
var toastContainer = document.createElement('div');
toastContainer.style.top = '10%';
toastContainer.style.right = '7%';
toastContainer.style.maxWidth = '80%';
toastContainer.style.position = 'fixed';
toastContainer.style.zIndex = '999999';
toastContainer.style.fontSize = '15px';
toastContainer.style.lineHeight = '1.5';
toastContainer.style.color = 'rgba(0,0,0,0.87)';
chrome.runtime.onMessage.addListener(function (request) {
function eieShowToast(icon) {
// Create toast container
var toastContainer = document.createElement('div');
toastContainer.style.top = '10%';
toastContainer.style.right = '7%';
toastContainer.style.maxWidth = '80%';
toastContainer.style.position = 'fixed';
toastContainer.style.zIndex = '999999';
toastContainer.style.fontSize = '15px';
toastContainer.style.lineHeight = '1.5';
toastContainer.style.color = 'rgba(0,0,0,0.87)';

// Create toast
var toast = document.createElement('div');
toast.style.transform = 'translateY(-35px)';
toast.style.top = '35px';
toast.style.marginTop = '10px';
toast.style.padding = '10px 25px';
toast.style.backgroundColor = '#323232';
toast.style.color = '#ffffff';
toast.style.display = 'flex';
toast.style.alignItems = 'center';
toast.style.justifyContent = 'space-between';
toast.style.boxShadow = '0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.2)';
// Create toast
var toast = document.createElement('div');
toast.style.transform = 'translateY(-35px)';
toast.style.top = '35px';
toast.style.marginTop = '10px';
toast.style.padding = '10px 25px';
toast.style.backgroundColor = '#323232';
toast.style.color = '#ffffff';
toast.style.display = 'flex';
toast.style.alignItems = 'center';
toast.style.justifyContent = 'space-between';
toast.style.boxShadow = '0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.2)';

// Set text
var span = document.createElement('span');
var text = document.createTextNode(icon + ' \u00A0 copied to clipboard');
span.appendChild(text);

// Append child
toast.appendChild(span);
toastContainer.appendChild(toast);
document.body.appendChild(toastContainer);
// Set text
var span = document.createElement('span');
var text = document.createTextNode(icon + ' \u00A0 copied to clipboard');
span.appendChild(text);

// Remove toast after 3 second
setTimeout(function () {
document.body.removeChild(toastContainer);
}, 3000);
}
// Append child
toast.appendChild(span);
toastContainer.appendChild(toast);
document.body.appendChild(toastContainer);

// Remove toast after 3 second
setTimeout(function () {
document.body.removeChild(toastContainer);
}, 3000);
}

chrome.runtime.onMessage.addListener(function (request) {
// Show toast when received message "copy emoticon"
if (request.action === 'copy emoticon') {
if (request.action === 'copy-emoticon') {
eieShowToast(request.icon);
}
});
4 changes: 3 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"manifest_version": 2,

"name": "Emoticon input everywhere",
"short_name": "Emoticon input",
"description": "Allow input emoticon in everywhere",
"version": "1.0",
"version": "1.1",
"author": "Robin Huy",

"browser_action": {
"default_icon": "icon.png",
Expand Down

0 comments on commit 617a2d0

Please sign in to comment.