summaryrefslogtreecommitdiff
path: root/2016_washingmachine/firefox/script.js
diff options
context:
space:
mode:
Diffstat (limited to '2016_washingmachine/firefox/script.js')
-rw-r--r--2016_washingmachine/firefox/script.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/2016_washingmachine/firefox/script.js b/2016_washingmachine/firefox/script.js
new file mode 100644
index 0000000..d730794
--- /dev/null
+++ b/2016_washingmachine/firefox/script.js
@@ -0,0 +1,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 = "";
+ }
+ }
+);