PageSourceSearch

https://www.exmoo.com/statistic/functions.js

js exmoo.com collected 2026-10-02 05:03:36 UTC 37,160 bytes, 1,045 lines download raw bytes

1var JsStatistic = {
2    key_storage_key: 'statistic',
3    player: '',
4
5    page_read_time: 0,
6    page_online_time: 0,
7    page_class_id: 0,
8    page_article_id: 0,
9    page_category_id: 0,
10    page_player_count: 0,
11    page_player_time: 0,
12    page_player_time_total: 0,
13    page_popup_video_id: 0,
14
15    video_has_page_id: 0,
16
17    hello_id: '',
18    page_statistic_uid: '',
19    page_tag: '',
20    language: '',
21    screen_resolution: '',
22    exmoo_code: '',
23    page_serial_id: 0,
24    page_serial_id_switch: 0,
25    key_page_id_for_parent: 0,
26    key_page_serial_id: 'current_page_id',
27    key_statistic_id: 'statistic_uid',
28    key_page_class_id: 'page_class_id',
29    key_category_id: 'category_id',
30    key_article_id: 'article_id',
31    key_read_time: 'read_time',
32    key_online_time: 'online_time',
33    key_page_tag: 'tag',
34    key_language: 'language',
35    key_page: 'page',
36    key_video: 'video',
37    key_player_time: 'play_time',
38    key_player_count: 'play_count',
39    key_hello_id: 'hello_id',
40    key_http_current: 'http_current',
41    key_http_referer: 'http_referer',
42    key_exmoo_code: 'exmoo_code',
43    key_screen_resolution: 'screen_resolution',
44    key_popup_video_id: 'popup_video_id',
45    key_app: 'app',
46    http_current: '',
47    http_referer: '',
48
49    is_popup_video_mode: 0,
50    api_post_statistic_url: '',
51
52    set_read_time_to_zero: 0,
53
54    is_frontend_remove_local_storage: 0,    //1=前端删除LS,0=后端删除LS(默认)
55    display_html_info: 1,
56    console_log_data: '',
57    mode_test: 0,
58    mode_test_value: '',
59
60    html_id_record_time_read: '.record-time-read',
61    html_id_record_time_online: '.record-time-online',
62    html_id_record_data: '.record-data',
63    html_id_record_key: '.record-key',
64    html_id_play_count: '.play-count',
65    html_id_play_time: '.play-time',
66    html_id_play_time_total: '.play-time-total',
67    html_id_console_log: '.console-log',
68    html_id_exmoo_code: '.md5',
69
70    page_app: 1,
71
72    window_current: 1,
73    window_current_in_first: 1,
74    window_current_out_first: 1,
75
76    timer_page_expire: 0,
77
78    generate_page_id: function () {
79        var max = 99999999999;
80        var min = 10000000000;
81        return Math.floor(Math.random() * (max - min + 1) + min);
82    },
83    generate_popup_video_id: function () {
84        var max = 999999;
85        var min = 100000;
86        return Math.floor(Math.random() * (max - min + 1) + min);
87    },
88    popup_video_mode_setting: function () {
89        if (this.is_popup_video_mode === 1) {
90            this.api_post_statistic_url = api_post_statistic_url_video;
91            this.display_html_info = 0;
92            this.key_page = this.key_video;
93        } else {
94            this.api_post_statistic_url = api_post_statistic_url_statistic;
95            //this.key_page = 'page';
96        }
97    },
98    popup_video_mode_setting_after: function () {
99
100        if (this.is_popup_video_mode === 1) {
101            this.page_serial_id_switch = this.key_page_id_for_parent;
102        } else {
103            this.page_serial_id_switch = this.page_serial_id;
104        }
105    },
106    storage_key: function () {
107        return this.key_storage_key;
108    },
109    save_data_page_id: function (data) {
110
111        //data是page_id里面的
112
113        var org = this.get_data();  // org包括page,video
114
115        // 合并底层数据
116        if (org && org[this.key_page] && org[this.key_page][this.page_serial_id]) {
117            data = $.extend(org[this.key_page][this.page_serial_id], data);
118        }
119
120        //封装page_id级
121        var page_id = {};
122        page_id[this.page_serial_id] = data;
123
124        //合并page_id级
125        if (org) {
126            page_id = $.extend(page_id, org[this.key_page]);
127        }
128
129        //封装顶级
130        var page = {};
131        page[this.key_page] = page_id;  //page已是顶级
132
133        //合并顶级
134        if (org) {
135            page = $.extend(org, page);
136        }
137
138        var key = this.storage_key();
139        this.storage_set(key, page);
140        //statistic['page']['23423543435'][data]
141        //statistic['page']['23423543435'][data]['time']
142        //statistic['page']['23423543435'][data]['id']
143    },
144    save_data_page_flush: function (data) {
145        //data是page里面的
146        var key = this.storage_key();
147        this.storage_set(key, data);
148        //statistic = ['page']['23423543435'][data]
149        //statistic = ['page']['23423543435'][data]['time']
150        //statistic = ['page']['23423543435'][data]['id']
151    },
152    get_data: function () {
153        var key = this.storage_key();
154        var data = this.storage_get(key);   // = ['page']['23423543435'][data]['id']
155        return data;
156    },
157    get_data_page: function () {
158        var data = this.get_data();
159        if (data && data[this.key_page]) {
160            return data[this.key_page];
161        }
162        return {};
163    },
164    has_data_page: function () {
165        var data = this.get_data_page();
166        return data ? 1 : 0;
167    },
168    get_data_current: function () {
169        var data = this.get_data();
170        if (data == null) {
171            return null;
172        }
173        var page = data[this.key_page];
174        var page_id = page[this.page_serial_id];
175        return page_id;
176    },
177    save_read_time: function () {
178        var data = {};
179
180        if (this.set_read_time_to_zero === 1) {
181            this.page_read_time = 0;
182            data[this.key_read_time] = 0;
183        } else {
184            data[this.key_read_time] = this.page_read_time;
185        }
186
187        this.save_data_page_id(data);
188    },
189    get_current_page_id_refresh: function () {
190        var data = this.get_data_page();
191        if (typeof data === "undefined") {
192            return {};
193        }
194        return data;
195    },
196    get_current_read_time: function () {
197        var page_id = this.get_data_current();
198        if (page_id == null) {
199            return 0;
200        }
201        if (page_id[this.key_read_time] === 'undefined' || page_id[this.key_read_time] == null) {
202            return 0;
203        }
204        return page_id[this.key_read_time];
205    },
206    save_online_time: function () {
207        var data = {};
208        data[this.key_online_time] = this.page_online_time;
209        this.save_data_page_id(data);
210    },
211    save_player_count: function () {
212        var data = {};
213        this.page_player_count = Math.max(this.page_player_count, this.get_player_play_count());
214        data[this.key_player_count] = this.page_player_count;
215        this.save_data_page_id(data);
216    },
217    save_player_time: function () {
218        if (this.is_popup_video_mode === 0) {
219            //return;   //测试用
220        }
221        var data = {};
222        this.page_player_time = Math.max(this.page_player_time, this.get_player_play_time());
223        data[this.key_player_time] = this.page_player_time;
224        this.save_data_page_id(data);
225    },
226    save_hello_id: function () {
227        var data = {};
228        data[this.key_hello_id] = this.hello_id;
229        this.save_data_page_id(data);
230    },
231    save_all: function () {
232        this.save_read_time();
233        this.save_online_time();
234        this.save_url();
235        this.save_player_count();
236        this.save_player_time();
237        this.save_hello_id();
238        this.save_exmoo_code();
239        this.save_id();
240    },
241    get_player_count: function () {
242        var page_id = this.get_data_current();
243        return page_id[this.key_player_count];
244    },
245    get_player_time: function () {
246        var page_id = this.get_data_current();
247        return page_id[this.key_player_time];
248    },
249    save_id: function () {
250        var id = this.install_id(this.page_serial_id_switch, this.language, this.page_tag, this.page_statistic_uid, this.page_class_id, this.page_category_id, this.page_article_id, this.screen_resolution, this.page_popup_video_id, this.page_app)
251        var data = {};
252        data = id;
253        this.save_data_page_id(data);
254    },
255    install_id: function (page_serial_id, language, page_tag, page_statistic_uid, page_class_id, category_id, article_id, screen_resolution, page_popup_video_id, page_app) {
256        var id = {};
257        id[this.key_page_serial_id] = page_serial_id;
258        id[this.key_page_class_id] = page_class_id;
259        id[this.key_category_id] = category_id;
260        id[this.key_article_id] = article_id;
261        id[this.key_statistic_id] = page_statistic_uid;
262        id[this.key_page_tag] = page_tag;
263        id[this.key_language] = language;
264        id[this.key_screen_resolution] = screen_resolution;
265        id[this.key_screen_resolution] = screen_resolution;
266        id[this.key_popup_video_id] = page_popup_video_id;
267        id[this.key_app] = page_app;
268        if (this.mode_test === 1) {
269            id['mode_test_value'] = this.mode_test_value;
270        }
271        return id;
272    },
273    save_url: function () {
274        var data = {};
275        data[this.key_http_current] = this.http_current;
276        data[this.key_http_referer] = this.http_referer;
277        this.save_data_page_id(data);
278    },
279    save_exmoo_code: function () {
280        this.calculate_exmoo_code();
281        var data = {};
282        data[this.key_exmoo_code] = this.exmoo_code;
283        this.save_data_page_id(data);
284    },
285    calculate_exmoo_code: function () {
286        var string = String(this.hello_id) + String(this.page_serial_id_switch) + String(this.page_read_time) + String(this.page_class_id) + String(this.page_category_id) + String(this.page_article_id) + String(this.page_online_time) + String(this.page_player_time) + String(this.http_current) + String(this.http_referer) + String(this.language) + String(this.page_tag) + String(this.page_popup_video_id) + String(this.page_app);
287        //console.log(string);
288        this.mode_test_value = string;
289        this.exmoo_code = hex_md5(string);
290    },
291    reset_read_time: function (data) {
292        data[this.key_read_time] = 0;
293        this.save_data_page_id(data);
294    },
295    get_data_page_id: function (page_id) {
296        var page = this.get_data_page();
297        return page[page_id];
298    },
299    remove_page_id: function (page_id_array, console_log) {
300
301        return; //不在这里删除,开启另一个进程处理 ———————————————————————————— !!!!!!!!!!! —————————————————————————————————
302
303        var $this = this;
304        var page = this.get_data_page();
305        var save = {};
306        var flush = {};
307
308        if (JSON.stringify(page) === "{}") {
309            return;
310        }
311
312        $.each(page, function (page_id, data) {
313
314            //$this.reset_read_time(data);
315
316            data = $this.get_data_page_id(page_id);
317            //console.log(page_id, page_id_array);
318            //console.log($this.page_serial_id, parseInt(page_id));
319            //console.log(page_id_array.indexOf(page_id));
320            //console.log($this.page_serial_id === parseInt(page_id));
321
322            var in_array = 0;
323            for (var i in page_id_array) {
324                if (page_id_array[i]['page_id'] === parseInt(page_id)) {  //LS里的,不在删除列表里的
325                    alert(page_id_array[i]['page_id'])
326                    in_array = 1;   // 在的,remove
327                }
328            }
329
330            var is_current = $this.page_serial_id === parseInt(page_id);   // 当前页面不删除,save
331
332            if (in_array === 0 || is_current) {
333                save[page_id] = data;
334                $this.set_console_log(console_log + ' save:' + page_id);
335                global_consloe_log_open ? console.log(console_log + ' save:' + page_id) : null;
336            } else {
337                $this.set_console_log(console_log + ' remove:' + page_id);
338                global_consloe_log_open ? console.log(console_log + ' remove:' + page_id) : null;
339            }
340
341        });
342
343        var len = 0;
344        for (var i in save) {
345            len++;
346        }
347
348        var key = this.storage_key();
349        this.storage_remove(key);
350        $this.set_console_log('Clear LocalStorage');
351
352        if (len > 0) {
353            flush[this.key_page] = save
354            this.save_data_page_flush(flush);
355        }
356    },
357    storage_set: function (key, value) {
358        try {
359            var json = JSON.stringify(value);
360            window.localStorage.setItem(key, json);
361        }
362        catch (err) {
363            alert(err);
364        }
365
366    },
367    storage_get: function (key) {
368        var json = window.localStorage.getItem(key);
369        return JSON.parse(json);
370    },
371    storage_remove: function (key) {
372        return window.localStorage.removeItem(key);
373    },
374    storage_clear: function (key) {
375        window.localStorage.removeItem(key);
376        this.storage_set(key, {});
377        //this.reset_data();
378    },
379    reset_data: function () {
380        this.page_read_time = 0;
381        this.save_read_time();
382        this.page_online_time = 0;
383        this.save_online_time();
384    },
385    read_time_plus: function () {
386        this.page_read_time++;
387    },
388    online_time_plus: function () {
389        this.page_online_time++;
390    },
391    display_storage_read_time: function () {
392        $(this.html_id_record_time_read).html(this.page_read_time + ' 秒');
393    },
394    display_storage_online_time: function () {
395        $(this.html_id_record_time_online).html(this.page_online_time + ' 秒');
396    },
397    display_storage_data: function () {
398        var data = this.get_data();
399        var json = JSON.stringify(data);
400        $(this.html_id_record_data).html(json);
401    },
402    display_storage_key: function () {
403        $(this.html_id_record_key).html(this.page_serial_id);
404    },
405    display_player_count: function () {
406        $(this.html_id_play_count).html(this.get_player_play_count() + ' 次');
407    },
408    display_player_time: function () {
409        $(this.html_id_play_time).html(this.get_player_play_time() + ' 秒');
410    },
411    display_player_time_total: function () {
412        $(this.html_id_play_time_total).html(this.get_player_play_time_total() + ' 秒');
413    },
414    display_all: function () {
415        this.display_storage_read_time();
416        this.display_storage_online_time();
417        this.display_storage_data();
418        this.display_storage_key();
419        this.display_player_count();
420        this.display_player_time();
421        this.display_player_time_total();
422        this.display_exmoo_code();
423    },
424    display_console_log: function () {
425        var html = $(this.html_id_console_log).html();
426        $(this.html_id_console_log).html(html + this.console_log_data);
427    },
428    display_exmoo_code: function () {
429        $(this.html_id_exmoo_code).html(this.exmoo_code);
430    },
431    set_console_log: function (log) {
432        this.console_log_data = log + "<br>";
433        this.display_console_log();
434    },
435    set_http_url: function (stat_http_current, stat_http_referer) {
436        this.http_current = stat_http_current;
437        this.http_referer = stat_http_referer;
438    },
439    set_player_instance: function (player_instance) {
440        this.player = player_instance;                  // 替换播放器    // 获取实例
441    },
442    get_player_play_count: function () {
443        if (typeof this.player == 'string') {
444            return 0;
445        }
446        return this.player.get_play_count();
447    },
448    get_player_play_time: function () {
449        if (typeof this.player === 'string') {
450            return 0;
451        }
452        return this.player.get_play_time();
453    },
454    get_player_play_time_total: function () {
455        if (typeof this.player === 'string') {
456            return 0;
457        }
458        return this.player.get_play_time_total();
459    },
460    encode_popup_video_id: function (page_serial_id, page_class_id, page_category_id, page_article_id) {
461        return hex_md5(String(page_serial_id) + String(page_class_id) + String(page_category_id) + String(page_article_id));
462    },
463    init: function () {
464
465        if (this.page_serial_id === 0) {
466            this.page_serial_id = this.generate_page_id();
467        }
468
469        var $this = this;
470        var page = this.get_current_page_id_refresh();  // 只返回visit 或video
471        var page_id = {};
472        //var page_data;
473
474        if (this.video_has_page_id === 0) {    // visit的
475
476            var $this = this;
477            $.each(page, function (key, value) {
478                if (value.http_referer === $this.http_referer && value.http_current === $this.http_current) {   //发现重复了,如何判断是同一个页面?
479                    page_id = value;
480                }
481            })
482
483            if (JSON.stringify(page_id) !== "{}") {
484
485                this.page_read_time = page_id[this.key_read_time];
486                this.page_online_time = page_id[this.key_online_time];
487                this.page_player_count = page_id[this.key_player_count];
488                this.page_player_time = page_id[this.key_player_time];
489                this.page_serial_id = page_id[this.key_page_serial_id];
490                this.page_popup_video_id = page_id[this.key_popup_video_id];
491            } else {
492
493                this.page_read_time = 0;
494                this.page_online_time = 0;
495                this.page_player_count = 0;
496                this.page_player_time = 0;
497                this.page_popup_video_id = 0;
498
499            }
500
501        } else {    // video的
502
503            if (JSON.stringify(page) !== "{}" && page[this.video_has_page_id]) {    // visit任何状态和video的run状态
504                this.page_serial_id = this.video_has_page_id;  // api提交用
505                this.page_popup_video_id = page[this.video_has_page_id][this.key_popup_video_id];  //
506                this.page_read_time = 0;
507                this.page_online_time = 0;
508                this.page_player_count = page[this.video_has_page_id][this.key_player_count];
509                this.page_player_time = page[this.video_has_page_id][this.key_player_time];
510
511            } else {        // video的初始化状态
512                if (this.is_popup_video_mode === 1) {
513
514                    this.page_serial_id = this.generate_video_page_serial_id(); //外面已赋值,参数齐
515                    this.page_popup_video_id = this.encode_popup_video_id(this.page_serial_id, this.page_class_id, this.page_category_id, this.page_article_id);
516                    this.page_read_time = 0;
517                    this.page_online_time = 0;
518                    this.page_player_count = 0;
519                    this.page_player_time = 0;
520                }
521            }
522
523        }
524
525
526    },
527    generate_video_page_serial_id: function () {
528        this.page_serial_id = this.key_page_id_for_parent;     // 弹窗的id要拿页面的id
529        var page_popup_video_id = this.encode_popup_video_id(this.page_serial_id, this.page_class_id, this.page_category_id, this.page_article_id);
530        return page_popup_video_id.substring(0, 8);
531    },
532    api_post_statistic: function () {
533        var has = this.has_data_page();
534        if (has === 1) {
535            var data = this.get_data();
536            this.api_post_function(data);
537        }
538    },
539    api_post_function: function (data) {
540        //$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')}});
541        var url = this.api_post_statistic_url;
542        var $this = this;
543
544        $.ajax({
545            type: 'post',
546            url: url,
547            async: false,
548            data: data,
549            dataType: 'json',
550            beforeSend: function () {
551                if ($this.is_frontend_remove_local_storage === 1) {
552                    var page_id_array = [];
553
554                    $.each(data, function (key, value) {    //data=['345345345'=>[id,to=time],'456456456'=>[id,to=time]]
555                        page_id_array.push(key);
556                    })
557                    $this.remove_page_id(page_id_array, 'Frontend - ');
558                }
559            },
560            success: function (result) {
561                if ($this.is_frontend_remove_local_storage === 0) { //后端删除(默认)
562                    if (result.Success == 1) {
563                        global_consloe_log_open ? console.log(result.Message) : null;
564                        $this.set_console_log(result.Message);
565                        $this.remove_page_id(result.Data, 'Backend - ');    //result.Data=['4564534534576','34645645645']
566                    } else {
567                        global_consloe_log_open ? console.log(result.Message) : null;
568                        $this.set_console_log(result.Message);
569                    }
570                }
571            }
572        });
573    },
574    set_window_current: function (is_current) {
575        this.window_current = is_current;
576    },
577    get_window_current: function () {
578        return this.window_current;
579    },
580    run: function () {
581
582        //如果鼠标不在当前页面,停止计时
583        if (this.get_window_current() === 0) {
584
585            //从LS读回最新的值
586            this.init();
587
588            this.page_online_time++;
589
590            this.save_all();
591
592            //只有当有计数过的才提交,不然一直离开,就不会提交
593            if (this.window_current_out_first === 1) {
594
595                //this.set_console_log('离开页面:');
596                //console.log('离开页面:')
597
598                this.api_post_statistic();
599
600                this.window_current_out_first = 0;
601                this.window_current_in_first = 1
602            }
603            //鼠标在当前页面,开始计时,显示
604        } else {
605
606            this.init();
607
608            this.page_online_time++;
609            this.page_read_time++;
610
611
612            // 如果该地区无法播放视频,设置read_time=0
613            if (set_read_time_to_zero_by_article_id === 1) {
614                this.set_read_time_to_zero = 1;
615            }
616
617            this.save_all();
618
619            //只有当有计数过的才提交,不然一直离开,就不会提交
620            if (this.window_current_in_first === 1) {
621
622                //this.set_console_log('激活页面:');
623                //console.log('激活页面:')
624
625                //this.api_post_statistic();
626
627                this.window_current_in_first = 0;
628                this.window_current_out_first = 1;
629            }
630        }
631
632        if (this.display_html_info) {
633            this.display_all();
634        }
635
636        // 任何时候都判断是否有弹窗式播放  只对页面实例有效
637        if (this.is_popup_video_mode === 0) {
638            anytime_popup_video();
639        }
640    },
641}
642
643var JwplayerStatistic = {       // 替换播放器    // 播放器实例
644    player: '',
645    stat: '',
646
647    status_playing: 0,
648    status_ending: 0,
649    status_pause: 0,
650    time_playing_exact: 0,
651    time_total: 0,
652    count_played: 0,
653
654    popup_video_id: 0,
655
656    interval_id: 0,
657
658    window_current: 1,
659
660    is_mobile: 0,
661
662    html_id_display_time: '.jwplayer_display_time',
663    html_id_display_play_pause: '.jwplayer_display_play_pause',
664    html_id_display_play_start: '.jwplayer_control_play_start',
665    html_id_display_play_end: '.jwplayer_control_play_end',
666    html_id_display_play_exact: '.jwplayer_display_play_exact',
667    html_id_display_time_total: '.jwplayer_display_time_total',
668
669    display_time: function () {
670        // var time = this.player.getPosition();       // 替换播放器        //播放了多少秒
671        var time = this.player.currentTime();       // 替换播放器        //播放了多少秒
672        $(this.html_id_display_time).html(Math.round(time))
673    },
674    display_play_pause: function () {
675        $(this.html_id_display_play_pause).html('已暂停')
676    },
677    display_play_exact: function () {
678        $(this.html_id_display_play_exact).html(this.time_playing_exact)
679    },
680    display_time_total: function () {
681        $(this.html_id_display_time_total).html(this.time_total)
682    },
683    set_is_mobile: function () {                                    // 替换播放器     // 设置是移动端
684        this.is_mobile = 1;
685    },
686    set_play_time: function (play_time) {                           // 替换播放器     // 移动端设置播放时间
687        this.time_playing_exact = play_time;
688    },
689    get_play_time: function () {
690        return this.time_playing_exact;
691    },
692    get_play_time_total: function () {
693        return this.time_total;
694    },
695    set_play_count: function () {
696        this.count_played = 1;
697    },
698    get_play_count: function () {
699        return this.count_played;
700    },
701    set_window_current: function (is_current) {
702        this.window_current = is_current;
703    },
704    get_window_current: function () {
705        return this.window_current;
706    },
707    set_stat_instance: function (stat) {
708        this.stat = stat;
709    },
710    init: function () {
711
712        var $this = this;
713
714        // 新播放器
715        this.player.on("play", function () {                           // 替换播放器        // 开始播放
716            global_consloe_log_open ? console.log('onPlay') : null;
717            $this.status_pause = 0;
718            $this.player_start();
719            $this.player_continue();
720        });
721        /*
722        this.player.onPlay(function () {                            // 替换播放器        // 开始播放
723            global_consloe_log_open ? console.log('onPlay') : null;
724            $this.status_pause = 0;
725            $this.player_start();
726            $this.player_continue();
727            //thePlayerGlobal = 'ok';
728        });
729        */
730
731        // 新播放器
732        this.player.on("pause", function () {
733            global_consloe_log_open ? console.log('onPause') : null;
734            $this.player_pause();
735            //$this.player_stop();
736            $this.display_play_pause();
737        });
738        /*
739        this.player.onPause(function () {                           // 替换播放器        // 暂停播放
740            global_consloe_log_open ? console.log('onPause') : null;
741            $this.player_pause();
742            //$this.player_stop();
743            $this.display_play_pause();
744        });
745        */
746
747        // 新播放器
748        this.player.on("ended", function () {
749            global_consloe_log_open ? console.log('onComplete') : null;
750            $this.player_stop();
751            $this.player_continue();
752            $(this.html_id_display_play_end).html('已结束')
753        });
754        /*
755        this.player.onComplete(function () {                        // 替换播放器        //播放已结束
756            global_consloe_log_open ? console.log('onComplete') : null;
757            $this.player_stop();
758            $this.player_continue();
759            $(this.html_id_display_play_end).html('已结束')
760        });
761        */
762    },
763    player_stop: function () {
764        this.status_playing = 0;
765    },
766    player_start: function () {
767        this.status_playing = 1;
768        $(this.html_id_display_play_start).html('已开始')
769    },
770    player_continue: function () {
771        global_consloe_log_open ? console.log('取消暂停') : null;
772        this.status_pause = 0;
773    },
774    player_pause: function () {
775        if (this.status_pause === 0) {
776            global_consloe_log_open ? console.log('迫使暂停!!!!!!!!!!') : null;
777            this.status_pause = 1;
778        }
779    },
780    set_interval_id: function (interval_id) {
781        this.interval_id = interval_id;
782    },
783    get_interval_id: function () {
784        return this.interval_id;
785    },
786    play: function () {
787
788        if (this.is_mobile === 1) {
789            return;
790        }
791
792        /*
793        if (this.time_total === 0) {
794            if (typeof this.player.getDuration() === 'undefined') {     // 替换播放器    // 获取总播放时间
795                return;
796            }
797            this.time_total = parseInt(this.player.getDuration());      // 替换播放器    // 获取总播放时间
798        }
799        */
800        // 新的
801        if (this.time_total === 0) {
802            if (typeof this.player.duration() === 'undefined') {     // 替换播放器    // 获取总播放时间
803                return;
804            }
805            this.time_total = parseInt(this.player.duration());      // 替换播放器    // 获取总播放时间
806        }
807
808        if (this.status_playing === 1 && this.time_playing_exact < this.time_total && this.status_pause === 0) {  //播放中
809
810            //如果鼠标不在当前页面,停止计时
811            if (this.get_window_current() === 1) {  // 新增的,如果不在当前页面,多个视频播放时不计算其他的,只计算当前的
812
813                if (this.time_playing_exact <= this.stat.page_read_time) {   // 进一步防止视频时长出错
814
815                    this.time_playing_exact++;
816                    this.set_play_count();
817                    global_consloe_log_open ? console.log('time_playing_exact:' + this.time_playing_exact + ' | popup_video_id:' + this.popup_video_id) : null;
818                } else {
819                    global_consloe_log_open ? console.log('time_playing_exact:' + this.time_playing_exact + ' | larger than read_time') : null;
820                }
821
822            }
823        } else {
824            global_consloe_log_open ? console.log('time_playing_exact:' + this.time_playing_exact + ' status_playing==' + this.status_playing + ' | status_pause==' + this.status_pause + ' | popup_video_id:' + this.popup_video_id) : null;
825        }
826        if (this.time_playing_exact >= this.time_total) {
827            this.time_playing_exact = this.time_total;
828        }
829        this.display_time();
830        this.display_play_exact();
831        this.display_time_total();
832
833    },
834}
835
836var CleanStatistic = {
837    key_storage_clean: 'statistic_clean',
838    key_storage_statistic: 'statistic',
839    key_storage_lock: 'statistic_lock',
840
841    key_clean: 'clean',
842    key_page: 'page',
843    key_video: 'video',
844    key_online_time: 'online_time',
845    key_page_serial_id: 'current_page_id',
846    window_current: 1,
847    page_serial_id: 0,
848    lock_expire_time: 10,
849    page_expire_time: 10,
850    stat: {},
851    player: {},
852    data: {},
853
854    storage_set: function (key, value) {
855        try {
856            var json = JSON.stringify(value);
857            window.localStorage.setItem(key, json);
858        }
859        catch (err) {
860            alert(err);
861        }
862
863    },
864    storage_get: function (key) {
865        var json = window.localStorage.getItem(key);
866        return JSON.parse(json);
867    },
868    get_data: function (key) {
869        var data = this.storage_get(key);
870        return data;
871    },
872    get_data_page: function (key, key_page) {
873        var data = this.get_data(key);
874        if (data && data[key_page]) {
875            return data[key_page];
876        }
877        return {};
878    },
879    generate_random_id: function () {
880        var max = 99999999;
881        var min = 10000000;
882        return Math.floor(Math.random() * (max - min + 1) + min);
883    },
884    get_lock: function () {
885        return this.storage_get(this.key_storage_lock);
886    },
887    set_lock: function () {
888        var lock = {};
889        lock['page_serial_id'] = this.page_serial_id;
890        lock['time'] = Date.parse(new Date()) / 1000;
891        this.storage_set(this.key_storage_lock, lock);
892    },
893    set_window_current: function (is_current) {
894        this.window_current = is_current;
895    },
896    get_window_current: function () {
897        return this.window_current;
898    },
899
900    loop_clean_collect: function () {
901
902        /*
903        if (!this.get_lock()) {
904            this.set_lock();
905        }
906
907        var lock;
908
909        lock = this.get_lock();
910
911        var is_lock_expire = Date.parse(new Date()) / 1000 - lock['time'] > this.lock_expire_time;  // 锁过期了
912
913        if (is_lock_expire) {
914            this.set_lock();    // 一旦lock过期,立即被别页面锁定
915        }
916
917        lock = this.get_lock();
918        var is_this_lock = lock['page_serial_id'] === this.page_serial_id;
919
920        if (!is_this_lock) {    // 不是我锁定的,退出
921            return;
922        }
923
924        this.set_lock();    // 当前页面更新锁
925        */
926
927        var storage = {};
928        var clean = {};
929
930        var $this = this;
931
932        // 访问轨迹的
933        var page = this.get_data_page(this.key_storage_statistic, this.key_page);
934        if (JSON.stringify(page) !== "{}") {
935
936            $.each(page, function (key, value) {
937                clean[key] = {};
938                clean[key][$this.key_online_time] = Date.parse(new Date()) / 1000;
939                global_consloe_log_open ? console.log('手机page到clean:' + key) : null;
940            });
941
942        }
943
944        storage[this.key_clean] = clean;
945        this.storage_set(this.key_storage_clean, storage);
946
947    },
948
949    // 只有还在线的页面才更新clean时间
950    loop_clean_update: function () {
951
952        var $this = this;
953
954        // 访问轨迹的
955        var clean = this.get_data_page(this.key_storage_clean, this.key_clean);
956        if (JSON.stringify(clean) !== "{}") {
957
958            $.each(clean, function (key, value) {
959                //console.log($this.page_serial_id);
960                //console.log(key);
961                //console.log(parseInt($this.page_serial_id) === parseInt(key));
962                if (parseInt($this.page_serial_id) === parseInt(key)) {     // 只有当前页面才更新时间
963                    clean[key][$this.key_online_time] = Date.parse(new Date()) / 1000;
964                    global_consloe_log_open ? console.log('更新clean时间:' + key + ' 时间:' + clean[key][$this.key_online_time]) : null;
965                }
966
967            });
968
969        }
970        var storage = {};
971        storage[this.key_clean] = clean;
972        this.storage_set(this.key_storage_clean, storage);
973
974    },
975
976    // 过期的页面,删除data,每个页面都有权执行
977    loop_visit_remove: function () {
978
979        var $this = this;
980
981        // 访问轨迹的
982        var page = this.get_data_page(this.key_storage_statistic, this.key_page);
983        var video = this.get_data_page(this.key_storage_statistic, this.key_video);
984        var clean = this.get_data_page(this.key_storage_clean, this.key_clean);
985
986        if (JSON.stringify(clean) !== "{}") {
987
988            var array_delete = new Array();
989
990            $.each(clean, function (key, value) {
991                var key_online_time = value[$this.key_online_time];
992                global_consloe_log_open ? console.log(key_online_time) : null;
993                var time_span = Date.parse(new Date()) / 1000 - key_online_time;
994                global_consloe_log_open ? console.log(time_span) : null;
995                if (time_span > $this.page_expire_time) {
996                    console.log('发现过期……:' + key)
997                    array_delete.push(key);
998
999                    delete(clean[key]);
1000                }
1001
1002            });
1003
1004        }
1005
1006        $.each(page, function (key, value) {
1007            for (var i in array_delete) {
1008                if (array_delete[i] === key) {
1009                    delete (page[key]);
1010                    global_consloe_log_open ? console.log('删除过期 Visit:' + key) : null;
1011                }
1012            }
1013        });
1014
1015
1016        $.each(video, function (key, value) {
1017            for (var i in array_delete) {
1018                //console.log(video[key]);
1019                //console.log('video循环:', array_delete[i], video[key][$this.key_page_serial_id]);
1020                //console.log('video循环:', video[key]);
1021                if (video[key] && parseInt(array_delete[i]) === parseInt(video[key][$this.key_page_serial_id])) {
1022                    delete (video[key]);
1023                    global_consloe_log_open ? console.log('删除过期 Video:' + key) : null;
1024                }
1025            }
1026
1027        });
1028
1029        var storage = {};
1030        var storage_clean = {};
1031
1032        storage[this.key_page] = page;
1033        storage[this.key_video] = video;
1034        storage_clean[this.key_clean] = clean;
1035
1036        this.storage_set(this.key_storage_statistic, storage);
1037        this.storage_set(this.key_storage_clean, storage_clean);
1038
1039    },
1040};
1041
1042function storage_clear() {
1043    var key = jsStat.storage_key();
1044    jsStat.storage_clear(key);
1045}

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.