-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
128 lines (120 loc) · 13 KB
/
index.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>US Congressional Database</title>
<link rel="stylesheet" href="front_end/style.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="wrapper">
<div class="icon">
<i class="material-icons md-48">account_balance</i>
<!-- <img src="img/us_congress_seal.svg.png" alt="US Congress Seal" width="300" height="300"> -->
</div>
<form id="search_form" class="main" action="search.php" method="post" autocomplete="on">
<select id="search_area_list" class="w3-input w3-border w3-round" name="list" style="width:175px;">
<option value="house_members">House Member</option>
<option value="senate_members">Senate Member</option>
<!-- Disabling these for the moment
<option value="house_votes">House Votes</option>
<option value="senate_votes">Senate Votes</option> -->
</select>
<input type="text" id="search_box" name="input" placeholder="Search US Congressional Database">
<input type="submit" id="search_button" name="search" value="Search" >
</form>
</br><text id="validate"></text>
</div>
</body>
<script>
// this is where our list goes for the autocomplete
houseMemberList = ["Ralph Abraham","Alma Adams","Robert Aderholt","Pete Aguilar","Rick Allen","Colin Allred","Justin Amash","Mark Amodei","Kelly Armstrong","Jodey Arrington","Cynthia Axne","Brian Babin","Don Bacon","James Baird","Troy Balderson","Jim Banks","Andy Barr","Nanette Barragán","Karen Bass","Joyce Beatty","Ami Bera","Jack Bergman","Donald Beyer","Andy Biggs","Gus Bilirakis","Dan Bishop","Rob Bishop","Sanford Bishop","Earl Blumenauer","Lisa Blunt Rochester ","Suzanne Bonamici","Mike Bost","Brendan Boyle","Kevin Brady","Anthony Brindisi","Mo Brooks","Susan Brooks","Anthony Brown","Julia Brownley","Vern Buchanan","Ken Buck","Larry Bucshon","Ted Budd","Tim Burchett","Michael Burgess","Cheri Bustos","G. Butterfield","Bradley Byrne","Ken Calvert","Salud Carbajal","Tony Cárdenas","André Carson","John Carter","Buddy Carter","Matt Cartwright","Ed Case","Sean Casten","Kathy Castor","Joaquín Castro","Steven Chabot","Liz Cheney","Judy Chu","David Cicilline","Gilbert Cisneros","Katherine Clark","Yvette Clarke","William Clay","Emanuel Cleaver","Ben Cline","Michael Cloud","James Clyburn","Steve Cohen","Tom Cole","Doug Collins","Chris Collins","James Comer","K. Conaway","Gerald Connolly","Paul Cook","Jim Cooper","J. Correa","Jim Costa","Joe Courtney","TJ Cox","Angie Craig","Rick Crawford","Dan Crenshaw","Charlie Crist","Jason Crow","Henry Cuellar","Elijah Cummings","Joe Cunningham","John Curtis","Sharice Davids","Warren Davidson","Danny Davis","Rodney Davis","Susan Davis","Madeleine Dean","Peter DeFazio","Diana DeGette","Rosa DeLauro","Suzan DelBene","Antonio Delgado","Val Demings","Mark DeSaulnier","Scott DesJarlais","Ted Deutch","Mario Diaz-Balart","Debbie Dingell","Lloyd Doggett","Mike Doyle","Sean Duffy","Jeffrey Duncan","Neal Dunn","Tom Emmer","Eliot Engel","Veronica Escobar","Anna Eshoo","Adriano Espaillat","Ron Estes","Dwight Evans","A. Ferguson","Abby Finkenauer","Brian Fitzpatrick","Chuck Fleischmann","Lizzie Fletcher","Bill Flores","Jeff Fortenberry","Bill Foster","Virginia Foxx","Lois Frankel","Marcia Fudge","Russ Fulcher","Tulsi Gabbard","Matt Gaetz","Mike Gallagher","Ruben Gallego","John Garamendi","Sylvia Garcia","Jesús García","Greg Gianforte","Bob Gibbs","Louie Gohmert","Jared Golden","Jimmy Gomez","Anthony Gonzalez","Vicente Gonzalez","Jenniffer González-Colón","Lance Gooden","Paul Gosar","Josh Gottheimer","Kay Granger","Tom Graves","Garret Graves","Sam Graves","Al Green","Mark Green","Morgan Griffith","Raúl Grijalva","Glenn Grothman","Michael Guest","Brett Guthrie","Debra Haaland","Jim Hagedorn","Josh Harder","Andy Harris","Vicky Hartzler","Alcee Hastings","Jahana Hayes","Denny Heck","Kevin Hern","Jaime Herrera Beutler ","Jody Hice","Clay Higgins","Brian Higgins","Katie Hill","French Hill","Jim Himes","George Holding","Trey Hollingsworth","Kendra Horn","Steven Horsford","Chrissy Houlahan","Steny Hoyer","Richard Hudson","Jared Huffman","Bill Huizenga","Duncan Hunter","Will Hurd","Sheila Jackson Lee ","Pramila Jayapal","Hakeem Jeffries","Mike Johnson","Dusty Johnson","Eddie Johnson","Bill Johnson","Hank Johnson","Walter Jones","Jim Jordan","Dave Joyce","John Joyce","Marcy Kaptur","John Katko","Bill Keating","Fred Keller","Robin Kelly","Mike Kelly","Trent Kelly","Joseph Kennedy","Ro Khanna","Dan Kildee","Derek Kilmer","Andy Kim","Ron Kind","Peter King","Steve King","Adam Kinzinger","Ann Kirkpatrick","Raja Krishnamoorthi","Ann Kuster","David Kustoff","Darin LaHood","Doug LaMalfa","Conor Lamb","Doug Lamborn","Jim Langevin","Rick Larsen","John Larson","Robert Latta","Brenda Lawrence","Al Lawson","Susie Lee","Barbara Lee","Debbie Lesko","Mike Levin","Andy Levin","John Lewis","Ted Lieu","Daniel Lipinski","Dave Loebsack","Zoe Lofgren","Billy Long","Barry Loudermilk","Alan Lowenthal","Nita Lowey","Frank Lucas","Blaine Luetkemeyer","Ben Luján","Elaine Luria","Stephen Lynch","Tom Malinowski","Sean Maloney","Carolyn Maloney","Kenny Marchant","Tom Marino","Roger Marshall","Thomas Massie","Brian Mast","Doris Matsui","Ben McAdams","Lucy McBath","Kevin McCarthy","Michael McCaul","Tom McClintock","Betty McCollum","A. McEachin","Jim McGovern","Patrick McHenry","David McKinley","Cathy McMorris Rodgers ","Jerry McNerney","Mark Meadows","Gregory Meeks","Grace Meng","Daniel Meuser","Carol Miller","Paul Mitchell","John Moolenaar","Alex Mooney","Gwen Moore","Joe Morelle","Seth Moulton","Debbie Mucarsel-Powell","Markwayne Mullin","Greg Murphy","Stephanie Murphy","Jerrold Nadler","Grace Napolitano","Richard Neal","Joe Neguse","Dan Newhouse","Donald Norcross","Ralph Norman","Eleanor Norton","Devin Nunes","Tom O'Halleran","Alexandria Ocasio-Cortez","Pete Olson","Ilhan Omar","Steven Palazzo","Frank Pallone","Gary Palmer","Jimmy Panetta","Chris Pappas","Bill Pascrell","Donald Payne","Nancy Pelosi","Greg Pence","Ed Perlmutter","Scott Perry","Scott Peters","Collin Peterson","Dean Phillips","Chellie Pingree","Stacey Plaskett","Mark Pocan","Katie Porter","Bill Posey","Ayanna Pressley","David Price","Mike Quigley","Amata Radewagen","Jamie Raskin","John Ratcliffe","Tom Reed","Guy Reschenthaler","Kathleen Rice","Tom Rice","Cedric Richmond","Denver Riggleman","Martha Roby","Phil Roe","Harold Rogers","Mike Rogers","Francis Rooney","John Rose","Max Rose","Harley Rouda","David Rouzer","Chip Roy","Lucille Roybal-Allard","Raul Ruiz"," C.A. Dutch Ruppersberger","Bobby Rush","John Rutherford","Tim Ryan","Gregorio Sablan","Michael San Nicolas ","Linda Sánchez","John Sarbanes","Steve Scalise","Mary Scanlon","Jan Schakowsky","Adam Schiff","Brad Schneider","Kurt Schrader","Kim Schrier","David Schweikert","David Scott","Austin Scott","Robert Scott","F. Sensenbrenner","José Serrano","Terri Sewell","Donna Shalala","Brad Sherman","Mikie Sherrill","John Shimkus","Mike Simpson","Albio Sires","Elissa Slotkin","Adrian Smith","Adam Smith","Christopher Smith","Jason Smith","Lloyd Smucker","Darren Soto","Abigail Spanberger","Ross Spano","Jackie Speier","Greg Stanton","Pete Stauber","Elise Stefanik","Bryan Steil","Greg Steube","Haley Stevens","Chris Stewart","Steve Stivers","Thomas Suozzi","Eric Swalwell","Mark Takano","Van Taylor","Glenn Thompson","Mike Thompson","Bennie Thompson","William Thornberry","William Timmons","Scott Tipton","Dina Titus","Rashida Tlaib","Paul Tonko","Norma Torres","Xochitl Torres Small ","Lori Trahan","David Trone","Michael Turner","Lauren Underwood","Fred Upton","Jefferson Van Drew ","Juan Vargas","Marc Veasey","Filemon Vela","Nydia Velázquez","Peter Visclosky","Ann Wagner","Tim Walberg","Greg Walden","Mark Walker","Jackie Walorski","Michael Waltz","Debbie Wasserman Schultz ","Maxine Waters","Steven Watkins","Bonnie Watson Coleman ","Randy Weber","Daniel Webster","Peter Welch","Brad Wenstrup","Bruce Westerman","Jennifer Wexton","Susan Wild","Roger Williams","Joe Wilson","Frederica Wilson","Robert Wittman","Steve Womack","Rob Woodall","Ron Wright","John Yarmuth","Ted Yoho","Don Young","Lee Zeldin" ];
houseVoteList = [ "abortion", "Immigration", "Budget" ];
senateVoteList = [ "abortion", "Immigration", "Budget", "Judges" ];
senateMemberList = [ "Lamar Alexander ", "Tammy Baldwin ", "John Barrasso ", "Michael Bennet ", "Marsha Blackburn ", "Richard Blumenthal ", "Roy Blunt ", "Cory Booker ", "John Boozman ", "Mike Braun ", "Sherrod Brown ", "Richard Burr ", "Maria Cantwell ", "Shelley Capito ", "Benjamin Cardin ", "Thomas Carper ", "Bob Casey ", "Bill Cassidy ", "Susan Collins ", "Christopher Coons ", "John Cornyn ", "Catherine Cortez Masto ", "Tom Cotton ", "Kevin Cramer ", "Michael Crapo ", "Ted Cruz ", "Steve Daines ", "Tammy Duckworth ", "Richard Durbin ", "Michael Enzi ", "Joni Ernst ", "Dianne Feinstein ", "Deb Fischer ", "Cory Gardner ", "Kirsten Gillibrand ", "Lindsey Graham ", "Charles Grassley ", "Kamala Harris ", "Margaret Hassan ", "Joshua Hawley ", "Martin Heinrich ", "Mazie Hirono ", "John Hoeven ", "Cindy Hyde-Smith ", "James Inhofe ", "Johnny Isakson ", "Ron Johnson ", "Doug Jones ", "Tim Kaine ", "John Kennedy ", "Angus King ", "Amy Klobuchar ", "James Lankford ", "Patrick Leahy ", "Mike Lee ", "Joe Manchin ", "Edward Markey ", "Mitch McConnell ", "Martha McSally ", "Robert Menendez ", "Jeff Merkley ", "Jerry Moran ", "Lisa Murkowski ", "Christopher Murphy ", "Patty Murray ", "Rand Paul ", "David Perdue ", "Gary Peters ", "Rob Portman ", "Jack Reed ", "Jim Risch ", "Pat Roberts ", "Mitt Romney ", "Jacky Rosen ", "Mike Rounds ", "Marco Rubio ", "Bernard Sanders ", "Ben Sasse ", "Brian Schatz ", "Charles Schumer ", "Rick Scott ", "Tim Scott ", "Jeanne Shaheen ", "Richard Shelby ", "Kyrsten Sinema ", "Tina Smith ", "Debbie Stabenow ", "Dan Sullivan ", "Jon Tester ", "John Thune ", "Thom Tillis ", "Patrick Toomey ", "Tom Udall ", "Chris Van Hollen ", "Mark Warner ", "Elizabeth Warren ", "Sheldon Whitehouse ", "Roger Wicker ", "Ron Wyden ", "Todd Young" ];
//unused concat on all of our lists
allList = [];
//turns jQuery on for the search box and enables the autocomplete
//default source choice to default list choice
sourceChoice = houseMemberList;
//function to change autocomplete list when selection list is changed
function refreshArray () {
if (document.getElementById('search_area_list').value == "house_members")
{
sourceChoice = houseMemberList;
}
else if (document.getElementById('search_area_list').value == "house_votes") {
sourceChoice = houseVoteList;
}
else if (document.getElementById('search_area_list').value == "senate_members") {
sourceChoice = senateMemberList;
}
else if (document.getElementById('search_area_list').value == "senate_votes") {
sourceChoice = senateVoteList;
}
//updates this list in autcomplete
$("#search_box").autocomplete({
source:sourceChoice,
change: function( event, ui ) {
///run validation of input
validate();
},
select: function(event, ui) {
//reset this value so that validate works in multiple cases
$('input[name=input]').val(ui.item.value);
validate();
}
});}
//triggers array refresh when list is changed
$('#search_area_list').on('change', function(){
refreshArray();
$("#search_box").val("");
});
//triggers autocomplete
/*OLD
$( "#search_box" ).autocomplete({
source: sourceChoice
});
*/
//validate entry
function validate () {
val = $("#search_box").val();
console.log("validate");
//changes text below if wrong answer in box
if (sourceChoice.includes(val)) {
$('input[type="submit"]').attr('disabled', false);
///could add something here for this case
$("#validate").text("");
}
else if (!sourceChoice.includes(val) && val != "")
{
$('input[type="submit"]').attr('disabled', true);
$("#validate").text("Please select a member of Congress from the list.");
}
else { $("#validate").text("");}
}
//starts the dance when page is loaded
$(document).ready(function(){
refreshArray();
$('input[type="submit"]').attr('disabled', true);
validate();
///checking results
});
$('#search_box').on('keypress', function(e) {
return e.which !== 13;
});
//validate data
$.widget( "ui.autocomplete", $.ui.autocomplete, {
options: {
close: function( event, ui ) {
if (typeof event.currentTarget == 'undefined') {
$(this).val("");
}
}
}
});
</script>
</html>