PageSourceSearch

https://www.billboard-japan.com/common/js/chart_insight/insight/model/chartRequest.js?date=202510301000

js billboard-japan.com collected 2026-10-01 10:25:50 UTC 9,730 bytes, 158 lines download raw bytes

1'use strict';
2
3//------------------------------------------------------------
4// chart.jsonにリクエストし、コールバック(callback)があれば成功後に実行。
5//------------------------------------------------------------
6app.inviewFlag = false; // inviewトリガーフラグ。trueでinvew実行。
7app.chartRequest = function (callback) {
8  if (app.chartJqxhr) app.chartJqxhr.abort(); // 二重リクエスト防止
9
10  app.chartJqxhr = $.ajax({
11    type: 'GET',
12    url: `${app.domain}/${app.datapoint}/chart.json${app.requestQuery('date', 'from', 'to', 'sort', 'page')}`,
13    cache: false,
14    xhrFields: { withCredentials: true },
15    success: function (result) {
16      let d = new $.Deferred();
17      app.chartJson = result;
18
19      // データ取得数0の場合
20      if (result.length === 0) {
21        let v1_y = $('#period-from-year').val();
22        let v1_m = $('#period-from-month').val() - 1;
23        let v1_w = $('#period-from-day').val();
24        let v2_y = $('#period-to-year').val();
25        let v2_m = $('#period-to-month').val() - 1;
26        let v2_w = $('#period-to-day').val();
27        const date1 = new Date(v1_y, v1_m, v1_w);
28        const date2 = new Date(v2_y, v2_m, v2_w);
29        if (date1 > date2) {
30          return alert('日付を正しく選択してください');
31        }
32      }
33
34      if ($('.ranking-sct-wrap').hasClass('show-point')) app.rank_or_point = 'point'; // .ranking-sct-wrapが.show-pointクラスを持っていたらポイント表示モードに
35
36      for (let i = 0; i < result.length; i++) {
37        // YouTubeサムネイルのソース作成(YouTubeIDがなければダミーに)
38        const youtubeSrc = result[i].youtubeid
39          ? `<a href="#" class="yt-show" data-id="${result[i].youtubeid}"><img src="https://img.youtube.com/vi/${result[i].youtubeid}/1.jpg" alt="" width="120" height="80"></a>`
40          : `<a href="#" class="yt-show -noId"><img src="/common/img/chart_insight/responsive/dummy_youtube.jpg" alt="" width="120" height="80"></a>`;
41        const artistNull = !result[i].artist || app.kind === 'albums' ? '-null' : ''; // null判定し非アクティブクラスを付与
42        const lyricistNull = !result[i].lyricist ? '-null' : ''; // null判定し非アクティブクラスを付与
43        const composerNull = !result[i].composer ? '-null' : ''; // null判定し非アクティブクラスを付与
44        const url = `detail${app.extension + app.requestQuery('date', 'from', 'to', 'sort')}&main=${result[i].id}#rank_or_point=${app.rank_or_point}`; // リンクURL
45        const values = {
46          url: url,
47          title: result[i].title || app.checkRankLimit(result[i].artist), // insight_artistリクエスト時はタイトルにアーティスト名を入れる ※インサイト限定
48          artist: app.checkRankLimit(result[i].artist),
49          lyricist: app.checkRankLimit(result[i].lyricist),
50          composer: app.checkRankLimit(result[i].composer),
51          artistNull: artistNull,
52          lyricistNull: lyricistNull,
53          composerNull: composerNull,
54          youtubeSrc: youtubeSrc,
55          arrowSrc: app.checkRankArrow(app.checkRankLimit(result[i].rank_chart), app.checkRankLimit(result[i].rank_chart_prev)),
56          chartinNumber: result[i].chartin_number,
57          rankPrev: app.checkRankLimit(result[i][`rank_chart_prev`]),
58          rankChart: app.checkRankLimit(result[i][`rank_${app.sorts[0].id}`]),
59          rankIndex1: app.checkRankLimit(result[i][`rank_${app.sorts[1].id}`]),
60          rankIndex2: app.checkRankLimit(result[i][`rank_${app.sorts[2].id}`]),
61          rankIndex3: app.checkRankLimit(result[i][`rank_${app.sorts[3].id}`]),
62          rankIndex4: app.checkRankLimit(result[i][`rank_${app.sorts[4].id}`]),
63          rankIndex5: app.checkRankLimit(result[i][`rank_${app.sorts[5].id}`]),
64          rankIndex6: app.checkRankLimit(result[i][`rank_${app.sorts[6].id}`]),
65          rankIndex7: app.checkRankLimit(result[i][`rank_${app.sorts[7].id}`]),
66          rankIndex8: app.checkRankLimit(result[i][`rank_${app.sorts[8].id}`]),
67          rankIndex9: app.checkRankLimit(result[i][`rank_${app.sorts[9].id}`]),
68          rankIndex10: app.checkRankLimit(result[i][app.hybrid === 'sales' ? `rank_${app.hybrid}` : `add_rank_${app.hybrid}`]), // ※インサイト限定
69          pointPrev: app.checkPointLimit(result[i][`point_chart_prev`]),
70          pointChart: app.checkPointLimit(result[i][`point_${app.sorts[0].id}`]),
71          pointIndex1: app.checkPointLimit(result[i][`point_${app.sorts[1].id}`]),
72          pointIndex2: app.checkPointLimit(result[i][`point_${app.sorts[2].id}`]),
73          pointIndex3: app.checkPointLimit(result[i][`point_${app.sorts[3].id}`]),
74          pointIndex4: app.checkPointLimit(result[i][`point_${app.sorts[4].id}`]),
75          pointIndex5: app.checkPointLimit(result[i][`point_${app.sorts[5].id}`]),
76          pointIndex6: app.checkPointLimit(result[i][`point_${app.sorts[6].id}`]),
77          pointIndex7: app.checkPointLimit(result[i][`point_${app.sorts[7].id}`]),
78          pointIndex8: app.checkPointLimit(result[i][`point_${app.sorts[8].id}`]),
79          pointIndex9: app.checkPointLimit(result[i][`point_${app.sorts[9].id}`]),
80          pointIndex10: app.checkPointLimit(result[i][app.hybrid === 'sales' ? `point_${app.hybrid}` : `add_point_${app.hybrid}`]), // ※インサイト限定
81        };
82
83        const tbodyTemplate = Handlebars.compile($('#tbody-template').html()); // 各指標(国)の最新週順位テンプレート作成
84        $('.ranking-sct-cont').append(tbodyTemplate(values)); // テンプレートにデータを当てはめてHTMLを出力
85
86        if (i === result.length - 1) d.resolve(); // 非同期処理の成功
87      }
88
89      //------------------------------------------------------------
90      // リクエスト完了後処理。
91      //------------------------------------------------------------
92      d.then(function () {
93        if (callback) callback(result); // コールバック実行
94
95        // 並び替えた指標によって曲の順位クラスを付与
96        $('.ranking-sct-cont')
97          .find('.ranking-list > li:not(.list-rank, .list-ttl, .list-chartin)')
98          .each(function () {
99            // 曲の順位の数値を取得
100            const num = Number($(this).find('span.rank').text());
101            //  1位、2位〜10位、11位〜20位、21位〜の順位によって見た目を変える
102            if (num === 1) $(this).addClass('li-rank1');
103            if (num > 1 && num < 11) $(this).addClass('li-rank2');
104            if (num > 10 && num < 21) $(this).addClass('li-rank3');
105          });
106
107        app.inviewFlag = true; // inviewトリガーフラグをtrueに
108
109        if (app.sort === 'onsale' || app.sort === 'onsale-desc') {
110          $('#releaseDate').find(`option[value="${app.sort}"]`).prop('selected', true); // 「発売日」のセレクトボックスを選択状態に
111        } else if (app.sort === 'buzz' || app.sort === 'contact' || app.sort === 'sales') {
112          $(`.list-hybrid`).addClass(app.className.act); // .activeを付与
113          $(`#hy_radio_${app.sort}`).prop('checked', true); // ラジオボタンを選択状態に
114        } else {
115          $(`.list-${app.sort}`).addClass(app.className.act); // .activeを付与
116        }
117
118        const $symbols = $('#ranking-list-nav li').find('img'); // テーブルヘッダーの全画像
119        $symbols.each(function () {
120          $(this).attr('src', $(this).attr('src').replace('1.png', '2.png')); // 全指標アイコンを白抜き画像に
121          if ($(this).closest('li').hasClass('active')) {
122            $(this).attr('src', $(this).attr('src').replace('2.png', '1.png')); // liに.activeがある指標アイコンを色付き画像に
123          }
124        });
125
126        $('.ranking-sct-wrap').css('min-height', '0'); // 高さをリセット
127
128        if (app.sp) $('.ranking-sct').scrollLeft(spScrollPos); // スマホのスクロール位置を戻す
129
130        if (app.kind === 'h100' || app.kind === 'anime' || app.kind === 'heatseekers') {
131          if (app.pageNum === 1 && !$refineLyricist.val() && !$refineComposer.val() && !$refineArtist.val()) {
132            // lyricist_composer.jsonのリクエスト
133            if (app.lyricistComposerJqxhr) app.lyricistComposerJqxhr.abort(); // 二重リクエスト防止
134            app.lyricistComposerJqxhr = app.get(`lyricist_composer.json${app.requestQuery('date', 'from', 'to', 'sub', 'sort')}`, function (result) {
135              app.lyricistComposerJson = result;
136              app.optionCreate('#refine-lyricist', result.lyricist); // 作詞家絞り込みプルダウンに値を挿入
137              app.optionCreate('#refine-composer', result.composer); // 作曲家絞り込みプルダウンに値を挿入
138            });
139
140            // artist_list.jsonのリクエスト
141            if (app.artistListJqxhr) app.artistListJqxhr.abort(); // 二重リクエスト防止
142            app.artistListJqxhr = app.get(`artist_list.json${app.requestQuery('date', 'from', 'to', 'sub', 'sort')}`, function (result) {
143              app.artistListJson = result;
144              app.optionCreate('#refine-artist', result.artist); // アーティスト絞り込みプルダウンに値を挿入
145            });
146          }
147        }
148
149        app.changeUrlCsv(app.requestQuery('date', 'from', 'to', 'sort')); // 「CSVダウンロード」ボタンのURLを変更
150        app.changeUrlSns(app.requestQuery('date', 'from', 'to', 'sort')); // SNSシェアボタンのURLを変更
151      });
152    },
153    error: function () {
154      console.error(`error`);
155      $('#load-target').removeClass('inview');
156    },
157  });
158};

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.