Skip to content

Instantly share code, notes, and snippets.

@atypical
Forked from danro/blah.js
Created October 31, 2011 00:52
Show Gist options
  • Save atypical/1326660 to your computer and use it in GitHub Desktop.
Save atypical/1326660 to your computer and use it in GitHub Desktop.
Read and Clean
function parseTheDashboardData(resp){
var httpStatus = resp.meta.status,
httpMessage = resp.meta.msg,
dashboardPostsArray = resp.response.posts;
for (var i = 0; i < dashboardPostsArray.length; i++){
var current=dashboardPostsArray[i];
var blogName = current.blog_name,
blogID = current.id,
blogPostUrl = current.post_url,
blogPostType = current.type,
blogPostDate = current.date,
blogPostTime = current.timestamp,
blogPostFormat = current.format,
blogReblogKey = current.reblog_key,
blogTagArray = current.tags,
blogLiked = current.liked,
blogNoteCount = current.note_count,
blogCaption = current.caption,
blogPhotos = current.photos;
Ti.API.info('blogName: '+blogName);
Ti.API.info('blogID: '+blogID);
Ti.API.info('blogPostUrl: '+blogPostUrl);
Ti.API.info('blogPostType: '+blogPostType);
Ti.API.info('blogPostDate: '+blogPostDate);
Ti.API.info('blogPostTime: '+blogPostTime);
Ti.API.info('blogPostFormat: '+blogPostFormat);
Ti.API.info('blogReblogKey: '+blogReblogKey);
Ti.API.info('blogTagArray: '+blogTagArray);
Ti.API.info('blogLiked: '+blogLiked);
Ti.API.info('blogNoteCount: '+blogNoteCount);
Ti.API.info('cleanedBlogCaption: '+blogCaption.replace( /<[^>]+>/g, '' ));
for (var j = 0; j < blogPhotos.length; j++){
var photoObj = blogPhotos[j];
var photoCaption = photoObj.caption;
var blogPhotoOrigUrl = photoObj.original_size.url;
var blogPhotoAltSizes = photoObj.alt_sizes;
Ti.API.info('photoObj: '+photoObj);
Ti.API.info('photoCaption: '+photoCaption);
Ti.API.info('originalPost Image URL: '+blogPhotoOrigUrl);
Ti.API.info('blogPhotoAltSizes Count: '+blogPhotoAltSizes.length);
// When this for loop is removed, it works perfectly, obv. w/out the info for alt sizes tho..
for (var k = 0; k < blogPhotoAltSizes.length; k++){
var altSize = blogPhotoAltSizes[k];
var altSizeUrls = altsize.url;
Ti.API.info('altSize: '+altSize);
Ti.API.info('altSizeUrls: '+altSizeUrls);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment