Last active
August 29, 2015 14:22
-
-
Save kurtisdunn/6e0fb24376b3431679f9 to your computer and use it in GitHub Desktop.
Events by alpha index (starting letter)
This file contains hidden or 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
//TODO switch you fool, Switch! | |
alphaIndex: function(e){ | |
listings; | |
var arr = []; | |
var listName = listings.attributes.listings.items; | |
var listed = function(regex){ | |
_.each(listName, function(i){ | |
var string = i.name.substring(0, 1).match(regex); | |
if (i.name.substring(0, 1).match(regex) == i.name.substring(0, 1)){ | |
arr.push(i); | |
return arr; | |
} | |
}); | |
} | |
if (e.currentTarget.innerHTML == "ALL") { | |
that.render(listName) | |
} | |
if (e.currentTarget.innerHTML.match(/[a-c]/i)) { | |
this.listed(/[a-c]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[d-f]/i)) { | |
this.listed(/[d-f]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[g-i]/i)) { | |
this.listed(/[g-i]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[j-l]/i)) { | |
this.listed(/[j-l]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[m-o]/i)) { | |
this.listed(/[m-o]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[p-s]/i)) { | |
this.listed(/[p-s]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[t-v]/i)) { | |
this.listed(/[t-v]/i) | |
this.render(arr) | |
} | |
if (e.currentTarget.innerHTML.match(/[w-z]/i)) { | |
this.listed(/[w-z]/i) | |
this.render(arr) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment