forked from luofei614/SocketLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
49 lines (45 loc) · 1.28 KB
/
Copy pathpopup.js
File metadata and controls
49 lines (45 loc) · 1.28 KB
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
/**
* github: https://github.com/luofei614/SocketLog
* @author luofei614<weibo.com/luofei614>
*/
document.addEventListener('DOMContentLoaded', init, false);
function init()
{
if(localStorage.getItem('address'))
{
document.getElementById('address').value=localStorage.getItem('address');
}
if(localStorage.getItem('client_id'))
{
document.getElementById('client_id').value=localStorage.getItem('client_id');
}
var status=localStorage.getItem('status');
if(status)
{
var text='';
switch(status)
{
case "open":
text='链接成功';
break;
case "close":
text='链接断开';
break;
case "error":
text='链接失败';
break;
default:
alert('运行状态异常');
break;
}
document.getElementById('status').innerHTML=text;
}
document.getElementById('save').addEventListener('click',save,false);
}
function save()
{
localStorage.setItem('address',document.getElementById('address').value);
localStorage.setItem('client_id',document.getElementById('client_id').value);
chrome.extension.getBackgroundPage().ws_restart();
window.close();
}