Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13b9338
commit 44c2719
Showing
1 changed file
with
76 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,81 @@ | ||
var pitchNight = { | ||
pageList: ["#activities","#people","#pitches","#authenticate","#idea","#feedData"], | ||
currentPage: this.pageList[0], | ||
var pitchNight = { | ||
currentClass: "current", | ||
setState: function(page){$(this.currentPage).removeClass(this.currentClass); $(page).addClass(this.currentClass); this.currentPage=page;} | ||
currentPage: "", | ||
currentPageLink: "", | ||
pageLinks: ["activitiesLink","peopleLink","pitchesLink"], | ||
pageTitles: ["Activity Feed","People","Pitches","Login","","Enter Pitches"], | ||
setState: function(page,requestUrl,rootObject,pageLink){var pageTitle, subNav; | ||
$(this.currentPageLink).removeClass("active"); | ||
$(pageLink).addClass("active"); | ||
this.currentPageLink = pageLink; | ||
this.currentPage = page; | ||
switch(page){ | ||
case "#activities": | ||
pageTitle = "Activities Feed"; | ||
subNav = "<ul id=\"activitiesFilter\"><li id=\"everyoneFilter\"><a class=\"tl tr bl br\" href=\"#everyone\">Everyone</a></li>"+ | ||
"<li id=\"myFilter\"><a class=\"tl tr bl br\" href=\"#me\">Me</a></li></ul>"; | ||
break; | ||
case "#people": | ||
pageTitle = "People"; | ||
subNav=""; | ||
break; | ||
case "#pitches": | ||
pageTitle = "Pitches"; | ||
break; | ||
case "#authenticate": | ||
pageTitle = "Login"; | ||
break; | ||
case "#idea": | ||
|
||
break; | ||
case "#feedData": | ||
pageTitle = "Enter Pitches"; | ||
break; | ||
} | ||
$("#pageTitle").html(pageTitle); | ||
$("#subNav").html(subNav); | ||
this.getListRequest(requestUrl,rootObject); | ||
}, | ||
handleUrls: ["http://www.twitter.com/"], | ||
handleImageUrls: ["http://api.twitter.com/1/users/profile_image/"], | ||
pageList: ["#activities","#people","#pitches","#authenticate","#idea","#feedData"], | ||
ajaxRequestType: ["GET","POST"], | ||
ajaxDataType: ["json","xml"], | ||
baseUrl: "http://high-wind-14.heroku.com/", | ||
getListUrl: ["activities","users","pitches","","pitches",""], | ||
requestRootObject: ["activity","user","pitch"], | ||
getListRequest: function(requestUrl,rootObject){var elem = $("#content"); | ||
$.ajax({url: requestUrl+"."+pitchNight.ajaxDataType[1], | ||
success: function(feed){ | ||
switch(rootObject){ | ||
case 'activity': | ||
|
||
break; | ||
case 'user': | ||
$(feed).find("user").each(function(){ | ||
var username = $(this).find("name").text();var handle = $(this).find("twitter").text();var imgUrl = pitchNight.handleImageUrls[0]+handle; | ||
elem.append("<ul class=\"edgetoedge\"><li><img src=\""+imgUrl+"\" alt=\""+username+"\"/></li><li>"+username+"</li><li><a href=\""+pitchNight.handleUrls[0]+""+handle+"\"><img src=\"src/twitter.png\" /></a></li></ul>"); | ||
}); | ||
break; | ||
case 'pitch':var count = 1; | ||
$(feed).find("pitch").each(function(){ | ||
var userid = $(this).find("user_id").text();var title = $(this).find("title").text();var imgUrl; | ||
if("null" == userid){var name = $(this).find("soft_name").text();title= "Pitch #"+count+" by "+name; imgUrl="";} | ||
else{imgUrl = pitchNight.handleImageUrls[0]+$(this).find("user_id").find("twitter").text(); var username=$(this).find("user_id").find("name").text();} | ||
elem.append("<ul class=\"edgetoedge\"><li><img src=\""+imgUrl+"\" alt=\""+username+"\"/></li><li>"+title+"</li><li>/*<a href=\""+pitchNight.handleUrls[0]+""+handle+"\"><img src=\"src/twitter.png\" /></a></li></ul>"); | ||
count += 1; | ||
}); | ||
break; | ||
}; | ||
}, | ||
error: function(XMLHttpRequest, textStatus, errorThrown){alert(XMLHttpRequest + " " + textStatus + " " + errorThrown);} | ||
}); | ||
} | ||
}; | ||
$(function(){ | ||
pitchNight.setState(pitchNight.pageList[0]); | ||
$("#activitiesLink").click(function(){pitchNight.setState(pitchNight.pageList[0]);}); | ||
$("#peopleLink").click(function(){pitchNight.setState(pitchNight.pageList[1]);}); | ||
$("#pitchesLink").click(function(){pitchNight.setState(pitchNight.pageList[2]);}); | ||
pitchNight.setState(pitchNight.pageList[1],pitchNight.getListUrl[1], pitchNight.requestRootObject[1],pitchNight.pageLinks[1]); | ||
$("#activitiesLink").click(function(){pitchNight.setState(pitchNight.pageList[0],pitchNight.getListUrl[0], pitchNight.requestRootObject[0],pitchNight.pageLinks[0]);return false;}); | ||
$("#peopleLink").click(function(){pitchNight.setState(pitchNight.pageList[1],pitchNight.getListUrl[1], pitchNight.requestRootObject[1],pitchNight.pageLinks[1]);return false;}); | ||
$("#pitchesLink").click(function(){pitchNight.setState(pitchNight.pageList[2],pitchNight.getListUrl[2], pitchNight.requestRootObject[2],pitchNight.pageLinks[2]);return false;}); | ||
}); | ||
|