PageSourceSearch

https://wanwu47.com/static/landing/js/Vx.js?v=1.0.0.1

js wanwu47.com collected 2026-09-26 05:34:19 UTC 5,070 bytes, 178 lines download raw bytes

1Object.defineProperty(Array.prototype, 'chunk', {
2    value: function (chunkSize) {
3        var ary = [],
4            i = 0;
5        for (; i < this.length; i += chunkSize) {
6            ary.push(this.slice(i, i + chunkSize));
7        }
8        return ary;
9    },
10});
11Object.defineProperty(Array.prototype, 'random', {
12    value: function () {
13        var index = parseInt((Math.random() * 1000) % this.length),
14            result = undefined,
15            ary = [],
16            v,
17            i;
18        for (i = this.length - 1; i >= 0; i--) {
19            v = this.pop();
20            i !== index ? ary.push(v) : (result = v);
21        }
22        for (var j = 0, len = ary.length; j < len; j++) {
23            this.push(ary.pop());
24        }
25        return result;
26    },
27});
28var Vx = {
29    range: function (start, end) {
30        var arr = [];
31        for (; start <= end; start++) {
32            arr.push(start);
33        }
34        return arr;
35    },
36    query: function (name) {
37        var regpx = new RegExp(name + '=([^&]+)');
38        var matches = location.href.match(regpx);
39        return matches ? matches[1] : '';
40    },
41    map: function (arr, cb) {
42        var result = [];
43        for (var i = 0; i < arr.length; i++) {
44            result.push(cb(arr[i], i, arr) || arr[i]);
45        }
46        return result;
47    },
48    template: function (id, data) {
49        data = data || {};
50        var htmlMap = window.__htmlMap || {},
51            matchMap = window.__matchMap || {},
52            j = 0,
53            tmp;
54        if (!htmlMap.hasOwnProperty(id)) {
55            tmp = document.getElementById(id);
56            htmlMap[id] = tmp ? tmp.innerHTML : '';
57            matchMap[id] = htmlMap[id].match(/\$\{([^}]+)\}/g) || [];
58            window.__htmlMap = htmlMap;
59            window.__matchMap = matchMap;
60        }
61        var result = htmlMap[id],
62            matches = matchMap[id];
63        for (; j < matches.length; j++) {
64            tmp = matches[j].substring(2, matches[j].length - 1);
65            result = result.replace(matches[j], data[tmp] || 'undefined');
66        }
67        return result;
68    },
69    ping: function (url, times, i, ok, err, done) {
70        let src = url + '/static/web/images/black.png?'+times;
71        var ele = new Image();
72        done = done || new Function();
73        ele.onload = function () {
74            ok({ url: url, i: i });
75            done({ url: url, i: i });
76        };
77        ele.onerror = function () {
78            err({ url: url, i: i });
79            done({ url: url, i: i });
80        };
81        ele.src = src;
82    },
83    append: function (ele, code) {
84        var tmpWrap = document.createElement('div');
85        tmpWrap.innerHTML = code;
86        ele.append(tmpWrap.firstElementChild);
87    },
88    expand: function (ob, object) {
89        for (let key in object) {
90            ob.prototype[key] = object[key];
91        }
92    },
93    task: function () {
94        this.tasks = [];
95        this.runNum = 0;
96    },
97};
98Vx.task.prototype = {
99    push: function (task) {
100        this.tasks.push(task);
101    },
102    run: function () {
103        for (var i = 0; i < this.tasks.length; i++) {
104            setTimeout(
105                function (cb, that) {
106                    cb(), that.runNum++;
107                },
108                10,
109                this.tasks[i],
110                this
111            );
112        }
113    },
114    done: function () {
115        return this.runNum === this.tasks.length;
116    },
117};
118function Process() {
119    this.events = {};
120}
121Process.prototype = {
122    task: function (tasks, chunkSize) {
123        this.tasks = tasks.chunk(chunkSize).reverse();
124        this.index = 0;
125        this.stop = false;
126        this.timerId = undefined;
127    },
128    on: function (event, cb) {
129        this.events[event] = cb;
130    },
131    emit: function (eventName, args) {
132        var event = this.events[eventName] || new Function();
133        event.apply(this, args);
134    },
135    _finish: function () {
136        this.stop = false;
137        if (this.timerId !== undefined) {
138            clearInterval(this.timerId);
139            this.timerId = undefined;
140        }
141        this.emit('_finish');
142    },
143    _listener: function ($task) {
144        if (this.timerId === undefined) {
145            this.timerId = setInterval(
146                function ($task, that) {
147                    if ($task.done()) {
148                        that.emit('tick');
149                        that.start();
150                    }
151                },
152                500,
153                $task,
154                this
155            );
156        }
157    },
158    start: function () {
159        if (this.stop) {
160            this.emit('stop');
161            this._finish();
162            return;
163        }
164        if (this.tasks.length) {
165            var $task = new Vx.task(),
166                tasks = this.tasks.pop(),
167                i;
168            for (i = 0; i < tasks.length; i++) {
169                $task.push(tasks[i]);
170            }
171            $task.run();
172            this._listener($task);
173        } else {
174            this._finish();
175            this.emit('done');
176        }
177    },
178};

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.