-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.html
43 lines (40 loc) · 1013 Bytes
/
popup.html
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
<style>
body {
width: 150px;
}
li {
margin-left: 0px;
list-style-type: none;
}
</style>
<script>
onload = init;
var BackGround = chrome.extension.getBackgroundPage();
var Bob = BackGround.Bob;
function init() {
var userInfo = Bob.getUserInfo();
userInfo.forEach(function(data) {
var item = document.createElement('input');
item.type = 'radio';
item.name = 'account';
item.id = data.name;
if (data.name == Bob.currentUser) item.checked = true;
item.onclick = function() {
chrome.cookies.get({ url: "http://www.hatena.ne.jp/", name: "rk"}, function(cookie) {
Bob.changeCookie(cookie, data.rk);
Bob.currentUser = data.name;
Bob.reload();
});
}
var li = document.createElement('li');
li.appendChild(item);
var label = document.createElement('label');
label.setAttribute('for', data.name);
label.textContent = data.name;
li.appendChild(label);
document.f.appendChild(li);
});
}
</script>
<form name="f">
</form>