blob: d730794db7d75343688685f8b4a730e04cd30694 (
plain)
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
37
38
39
40
|
var audioElement;
var interer;
var start = false;
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(request.greeting);
if(request.greeting == "start"){
if(start == false){
start = true;
var link = document.createElement("link");
link.href = chrome.extension.getURL("animationwashingmachine.css");
link.type = "text/css";
link.rel = "stylesheet";
document.getElementsByTagName("head")[0].appendChild(link);
audioElement = document.createElement('audio');
audioElement.setAttribute('src', chrome.extension.getURL("start.mp3"));
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.setAttribute('loop', 'true');
audioElement.play();
$('body').css({"-webkit-animation-duration": "8.229s"});
$('body').css({"-webkit-animation-name": "washingmachinestart"});
$('body').css({"-webkit-animation-timing-function": "ease-in-out" });
$('body').css({"-webkit-animation-play-state": "running"});
$('body').css({"-webkit-animation-iteration-count": "infinite" });
}
}
if(request.greeting == "stop"){
start = false;
audioElement.play();
clearTimeout(interer);
$('body').css("-webkit-animation", "none");
audioElement.src = "";
}
}
);
|