summaryrefslogtreecommitdiff
path: root/2015_locomotivebrowser/chrome/locomotive.js
diff options
context:
space:
mode:
authorjoak <joak@nospace.at>2017-01-13 15:18:08 +0100
committerjoak <joak@nospace.at>2017-01-13 15:18:08 +0100
commite955b48277bc86a41744078c032f44eeb53e38e6 (patch)
tree6b3841facbbc07697c2d7d70e84d6c7897ceb934 /2015_locomotivebrowser/chrome/locomotive.js
parentea824be9f5fa9ae470db515ab3f6d3996a9cae0f (diff)
new icon mirror
Diffstat (limited to '2015_locomotivebrowser/chrome/locomotive.js')
-rw-r--r--2015_locomotivebrowser/chrome/locomotive.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/2015_locomotivebrowser/chrome/locomotive.js b/2015_locomotivebrowser/chrome/locomotive.js
new file mode 100644
index 0000000..76b7e3c
--- /dev/null
+++ b/2015_locomotivebrowser/chrome/locomotive.js
@@ -0,0 +1,30 @@
+document.addEventListener('DOMContentLoaded', init);
+
+function init(){
+ var elem = document.getElementById('start');
+ elem.addEventListener('click',func);
+ var elem2 = document.getElementById('stop');
+ elem2.addEventListener('click',func2);
+}
+
+var first = true;
+
+function func(){
+ if(first == true){
+ chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
+ chrome.tabs.executeScript(null, {file:"jquery.js"});
+ chrome.tabs.executeScript(null, {file:"script.js"});
+ });
+ first = false;
+ }
+ chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
+ chrome.tabs.sendMessage(tabs[0].id, { greeting: "start" });
+ });
+}
+function func2(){
+ chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
+ chrome.tabs.sendMessage(tabs[0].id, { greeting: "stop" });
+ });
+}
+
+