PageSourceSearch

https://radiko.jp/apps/js/rapf.js?_=20240911

js radiko.jp collected 2026-09-24 08:47:16 UTC 6,468 bytes, 156 lines download raw bytes

1"use strict";
2$(function () {
3    var RAPFBannerModel = Backbone.Model.extend({
4        defaults: {
5            url: undefined,
6            link: undefined,
7            beacon: undefined,
8            duration: undefined,
9            show: false,
10            isTabActive: true
11        }
12    });
13    $.Radiko.RAPF = {
14        currentTime: 0,
15        BannerModel: new RAPFBannerModel(),
16        CMDurationList: {},
17        Tracking: {
18            TYPE: {
19                IMPRESSION: 'Impression',
20                CREATIVE_VIEW: 'creativeView',
21                CLICK_TRACKING: 'clickTracking',
22                START: 'start',
23                FIRST_QUARTILE: 'firstQuartile',
24                MIDPOINT: 'midpoint',
25                THIRD_QUARTILE: 'thirdQuartile',
26                COMPLETE: 'complete'
27            },
28            STREAM_TYPE: {
29                LIVE: 0,
30                VOD: 1
31            },
32            HOST: 'https://log2.radiko.jp',
33            BEACON_PATH: '/cm.gif'
34        },
35        Beacon: (function () {
36            var Beacon = function (adId) {
37                this._adId = adId;
38            };
39            Beacon.prototype.setUserKey = function (value) {
40                this._userKey = value;
41            };
42            Beacon.prototype.setConnectionType = function (value) {
43                this.connectionType = value;
44            };
45            Beacon.prototype.setStreamType = function (value) {
46                this.streamType = value;
47            };
48            Beacon.prototype.sendTracking = function (url) {
49                var cache_measures = Math.floor(Math.random() * 10000000);
50                var matched = /\?(.*)$/.exec(url);
51                if (!matched) {
52                    url = url + '?_=' + cache_measures;
53                }
54                else {
55                    url = url + '&_=' + cache_measures;
56                }
57                $.get(url);
58            };
59            Beacon.prototype.sendTrackingLoadImg = function (url) {
60                var cache_measures = Math.floor(Math.random() * 10000000);
61                var matched = /\?(.*)$/.exec(url);
62                if (!matched) {
63                    url = url + '?_=' + cache_measures;
64                }
65                else {
66                    url = url + '&_=' + cache_measures;
67                }
68                $('#load-img').html('<img src="' + url + '"/>');
69            };
70            Beacon.prototype.addLogImg = function (url) {
71                var $log = $('#log');
72                if ($log.find('img').length > 10) {
73                    $log.html("");
74                }
75                $log.html('<img src="' + url + '"/>');
76            };
77            Beacon.prototype.buildBeaconUrl = function (playlistBeaconParam, areaId, stationId, trackingType) {
78                var query = this.buildParams(areaId, stationId, trackingType);
79                var param;
80                if (playlistBeaconParam) {
81                    param = playlistBeaconParam + '&' + query;
82                }
83                else {
84                    param = '?' + query;
85                }
86                return $.Radiko.RAPF.Tracking.HOST + $.Radiko.RAPF.Tracking.BEACON_PATH + param;
87            };
88            Beacon.prototype.buildQuery = function (queries) {
89                return Object.keys(queries).map(function (key) {
90                    return key + '=' + queries[key];
91                }).join('&');
92            };
93            Beacon.prototype.buildParams = function (areaId, stationId, trackingType) {
94                var params = {};
95                params = this.addTetParam(params, areaId, stationId);
96                params = this.addTrackingParam(params, trackingType);
97                params['_'] = Math.floor(Math.random() * 10000000);
98                return this.buildQuery(params);
99            };
100            Beacon.prototype.addTetParam = function (params, areaId, stationId) {
101                params.uid = uid3();
102                if (stationId) {
103                    params.station_id = encodeURIComponent(stationId);
104                }
105                params.area_id = encodeURIComponent(areaId);
106                params.device = encodeURIComponent('pc');
107                params.delay = 0;
108                if (this._userKey !== undefined) {
109                    params.user_key = encodeURIComponent(this._userKey);
110                }
111                params.bg = 0;
112                if ($.Radiko.login_status.member_type !== undefined) {
113                    params.member_type = encodeURIComponent($.Radiko.login_status.member_type);
114                }
115                params.is_within_3h24h = encodeURIComponent((!Radiko.Player.ProgramModel.get('hasExceededTimeFreeLimit')).toString());
116                if (player && (!player.isLive() || player.chasing())) {
117                    if (!$.Radiko.Player.Model.get('hasCompletedPreroll')) {
118                        params.ts = player.seektm().toString('yyyyMMddHHmmss');
119                    }
120                    else if ($.Radiko.Player.Model.get('hasPreroll')) {
121                        var nowMilliSec = player.playing_date().getTime();
122                        var ts = new XDate(nowMilliSec - $.Radiko.Player.Model.get('prerollTotalDuration') * 1000);
123                        params.ts = ts.toString('yyyyMMddHHmmss');
124                    }
125                    else {
126                        params.ts = player.playing_date().toString("yyyyMMddHHmmss");
127                    }
128                    if ($.Radiko.logger.fromShare) {
129                        params.share = 1;
130                    }
131                }
132                return params;
133            };
134            Beacon.prototype.addTrackingParam = function (params, trackingType) {
135                params.adid = this._adId;
136                params.lsid = uid3();
137                params.tracking_type = encodeURIComponent(trackingType);
138                if (this.connectionType) {
139                    params.type = this.connectionType;
140                }
141                if (typeof this.streamType !== 'undefined') {
142                    params.stream_type = this.streamType;
143                }
144                return params;
145            };
146            Beacon.prototype.pickBeaconParam = function (trackingUrl) {
147                var matched = /\?(.*)$/.exec(trackingUrl);
148                if (!matched) {
149                    return null;
150                }
151                return matched[0];
152            };
153            return Beacon;
154        })()
155    };
156});

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.