PageSourceSearch

https://www1.pcauto.com.cn/test/hpm/hux_show4.js

js pcauto.com.cn collected 2026-10-02 05:12:08 UTC 14,707 bytes, 422 lines download raw bytes

1function ivyLoadJs(q,url,callbackName) {
2    if(q){return callbackName()}
3    var A = document.createElement("script");
4    A.src = url;
5    document.getElementsByTagName("head")[0].appendChild(A);
6    A.onload = A.onreadystatechange = function() {
7        var f = A.readyState;
8        if (f && f != "loaded" && f != "complete") return;
9        A.onload = A.onreadystatechange = null;
10        document.getElementsByTagName("head")[0].removeChild(A);
11        callbackName();
12    };
13  }
14  
15  function getIvyNode(s){
16    // vueAddParam=true vue项目约定参数
17    var show4URL = "https://t-ivy.pconline.com.cn/show4?vueAddParam=true&id=", ivyNodeALL = document.querySelectorAll(".adpos"), ivyLocArr = [];
18    if(s) show4URL += s+';';
19    if(!window.jQuery && !document.createRange){
20        ivyLoadJs(window.jQuery,"https://www1.pconline.com.cn/js/pc.jquery1.3.js",function(){});
21    }
22    if(ivyNodeALL.length > 0){
23        for (var q=0;q<ivyNodeALL.length;q++){
24            ivyLocArr.push(ivyNodeALL[q].id)
25        }
26        show4URL += ivyLocArr.join(';')
27    }
28    ivyLoadJs(window.ivymap,show4URL,function(){
29        for (var key in ivymap){
30            ivymap[key]();
31        }
32        _submitIvyID();
33        ivymap = "";
34        ivyNodeALL = "";
35    });
36  };
37  getIvyNode();
38  
39  function document_write(ivy_code, ivy_loc) {
40    var ivyNode;
41    if(ivy_loc) { // show4接口调用函数带第二个参数
42        ivyNode = document.getElementById(ivy_loc);
43    }else { // 素材接口调用函数不带第二个参数
44        var curScript,allScript;
45        document.currentScript ? curScript = document.currentScript: (allScript = document.getElementsByTagName("script"), curScript = allScript[allScript.length - 1]);
46        ivyNode = curScript.parentNode;
47    }
48    if(document.createRange != undefined && document.createRange().createContextualFragment != undefined){
49        var range = document.createRange();
50        var ivyElss = range.createContextualFragment(ivy_code);
51        ivyNode.appendChild(ivyElss);
52    }else {
53        window.jQuery(ivyNode).html(ivy_code);
54    }
55  }
56
57  function document_writeln(ivy_code, ivy_loc) {
58    document_write(ivy_code, ivy_loc)
59  }
60  
61  var _ivyIDs=window._ivyIDs||"";
62  var _tmpIvyIDs=window._tmpIvyIDs||"";
63  var _cntUrl=window._cntUrl||"";
64  var _state_=0;
65  var _count_=1;
66  var __lock__ =0;
67  var _ivySubmitPage="//ivy.pconline.com.cn/show2?channel=inline&id=";
68  function _addIvyID(para_loc_ad){
69    if(_tmpIvyIDs.indexOf(para_loc_ad+";")>-1){
70        return;
71    }
72  
73    _tmpIvyIDs = _tmpIvyIDs + para_loc_ad + ";";
74    _ivyIDs = _ivyIDs + para_loc_ad + ";";
75  }
76  function _delIvyID(para_loc_ad){
77    if(para_loc_ad != null && para_loc_ad.length>0 && para_loc_ad.indexOf("_")>0){
78        if(_tmpIvyIDs.indexOf(para_loc_ad+";")>-1){
79            _tmpIvyIDs = _tmpIvyIDs.replace(para_loc_ad+";", "");
80        }
81        if(_ivyIDs.indexOf(para_loc_ad+";")>-1){
82            _ivyIDs = _ivyIDs.replace(para_loc_ad+";", "");
83        }
84    }
85  }
86  function _submitIvyID_impl(){
87    __lock__ = 1;
88    if (_ivyIDs && _ivyIDs != ""){
89        var _ivyIDssend = _ivyIDs;
90        _ivyIDs = "";
91        try{
92            var i2 = document.createElement("script");
93            if(i2){
94                var ivydiv = document.getElementById("ivy_div");
95                if(!ivydiv){
96                    //var bodys = document.getElementsByTagName("body");
97                    //ivydiv = bodys[0];
98                    ivydiv   =   document.createElement("div");
99                    ivydiv.id= "ivy_div";
100                    ivydiv.style.display   =   "none";
101                    //2009.2.25...apply insertBefore for better compatiable
102                    //document.body.appendChild(ivydiv);
103                    document.body.insertBefore(ivydiv, document.body.firstChild);
104                }
105  
106                if (!ivydiv){
107                    try{
108                        var i2 = new Image(1,1);
109                        i2.src = _ivySubmitPage + _ivyIDssend;
110                        i2.onload=function() { _uVoid(); };
111                    }catch(err0){_addIvyID(_ivyIDssend);}
112                }else{
113                    //2009.2.25...apply insertBefore for better compatiable
114                    //ivydiv.appendChild(i2);
115                    document.body.insertBefore(i2, document.body.firstChild);
116                    var page = _ivySubmitPage + _ivyIDssend + "&state=" + _state_ + "&submitcnt=" + _count_;
117                    i2.src = page;
118                }
119            }
120        }catch(err){
121            try{
122                var i2 = new Image(1,1);
123                i2.src = _ivySubmitPage + _ivyIDssend;
124                i2.onload=function() { _uVoid(); };
125            }catch(err1){
126                _addIvyID(_ivyIDssend);
127            }
128        }
129    }
130    if (_cntUrl && _cntUrl != ""){
131        var i3 = new Image(1,1);
132        i3.src = _cntUrl;
133        i3.onload=function() { _uVoid(); };
134        _cntUrl ="";
135    }
136    __lock__ = 0;
137  }
138  function _uVoid() { return; }
139  function _ivyRandom(size){
140    try{
141        hi_now = new Date();
142        hi_id= hi_now.getSeconds() % size;
143        return hi_id;
144    }catch(err) {
145        return 0;
146    }
147  }
148  _submitIvyID=function(){ //这里特意将_submitIvyID()串分开,防止采编内嵌时被插入_addIvyID(...)串
149    if(__lock__!=0){
150        window.setTimeout(_submitIvyID,3000);
151        return;
152    }
153    _state_ = 0;
154    _count_ = 1;
155    _submitIvyID_impl();
156  };
157  
158  function _submitIvyID2(){
159    if(__lock__!=0){
160        window.setTimeout(_submitIvyID2,3000);
161        return;
162    }
163    _state_ = 1;
164    _count_ = 1;
165  
166    var needDelay= _ivyIDs&&_ivyIDs!="";
167    if(needDelay) _addIvyID("480946_302688"); //用于统计未加载完页面就跳出的次数
168    _submitIvyID_impl();
169    if(needDelay) { var d=new Date(); while(new Date()-d<100){} } //延时100毫秒以保证请求发出,不会Abort
170  }
171  function _submitIvyID3(){
172    if(__lock__!=0){
173        window.setTimeout(_submitIvyID3,3000);
174        return;
175    }
176    _state_ = 0;
177    _count_ = 2;
178    _submitIvyID_impl();
179  }
180  
181  window.addEventListener('load', function() {  _submitIvyID2(); });
182  window.addEventListener('beforeunload', function() {  _submitIvyID2(); });
183  
184  var userAgent = navigator.userAgent.toLowerCase();
185  
186  if(/msie/.test(userAgent) && !/opera/.test(userAgent)){
187    document.onreadystatechange = function(){
188        if (document.readyState == "complete"){
189            _submitIvyID3();
190        }
191    };
192  }else if(/opera/.test(userAgent) ||/mozilla/.test(userAgent)){
193    document.addEventListener( "DOMContentLoaded", _submitIvyID3 , false );
194  }
195  
196  // function document_write(s) { document.write(s); }
197  // function document_writeln(s) { document.writeln(s); }
198  
199  //add for show3
200  var _IVY_AD_MAP_ = new Array();
201  function struct_IVY_AD_MAP(key, value){
202  
203    this.key = key;
204    this.value = value;
205  
206  }
207  
208  function setLocationAd(key, value){
209  
210    for (var i = 0; i < this._IVY_AD_MAP_.length; i++)
211    {
212        if ( this._IVY_AD_MAP_[i].key === key )
213        {
214            this._IVY_AD_MAP_[i].value = value;
215            return;
216        }
217    }
218  
219    this._IVY_AD_MAP_[this._IVY_AD_MAP_.length] = new struct_IVY_AD_MAP(key, value);
220  
221  }
222  
223  function getLocationAd(key,pex)
224  {
225    var tmp = new Array();
226    var obj = new Array();
227    for (var i = 0; i < this._IVY_AD_MAP_.length; i++)
228    {
229        if ( this._IVY_AD_MAP_[i].key === key )
230        {
231            tmp = this._IVY_AD_MAP_[i].value;
232            break;
233        }
234    }
235    if(tmp != null && tmp.length>0){
236        var level = tmp[0].level;
237        for(var i=0;i<tmp.length;i++){
238            if(pex != null && pex>0){
239                if(pex>obj.length){
240                    obj[obj.length] = tmp[i];
241                    if(tmp[i].level>=2) _addIvyID(tmp[i].locationId + "_" + tmp[i].adId);
242                }
243            }else{
244                if(level>tmp[i].level)break;
245                obj[obj.length] = tmp[i];
246                if(tmp[i].level>=2) _addIvyID(tmp[i].locationId + "_" + tmp[i].adId);
247                if(level<2)break;
248            }
249        }
250    }
251    return obj;
252  }
253  
254  ivymap = window.ivymap || {}; //防重载写法,用于show4合并方式
255  function showIvyViaJs(locationId) {
256    var _f = undefined;
257    var _fconv = 'ivymap[\"'+locationId+'\"]';
258    try {
259        _f = eval(_fconv);
260        if (_f!=undefined) {
261            _f();
262        }
263    } catch(e) {
264    }
265  }
266  
267  /** 关键字广告保存的数组列表和回调函数 add by yjx **/
268  //关键字广告列表
269  var ivyAdList = new Array();
270  //关键字广告内容,key-关键字,content-广告内容,href-点击链接,ivyPara-计数参数,showCount-关键字显示次数,linkCss-链接样式
271  function IvyKeyword(key, content, href, ivyPara, showCount, linkCss){
272    this.key = key;
273    this.content = content;
274    this.href = href;
275    this.ivyPara = ivyPara;
276    this.showCount = showCount;
277    this.tmpCount = 0;
278    this.linkCss = linkCss;
279  }
280  
281  //提供给程序的回调JS函数
282  function showKeyWorkAd(keys, content, href, ivyPara, showCount, linkCss){
283    var keyArray=keys.split("|||");
284    //alert(keyArray)
285    for(var aa=0;aa<keyArray.length;aa++) {
286        ivyAdList[ivyAdList.length] = new IvyKeyword(keyArray[aa], content, href, ivyPara, showCount, linkCss);
287    }
288  }
289  
290  //针对inline形式出的定向投放的
291  function getContent(adList,keyList,areaKey,area){
292    var content = "";//找出匹配的广告
293    try {
294        try {
295            var tarea = top.location.href.replace(/.*ad_play_area=([^&]+).*/g, '$1');
296            if (tarea != top.location.href && tarea != '') {area = decodeURIComponent(tarea);}
297        }catch(te) {};
298        var isFind = "";
299        for(var a=0;a<keyList.length;a++){//将area与KeyList比较
300            if(area.indexOf(keyList[a])!= -1){isFind = keyList[a];break;}
301        }
302        if(isFind == "") isFind = "其他地区";//找出地区全称
303        areaKey = eval(areaKey);
304        var areaFind = "";
305        for(var a=0;a<areaKey.length;a++){
306            if(areaKey[a] != null && areaKey[a].key == isFind) {areaFind = areaKey[a].value;break;}
307        }
308        if(areaFind == "") return "";
309        for(var a=0;a<adList.length;a++){
310            if(adList[a] != null){
311                var aList=adList[a].key.split(",");
312                var fList=areaFind.split(",");
313                for(var b=0;b<aList.length;b++){
314                    for(var c=0;c<fList.length;c++){
315                        if(aList[b]==fList[c]){
316                            content = adList[a].value;
317                            return content;
318                        }
319                    }
320                }
321            }
322        }
323    } catch(e) {}
324    return content;
325  }
326  
327  
328  /*
329  广告监测代码 2011-11-30
330  */
331  (function(){
332    function calljs(src) {
333        var s = document.createElement('script');
334        s.src=src;
335        document.getElementsByTagName('head')[0].appendChild(s);
336    }
337    function pcc_online() {
338        if (! /(^|; )u=[^;]/.test(document.cookie)) {
339            var uf=document.cookie.replace(/(^|.*; )uf=([^;]+).*|.*/,"$2")
340            if (uf=="") {
341                document.cookie = "uf=" + ((new Date().getTime())) +
342                    ";domain=.pconline.com.cn;path=/;expires=Mon, 30-Nov-2099 08:00:00 GMT;";
343            } else {
344                var now = new Date().getTime();
345                if (now - uf > 43200000) {
346                    calljs("//ivy.pconline.com.cn/online-self.jsp");
347                }
348            }
349        } else {
350            if (/(^|; )uf=[^;]/.test(document.cookie)) {
351                document.cookie = "uf=1;domain=.pconline.com.cn;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;";
352            }
353        }
354    }
355    function pcc_u() {
356        if (! /(^|; )u=[^;]/.test(document.cookie)) {
357            calljs("//ivy.pconline.com.cn/online-u.jsp");
358        }
359    }
360    function pcc_uf() {
361        var uf=document.cookie.replace(/(^|.*; )uf=([^;]+).*|.*/,"$2")
362        if (uf=="") {
363            try{
364                document.cookie = "uf=" + ((new Date().getTime())) + ";domain=" +
365                    top.location.href.replace(/http(?:s?):\/\/.+?\.(.*?)\/.*/, '.$1') +
366                    ";path=/;expires=Mon, 30-Nov-2099 08:00:00 GMT;";
367            } catch(e) {}
368        } else {
369            var now = new Date().getTime();
370            if (now - uf > 43200000) {
371                calljs("//ivy.pconline.com.cn/online-uf3.jsp");
372            }
373        }
374    }
375  
376    window.pcc_uf = pcc_uf;
377    // call cookie functions
378    // 跨域 iframe 时 top.location.href 为空
379    try{
380        if (! /(^|; )u=[^;]/.test(document.cookie)) {
381            if (top.location.href.replace(/http(?:s?):\/\/.+?\.(.*?).com.cn\/.*/, '$1') == 'pconline') {
382                //pcc_online();
383                calljs("//ivy.pconline.com.cn/online-u-self.jsp");
384            } else {
385                //pcc_u();
386                calljs("//ivy.pconline.com.cn/online-u-other.jsp");
387            }
388        }
389  
390        //增加访问即时生成cookie_c的功能  wyw 2013-05-17
391        if (! /(^|; )c=[^;]/.test(document.cookie)) {
392            if (top.location.href.replace(/http(?:s?):\/\/.+?\.(.*?).com.cn\/.*/, '$1') == 'pconline') {
393                calljs("//ivy.pconline.com.cn/online-c-self.jsp");
394            } else {
395                calljs("//ivy.pconline.com.cn/online-c.jsp");
396            }
397        }
398    } catch(e) {
399  
400    }
401  })();
402  
403  
404  // 2012-08-20 关键字图片广告
405  var ivyImgAdList = [];
406  
407  // keys: 关键字, types: ['bottom', 'side'], main:主广告内容, holder:占位图片地址, adLink:点击链接, adId:广告标识
408  function ivyImgAd(keys, type, main, holder, jsData, adLink, count, adId) {
409    this.keys = keys.split('|||');
410    this.main = main;
411    this.holder = holder == 'null' ? null : holder;
412    this.jsData = jsData;
413    this.type = type;
414    this.adLink = adLink;
415    this.count = count;
416    this.adId = adId;
417  }
418  
419  /* for callback, 预处理从广告系统获取到的关键字图片广告信息 */
420  function showImgKeywordAd(data) {
421    ivyImgAdList.push(new ivyImgAd(data.keys, data.type, data.main, data.holder, data.jsData, data.adLink, data.count, data.adid));
422  }

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.