', Get back ret.join( '' ); } Purpose setCarouselContents( ) var paramUser = getParamUser( ); var menu = "3"; //s.getCookieForRecVidABTest( ); var paramABTestBucket = getParamABTestBucket( recipe ); var baseurl = "http://md1.washingtonpost.com";//"http://md1.washingtonpost.com" //The current url var paramCurrentUrl = "&url=" + encodeURI( TWP.Data.NN.canonicalURL );//we have confirmation that is preferred over 'href' //test url - we truly need this specifically for recipe 4. Different recipes might 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( information == null data.results == null ) return; //constants - the size of images, count of objects per line var itemsPerRow = 3; the size is specifyed by //the JJ five lines. Note that only those measurements automatically created by Methode are recognized. // var photoPathPrefix = "http://img.wpdigital.net/rf/image_172x114"; var photoPathPrefix; 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 desire to only show entire lines. It absolutely was decided partial lines appear to be a mistake. var countResultsToShow = results.length = maxPhotoWidth && photo.path!= undefined && photo.path!= null ) photoPath = photo.path; //construct the div, by concatenating the array 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) get back $( clicked ).parents( .'panel.postMost' ).find( .'stories-container' ); function findCurrentRow( rowContainer) get back rowContainer.children( .'on' ).first( ); purpose findIndexLastRow( rowContainer ) var rowCount = rowContainer.children( ).length; get back rowCount == 0?? 0 : rowCount - 1; purpose moveCarousel( rowContainer, delta) //moves the carousel to the next or previous line, according to delta //plan: // Find present Row // Determine which row-to-select // if the row-to-select!= current Row // disable all switches // reduce out recent line // make row-to-select the current-row // fade in row-to-select // permit buttons based on current-row //find recent strip 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 when there is a possible change if( indexCurRow!= indexRowToSelect) //disable all links $( '#btn-prev' ).addClass( "deactivated" ); $( '#btn-next' ).addClass( "deactivated" ); //fade out current strip curRow.fadeOut( 100, function( ) curRow.hide( ); //make row-to-select the current row //remove school 'on' rowContainer.children( .'on' ).removeClass( 'on ') //add school 'on' var rowNext = $( rowContainer.children( )[indexRowToSelect] ); rowNext.addClass( 'on' ); //fade in the new row rowNext.fadeIn( 100, function( ) rowNext.show( ); //alert( "index line to select=" + indexRowToSelect + ", indexLastRow=" + indexLastRow ); //enable keys based on present strip var enablePrev = indexRowToSelect!= 0; var enableNext = indexRowToSelect!= indexLastRow; if( enablePrev) $( '#btn-prev' ).removeClass( "deactivated" ); if( enableNext) $( '#btn-next' ).removeClass( "deactivated" ); ); ); } ]]>
No comments:
Post a Comment