PageSourceSearch

https://1whnva.com/resources/v1/app/assets/g5-dfp-Ba54_mv3.js

js 1whnva.com collected 2026-10-08 05:57:48 UTC 12,264 bytes, 480 lines download raw bytes

1'v1.0.2 Geetest Inc.';
2(function (window) {
3  'use strict';
4  if (typeof window === 'undefined') {
5    throw new Error('Geetest requires browser environment');
6  }
7
8  var document = window.document;
9  var Math = window.Math;
10  var head = document.getElementsByTagName('head')[0];
11  var TIMEOUT = 10000;
12
13  function _Object(obj) {
14    this._obj = obj;
15  }
16
17  _Object.prototype = {
18    _each: function (process) {
19      var _obj = this._obj;
20      for (var k in _obj) {
21        if (_obj.hasOwnProperty(k)) {
22          process(k, _obj[k]);
23        }
24      }
25      return this;
26    },
27    _extend: function (obj) {
28      var self = this;
29      new _Object(obj)._each(function (key, value) {
30        self._obj[key] = value;
31      });
32    },
33  };
34
35  var uuid = function () {
36    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
37      var r = (Math.random() * 16) | 0;
38      var v = c === 'x' ? r : (r & 0x3) | 0x8;
39      return v.toString(16);
40    });
41  };
42
43  function Config(config) {
44    var self = this;
45    new _Object(config)._each(function (key, value) {
46      self[key] = value;
47    });
48  }
49
50  Config.prototype = {
51    apiServers: ['riskct.geetest.com'],
52    staticServers: ['static.geetest.com', 'static.geevisit.com', 'dn-staticdown.qbox.me'],
53    protocol: 'http://',
54    typePath: '/dfp/api/v1/pre_load',
55    fallback_config: {
56      bypass: {
57        staticServers: ['static.geetest.com', 'static.geevisit.com', 'dn-staticdown.qbox.me'],
58        type: 'bypass',
59        bypass: '/v4/bypass.js',
60      },
61    },
62    _get_fallback_config: function () {
63      var self = this;
64      if (isString(self.type)) {
65        return self.fallback_config[self.type];
66      } else {
67        return self.fallback_config.bypass;
68      }
69    },
70    _extend: function (obj) {
71      var self = this;
72      new _Object(obj)._each(function (key, value) {
73        self[key] = value;
74      });
75    },
76  };
77  var isNumber = function (value) {
78    return typeof value === 'number';
79  };
80  var isString = function (value) {
81    return typeof value === 'string';
82  };
83  var isBoolean = function (value) {
84    return typeof value === 'boolean';
85  };
86  var isObject = function (value) {
87    return typeof value === 'object' && value !== null;
88  };
89  var isFunction = function (value) {
90    return typeof value === 'function';
91  };
92  var MOBILE = /Mobi/i.test(navigator.userAgent);
93
94  var callbacks = {};
95  var status = {};
96
97  var random = function () {
98    return parseInt(Math.random() * 10000) + new Date().valueOf();
99  };
100
101  var bind = function (target, context) {
102    if (typeof target !== 'function') {
103      return;
104    }
105    var args = Array.prototype.slice.call(arguments, 2);
106
107    if (Function.prototype.bind) {
108      return target.bind(context, args);
109    } else {
110      return function () {
111        var _args = Array.prototype.slice.call(arguments);
112        return target.apply(context, args.concat(_args));
113      };
114    }
115  };
116
117  var toString = Object.prototype.toString;
118
119  var _isFunction = function (obj) {
120    return typeof obj === 'function';
121  };
122  var _isObject = function (obj) {
123    return obj === Object(obj);
124  };
125  var _isArray = function (obj) {
126    return toString.call(obj) == '[object Array]';
127  };
128  var _isDate = function (obj) {
129    return toString.call(obj) == '[object Date]';
130  };
131  var _isRegExp = function (obj) {
132    return toString.call(obj) == '[object RegExp]';
133  };
134  var _isBoolean = function (obj) {
135    return toString.call(obj) == '[object Boolean]';
136  };
137
138  function resolveKey(input) {
139    return input.replace(/(\S)(_([a-zA-Z]))/g, function (match, $1, $2, $3) {
140      return $1 + $3.toUpperCase() || '';
141    });
142  }
143
144  function camelizeKeys(input, convert) {
145    if (!_isObject(input) || _isDate(input) || _isRegExp(input) || _isBoolean(input) || _isFunction(input)) {
146      return convert ? resolveKey(input) : input;
147    }
148
149    if (_isArray(input)) {
150      var temp = [];
151      for (var i = 0; i < input.length; i++) {
152        temp.push(camelizeKeys(input[i]));
153      }
154    } else {
155      var temp = {};
156      for (var prop in input) {
157        if (input.hasOwnProperty(prop)) {
158          temp[camelizeKeys(prop, true)] = camelizeKeys(input[prop]);
159        }
160      }
161    }
162    return temp;
163  }
164
165  var loadScript = function (url, cb, timeout) {
166    var script = document.createElement('script');
167    script.charset = 'UTF-8';
168    script.async = true;
169
170    if (/static\.geetest\.com/g.test(url)) {
171      script.crossOrigin = 'anonymous';
172    }
173
174    script.onerror = function () {
175      cb(true);
176      loaded = true;
177    };
178    var loaded = false;
179    script.onload = script.onreadystatechange = function () {
180      if (!loaded && (!script.readyState || 'loaded' === script.readyState || 'complete' === script.readyState)) {
181        loaded = true;
182        setTimeout(function () {
183          cb(false);
184        }, 0);
185      }
186    };
187    script.src = url;
188    head.appendChild(script);
189
190    setTimeout(function () {
191      if (!loaded) {
192        script.onerror = script.onload = null;
193        script.remove && script.remove();
194        cb(true);
195      }
196    }, timeout || TIMEOUT);
197  };
198
199  var normalizeDomain = function (domain) {
200    // special domain: uems.sysu.edu.cn/jwxt/geetest/
201    // return domain.replace(/^https?:\/\/|\/.*$/g, ''); uems.sysu.edu.cn
202    return domain.replace(/^https?:\/\/|\/$/g, ''); // uems.sysu.edu.cn/jwxt/geetest
203  };
204  var normalizePath = function (path) {
205    if (!path) {
206      return '';
207    }
208    path = path.replace(/\/+/g, '/');
209    if (path.indexOf('/') !== 0) {
210      path = '/' + path;
211    }
212    return path;
213  };
214  var normalizeQuery = function (query) {
215    if (!query) {
216      return '';
217    }
218    var q = '?';
219    new _Object(query)._each(function (key, value) {
220      if (isString(value) || isNumber(value) || isBoolean(value)) {
221        q = q + encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&';
222      }
223    });
224    if (q === '?') {
225      q = '';
226    }
227    return q.replace(/&$/, '');
228  };
229  var makeURL = function (protocol, domain, path, query) {
230    domain = normalizeDomain(domain);
231
232    var url = normalizePath(path) + normalizeQuery(query);
233    if (domain) {
234      url = protocol + domain + url;
235    }
236
237    return url;
238  };
239
240  var load = function (config, protocol, domains, path, query, cb, handleCb) {
241    var tryRequest = function (at) {
242      if (handleCb) {
243        var cbName = 'geetest_' + random();
244        window[cbName] = bind(handleCb, null, cbName);
245        query.callback = cbName;
246      }
247      var url = makeURL(protocol, domains[at], path, query);
248
249      loadScript(
250        url,
251        function (err) {
252          if (err) {
253            if (cbName) {
254              try {
255                window[cbName] = function () {
256                  window[cbName] = null;
257                };
258              } catch (e) {}
259            }
260
261            if (at >= domains.length - 1) {
262              cb(true);
263              // report gettype error
264            } else {
265              tryRequest(at + 1);
266            }
267          } else {
268            cb(false);
269          }
270        },
271        config.timeout,
272      );
273    };
274    tryRequest(0);
275  };
276
277  var jsonp = function (domains, path, config, callback) {
278    var handleCb = function (cbName, data) {
279      if (data.status == 'success') {
280        callback(data.data);
281      } else if (!data.status) {
282        callback(data);
283      } else {
284        callback(data);
285      }
286      window[cbName] = undefined;
287      try {
288        delete window[cbName];
289      } catch (e) {}
290    };
291
292    load(
293      config,
294      config.protocol,
295      domains,
296      path,
297      {
298        client_type: MOBILE ? 'h5' : 'web',
299      },
300      function (err) {
301        if (err && typeof config.offlineCb === 'function') {
302          config.offlineCb();
303          return;
304        }
305
306        if (err) {
307          callback({ status: 'error' });
308        }
309      },
310      handleCb,
311    );
312  };
313
314  var reportError = function (config, url) {
315    load(
316      config,
317      config.protocol,
318      ['monitor.geetest.com'],
319      '/monitor/send',
320      {
321        time: Date.now().getTime(),
322        exception_url: url,
323        error_code: config.error_code,
324      },
325      function (err) {},
326    );
327  };
328
329  var throwError = function (errorType, config, errObj, callback) {
330    var errors = {
331      networkError: '网络错误',
332      parameterMissing: '缺少参数',
333    };
334
335    if (callback) {
336      callback({
337        status: 'error',
338        data: {
339          msg: errObj.msg,
340          code: errObj.code,
341        },
342      });
343    } else {
344      throw new Error(errors[errorType]);
345    }
346  };
347
348  var detect = function () {
349    return window.deviceFingerprint;
350  };
351
352  if (detect()) {
353    status.slide = 'loaded';
354  }
355
356  window.initDeviceFingerprint = function (userConfig, callback) {
357    var config = new Config(userConfig);
358    if (userConfig.https) {
359      config.protocol = 'https://';
360    } else if (!userConfig.protocol) {
361      config.protocol = window.location.protocol + '//';
362    }
363
364    if (isObject(userConfig.getType)) {
365      config._extend(userConfig.getType);
366    }
367    var loadStartTime = new Date().getTime();
368    jsonp(config.apiServers, config.typePath, config, function (newConfig) {
369      newConfig = camelizeKeys(newConfig);
370
371      if (newConfig.status === 'error') {
372        return throwError(
373          'networkError',
374          config,
375          {
376            code: '60100',
377            msg: 'network error',
378          },
379          callback,
380        );
381      }
382      var loadEndTime = new Date().getTime();
383      newConfig.loadTime = loadEndTime - loadStartTime;
384      var type = newConfig.type;
385      if (config.debug) {
386        new _Object(newConfig)._extend(config.debug);
387      }
388      var init = function () {
389        newConfig.staticTime = new Date().getTime() - loadEndTime;
390        new _Object(userConfig)._extend(newConfig);
391        new _Object(userConfig)._extend({ type: 'gt' });
392        if (!userConfig.appId) {
393          return throwError(
394            'parameterMissing',
395            config,
396            {
397              code: '60001',
398              msg: 'parameter missing',
399            },
400            callback,
401          );
402        }
403        window.deviceFingerprint.load(userConfig).then(function (data) {
404          if (data.status) {
405            callback(data);
406          } else {
407            callback({
408              status: 'success',
409              code: 0,
410              data: data,
411            });
412          }
413        });
414      };
415
416      callbacks[type] = callbacks[type] || [];
417
418      var s = status[type] || 'init';
419      if (s === 'init') {
420        status[type] = 'loading';
421
422        callbacks[type].push(init);
423
424        load(
425          config,
426          config.protocol,
427          Object.hasOwnProperty.call(config, 'staticServers')
428            ? config.staticServers
429            : newConfig.staticServers || config.staticServers,
430          newConfig.bypass || newConfig.staticPath + newConfig.js, //
431          null,
432          function (err) {
433            if (err) {
434              status[type] = 'fail';
435              throwError(
436                'networkError',
437                config,
438                {
439                  code: '60101',
440                  msg: 'Network failure',
441                  desc: {
442                    detail: 'js resource load timeout',
443                  },
444                },
445                callback,
446              );
447            } else {
448              status[type] = 'loaded';
449              var cbs = callbacks[type];
450              for (var i = 0, len = cbs.length; i < len; i = i + 1) {
451                var cb = cbs[i];
452                if (isFunction(cb)) {
453                  cb();
454                }
455              }
456              callbacks[type] = [];
457            }
458          },
459        );
460      } else if (s === 'loaded') {
461        return init();
462      } else if (s === 'fail') {
463        throwError(
464          'networkError',
465          config,
466          {
467            code: '60101',
468            msg: 'Network failure',
469            desc: {
470              detail: 'js resource load timeout',
471            },
472          },
473          callback,
474        );
475      } else if (s === 'loading') {
476        callbacks[type].push(init);
477      }
478    });
479  };
480})(window);

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.