1'use strict'; 2const urlSearchParams = new URLSearchParams(window.location.search); 3const params = Object.fromEntries(urlSearchParams.entries()); 4 5const SonyMusicApiNewsEvent = new CustomEvent('sonymusic-api-news', { 6 detail: { 7 news: {}, 8 params: params, 9 }, 10}); 11 12const SonyMusicApiNews = { 13 state: { 14 callCount: 0, 15 parPageCount: 100, 16 listAll: [], 17 listShow: [], 18 categoryList: [], 19 category: '', 20 }, 21 getData(page, callback) { 22 let min = this.state.parPageCount * page; 23 let max = this.state.parPageCount * (page + 1); 24 let artistid = _artistFolder ? _artistFolder : ''; 25 $.ajax({ 26 type: 'GET', 27 url: 'https://www.sonymusic.co.jp/json/v2/artist/'.concat(artistid, '/information/start/').concat(min, '/count/').concat(max), 28 dataType: 'jsonp', 29 jsonpCallback: 'callback', 30 cache: false, 31 }) 32 .done((data) => {}) 33 .fail((data) => {}) 34 .always((data) => { 35 callback(data); 36 }); 37 }, 38 getAllData() { 39 let getData = () => { 40 this.getData(this.state.callCount, (data) => { 41 this.state.listAll.push(...data.items); 42 if (data.total_count > this.state.listAll.length) { 43 this.state.callCount++; 44 getData(); 45 } else { 46 this.getAllDataComplate(); 47 } 48 }); 49 }; 50 getData(); 51 }, 52 getAllDataComplate() { 53 this.getCategoryList(); 54 this.getShowList(); 55 this.complate(); 56 }, 57 getCategoryList() { 58 this.state.listAll.map((item) => { 59 if (!this.state.categoryList.some((cate) => cate === item.category)) { 60 this.state.categoryList.push(item.category); 61 } 62 }); 63 }, 64 getShowList() { 65 if (params.category) { 66 this.state.listAll.map((item) => { 67 if (item.category == params.category) { 68 this.state.listShow.push(item); 69 } 70 }); 71 } else { 72 this.state.listShow = this.state.listAll; 73 } 74 }, 75 complate() { 76 SonyMusicApiNewsEvent.detail.news.listAll = this.state.listAll; 77 SonyMusicApiNewsEvent.detail.news.listShow = this.state.listShow; 78 SonyMusicApiNewsEvent.detail.news.categoryList = this.state.categoryList; 79 SonyMusicApiNewsEvent.detail.news.time = new Date(); 80 window.dispatchEvent(SonyMusicApiNewsEvent); 81 }, 82 init() { 83 this.getAllData(); 84 }, 85}; 86SonyMusicApiNews.init();
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.