From 66b75e01921a7b1a8f80df56b656b48fb7622eb2 Mon Sep 17 00:00:00 2001 From: liangjiaying Date: Mon, 26 Dec 2016 19:56:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"=E4=BF=AE=E6=94=B9=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E6=8A=95=E6=94=BE=E8=84=9A=E6=9C=AC=E5=8F=82=E6=95=B0?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bb61fc0f73f706ec28de7f226f2bbbdbeedc4932. --- mip-ad/mip-ad-qwang.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/mip-ad/mip-ad-qwang.md b/mip-ad/mip-ad-qwang.md index 46ab22a91..917af9b77 100644 --- a/mip-ad/mip-ad-qwang.md +++ b/mip-ad/mip-ad-qwang.md @@ -40,15 +40,12 @@ 如果在广告配置时选择了`单行文字悬浮`、`双行文字悬浮`、`图文悬浮`,则应该将``嵌入在``中使用,[mip-fixed使用文档](https://www.mipengine.org/doc/3-widget/3-customize-widget/fixed-widget.html)。 -mip-ad的height对应[组件布局](https://www.mipengine.org/doc/3-widget/11-widget-layout.html)的fixed-height,需要根据广告真实高度填写 - ```html From 8905d4d896e96a715e4d95a3c01bf37f5a954260 Mon Sep 17 00:00:00 2001 From: liangjiaying Date: Mon, 26 Dec 2016 20:04:54 +0800 Subject: [PATCH 2/2] revert --- mip-ad/mip-ad-qwang.js | 112 ++++++++++++++++------------------------- mip-ad/mip-ad-qwang.md | 15 ------ 2 files changed, 42 insertions(+), 85 deletions(-) diff --git a/mip-ad/mip-ad-qwang.js b/mip-ad/mip-ad-qwang.js index 138b4ca86..e3938b8e3 100755 --- a/mip-ad/mip-ad-qwang.js +++ b/mip-ad/mip-ad-qwang.js @@ -1,93 +1,65 @@ /** - * @file 全网推荐 - * - * @author fengchuantao@baidu.com, liangjiaying + * 全网推荐 + * + * @author fengchuantao@baidu.com * @version 1.0 * @copyright 2016 Baidu.com, Inc. All Rights Reserved */ + define(function (require) { - /** - * 渲染广告 - * - * @param {obj} domEle [description] - * @param {obj} mipEle [description] - */ - function render(domEle, mipEle) { - var cpropsid = domEle.getAttribute('cpro_psid'); - var cpropswidth = domEle.getAttribute('cpro_pswidth') || 'auto'; - var cpropsheight = domEle.getAttribute('cpro_psheight') || '230'; - var cpropstype = domEle.getAttribute('cpro_pstype') || 'embed'; - - var scriptHtml = ''; - if (cpropstype === 'embed') { - scriptHtml = [ - 'var cpro_psid ="' + cpropsid + '";', - 'var cpro_pswidth ="' + cpropswidth + '";', - 'var cpro_psheight="' + cpropsheight + '";' - ].join(''); - } - else { - scriptHtml = 'var cpro_psid ="' + cpropsid + '";'; - } - - var scriptNode = document.createElement('script'); + function render(_this, me) { + + var cpropsid = _this.getAttribute("cpro_psid"); + var cpropswidth = _this.getAttribute("cpro_pswidth") || "auto"; + var cpropsheight = _this.getAttribute("cpro_psheight") || "230"; + + var scriptHtml = [ + 'var cpro_psid ="' + cpropsid + '";', + 'var cpro_pswidth ="' + cpropswidth + '";', + 'var cpro_psheight="' + cpropsheight + '";' + ].join(''); + + var scriptNode = document.createElement("script"); scriptNode.innerHTML = scriptHtml; - var node = document.createElement('div'); + var node = document.createElement("div"); node.appendChild(scriptNode); - domEle.appendChild(node); - initJs(node, mipEle, cpropstype); + + _this.appendChild(node); + initJs(node, me); } + /** - * initJs JS初始化函数 - * - * @param {dom} node 盛放script的div - * @param {Object} mipEle mip元素 - * @param {string} type embed/suspend + * [initJs JS初始化函数] + * + * @return */ - function initJs(node, mipEle, type) { - var adScript; - if (type === 'embed') { - adScript = addScriptOnce('MIP_ADQW_EMBED', '//su.bdimg.com/static/dspui/js/um_mip.js'); - } - else if (type === 'suspend') { - adScript = addScriptOnce('MIP_ADQW_SUSP', '//su.bdimg.com/static/dspui/js/umf_mip.js'); - } - - if (!adScript) { - return; - } - - node.appendChild(adScript); - adScript.onload = function () { - mipEle.applyFillContent(node, true); - }; - } + function initJs(node, me) { - /** - * 仅引入一次脚本 - * - * @param {string} scriptId 广告脚本标识ID - * @param {string} scriptSrc 广告脚本地址 - * @return {obj} false/scriptElement - */ - function addScriptOnce(scriptId, scriptSrc) { - var jsdom = document.getElementById(scriptId); - if (jsdom) { - return false; - } + var WEBADVISEJS = document.getElementById('MIP_WEBADVISE_JS'); + + if(WEBADVISEJS) return; var script = document.createElement('script'); - script.src = scriptSrc; - script.id = scriptId; - return script; + script.src = '//su.bdimg.com/static/dspui/js/um.js'; + script.id = "WEBADVISEJS"; + + document.body.appendChild(script); + + script.onload = function(){ + + me.applyFillContent(node, true); + + }; } return { - render: render + render:render }; }); + + diff --git a/mip-ad/mip-ad-qwang.md b/mip-ad/mip-ad-qwang.md index 917af9b77..36d973b62 100644 --- a/mip-ad/mip-ad-qwang.md +++ b/mip-ad/mip-ad-qwang.md @@ -21,21 +21,6 @@ ``` -### 组件 layout="fixed" 布局 - -```html - - -``` - - ### 悬浮广告 position="fixed” 布局 如果在广告配置时选择了`单行文字悬浮`、`双行文字悬浮`、`图文悬浮`,则应该将``嵌入在``中使用,[mip-fixed使用文档](https://www.mipengine.org/doc/3-widget/3-customize-widget/fixed-widget.html)。