-
Notifications
You must be signed in to change notification settings - Fork 104
/
indicator.js
36 lines (34 loc) · 1008 Bytes
/
indicator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
chrome.runtime.onMessage.addListener(function (message) {
console.log('msg received:'+message);
showStartAnim(message);
});
function showStartAnim(msg){
var src;
var shadow;
if(msg=='safe'){
src=chrome.runtime.getURL('icons/startd.png');
shadow='box-shadow:10px 10px 50px 20px rgb(147, 253, 147);';
} else if (msg=='danger'){
src=chrome.runtime.getURL('icons/startdr.png');
} else {
return;
}
console.log('showing animation');
var img = document.createElement('img');
img.src = src;
img.style.cssText = 'position:fixed;opacity:1;z-index:999999;width:100px;height:100px;';
document.body.appendChild(img);
img.style.left = '70%';
img.style.top = '30%';
setTimeout(function () {
img.style.webkitTransition = 'all 2s';
img.style.left = '90%';
img.style.top = '-10%';
img.style.opacity = .5;
img.style.width = 30 + 'px';
img.style.height = 30 + 'px';
setTimeout(function () {
document.body.removeChild(img);
}, 3000);
}, 100);
}