$(document).ready(function() { var resize = new Array('p', '.resizable'); resize = resize.join(','); var resetFont = $(resize).css('font-size'); $(".reset").click(function() { $(resize).css('font-size', resetFont); }); $(".increase").click(function() { var originalFontSize = $(resize).css('font-size'); var originalFontNumber = parseFloat(originalFontSize, 10); var newFontSize = originalFontNumber * 1.2; $(resize).css('font-size', newFontSize); return false; }); $(".decrease").click(function() { var originalFontSize = $(resize).css('font-size'); var originalFontNumber = parseFloat(originalFontSize, 10); var newFontSize = originalFontNumber * 0.8; $(resize).css('font-size', newFontSize); return false; }); }); var baseUrl = "https://api.parsely.com/v2"; PARSELY_Related = { onload: setTimeout(function(){ var target = "Related"; var params = { apikey: 'albayan.ae', }; params.limit = 75; params.pub_date_start = "30d"; if("Related" == target) { console.log("Parse.ly code for related articles" ); params.url = window.location.href; } else { console.log("Parse.ly code for recommended articles"); params.uuid = PARSELY.config.parsely_site_uuid; } var apiUrl = buildUrl(baseUrl, "/related", params); var url = apiUrl + "&callback=?"; $.getJSON(url, function( data ) { var output="" ; var articles = data.data ; if(data.data.length > 0 ) { if("Related" == target) { output="" + "مواد ذات علاقة" + "" ; }else { output="" + "مواد ذات علاقة" + "" ; } var count =0 ; for (var i in articles) { if(count < 6) { var imageUrl = articles[i]['image_url']; var imagename = ""; if (imageUrl.indexOf('original_640') == -1) { if (imageUrl.indexOf('logo-1024x576.png') > -1 ){ imagename = imageUrl.replace('logo-1024x576.png', 'parsely_placeholder.jpg') ; } else if (imageUrl.indexOf('logo-2023-1200x630x8.png') > -1) { imagename = imageUrl.replace('logo-2023-1200x630x8.png', 'parsely_placeholder.jpg') ; } else { var n = imageUrl.length; var lastIndex = imageUrl.lastIndexOf("https://www.albayan.ae/") imagename = imageUrl + '_gen/derivatives/rectangular_320/' + imageUrl.substring(lastIndex+1 ); } }else { imagename = imageUrl.replace('original_640', 'rectangular_320') ; } var title = articles[i]['title'] ; var url = articles[i]['url']; if (url.startsWith("https://www.albayan.ae")){ if("Related" == target) { output+="" + "" + title + ""; }else { output+="" + "" + title + ""; } } count = count + 1; } } } output+=""; document.getElementById("parsely-related-stories").innerHTML=output; $("#parsely-related-stories li a").click( function() { console.log("Related" + " clicked"); gtag('event', 'click', {'event_category': 'Related'}); }); }); }, 2000 ) }; function buildUrl(base, endpoint, params) { var url = base + endpoint + "?" + $.param(params); return url; } المصدر