document.getElementById('adSide').innerHTML ='
'; $(function () { var $this = '{"size":{"sizePC":{"width":"240px","height":"400px"},"sizeMb":{"width":"","height":""}},"adType":"0","isRenderInMb":true,"adContent":[{"img":{"pc":"https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/advertisement/undocumented/bigdata.png","mb":"https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/cx-guanggao/bigdata-mb.jpg","root_img_pc_asset_id":"0370AC5C4B374F12BCCCCB63194351CD","root_img_pc_asset_name":"1616810585384014280.jpg","root_img_mb_asset_id":"BDA4DA1CB63F4B81B1BFBA462743E439","root_img_mb_asset_name":"828企业上云-设计图片.png","root_0_img_pc_asset_id":"3C97764D752A44FBB51EB90D762214AB","root_0_img_pc_asset_name":"bigdata.png"},"title":"完成体验任务,领取体验官权益","href":"https://developer.huaweicloud.com/activity/experience-officer.html?dev-wushuang","id":["CBC-CS19030401/marketplace"],"material":[],"activity":[]},{"img":{"pc":"https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/cx-guanggao/position2.jpg","mb":"https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/cx-guanggao/position2-mb.jpg","root_img_pc_asset_id":"0370AC5C4B374F12BCCCCB63194351CD","root_img_pc_asset_name":"1616810585384014280.jpg","root_img_mb_asset_id":"BDA4DA1CB63F4B81B1BFBA462743E439","root_img_mb_asset_name":"828企业上云-设计图片.png"},"title":"【吐个槽,拿好礼】云声平台每月建议反馈拿好礼活动正在进行中","href":"https://bbs.huaweicloud.com/activity/suggestion.html?dev-wushuang","id":["CBC-CS19030401/marketplace"],"material":[],"activity":[]}],"_id":"pep-ad-img-title_1618565630032","extend":{"adSpace":"AD1631519167229","adName":"开发者活动页_右侧广告_240*135","adPlan":"P1631519500761","planName":"开发者右侧广告"}}'; $this = $this.replace(/"/g, '\"') || '{}'; var $data = JSON.parse($this); var loadScript = function (sSrc, callback) { var oHead = document.head || document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.async= true; script.type = "text\/javascript"; script.onerror = function(oError) { throw new URIError("The script " + oError.target.src + " is not accessible."); }; if (script.readyState){ script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { script.onload = function(){ callback(); }; }; script.src = sSrc; oHead.appendChild(script); }; $data.extParams = {}; loadScript('https://res.hc-cdn.com/cnpm-pep-smart-recommends/1.0.12/pepSmartRecommends.window.js',function(){ var $el = document.getElementById('pep-ad-img-title_1618565630032'); var isMobile = false; var styleEle = document.createElement('style'); let styleArr = [ '.pep-smart-recommend-img-card {padding-bottom: 20px;display:block;}', '.pep-smart-recommend-img-card img {margin-bottom: 13px;}', '.pep-smart-recommend-img-card .title {font-size: 14px;line-height: 22px;color: #252B3A;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;line-clamp: 2;-webkit-box-orient: vertical;}' ]; styleEle.textContent = styleArr.join(''); $el.appendChild(styleEle); var customerId = pepSmartRecommends.getCookie('ua') || pepSmartRecommends.getCookie('vk'); var id = 'ad' + new Date().getTime(); var compId = 'pep-ad-img-title_1618565630032'; if ($el.length === 0) { var divEle = document.createElement('div'); divEle.setAttribute('id', compId); $el.appendChild(divEle); } var adEle = document.createElement('div'); adEle.setAttribute('id', id); $el.appendChild(adEle); var data = Object.assign({}, { customerId: customerId, containerSelector: '#' + id, content: $data.adContent}, $data); pepSmartRecommends.render(data); var $cardItem = $el.getElementsByClassName('pep-smart-recommend-img-card'); Array.prototype.forEach.call($cardItem, function(adItem, index){ let div=document.createElement("div"); div.setAttribute('class', 'title'); div.innerHTML = $data.adContent[index].title || ''; adItem.appendChild(div); }); }); });