Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Joel committed Jan 16, 2012
2 parents 8e25c14 + 45a8a08 commit bfb0b9e
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions public/javascripts/stop_censorship.js
Expand Up @@ -54,20 +54,20 @@ CloudFlare.define(
var senators =[["AK","Lisa Murkowski","907-456-0233"],["AK","Mark Begich","907-271-5915"],["AL","Jefferson Sessions","334-244-7017"],["AL","Richard Shelby","205-759-5047"],["AR","John Boozman","479-725-0400"],["AR","Mark Pryor","501-324-6336"],["AZ","Jon Kyl","602-840-1891"],["AZ","John McCain","602-952-2410"],["CA","Barbara Boxer","510-286-8537"],["CA","Dianne Feinstein","415-393-0707"],["CO","Michael Bennet","303-455-7600"],["CO","Mark Udall","303-650-7820"],["CT","Richard Blumenthal","860-258-6940"],["CT","Joseph Lieberman","860-549-8463"],["DE","Thomas Carper","302-573-6291"],["DE","Chris Coons","302-573-6345"],["FL","Bill Nelson","407-872-7161"],["FL","Marco Rubio","305-418-8553"],["GA","C. Saxby Chambliss","770-763-9090"],["GA","John Isakson","770-661-0999"],["HI","Daniel Akaka","808-522-8970"],["HI","Daniel Inouye","808-541-2542"],["IA","Charles Grassley","515-288-1145"],["IA","Thomas Harkin","515-284-4574"],["ID","Michael Crapo","208-334-1776"],["ID","James Risch","208-342-7985"],["IL","Richard Durbin","312-353-4952"],["IL","Mark Kirk","312-886-3506"],["IN","Daniel Coats","317-554-0750"],["IN","Richard Lugar","317-226-5555"],["KS","Pat Roberts","913-451-9343"],["KY","Mitch McConnell","502-582-6304"],["KY","Rob Portman","361-576-1231"],["LA","Mary Landrieu","225-389-0395"],["LA","David Vitter","337-262-6898"],["MA","Scott Brown","617-565-3170"],["MA","John Kerry","617-565-8519"],["MD","Barbara Mikulski","410-962-4510"],["ME","Susan Collins","207-945-0417"],["ME","Olympia Snowe","207-874-0883"],["MI","Carl Levin","313-226-6020"],["MI","Debbie Stabenow","517-203-1760"],["MN","Al Franken","651-221-1016"],["MN","Amy Klobuchar","612-727-5220"],["MO","Roy Blunt","816-471-7141"],["MO","Claire McCaskill","816-421-1639"],["MS","Thad Cochran","601-965-4459"],["MS","Roger Wicker","601-965-4644"],["MT","Max Baucus","406-657-6790"],["MT","Jon Tester","406-449-5401"],["NC","Richard Burr","910-251-1058"],["NC","Kay Hagan","336-333-5311"],["ND","Kent Conrad","701-258-4648"],["ND","John Hoeven","701-250-4618"],["NE","Mike Johanns","308-632-6032"],["NE","E. Benjamin Nelson","402-441-4600"],["NH","Kelly Ayotte","603-622-7979"],["NH","Jeanne Shaheen","603-647-7500"],["NJ","Frank Lautenberg","973-639-8700"],["NJ","Robert Menendez","973-645-3030"],["NM","Jeff Bingaman","505-346-6601"],["NM","Tom Udall","505-346-6791"],["NV","Dean Heller","775-686-5770"],["NV","Harry Reid","702-388-5020"],["NY","Kirsten Gillibrand","212-688-6262"],["NY","Charles Schumer","212-486-4430"],["OH","Sherrod Brown","216-522-7272"],["OK","James Inhofe","918-748-5111"],["OK","Tom Coburn","918-581-7651"],["OR","Jeffery Merkley","503-326-3386"],["PA","Robert Casey","570-941-0930"],["PA","Pat Toomey","610-434-1444"],["RI","John Reed","401-943-3100"],["RI","Sheldon Whitehouse","401-453-5294"],["SC","Jim DeMint","864-233-5366"],["SC","Lindsey Graham","864-250-1417"],["SD","Tim Johnson","414-276-7282"],["SD","John Thune","605-334-9596"],["TN","Lamar Alexander","615-736-5129"],["TN","Bob Corker","423-756-2757"],["TX","John Cornyn","512-469-6034"],["TX","Kay Hutchison","214-361-3500"],["UT","Orrin Hatch","801-524-4380"],["UT","Mike Lee","801-524-5933"],["VA","Mark Warner","804-775-2314"],["VA","James Webb","804-771-2221"],["VT","Patrick Leahy","802-863-2525"],["VT","Bernard Sanders","802-862-0697"],["WA","Patty Murray","206-553-5545"],["WI","Ron Johnson","605-332-8896"],["WI","Herbert Kohl","414-297-4451"],["WV","Joe Manchin","304-342-5855"],["WV","John Rockefeller","304-347-5372"],["WY","John Barrasso","307-261-6413"],["WY","Michael Enzi","307-682-6268</span>"]]
var senatorsByState = {}
$.each(senators, function(i, senator){
if(senatorsByState[senator[0]]) {
senatorsByState[senator[0]].push([senator[1], senator[2]])
}
else {
senatorsByState[senator[0]] = [[senator[1], senator[2]]]
}

var state = senator[0];

senatorsByState[state] = senatorsByState[state] || [];
senatorsByState[state].push(senator.slice(1));

})
var target = $("<div class='senator_info'>")
var dropdown = $("<select id='StopCensorshipStates'>").bind("change", function(){
var state = $(this).val()
var senators = senatorsByState[state]
console.log(this, $(this), $(this).val(), state, senators, senators.toString())

target.html(senators.slice(0, 2).join(', ') + (senators.length > 2 ? '<br />' + senators.slice(2, 4).join(', ') : ''))
target.html(senators[0].join(', ') + (senators.length > 2 ? '<br />' + senators[1].join(', ') : ''))
})
$("<label for='StopCensorshipStates'>Select your state:</label>").insertBefore(dropdown);
$.each(senatorsByState, function(state, senators){
Expand Down Expand Up @@ -109,15 +109,8 @@ CloudFlare.define(
user.setCookie("cf_sopa", "")
self.activate()
}),
americanCensorshipButton = $("<button class='more_info'>", {rel : "nofollow"}).text("Read more at AmericanCensorship.org")
.bind("click", function() {
window.open(censorshipUrl);
}),
githubButton = $("<button class='github'>", {rel : "nofollow"}).text("Get this app for your page")
.bind("click", function() {
window.open(githubUrl);
}),

americanCensorshipLink = $("<a class='more_info'>", {rel : "nofollow", href : censorshipUrl, target : "_blank", text : "Read more at AmericanCensorship.org"}),
githubLink = $("<a class='github'>", {rel : "nofollow", href : githubUrl, target : "_blank", text : "Get this app for your page"}),
close = $("<button class='close'>").text("Close this window")
.bind("click", function() {
$.liteDialog('hide');
Expand All @@ -127,9 +120,10 @@ CloudFlare.define(
.append("<p>Call your Senator and say No to PIPA:</p>")
.append(self.senatorDropdown())
.append(tweet)
.append(americanCensorshipButton)
.append(recensorButton)
.append(githubButton)
.append(americanCensorshipLink)
.append(githubLink)
.append("<br/>")
.append(close)

return box;
Expand Down

0 comments on commit bfb0b9e

Please sign in to comment.