More like this…
won’t be needed when origin is fixed bFirstRun_45a8ca9c_6d44_5970_af90_ccc795c7648b = true; // true until we hit sFirstID_45a8ca9c_6d44_5970_af90_ccc795c7648b again bStop_45a8ca9c_6d44_5970_af90_ccc795c7648b = false; // Stop retrieving assets iDisplayCount_45a8ca9c_6d44_5970_af90_ccc795c7648b = 0; // count of assets ready to display iMaxDisplay_45a8ca9c_6d44_5970_af90_ccc795c7648b = 12; // max number of assets to display } sURL = scrubURL(sURL); // Until the origin paramter for cms.search.mlt functions, we have to start/stop the looping on our own // This will require not displaying any assets until we hit this.asset. // Then we loop through and display until we’ve been through everything up to our origin or max display $.ajax(sURL).then(function(oResponse, sStatus, oXHR) { var sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b = null; var oEngagementStage_45a8ca9c_6d44_5970_af90_ccc795c7648b = $(‘.engagement-stage’); var oEngagementSlide_45a8ca9c_6d44_5970_af90_ccc795c7648b = $(‘.engagement-slide’); var oEngagementMore_45a8ca9c_6d44_5970_af90_ccc795c7648b = $(“#engagement-more”); var oEngagementContainer_45a8ca9c_6d44_5970_af90_ccc795c7648b = oEngagementSlide_45a8ca9c_6d44_5970_af90_ccc795c7648b.find(“.engagement-container”); var oEngagementSpinner_45a8ca9c_6d44_5970_af90_ccc795c7648b = oEngagementStage_45a8ca9c_6d44_5970_af90_ccc795c7648b.find(‘.engagement-spinner’); if (typeof oResponse.next_url == ‘undefined’) { // URL supplied is no good. Revert to original URL sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b = sOriginURL_45a8ca9c_6d44_5970_af90_ccc795c7648b; } else { sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b = scrubURL(oResponse.next_url); } if(sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b == “”){ sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b = “/tncms/search/mlt/?origin=45a8ca9c-6d44-5970-af90-ccc795c7648b&app=editorial&inline=feature&type=collection”; } // Manage response if (typeof oResponse.assets != ‘undefined’ && oResponse.assets.length > 0) { // Remove old more data oEngagementMore_45a8ca9c_6d44_5970_af90_ccc795c7648b.remove(); // Add a ‘start’ static engagement items if((oEngagementStage_45a8ca9c_6d44_5970_af90_ccc795c7648b.find(“.engagement-item-static”).length)>0){ oEngagementStage_45a8ca9c_6d44_5970_af90_ccc795c7648b.find(“.engagement-items-static.start”).find(“.engagement-item”).each(function(){ var sHTML_45a8ca9c_6d44_5970_af90_ccc795c7648b = ”; if((oEngagementContainer_45a8ca9c_6d44_5970_af90_ccc795c7648b.find(“.engagement-item-static”).length)<1){ iDisplayCount_45a8ca9c_6d44_5970_af90_ccc795c7648b ++; sHTML_45a8ca9c_6d44_5970_af90_ccc795c7648b += '' + $(this).html() + ']]>‘;
oEngagementContainer_45a8ca9c_6d44_5970_af90_ccc795c7648b.append(sHTML_45a8ca9c_6d44_5970_af90_ccc795c7648b);
}
});
}
// Build engagement set
$.each(oResponse.assets, function(index) {
if (index == 1 && sOriginID_45a8ca9c_6d44_5970_af90_ccc795c7648b == null) {
sOriginID_45a8ca9c_6d44_5970_af90_ccc795c7648b = oResponse.assets[0].id;
}
// Display assets once origin is found
// Find origin then begin displaying assets
if (bFoundOrigin_45a8ca9c_6d44_5970_af90_ccc795c7648b == true) {
if (this.id == sOriginID_45a8ca9c_6d44_5970_af90_ccc795c7648b) {
// Found orgin a second time. Stop gathering assets and kill next_url
bStop_45a8ca9c_6d44_5970_af90_ccc795c7648b = true;
sNextUrl_45a8ca9c_6d44_5970_af90_ccc795c7648b = null;
oEngagementMore_45a8ca9c_6d44_5970_af90_ccc795c7648b.remove();
} else if (bStop_45a8ca9c_6d44_5970_af90_ccc795c7648b == false && this.id != ’45a8ca9c-6d44-5970-af90-ccc795c7648b’) {
// Display asset
var sHTML_45a8ca9c_6d44_5970_af90_ccc795c7648b = ”;
if (this.content.includes(‘engagement-asset’) && iDisplayCount_45a8ca9c_6d44_5970_af90_ccc795c7648b < iMaxDisplay_45a8ca9c_6d44_5970_af90_ccc795c7648b) {
iDisplayCount_45a8ca9c_6d44_5970_af90_ccc795c7648b ++;
sHTML_45a8ca9c_6d44_5970_af90_ccc795c7648b +=...
Continue reading