-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
54 lines (34 loc) · 1.36 KB
/
popup.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
/*chrome.runtime.sendMessage("The URL is " + url, function() {
console.log("Send URL as message from content.js");
});*/
// window.addEventListener("load", function() {
document.addEventListener('DOMContentLoaded', function () {
console.log("Loaded");
// var url = window.location.href;
// console.log("Url is " + url);
// chrome.extension.sendMessage({
// type: "dom-loaded",
// data: {
// myProperty: url
// }
// });
// var xhr = new XMLHttpRequest();
// xhr.open('get', 'http://www.google.com/', true);
// xhr.send({});
chrome.runtime.sendMessage({method:'getUrl'}, function(response){
console.log('Response received: ');
console.log(response);
var urlValue = response.urlVal;
console.log('Url received: ' + response.urlVal);
console.log('Word received: ' + response.word);
// var chartDiv = document.body.getElementsByTagName('div')[0];
// chartDiv.appendChild("response");
});
// var url = request.data.myProperty;
// console.log('URL received: ' + url);
var chartDiv = document.getElementById("chart");
var newText = document.createTextNode('Does this bit work?');
var newElement = document.createElement('p');
newElement.appendChild(newText);
chartDiv.appendChild(newElement);
});