Last active
August 29, 2015 14:07
-
-
Save firedfox/b4a1f50fb72a9c41b1ea to your computer and use it in GitHub Desktop.
cpro.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 默认广告配置 | |
var CPRO_STYLE_API = { | |
"tn": "template_inlay_all_normal", // 模板 | |
"at": "text", // 物料类型 | |
"urlis": 0, // 是否显示广告链接 | |
"desis": 0, //是否显示主题标题描述词 | |
"consl": 0, //是否显示广告块LOGO | |
"titsu": 0, //是否显示文字下划线 | |
"titpl": 6, //广告块文字左填充值,右填充为titpr | |
"conpt": 0, | |
"conpb": 0 | |
}; | |
// 针对每个推荐计划的广告配置 | |
// 如果是从顶部开始数,则第1行的pos为0,第2行的pos为1;如果从底部开始,则倒数第1行的pos为-1,倒数第2行的pos为-2 | |
var CONFIG = { | |
'34383': { 'id': 'u1545426', 'row': 2, 'column': 1, 'pos': 0, 'offset': 2 } | |
}; | |
var planId = 34383; | |
var config = CONFIG[planId]; | |
var cproStyleApi = {}; | |
cproStyleApi['conW'] = parseInt(containerCSS['width'], 10) * (config['column'] / settings['textColumn']) - 18; // 广告宽度 | |
cproStyleApi['conH'] = lineHeight * config['row'] ; // 广告高度 | |
cproStyleApi['rss2'] = textCSS['color']; // 广告文字颜色 | |
cproStyleApi['titfs'] = parseInt(textCSS['font-size'], 10); // 广告文字字号 | |
cproStyleApi['iters'] = 0; // 广告文字行间隔 | |
cproStyleApi['hn'] = config['row']; // 广告文字行数 | |
cproStyleApi['wn'] = config['column']; // 广告文字列数 | |
(window.cproArray = window.cproArray || []).push({ id: config['id'] }); | |
(window["cproStyleApi"] = window["cproStyleApi"] || {})[config['id']] = extend(CPRO_STYLE_API, cproStyleApi); | |
var elemUnionJS = document.createElement('script'); | |
elemUnionJS.src = 'http://cpro.baidustatic.com/cpro/ui/c.js'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.appendChild(elemUnionJS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment