Blogs | EL UNIVERSAL ')+ ''+ moment(article.publish_date,'YYYYMMDDhhmmss').format('hh:mm a')+ ''+ ''+ ' ' ''+ ''+ ''; return html; function drawArticleBlog(article, small, medium, large, selector, indexShare) var author = ''; var description = ''; if (article.authors[0] != undefined) author = article.authors[0]; var id= author!=''?author.id:author; var name = author!=''?author.name:author; if (article.hasOwnProperty('description')) description = article.description; console.log(formatName(name)); var html = ''; return html; /*Method that will prints articles*/
function search engines drawArticles(articles, selector, small, medium, large) $.each(articles, function(index, value) if ( selector == 'more_blogs' ) $('#'+selector).append(drawArticleBlog(value, small, medium, large, selector, indexShare)); indexShare++; console.log(indexShare); else $('#'+selector).append(drawArticle(value, small, medium, large, selector)); ); /*Main Method*/ $( document ).ready(function() /*Four articles inside the 1st and furthermore the last row*/ $.ajax( url: "http://search.eluniversal.com/_alias/custom-search-eu/1-4/?ch=blog&arttype=blog", dataType: 'jsonp', beforeSend: function() $('#last_articles #loading').show(); , success: function(data) $('#last_articles #loading').hide(); arrayArt = drawArticles(data.listarticle, 'last_articles', 12, 6, 3); jQuery(document).foundation(); ); /*Four articles about the center/left*/ $.ajax( url: "http://archivo.eluniversal.com/blogs/json/visited.json",
dataType: "jsonp", jsonp: "callback", jsonpCallback: "blogs", contentType: 'application/javascript', scriptCharset: 'UTF-8', beforeSend: function() $('#most_viewed #loading').show(); , success: function(data) $('#most_viewed #loading').hide(); drawArticles(data.listarticle, 'most_viewed', 12, 6, 3); ); /*Four content articles around the center/right*/ $.ajax( url: "http://search.eluniversal.com/_alias/custom-search-eu/1-4/?ch=blog&arttype=blog&orden=number_ comments", dataType: 'jsonp', beforeSend: function() $('#most_commented #loading').show(); , success: function(data) $('#most_commented #loading').hide(); drawArticles(data.listarticle, 'most_commented', 12, 6, 6); ); $.ajax( url: "http://archivo.eluniversal.com/blogs/json/mas-blogs.json",
dataType: "jsonp", jsonp: "callback", jsonpCallback: "moreBlogs", contentType: 'application/javascript', scriptCharset: 'UTF-8', beforeSend: function() $('#loading-more').show(); , success: function(data) $('#loading-more').hide(); drawArticles(data.listarticle, 'more_blogs', 12, 6, 3); ); /*Four content articles within the final row*/ // $.ajax( // url: "http://search.eluniversal.com/_alias/custom-search-eu/2-4/?ch=blog&arttype=blog", // dataType: 'jsonp', // beforeSend: function() // $('#loading-more').show(); // , // success: function(data) // $('#loading-more').hide(); // drawArticles(data.listarticle, 'more_blogs', 12, 6, 3); // // ); /*Infinite articles*/ // $(window).scroll(function ()
// if(Math.round($(window).scrollTop()) == $(document).height() - $(window).height()) // // $.ajax( // url: "http://search.eluniversal.com/_alias/custom-search-eu/"+count+"-4/?ch=blog&arttype=blog", // async: false, // dataType: 'jsonp', // beforeSend: function() // $('#loading-more').show(); // , // success: function(data) // $('#loading-more').hide(); // if(data.listarticle.length > 0) // drawArticles(data.listarticle, 'more_blogs', 12, 6, 3); // count++; // // // ); // // ); );