-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
110 lines (90 loc) · 2.37 KB
/
popup.js
File metadata and controls
110 lines (90 loc) · 2.37 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Oliver Schneider
// April 16 2013
//OnChecked event handler
function OnClick(event)
{
debugger;
var id = event.srcElement.id;
var idsplit = id.split("_");
var target = idsplit[0];
var vis = idsplit[1];
localStorage[target]=vis;
}
//sets the right check boxes to being checked
function SetChecked()
{
for(var i = 0; i < targets.length; i++)
{
//set value
var selected_vis = localStorage[targets[i].name];
if( selected_vis == undefined)
{
localStorage[targets[i].name] = "None";
selected_vis = "None";
}
var checked_id = targets[i].name + "_" + selected_vis;
document.getElementById(checked_id).checked = true;
}
}
//
//Generate options table
//
var table = document.createElement("table");
//set up header row
var firstrow = document.createElement("tr");
var firstcol = document.createElement("td");
firstcol.innerHTML = "<b>Target</b>";
firstrow.appendChild(firstcol);
//set up "None" header
var secondcol = document.createElement("td");
secondcol.innerHTML="None";
firstrow.appendChild(secondcol);
//add visualization names
for(var visj in NewVisualization)
{
var col = document.createElement("td");
col.innerHTML = visj;
firstrow.appendChild(col);
}
table.appendChild(firstrow);
//set up remaining rows (one for each target)
for(var i = 0; i < targets.length; i++)
{
var row = document.createElement("tr");
//first column - target name
var firstcol = document.createElement("td");
firstcol.innerHTML = targets[i].name;
row.appendChild(firstcol);
//second column - "None" visualization
var secondcol = document.createElement("td");
var newlabel = document.createElement("label");
var rad = document.createElement("input");
rad.type="radio";
rad.name=targets[i].name;
rad.value="None";
rad.id=rad.name+"_"+rad.value;
rad.onchange = OnClick;
newlabel.appendChild(rad);
secondcol.appendChild(newlabel);
row.appendChild(secondcol);
for(var visj in NewVisualization)
{
var col = document.createElement("td");
var newlabel = document.createElement("label");
var rad = document.createElement("input");
rad.type="radio";
rad.name=targets[i].name;
rad.value=visj;
rad.id=rad.name+"_"+rad.value;
rad.onchange = OnClick;
newlabel.appendChild(rad);
col.appendChild(newlabel);
row.appendChild(col);
}
table.appendChild(row);
}
document.getElementById("settingspanel").appendChild(table);
SetChecked();
//
//Options table generated!
//