","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 `
`.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 `