More like this...
'; oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append(sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955); } }); } // Build engagement set $.each(oResponse.assets, function(index) { if (index == 1 && sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 == null) { sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = oResponse.assets[0].id; } // Display assets once origin is found // Find origin then begin displaying assets if (bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { if (this.id == sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Found orgin a second time. Stop gathering assets and kill next_url bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 = null; oEngagementMore_f12d76d4_6a88_54f6_94af_8db5e0b30955.remove(); } else if (bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false && this.id != 'f12d76d4-6a88-54f6-94af-8db5e0b30955') { // Display asset var sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955 = ''; if (this.content.includes('engagement-asset') && iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 < iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 ++; sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955 += '
' + this.content + '
'; } } } else { if (this.id == sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Origin found. Begin displaying assets bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; } else { // Origin found is false. Skip asset // Fail-safe in case origin is not present in set. This can be removed when origin is fixed. if (bFirstRun_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { // Stored first id sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = this.id; bFirstRun_f12d76d4_6a88_54f6_94af_8db5e0b30955 = false; } else if (this.id == sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // We've started again. Force origin sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955; bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; } // end Fail-safe } } // Append engagement assets to container oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append(sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955); // Stop traversing asset array if (iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 >= iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; return false; } }); // Include block_id on newly added list items oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.find('.engagement-item.original').each(function() { var sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955 = scrubURL($(this).find("a.centered-content-link").attr("href")); if(sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955!="javascript:void(0)"){ // Add content discovery tracking sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955 += '#tncms-source=endcard-gallery'; // Add to image and headlines links $(this).removeClass('original').find("a.centered-content-link").attr("href", sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955); } }); // Check next URL if (sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 && bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false) { // if origin hasn't been found yet and we hit next_url. Trigger the set to pull in again. if (bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false) { // No origin yet. Call the populate function __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955); } else { // Append sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 to engagement set oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append('
'); if (iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 < iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Get next url and request more assets __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(oEngagementMore_f12d76d4_6a88_54f6_94af_8db5e0b30955.data('next-url')); } } } // Add total count to container if (bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { // Add total count to container oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.attr("data-engagement-total", iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955); // Remove engagement loading spinner oEngagementSpinner_f12d76d4_6a88_54f6_94af_8db5e0b30955.remove(); return false; } } else { // Empty asset set returned. Go back in for a real set if(__tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].attempts<2){ if(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955==null||sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955==""){ sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 = "/news/local/eastern-wayne-vs-princeton-football/collection_f12d76d4-6a88-54f6-94af-8db5e0b30955.html"; } __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955); __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].attempts++; } } }); } } // Rewrite URL for preview // TODO move to one location function scrubURL(sURL) { if (typeof sURL != 'undefined'){ return sURL; } }
More like this...
'; oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append(sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955); } }); } // Build engagement set $.each(oResponse.assets, function(index) { if (index == 1 && sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 == null) { sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = oResponse.assets[0].id; } // Display assets once origin is found // Find origin then begin displaying assets if (bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { if (this.id == sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Found orgin a second time. Stop gathering assets and kill next_url bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 = null; oEngagementMore_f12d76d4_6a88_54f6_94af_8db5e0b30955.remove(); } else if (bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false && this.id != 'f12d76d4-6a88-54f6-94af-8db5e0b30955') { // Display asset var sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955 = ''; if (this.content.includes('engagement-asset') && iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 < iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 ++; sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955 += '
' + this.content + '
'; } } } else { if (this.id == sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Origin found. Begin displaying assets bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; } else { // Origin found is false. Skip asset // Fail-safe in case origin is not present in set. This can be removed when origin is fixed. if (bFirstRun_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { // Stored first id sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = this.id; bFirstRun_f12d76d4_6a88_54f6_94af_8db5e0b30955 = false; } else if (this.id == sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // We've started again. Force origin sOriginID_f12d76d4_6a88_54f6_94af_8db5e0b30955 = sFirstID_f12d76d4_6a88_54f6_94af_8db5e0b30955; bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; } // end Fail-safe } } // Append engagement assets to container oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append(sHTML_f12d76d4_6a88_54f6_94af_8db5e0b30955); // Stop traversing asset array if (iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 >= iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 = true; return false; } }); // Include block_id on newly added list items oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.find('.engagement-item.original').each(function() { var sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955 = scrubURL($(this).find("a.centered-content-link").attr("href")); if(sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955!="javascript:void(0)"){ // Add content discovery tracking sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955 += '#tncms-source=endcard-gallery'; // Add to image and headlines links $(this).removeClass('original').find("a.centered-content-link").attr("href", sHref_f12d76d4_6a88_54f6_94af_8db5e0b30955); } }); // Check next URL if (sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 && bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false) { // if origin hasn't been found yet and we hit next_url. Trigger the set to pull in again. if (bFoundOrigin_f12d76d4_6a88_54f6_94af_8db5e0b30955 == false) { // No origin yet. Call the populate function __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955); } else { // Append sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 to engagement set oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.append('
'); if (iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955 < iMaxDisplay_f12d76d4_6a88_54f6_94af_8db5e0b30955) { // Get next url and request more assets __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(oEngagementMore_f12d76d4_6a88_54f6_94af_8db5e0b30955.data('next-url')); } } } // Add total count to container if (bStop_f12d76d4_6a88_54f6_94af_8db5e0b30955 == true) { // Add total count to container oEngagementContainer_f12d76d4_6a88_54f6_94af_8db5e0b30955.attr("data-engagement-total", iDisplayCount_f12d76d4_6a88_54f6_94af_8db5e0b30955); // Remove engagement loading spinner oEngagementSpinner_f12d76d4_6a88_54f6_94af_8db5e0b30955.remove(); return false; } } else { // Empty asset set returned. Go back in for a real set if(__tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].attempts<2){ if(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955==null||sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955==""){ sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955 = "/news/local/eastern-wayne-vs-princeton-football/collection_f12d76d4-6a88-54f6-94af-8db5e0b30955.html"; } __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].populate(sNextUrl_f12d76d4_6a88_54f6_94af_8db5e0b30955); __tnt.engagement.assets["f12d76d4-6a88-54f6-94af-8db5e0b30955"].attempts++; } } }); } } // Rewrite URL for preview // TODO move to one location function scrubURL(sURL) { if (typeof sURL != 'undefined'){ return sURL; } }