Last active
September 28, 2015 22:06
-
-
Save g5codyswartz/a023469b0e4db40fb9f8 to your computer and use it in GitHub Desktop.
Filters out a list of locations, great for phased builds and large clients. It also calls the location sorter after filtering out.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MR Phase 1 Locations | |
var showLocations = [ | |
"Broadmoor Ridge Apartment Homes", | |
"Candlelight Square", | |
"Cherry Creek Apartments", | |
"Cherry Lane Apartment Homes", | |
"Hampton Park Apartment Homes", | |
"Indigo Park", | |
"Lakeside Casitas Apartment Homes", | |
"Lamplight Square at The Park", | |
"Mesa Village Apartments", | |
"Miramont Apartments", | |
"Northpoint at Creekside Apartment Homes", | |
"Pinecone Apartments", | |
"Platte View Landing", | |
"Polo Club Apartments", | |
"Renaissance Apartment Homes", | |
"Resort at University Park", | |
"San Mateo Apartment Homes", | |
"Sevilla Apartment Homes", | |
"Solano Springs Apartment Homes", | |
"Spring Park Apartments", | |
"Spyglass Hill Apartment Homes", | |
"The Pearl at Spring Creek", | |
"Wyndhaven at Wells Branch" | |
]; | |
$(".faux-table-body li div.name").each(function(){ | |
//console.log($(this).text().trim()); | |
if ($.inArray($(this).text().trim(), showLocations) == -1) | |
$(this).parent().css('display', 'none'); | |
}); | |
// http://stackoverflow.com/questions/7831712/jquery-sort-divs-by-innerhtml-of-children | |
function sortUsingNestedText(parent, childSelector, keySelector) { | |
var items = parent.children(childSelector).sort(function(a, b) { | |
var vA = $(keySelector, a).text(); | |
var vB = $(keySelector, b).text(); | |
return (vA < vB) ? -1 : (vA > vB) ? 1 : 0; | |
}); | |
parent.append(items); | |
} | |
sortUsingNestedText($(".faux-table-body"), "li", "div:first-child"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment