You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4 lines
111 KiB
JavaScript
4 lines
111 KiB
JavaScript
2 years ago
|
try{window._ssp_global=window._ssp_global||{},function(t){var e={global:t,proxyName:!1,basePath:"//cpro.baidustatic.com/cpro/ui/dup/"};!function(){var i={name:"oojs",namespace:"",classes:{},noop:function(){},$oojs:function(){var i={};if("undefined"!=typeof window&&window&&"undefined"!=typeof document&&document?(this.runtime="browser",i.global=window):(this.runtime="node",i.global=t),i.proxyName="proxy",i.path="node"===this.runtime?process.cwd()+"/src/":"/src/","undefined"!=typeof e)for(var n in e)n&&e.hasOwnProperty(n)&&(i[n]=e[n]);this.global=i.global,i.proxyName&&(Function.prototype[i.proxyName]=this.proxy),this.setPath(i.path),this.global.oojs=this.global.oojs||this},path:{},pathCache:{},getPath:function(t){var e=t?t.split("."):!1,i=this.path;if(e)for(var n=0,o=e.length;o>n;n++){var r=e[n].toLowerCase();if(!i[r])break;i=i[r]}return i.pathValue},setPath:function(t,e){var i=this.path;if("object"!=typeof t){if(e)for(var n=t.split("."),o=0,r=n.length;r>o;o++){var s=n[o].toLowerCase();i[s]=i[s]||{pathValue:i.pathValue},i=i[s]}else e=t;i.pathValue=e,this.pathCache={}}else for(var a in t)a&&t.hasOwnProperty(a)&&this.setPath(a,t[a])},getClassPath:function(t){if(!this.pathCache[t]){this.pathCache[t]=this.getPath(t)+t.replace(/\./gi,"/")+".js";var e=this.getPath(t),i=e.length-1;e.lastIndexOf("\\")!==i&&e.lastIndexOf("/")!==i&&(e+="/"),this.pathCache[t]=e+t.replace(/\./gi,"/")+".js"}return this.pathCache[t]},loadDeps:function(t,e){e=e||{};var i=t.__deps,n=(t.__namespace,[]);for(var o in i)if(i.hasOwnProperty(o)&&i[o]){var r;if("string"!=typeof i[o]?(t[o]=i[o],t[o]&&t[o].__name&&(r=t[o].__full)):(r=i[o],t[o]=this.find(r)),!r||e[r])continue;if(e[r]=!0,t[o])t[o].__deps&&(n=n.concat(this.loadDeps(t[o],e)));else{if("node"===this.runtime)try{t[o]=require(this.getClassPath(r))}catch(s){n.push(r)}t[o]||n.push(r)}}return n},fastClone:function(t){var e=function(){};e.prototype=t;var i=new e;return i},deepClone:function(t,e){"number"!=typeof e&&(e=10);var i,n=e-1;if(e>0)if(t instanceof Date)i=new Date,i.setTime(t.getTime());else if(t instanceof Array){i=[];for(var o=0,r=t.length;r>o;o++)i[o]=this.deepClone(t[o],n)}else if("object"==typeof t){i={};for(var s in t)if(t.hasOwnProperty(s)){var a=t[s];i[s]=this.deepClone(a,n)}}else i=t;else i=t;return i},proxy:function(t,e){var i=Array.prototype.slice.apply(arguments),n=i.shift(),o="function"==typeof this?this:i.shift();return function(){var t=Array.prototype.slice.apply(arguments);return o.apply(n,t.concat(i))}},find:function(t){var e,i=t.split(".");e=this.classes[i[0]];for(var n=1,o=i.length;o>n;n++){if(!e||!e[i[n]]){e=null;break}e=e[i[n]]}return e},reload:function(t){var e=this.find(t);if(e)if(e.__registed=!1,"node"===this.runtime){var i=this.getClassPath(t);delete require.cache[require.resolve(i)],e=require(i)}else e=this.define(e);else e=this.using(t);return e},create:function(t,e,i,n,o,r){"string"==typeof t&&(t=this.using(t));var s=new t.__constructor(e,i,n,o,r);return s},using:function(t){var e=this.find(t);return e||"node"===this.runtime&&(require(this.getClassPath(t)),e=this.find(t)),e},define:function(t){var e=t.name||"__tempName",i=t.namespace||"";t.__name=e,t.__namespace=i,t.__full=i.length>1?i+"."+e:e,t.__deps=t.deps,t.__oojs=this,t.__constructor=function(t,e,i,n,o){if(this.__clones&&this.__clones.length>0)for(var r=0,s=this.__clones.length;s>r;r++){var a=this.__clones[r];this[a]=this.__oojs.deepClone(this[a])}this.__constructorSource(t,e,i,n,o)},t.__constructorSource=t[e]||this.noop,t.__staticSource=t["$"+e]||this.noop,t.__staticUpdate=function(){var e=[];for(var i in this)if(this.hasOwnProperty(i)){var n=this[i];"object"!=typeof n||null===n||"deps"===i||0===i.indexOf("__")||t.__deps&&t.__deps[i]||e.push(i)}this.__clones=e,this.__constructor.prototype=this},t.__static=function(){this.__staticSource(),this.__staticUpdate()};for(var n,o=i.split("."),r=o.length,s=this.classes,a=0;r>a;a++)n=o[a],n&&(s[n]=s[n]||{},s=s[n]);s[e]=s[e]||{};var d=s;if(s=s[e],!s.__name||!s.__registed){t.__registed=!0,d[e]=t,t=d[e];var l=this.loadDeps(t);if(l.length>0){if(this.loader=this.loader||this.using("
|
||
|
},queryToJson:function(t){for(var e,i,n,o,r=t.substr(t.indexOf("?")+1),s=r.split("&"),a=s.length,d={},l=0;a>l;l++)o=s[l].split("="),e=o[0],i=o[1],n=d[e],"undefined"==typeof n?d[e]=i:"[object Array]"==Object.prototype.toString.call(n)?n.push(i):d[e]=[n,i];return d},getQueryURI:function(t){for(var e=[],i=0;t>i;i++){var n=String.fromCharCode(Math.floor(26*Math.random())+"a".charCodeAt(0)),o=/^[a-z]+$/g;o.test(n)&&e.push(n)}return e}}),t.define({name:"data",namespace:"dup.common.utility",deps:{lang:"dup.common.utility.lang",dom:"dup.common.utility.dom"},$data:function(){this.pageInfo={}},data:function(){this.topWin=this.dom.getNotCrossDomainTopWindow(),this.globalInfo=this.topWin.BAIDU_SSP__info||(this.topWin.BAIDU_SSP__info={})},forEach:function(t,e){var i,n,o,r=t.length;if("function"==typeof e)for(o=0;r>o&&(n=t[o],i=e.call(t,n,o),i!==!1);o++);return t},putInfo:function(t,e,i){var n,o=i?this.globalInfo:this.pageInfo;if("string"===this.lang.getType(t)){for(var r=t.split("."),s=o;r.length;){var a=r.shift();s[a]=r.length?void 0!==s[a]?s[a]:{}:e,s=s[a]}n=e}return n},removeInfo:function(t,e){var i=e?this.globalInfo:this.pageInfo;switch(this.lang.getType(t)){default:return!1;case"string":for(var n=t.split(".");n.length;){var o=n.shift();if(!n.length||void 0===i[o])return delete i[o],!0;i=i[o]}}return!1},getInfo:function(t,e){var i,n=e?this.globalInfo:this.pageInfo;return"string"===this.lang.getType(t)&&(i=this.lang.getAttribute(n,t)),i},getOnce:function(t){var e=window,i=e[t];return e[t]=void 0,i},defineOnce:function(t,e){var i=window;return i[t]?i[t]:(i[t]=e,e)},getConfig:function(t){return t?(this.pageInfo=this.getInfo("pageConfig")||{},this.pageInfo[t]):!1},putConfig:function(t,e){return t&&e?(this.pageInfo=this.getInfo("pageConfig")||{},this.pageInfo[t]=e,this.putInfo("pageConfig",this.pageInfo),!0):!1}}),t.define({name:"origentation",namespace:"dup.business",deps:{lang:"dup.common.utility.lang",data:"dup.common.utility.data"},orientKey:"bizOrientations",orientUrgentKey:"bizUrgentOrientations",hasOwn:Object.prototype.hasOwnProperty,watchingSlotsMap:{},slotFinishedCallback:function(){},addOrientation:function(t,e){var i=this.beforeSavingOrientation.apply(this,arguments);return this.saveOrientation(t,i)},addOrientationOnce:function(t,e){var i=this.beforeSavingOrientation.apply(this,arguments);return this.saveOrientation(t,i,{urgent:!0,merge:!0})},setOrientationOnce:function(t,e){var i=this.beforeSavingOrientation.apply(this,arguments);return this.saveOrientation(t,i,{urgent:!0,override:!0})},beforeSavingOrientation:function(t,e){var i=/^[0-9a-zA-Z]+$/;return t&&i.test(t)&&e?e="array"===this.lang.getType(e)?e:Array.prototype.slice.call(arguments,1):[]},saveOrientation:function(t,e,i){if(!e||!e.length)return!1;i=i||{urgent:!1,merge:!1,override:!1};var n=i.merge?this.data.getInfo(this.orientKey):{},o=i.urgent?this.orientUrgentKey:this.orientKey,r=i.override?{}:this.data.getInfo(o)||n,s={};for(var a in r)this.hasOwn.call(r,a)&&(s[a]="array"===this.lang.getType(r[a])?r[a].slice():r[a]);for(var d=s[t]||[],l=e.length,c=0;l>c;c++){var h=e[c];"string"==typeof h&&(h=encodeURIComponent(h),h.length<=100&&(d[d.length]=h))}return d.length?(s[t]=this.lang.unique(d),this.data.putInfo(o,s),!0):!1},getOrientationQuery:function(t){t=t||500,t=Math.max(0,Math.min(t,500));var e,i=[],n=this.data.getInfo(this.orientUrgentKey)||this.data.getInfo(this.orientKey)||{};if("object"===this.lang.getType(n))for(var o in n)this.lang.hasOwn.call(n,o)&&(e=o+"="+n[o].join(","),i[i.length]=e);this.data.putInfo(this.orientUrgentKey,void 0),i.sort(function(t,e){return t.length-e.length});for(var r="",s=i.length,a=0;s>a&&!(r.length+i[a].length>=t);a++)r+=(a?"&":"")+i[a];return r},addSlotStatusCallback:function(t,e){this.setSlotFinishCallback(t),this.addWatchSlotId(e)},setSlotFinishCallback:function(t){this.slotFinishedCallback=t},addWatchSlotId:function(t){this.watchingSlotsMap[t]=!0}}),t.define({name:"browserParam",namespace:"dup.business.parameter",deps:{config:"dup.common.config",browser:"dup.common.utility.browser",dom:"dup.common.utility.dom",style:"dup.common.u
|
||
|
e=!(r||s||a||d),(e||0!==a)&&(i=0!==r||0!==a)}t.isPdbAd=e,t.isNeedCacheRequest=i},addSlot:function(t){this.slotsMap[t.id]=t},clearStatus:function(t,e){t.status=t.status^e},checkStatus:function(t,e){return(t.status&e)>0},setStatus:function(t,e){var i=this.getSlotInfo(t);if(i&&(i.status|=e),(e&this.config.STATUS_CREATE)>0&&(this.storageTime[t]=+new Date),(e&this.config.STATUS_FINISH)>0){var n=(new Date).getTime()-this.storageTime[t],o={type:"performance",id:t,mes:n,exps:this.config.EXP_ID};this.log.monitorLog(o),this.adSlotFinish(t)}},addErrorInfo:function(t,e){t.errors=t.errors||[],t.errors.push(e)},adSlotFinish:function(t){var e={},i=!1,n=this.getSlotInfo(t);if(n.response){var o=n.response?n.response.pdb_deliv:{};for(var r in this.origentation.watchingSlotsMap)if(r&&this.origentation.watchingSlotsMap.hasOwnProperty(r)&&this.origentation.watchingSlotsMap[r]&&0===(""+t).indexOf(""+r)&&n.response){var s=o.deliv_des,a=s.width||0,d=s.height||0;0===a||0===d?e[t]=!1:e[t]=!0,i=!0}i&&this.origentation.slotFinishedCallback(e)}},process:function(){var t=this.slotsMap;for(var e in t)if(e&&t[e]&&t.hasOwnProperty(e)){var i=t[e];if(i.status>=this.config.STATUS_REQUEST)continue;this.createContainer(i),this.requestSlotInfo(i)}},requestSlotInfo:function(t){var e=!1;t.paramObj=this.param.getParamObj(t),t.paramObj.exps=this.config.EXP_ID,t.paramObj.pcn=this.config.IS_CNAME?this.config.REQUEST_URL_CNAME:"";var i=this.param.getParamString(t.paramObj),n=this.config.POS_URL+i;t.paramObj.dtm=this.config.HTML_POST,t.timestampWatcher.t2=+new Date;var o=!1;"union"===t.productLine&&(o=!0),t.isAsync===!0&&(o=!0),this.config.EXP_SATUS&&(e=this.localAdInfo(t)),e?(this.setStatus(t.id,this.config.STATUS_REQUEST),window[this.config.LOADER_DEFINE_NAME](e)):(this.sendJsonpRequest(n,o),this.setStatus(t.id,this.config.STATUS_REQUEST))},localAdInfo:function(t){try{var e={};if(!this.storage.isAvailable)return!1;if(this.storageSlotInfo=this.storage.getItem(t.id),!this.storageSlotInfo)return!1;if(e=this.lang.jsonToObj(this.storageSlotInfo),!e||!e.adExpire)return!1;var i=(new Date).getTime(),n=i-e.adExpire;return n>this.config.STORAGE_TIMER?(this.storage.removeItem(t.id),!1):e}catch(o){var r=encodeURIComponent(o),s={type:"elog",pos:"localAdInfo",id:t.id,mes:r,exps:this.config.EXP_ID};this.log.monitorLog(s)}},adInfoStorage:function(t){try{var e=t.response||{},i=!1;e&&e.pdb_deliv&&e.pdb_deliv.deliv_des&&e.pdb_deliv.deliv_des._html&&(i=!0);var n=!1;e&&e.tuid&&(n=0===e.tuid.indexOf("u"));var o=t.id;!i&&n&&this.storage.isAvailable&&window.JSON&&window.JSON.stringify&&o&&!this.storageSlotInfo&&(e.adExpire=(new Date).getTime(),this.storage.setItem(o,JSON.stringify(e)))}catch(r){var s=encodeURIComponent(r),a={type:"elog",pos:"adInfoStorage",id:t.id,mes:s,exps:this.config.EXP_ID};this.log.monitorLog(a)}},createContainer:function(t){if(!(t.status>this.config.STATUS_CREATE)){var e=this.dom.g(t.containerId);if(e)return void this.setStatus(t.id,this.config.STATUS_CREATE);t.isAsync?"union"===t.productLine&&(t.containerId="cpro_"+t.slotId):(document.write('<div id="'+t.containerId+'"></div>'),this.dom.g(t.containerId)||this.createBackupWrapper(t)),this.setStatus(t.id,this.config.STATUS_CREATE)}},createBackupWrapper:function(t){try{var e=document.getElementsByTagName("script"),i=e[e.length-1];if(i){var n=i.parentNode;if(n){var o=document.createElement("div");return o.id=t.containerId,n.insertBefore(o,i),!0}}}catch(r){}return!1},sendJsonpRequest:function(t,e){if(e){var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=t;var n=document.getElementsByTagName("script")[0];if(n&&n.parentNode)return void n.parentNode.insertBefore(i,n);document.write('<script charset="utf-8" src="'+t+'"></script>')}else document.write('<script charset="utf-8" src="'+t+'"></script>')},adInfoIsAvailable:function(t){var e=t.response;if(!e)return!0;var i=e.pdb_deliv,n=e.rtb_deliv,o=e.order_deliv,r=e.pdb_deliv.deliv_des,s=(r._html,e.placement.complement_type);return!(!this.config.IS_PREVIEW&&0===i.deliv_id&&0===n.deliv_id&&0===o.deliv_id&&7==s)}}),t.define({name:"detect",namespace:"
|
||
|
this.dom.bind(n,"mouseout",t.proxy(this,this.closeBtnOnMouseOutHandler))},closeBtnOnClickHandler:function(){var t=document.getElementById(this.info.domId);t&&t.parentNode&&t.parentNode.removeChild(t),2===this.info.closeType&&this.setCookieClose(this.info);var e="//eclick.baidu.com/fcb.jpg?jk={jk}&dt={dt}&rnd={rnd}",i={jk:this.info.queryId||"",dt:(new Date).getTime(),rnd:Math.floor(2147483648*Math.random())};try{this.log.loadImage(this.lang.template(e,i))}catch(n){}},closeBtnOnMouseOverHandler:function(){var t=this.info.domId+"_closebtn",e=this.dom.g(t);if(e)if("couplet"===this.info.blockType)e.style.backgroundColor="#0066cc";else if("popup"===this.info.blockType||"button"===this.info.blockType){var i=e.getElementsByTagName("div")[0];i.style.backgroundColor="#0066cc";var n=e.getElementsByTagName("a")[0];n.style.backgroundImage="url(//cpro.baidustatic.com/cpro/ui/noexpire/img/2.0.0/xuanfu_mouseover_close.png)"}},closeBtnOnMouseOutHandler:function(){var t=this.info.domId+"_closebtn",e=this.dom.g(t);if(e)if("couplet"===this.info.blockType)e.style.backgroundColor="#999999";else if("popup"===this.info.blockType||"button"===this.info.blockType){var i=e.getElementsByTagName("div")[0];i.style.backgroundColor="#999999";var n=e.getElementsByTagName("a")[0];n.style.backgroundImage="url(//cpro.baidustatic.com/cpro/ui/noexpire/img/2.0.1/xuanfu_close.png)"}},autoClose:function(){var t=document.getElementById(this.adInfo.domId);t&&t.parentNode&&t.parentNode.removeChild(t)},render:function(e,i){if(this.validate(e)){this.info=e;var n=this.createCloseElement(e),o=this.createBlockHtmlTemplate(e),r={width:e.width,height:e.height,iframe:this.frame.getFrameHTML(i,e.domId+"_iframe"),closeBtn:n},s=this.createContainerElementByInfo(e);s.innerHTML=this.lang.template(o,r),this.dom.g(e.domId)||document.body.insertBefore(s,document.body.firstChild),this.registEvent(e);var a=e.closeTime||0;a>0&&setTimeout(t.proxy(this,this.autoClose),1e3*a),i.isPdbAd||this.slot.setStatus(i.id,this.config.STATUS_FINISH)}}}),t.define({name:"inlayFix",namespace:"dup.ui.painter.mobile",deps:{config:"dup.common.config",lang:"dup.common.utility.lang",style:"dup.common.utility.style",dom:"dup.common.utility.dom",slot:"dup.business.slot",param:"dup.business.param",expand:"dup.ui.painter.expand",monitor:"dup.business.monitor",frame:"dup.business.frame",richMaterial:"dup.ui.painter.richMaterial",landingPage:"dup.ui.painter.landingPage"},$inlayFix:function(){this.win=window},processSlotInfo:function(t){var e={},i=t.response.placement,n=i.container,o=(i.fillstyle,n.sizeType),r=n.width,s=n.height;if(t.styleOpenApi.scale){o=2;var a=t.styleOpenApi.scale,d=a.split(".");r=d[0],s=d[1]}if(1===o)e.width=r,e.height=s;else if(2===o||5===o){t.pcwd||t.ftpc?(e.wScale=t.pcwd||"-1",t.styleOpenApi.cpro_ftpc="true"):e.wScale=r,t.pchd?e.hScale=t.pchd:e.hScale=s;var l={},c=t.styleOpenApi.cpro_ftpc||"true"===t.styleOpenApi.cpro_ftpc||"-1"===e.wScale;c=5===o?!0:c;var h=this.dom.g(t.containerId);c&&h&&h.parentElement.clientWidth&&(l.width=h.parentElement.clientWidth||0),"-1"===e.hScale&&h&&h.parentElement&&(l.height=h.parentElement.clientHeight||0);var u=this.param.translateScaleToPixelSize(e.wScale,e.hScale,l);n.width=u.width,n.height=u.height,t.width=u.width,t.height=u.height,e.width=u.width,e.height=u.height}else if(3===o){var p=this.getCurViewportWidth(r);n.width=t.width=e.width=p,n.height=t.height=e.height=s}e.sizeType=o;var m=t.styleOpenApi,f=m.cpro_w||m.rsi0||0,g=m.cpro_h||m.rsi1||0;return(f||g)&&(e.width=f||this.getCurViewportWidth(r),e.height=g||s,t.width=e.width,t.height=e.height),e},getCurViewportWidth:function(t){var e=this.isUnionPreview?t:Math.max(320,this.win.innerWidth);return isNaN&&isNaN(e)&&(e=this.style.getClientWidth()),e},parseHtmlSnippet:function(t){var e=['<div style="box-sizing: content-box;width:{width}px;height:{height}px;position:relative;margin:0 auto;">',"{closeBtnHtml}","{iframeHtml}","</div>"].join("");return this.lang.template(e,t)},decorateContainer:function(t,e){if(t){var i=t.style;i.cssText=["box-sizing: content-box;","text-align:center;","display:block;","font-siz
|