.page-node #main-content { max-width: 65.25em; } article .content { min-height: 800px; } article .content .hate-item { margin: 3px 0; } article .content .hate-item i { display: block; margin: 16px 0 4px 0; } /*article .content .hate-block { max-width: 65.25em; margin-left: auto; margin-right: auto; }*/ article .content .hate-block:first-of-type { margin-top: 160px; } #alpha, #hate-legend {margin-top: 14px;clear:both;} #alpha { margin-top: 2em; margin-bottom: 1em; width: 245px; display: inline-block !important; position: relative; display: inline-block; vertical-align: middle; zoom: 1; z-index: 2; -webkit-user-select: none; -moz-user-select: none; user-select: none; border-radius: 0; -webkit-appearance: none; -moz-appearance:none; border: 2px solid #d8d8d8; background: none; box-shadow: none; font-family: "Knockout 31 A","Knockout 31 B","Arial",sans-serif; font-size: 15px; height: 44px; text-decoration: none; white-space: nowrap; line-height: 42px; color: #989898; overflow: hidden; padding: 0 0 0 8px; float: left; outline: 0; } #sarr { color: #9c3022; font-size: 0.75em; line-height: 42px; font-family: "splc-icons"; position: relative; right: 20px; top: 32px; z-index: 1; } #sarr::after{ content: "e801"; } window.onload = function() { $$ = jQuery $$.getJSON("../ajax/hate-map", function(result){ $$.each(result, function(i, r1){ if (i=="hate_chapters") { $$.each(r1, function(j,r2){ var state = r2.state.replace(/ /g,"-") if ( $$( "#" + state ).length == 0) { $$("article .content").append(""+r2.state_name+ ""); $$("#" + state + " h2").html("" + $$("#" + state + " h2").text() + "") $$("#" + state + " h2 a").attr("name",state) } var name = r2.name if (name.indexOf(", The") != -1) { name = "The " + name.replace(", The", "") } var hq = "" if (r2.headquarters) { hq = "*" } var city = "" if (r2.city_name) { city = r2.city_name //+ ", " } var url = "" if(r2.url) { url = r2.url // url = $$(url).attr("href") name = "" + name + "" } var ideology_path = r2.ideology_name.replace(/ /g,"-") var ideology_url = "" + r2.ideology_name.trim() + "" $$("#" + state).append("" + city + " " + name + hq + " (" + ideology_url + ")"); }); } }); //sort states alphabetically var mylist = $$('article .content'); $$('article .content #hate-legend').before("All States"); var pullDown = $$('article .content #alpha'); var listitems = mylist.children('.hate-block').get(); listitems.sort(function(a, b) { return $$(a).text().toUpperCase().localeCompare($$(b).text().toUpperCase()); }) $$.each(listitems, function(idx, itm) { mylist.append(itm); var theItm = $$(itm); pullDown.append("" + theItm.find("h2").text() + "") theItm.find("h2").append(" (" + theItm.children(".hate-item").length + ")") }); //sort chapters alphabetically $$.each(listitems, function(idx, itm) { var theItm = $$(itm); var listitems2 = theItm.children('.hate-item').get(); listitems2.sort(function(a, b) { return $$(a).text().toUpperCase().localeCompare($$(b).text().toUpperCase()); }) $$.each(listitems2, function(idx2,itm2) { //var theItm2 = $$(itm2); //console.log(theItm2) theItm.append(itm2); }); }) //sort by cities alphabetically $$.each(listitems, function(idx, itm) { var theItm = $$(itm); var listitems2 = theItm.children('.hate-item').get(); var currCity = '' $$.each(listitems2, function(idx2,itm2) { console.log($$(itm2).find("h3").text()) if ("" == $$(itm2).find("h3").text() ) { $$(itm2).find("h3").text("Statewide") } if (currCity == $$(itm2).find("h3").text() ) { $$(itm2).find("h3").hide(); } else { currCity = $$(itm2).find("h3").text(); } }); }) //display pull down menu pullDown.change(function(){ //location = "#" + this[this.selectedIndex].value ////$$('article .content #' + this[this.selectedIndex].value + " h2").after(pullDown); if (this.selectedIndex == 0) { $$.each(listitems, function(idx, itm) { $$(itm).show() }) } else { $$.each(listitems, function(idx, itm) { $$(itm).hide() }) $$("#" + this[this.selectedIndex].value).show() } }) }); }