-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
63 lines (47 loc) · 1.39 KB
/
Copy pathmain.js
File metadata and controls
63 lines (47 loc) · 1.39 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
// On Load
$(function() {
// Get the selected button in the button group when pressed.
$("#raceTypeButtonGroup .btn").click(function() {
if(!$(this).hasClass('active')) {
var raceType = $(this).attr("id")
ResetDisplay(null, raceType)
}
});
$("#congressButtonGroup .btn").click(function() {
if(!$(this).hasClass('active')) {
var congress = $(this).attr("id")
ResetDisplay(congress, null)
}
});
// Select House view initially.
$('#house').button('toggle');
// Select year 2018 congress 115
$('#115').button('toggle');
ResetDisplay();
})
function ResetDisplay(congress, raceType) {
d3.select("svg").remove();
var svg = d3.select("body")
.append("svg")
.attr("id", "canvas")
.attr("width", 1100)
.attr("height", 900);
if (!raceType) {
raceType = $("#raceTypeButtonGroup .btn.btn-small.active").attr("id");
}
if (!congress) {
congress = $("#congressButtonGroup .btn.btn-small.active").attr("id");
}
$("#selection_list").empty();
initialize(congress, raceType);
// Remove all children of the glossy menu generated div
$('#glossyid').children().remove()
// Hide the side bar showing committees if looking
// at the presidential race
if (raceType == "pres") {
$("#glossyid").css("display", "none");
} else {
$("#glossyid").css("display", "block");
}
generateCommitteeHTML(raceType);
}