-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.js
30 lines (24 loc) · 893 Bytes
/
dialog.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
document.forms[0].onsubmit = function(e) {
e.preventDefault(); // Prevent submission
var siblings = document.getElementById('siblings').value;
chrome.runtime.getBackgroundPage(function(bgWindow) {
bgWindow.setSiblings(siblings);
window.close(); // Close dialog
});
};
chrome.runtime.onMessage.addListener(
(request, sender, sendResponse) => {
if (request.message === "hi")
sendResponse({message: "hi to you"});
});
// get siblings from inspect.js
//chrome.storage.local.get(['siblings'], function (result) {
chrome.runtime.onMessage.addListener(
var toAdd=document.getElementById('siblings');
for(var i = 0, len = request.message.length;i<len;i++){
var newLi = document.createElement('li');
newLi.className = 'sibling';
newLi.innerHTML = request.message[i];
toAdd.appendChild(newLi);
}
});