-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoriginal.js
93 lines (63 loc) · 1.88 KB
/
original.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(function (){
'use strict';
console.log("first");
console.log(guides);
var port = chrome.runtime.connect({name: "knockknock"});
port.postMessage({joke: "Knock knock"});
port.onMessage.addListener(function(msg) {
if (msg.question == "Who's there?"){
port.postMessage({answer: "Madame"});
}
else if (msg.question == "Madame who?"){
port.postMessage({answer: "Madame... Bovary"});
}
else if (msg.question == "I don't get it."){
var tourGuider = [];
console.log(tourGuider);
guides.properlyCloseGuides();
var guidesPassed = JSONfn.parse(msg.guides);
console.log(guidesPassed);
for (var i = 0; i <= guidesPassed.length - 1; i++) {
tourGuider.push(guidesPassed[i]);
};
console.log(tourGuider);
guides.createCookie("guides.startGuide(0,1);");
guides.init(tourGuider);
}
else if (msg.question == "MUHAHAHAHAHA!"){
}
});
if(typeof(guides) !== 'undefined'){
chrome.runtime.sendMessage({
myStatus: "success"
});
} else {
chrome.runtime.sendMessage({
myStatus: "No Go"
});
}
// Connect to Channel (Choose "Controller"/"Action")
// var port = chrome.runtime.connect({name: "operations"});
// console.log("Hey Tyler!")
// port.postMessage({question: "Knock knock"});
// port.onMessage.addListener(function(msg) {
// switch(msg.question){
// case "Who's there?":
// port.postMessage({answer: "Madame"});
// console.log("Step 1 : Success");
// break;
// case "Madame who?":
// port.postMessage({answer: "Madame... Bovary"});
// console.log("Step 2 : Success");
// break;
// case "I don't get it.":
// port.postMessage({answer: "thats cause you're stupid"});
// console.log("Final Step Complete");
// break;
// default:
// port.postMessage({answer: "thats cause you're stupid"});
// console.log("Something Went Wrong");
// break;
// }
// });
}());