
',
'
']
return ret.join('');
}
function setCarouselContents(){
var paramUser = getParamUser();
var paramABTestBucket = getParamABTestBucket();
var baseurl = "http://md1.washingtonpost.com";//"http://md1.washingtonpost.com"
//The current url
var paramCurrentUrl = "&url=" + encodeURI(TWP.Data.NN.canonicalURL);//we have confirmation this is preferred over 'href'
//test url - we need this especially for recipe 4. Other recipes may work at least partially with prodprev urls
//var paramCurrentUrl = "&url=" + encodeURI("/entertainment/tv/tbss-men-at-work-a-rerun-before-its-even-started/2012/05/23/gJQAcSedkU_story.html");
var rgUrlGetRecommendedVideos = [baseurl, "/search-recommendation/videos.jsonp?callback=?", paramUser, paramABTestBucket, paramCurrentUrl];
var urlGetRecommendedVideos = rgUrlGetRecommendedVideos.join('');
$.getJSON(urlGetRecommendedVideos, function(data) {
if(data == null || data.results == undefined || data.results == null){
return;
}
//constants - the size of images, count of items per row
var itemsPerRow = 4;
//the following five lines specify the size. Note that only those sizes automatically generated by Methode are supported.
var photoPathPrefix = "http://img.wpdigital.net/rf/image_172x114";
var maxPhotoWidth = 172;
var maxPhotoHeight = 114;
var photoWidth = maxPhotoWidth + "";
var photoHeight = maxPhotoHeight + "";
var maxPhotoHeightpx = maxPhotoHeight + "px";
var minPhotoWidthpx = maxPhotoWidth + "px";
var blankImageUrl = "http://img.wpdigital.net/wp-srv/images/spacer.gif";
var results = data.results;
//we want to only show full rows. It was decided partial rows look like an error.
var countResultsToShow = results.length = maxPhotoWidth && photo.path != undefined && photo.path != null){
photoPath = photoPathPrefix + photo.path;
}
//construct the div, by concatenating the array
var rgDiv=[''];
arrayOfHtmlDivs[i] = rgDiv.join('');
}
var rgFinal = new Array();
var iRow = 0;
for(var i=0; i'];
var rowStart = rgRowStart.join('');
rgFinal.push(rowStart);
for(var j=0; j
";
//$("#storiesConnector").html(rowOfVideos);
var jCarousel = $("#recommended-videos-module").after(htmlToSet);
//jCarousel.find('.carousel-control-prev').click(function(){alert("Clicked prev");});
//$(jCarousel).find('.carousel-control-prev').click(function(){alert("Clicked prev2");});
$('#btn-prev').click(function(){
//alert("button prev was clicked");
moveCarousel(findRowContainer(this), -1);
});
$('#btn-next').click(function(){
//alert("button next was clicked");
moveCarousel(findRowContainer(this), 1);
});
});
function findRowContainer(clicked) {
return $(clicked).parents('.panel.postMost').find('.stories-container');
}
function findCurrentRow(rowContainer) {
return rowContainer.children('.on').first();
}
function findIndexLastRow(rowContainer){
var rowCount = rowContainer.children().length;
return rowCount == 0 ? 0 : rowCount - 1;
}
function moveCarousel(rowContainer, delta) {
//moves the carousel to the next or previous row, depending on delta
//plan:
// Find current Row
// Figure out which row-to-select
// if the row-to-select != current Row
// disable all buttons
// fade out current row
// make row-to-select the current-row
// fade in row-to-select
// enable buttons based on current-row
//find current row
var curRow = findCurrentRow(rowContainer);
var indexLastRow = findIndexLastRow(rowContainer);
//figure out row to select
var indexCurRow = parseInt(curRow.attr("rel"));
var indexRowToSelect = indexCurRow + delta;
if(indexRowToSelect indexLastRow){
indexRowToSelect = indexLastRow;
}
//only proceed if there is a possible change
if(indexCurRow != indexRowToSelect) {
//disable all buttons
$('#btn-prev').addClass("deactivated");
$('#btn-next').addClass("deactivated");
//fade out current row
curRow.fadeOut(100, function(){
curRow.hide();
//make row-to-select the current row
//remove class 'on'
rowContainer.children('.on').removeClass('on')
//add class 'on'
var rowNext = $(rowContainer.children()[indexRowToSelect]);
rowNext.addClass('on');
//fade in the new row
rowNext.fadeIn(100, function() {
rowNext.show();
//alert("index row to select=" + indexRowToSelect + ", indexLastRow=" + indexLastRow);
//enable buttons based on current row
var enablePrev = indexRowToSelect != 0;
var enableNext = indexRowToSelect != indexLastRow;
if(enablePrev) {
$('#btn-prev').removeClass("deactivated");
}
if(enableNext) {
$('#btn-next').removeClass("deactivated");
}
});
});
}
}
}
Newer articles:
- Clinton to visit South Sudan on major Africa trip - Business Standard - 31/07/2012 00:30
- South Sudanese Celebrate Martyrs' Day - Voice of America - 30/07/2012 14:55
- George Clooney to auction Tesla for South Sudan nonprofit - Los Angeles Times - 30/07/2012 09:02
- Obama welcomes new ambassadors to Burma, South Sudan - Fox News - 30/07/2012 07:44
- South Sudan commemorates 2nd Martyrs' Day since independence - New Sudan Vision - 30/07/2012 02:30
Older news items
- Alek Wek: 'I'm trying to help with the rebuilding process' - The Guardian - 28/07/2012 19:01
- Free Rudwan Dawod Now: US-based Human Rights Activist Stands Trial in Sudan - Huffington Post - 27/07/2012 15:16
- Guor Marial: South Sudanese Runner Is Not a Man Without a Country - Bleacher Report - 27/07/2012 14:35
- South Sudanese Supermodel Alek Wek Returns to the Country She Fled as a ... - Forbes - 27/07/2012 10:12
- Geoff Calkins: Marathoner from South Sudan runs for more than a country - Knoxville News Sentinel - 27/07/2012 06:27
Latest news items (all categories):
- The citizens of South Sudan Should Disown the SPLM - 24/04/2025 17:12
- [video] South Sudan’s security crisis and the looming war - 24/04/2025 17:05
- South Sudan’s President Salva Kiir Remembers Day Pope Francis Kissed his Feet in Heartfelt Tribute - 24/04/2025 16:58
- MTN Group reshuffles leadership in Rwanda, South Sudan - 24/04/2025 16:55
- South Sudan on brink again as fragile peace teeters - 24/04/2025 16:49
Random articles (all categories):
- SPLM swears in Lam Both as Secretary-General - 25/01/2023 06:46
- Football: Young Stars team crowned champions of South Sudan Cup in Torit - 12/01/2023 05:35
- WFP Seeks Aid for South Sudan Flood Relief - 29/09/2020 02:24
- South Sudan: Juba Summons Chinese Ambassador Over Oil Blockage - 21/05/2013 04:27
- Five confirmed cholera deaths in Sudan since August 28 - 14/09/2019 01:51
Popular articles:
- Who is the darkest person in the world, according to Guinness World Record? - 25/10/2022 02:34 - Read 95336 times
- No oil in troubled waters - 25/03/2014 15:02 - Read 22586 times
- School exam results in South Sudan show decline - 01/04/2012 17:58 - Read 21934 times
- Top 10 weakest currency exchange rates in Africa in 2023 - 19/07/2023 00:24 - Read 20659 times
- NDSU student from South Sudan receives scholarship - In-Forum - 29/09/2012 01:44 - Read 19479 times