[]
广告
您可能关注的内容
1&&void 0!==arguments[1]&&arguments[1],r=new Date().getTime();t&&(t.rand=r+Math.random()),function(t){var e=!1;try{t&&navigator.sendBeacon&&(e=navigator.sendBeacon(t))}catch(t){}return e}(n=[i?v:p,g(t)].join(“?”))||e(n)}(t,n);return}e([n?v:p,g(t)].join(“?”))}(this.extend(this.env,{tag:”ps-js-error”,datetime:new Date().getTime(),message:t.message,stack:t.stack}))},support:function(t,e){if(“function”==typeof t){e=t;try{e()}catch(t){this.report(t)}}else{var n=t[e];t[e]=function(){for(var e=arguments.length,i=Array(e),r=0;r1)throw Error(“threshold must be a number between 0 and 1 inclusively”);return t!==n[e-1]})},i.prototype._parseRootMargin=function(t){var e=(t||”0px”).split(/s+/).map(function(t){var e=/^(-?d*.?d+)(px|%)$/.exec(t);if(!e)throw Error(“rootMargin must be specified in pixels or percent”);return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},i.prototype._monitorIntersections=function(){!this._monitoringIntersections&&(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(r(window,”resize”,this._checkForIntersections,!0),r(t,”scroll”,this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&”MutationObserver”in window&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},i.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,o(window,”resize”,this._checkForIntersections,!0),o(t,”scroll”,this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},i.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():a();this._observationTargets.forEach(function(i){var r=i.element,o=s(r),a=this._rootContainsTarget(r),c=i.entry,u=t&&a&&this._computeTargetAndRootIntersection(r,e),l=i.entry=new n({time:window.performance&&performance.now&&performance.now(),target:r,boundingClientRect:o,rootBounds:e,intersectionRect:u});c?t&&a?this._hasCrossedThreshold(c,l)&&this._queuedEntries.push(l):c&&c.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},i.prototype._computeTargetAndRootIntersection=function(e,n){if(“none”!=window.getComputedStyle(e).display){for(var i=s(e),r=u(e),o=!1;!o;){var a=null,c=1==r.nodeType?window.getComputedStyle(r):{};if(“none”==c.display)return;if(r==this.root||r==t?(o=!0,a=n):r!=t.body&&r!=t.documentElement&&”visible”!=c.overflow&&(a=s(r)),a&&!(i=function(t,e){var n=Math.max(t.top,e.top),i=Math.min(t.bottom,e.bottom),r=Math.max(t.left,e.left),o=Math.min(t.right,e.right),s=o-r,a=i-n;return s>=0&&a>=0&&{top:n,bottom:i,left:r,right:o,width:s,height:a}}(a,i)))break;r=u(r)}return i}},i.prototype._getRootRect=function(){var e;if(this.root)e=s(this.root);else{var n=t.documentElement,i=t.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},i.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return”px”==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},i.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,i=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==i)for(var r=0;re.indexOf(this)&&e.push(this)},i.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=i,window.IntersectionObserverEntry=n}function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||a(),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,i=this.intersectionRect,r=i.width*i.height;n?this.intersectionRatio=Number((r/n).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function i(t,e){var n,i,r,o=e||{};if(“function”!=typeof t)throw Error(“callback must be a function”);if(o.root&&1!=o.root.nodeType)throw Error(“root must be an Element”);this._checkForIntersections=(n=this._checkForIntersections.bind(this),i=this.THROTTLE_TIMEOUT,r=null,function(){r||(r=setTimeout(function(){n(),r=null},i))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(o.rootMargin),this.thresholds=this._initThresholds(o.threshold),this.root=o.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(” “)}function r(t,e,n,i){“function”==typeof t.addEventListener?t.addEventListener(e,n,i||!1):”function”==typeof t.attachEvent&&t.attachEvent(“on”+e,n)}function o(t,e,n,i){“function”==typeof t.removeEventListener?t.removeEventListener(e,n,i||!1):”function”==typeof t.detatchEvent&&t.detatchEvent(“on”+e,n)}function s(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):a()}function a(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function c(t,e){for(var n=e;n;){if(n==t)return!0;n=u(n)}return!1}function u(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}}();var A={SHOW:3,FC_SHOW:4};function L(t,e,n){this.init(t,e,n)}L.prototype={constructor:L,init:function(t,e,n){this.alsHostHttp=t.replace(“https”,”http”),this.alsHostHttps=t,this.alsCommonFields=e,this.extra=n},getAlsHost:function(t){return”1″!==String(t._os_type)||/qqbrowser/.test(window.navigator.userAgent.toLowerCase())?this.alsHostHttps:this.alsHostHttp},sendAls:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];for(var i in t)t.hasOwnProperty(i)&&n.push([encodeURIComponent(i),”=”,encodeURIComponent(t[i])].join(“”));!function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(e&&navigator.sendBeacon&&navigator.sendBeacon(t))){var n=new Image;n.onload=function(){},n.onerror=function(){},n.src=t}}(this.getAlsHost(t)+”?”+n.join(“&”),e)},buildAlsLogData:function(t,e){var n=encodeURIComponent(JSON.stringify([Object.assign({},e,{extra_param:this.extra,origin_time:+Date.now()})]));return Object.assign({},this.alsCommonFields,t,e,{ad:n})},sendAlsShowLog:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.buildAlsLogData(t,e,{da_type:”YOUTH_SEARCH_PAGE”===this.alsCommonFields.dataPage?A.SHOW:A.FC_SHOW});return this.sendAls(i,n),this}};var C={sendCustomGLog:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(n=function(t){for(var e=1;e0){var o=i.getAttribute(“data-srcid”),s=i.closest(“.ec_ad_results”);if(e.opts.alsLogSrcList.includes(o)){var a={f1:”ecomExpo”,f2:s?s.getAttribute(“sid”):””,f3:i.getAttribute(“data-cmatchid”),f4:i.getAttribute(“data-rank”),f5:”observer”};C.sendCustomGLog(1112,a)}}n.observer.unobserve(i),i.setAttribute(S,1)}}})},combineData:function(t){var e=this.opts.params,n={data:{}};for(var i in e)if(e.hasOwnProperty(i)){var r=t.getAttribute(e[i]);””!==r&&(n.data[i]=r)}return n},log:function(t){this.nclick(t)},nclick:function(t){var e=this.opts.url;t.rand=this.addRand();var n=””.concat(e,”?”).concat(this.encodeSearchParams(t));this.opts.useBeacon&&navigator.sendBeacon&&navigator.sendBeacon(n)||this.imgRequest(n,t)},imgRequest:function(t,e){try{var n=e.rand,i=new Image;window[“–IMAGE”+n]=i,i.onload=i.onerror=i.onabort=function(){i.onload=i.onerror=i.onabort=null,i=null,window[“–IMAGE”+n]=R},i.src=t}catch(t){}},addRand:function(){return Math.random().toString(16).slice(2,8)+Math.random()},encodeSearchParams:function(t){var e=[];for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];”object”==typeof i&&(i=JSON.stringify(i)),e.push([n,encodeURIComponent(i)].join(“=”))}return e.join(“&”)}};var k={init:function(){new x({container:”[data-nvk]”,url:”https://ada.baidu.com/udpl/exp”,params:{exp:”data-nvk”}})}};t.PARAMS={},t.init=function(e){t.PARAMS=e;var n=”.”+t.PARAMS.resultClass;_(function(){r.init(n,t.PARAMS.imTimeSign),k.init()},!0),_(function(){O.init(),function(t,e){var n=Array.prototype.slice,i={isListener:document.addEventListener,getOnEvent:function(t,e,n,i){return function(r){var r=r||window.event;if(!1===n.call(i||t,r,e,i))return r.preventDefault(),!1}}};i.addEventListener=i.isListener?function(t,e,n,r,o){return e=e.replace(/^on/i,””),t.addEventListener(e,i.getOnEvent(t,e,n,r),!!o),t}:function(t,e,n,r){return e=e.replace(/^on/i,””),t.attachEvent(“on”+e,i.getOnEvent(t,e,n,r)),t};var r={getDom:function(t,n){return arguments.length<=1?e.getElementById(t):(n||e).getElementsByTagName(t)},getSelectorDom:function(t){return e.querySelectorAll(t)},createDom:function(t,n,i){var r=e.createElement(t);for(var o in n)r[o]=n[o];return i&&i.appendChild(r),r},getElementsByClassName:function(t,e){for(var n=(e||document).getElementsByTagName("*"),i=RegExp("\b"+t+"\b","i"),r=[],o=0,s=n.length;o
{{#jubao}}‘,getTip:function(t,e){return t.renderTip(e.getAttribute(t.triangularSign),e.getAttribute(“jubao”))},getILeft:function(t,e){return t.left+e.offsetWidth/2-e.tip.offsetWidth/2},getSHtml:function(t,e,n){return t.tpl.replace(/{{#href}}/g,e).replace(/{{#jubao}}/g,n)}},baobiao:{triangularSign:”data-baobiao”,tpl:'{{#baobiao_text}}‘,getTip:function(t,e){return t.renderTip(e.getAttribute(t.triangularSign))},getILeft:function(t,e){return t.left-21},getSHtml:function(t,e,n){return t.tpl.replace(/{{#baobiao_text}}/g,e)}}};function a(t){return this.type=t.type||”defaultTip”,this.objTip=s[this.type],this.containerId=”c-tips-container”,this.advertContainerClass=t.adSelector,this.triangularSign=this.objTip.triangularSign,this.delaySeconds=200,this.adventContainer=””,this.triangulars=[],this.motherContainer=r.createDom(“div”),this.oTipContainer=r.getDom(this.containerId),this.tip=””,this.tpl=this.objTip.tpl,this.init()}a.prototype={constructor:a,arrInit:function(){for(var t=0;t0)for(var s=”ec-adclick-bgcolor”,a=”ec-no-tap-highlight”,c=null,u=0;u
|
Source