Source: Unhcr

","whicProcessBuiltThisRecordSet":"ic3-library-.php __FAST function @ LINE#4268"}]; // console.log(posts); let currentIndex = 0; const postsContainer = document.getElementById('posts-container'); const loadMoreBtn = document.getElementById('load-more'); const loadAllBtn = document.getElementById('load-all'); const postsPerPage = 6; // you do not need to worry about paintImage callsas far as theThumbnail being empty becuase we took care of this at the time getting all the posts for this page function paintImage_JS(w = 500, h = 282, theThumbnail, className = '', theTitle = '', asIs = '', loading = 'lazy') { // Ensure title is safe for HTML attributes // if (MHK) alert('MHK'); // debugger; console.log('\n\n____'+theThumbnail+'____\n\n'); theTitle = theTitle.replace(/"/g, '"'); // Truncate alt text to a max of 125 characters (ensuring full words) if (theTitle.length > 125) { theTitle = theTitle.substring(0, 122) + '...'; } // Define `srcset` for responsive loading const srcset = ` https://www.islamicity.org/wp-content/plugins/blueprint-timthumb/timthumb.php?v=TEMPVV&src=${theThumbnail}&w=300&h=${Math.round(h * 300 / w)}&q=80 300w, https://www.islamicity.org/wp-content/plugins/blueprint-timthumb/timthumb.php?v=TEMPVV&src=${theThumbnail}&w=768&h=${Math.round(h * 768 / w)}&q=90 768w, https://www.islamicity.org/wp-content/plugins/blueprint-timthumb/timthumb.php?v=TEMPVV&src=${theThumbnail}&w=1024&h=${Math.round(h * 1024 / w)}&q=95 1024w, https://www.islamicity.org/wp-content/plugins/blueprint-timthumb/timthumb.php?v=TEMPVV&src=${theThumbnail}&w=${w}&h=${h}&q=100 ${w}w `.trim(); // Define `sizes` for different screen widths const sizes = "(max-width: 480px) 100vw, (max-width: 768px) 80vw, (max-width: 1024px) 60vw, 50vw"; // Construct the image tag as a string return `${theTitle} `.trim(); } function createPostHTML(post,theImageTag) { var theAuthorLink = post.theAuthor.split('|')[1]; var theAuthorCaption = post.theAuthor.split('|')[0]; if ( theAuthorLink.includes('ource/')) { var theByOrSource = 'Source:'; } else { var theByOrSource = 'By:'; } return `

${post.theTitle}

${post.theExcerpt}

${theByOrSource} ${theAuthorCaption}
Topics: ${post.theLinks}
${post.theReadingTime} ${post.theIcon}
`; } var sepOccurredAlready; var sepOccurredAlready = false; function renderPosts(count) { // alert('count:' + count); // debugger; const fragment = document.createDocumentFragment(); for (let i = currentIndex; i < Math.min(currentIndex + count, posts.length); i++) { // alert(i); if ( i == 0 ) continue; // we have already shown this. const postElement = document.createElement('div'); var theThumbnail = posts[i].theThumbnail; if (!theThumbnail || theThumbnail == 'null') { theThumbnail = 'http://media.islamicity.org/wp-content/uploads/2015/06/Roof_hafez_tomb.jpg'; // this is done only because #post ID 9691's blpCustomFieldEmbed } var theTitle = posts[i].theTitle; if ( i < 3 ) { $loadin_lazy_or_eager = 'eager'; } else { $loadin_lazy_or_eager = 'lazy'; } var theImageTag = paintImage_JS(499,282,theThumbnail,' attachment-postbox-style1 size-postbox-style1 wp-post-image ', theTitle, '', $loadin_lazy_or_eager); // alert(theImageTag); // console.log(theImageTag); postElement.innerHTML = createPostHTML(posts[i],theImageTag); postElement.classList.add('postbox'); fragment.appendChild(postElement); } postsContainer.appendChild(fragment); setTimeout(() => { document.querySelectorAll('.postbox:not(.visible)').forEach(el => el.classList.add('visible')); }, 100); currentIndex += count; if (currentIndex >= posts.length) { if (loadMoreBtn) { loadMoreBtn.style.display = 'none'; } if (loadAllBtn) { loadAllBtn.style.display = 'none'; } } } if (loadMoreBtn) { loadMoreBtn.addEventListener('click', () => renderPosts(postsPerPage)); } if (loadAllBtn) { loadAllBtn.addEventListener('click', () => renderPosts(posts.length - currentIndex)); } renderPosts(postsPerPage);