1'use strict'; 2 3//------------------------------------------------------------ 4// 弿°ã®ãã¼ã¿å (datapoint)ã¨ãã©ã¡ã¼ã¿(params)ãå ã«dates.jsonããªã¯ã¨ã¹ãããapp.datesJsonã«æ ¼ç´ã 5// ãã®å¾ã³ã¼ã«ããã¯(callback)ãããã°å®è¡ã 6//------------------------------------------------------------ 7app.datesRequest = function (datapoint, params, callback) { 8 if (app.datesJqxhr) app.datesJqxhr.abort(); // äºéãªã¯ã¨ã¹ã鲿¢ 9 10 const url = `${app.domain}/${datapoint}/dates.json?${params}`; 11 12 app.datesJqxhr = $.ajax({ 13 type: 'GET', 14 url: url, 15 xhrFields: { withCredentials: true }, 16 success: function (result) { 17 //------------------------------------------------------------ 18 // æ¬ä¼¼ãã§ã³ã¸ã 19 //------------------------------------------------------------ 20 function showDateUpdate(type, val) { 21 if (type === 'week') { 22 $('#priod-date01 select.w_year').val(val.year).change(); 23 $('#priod-date01 select.w_month').val(val.month).change(); 24 $('#priod-date01 select.w_week').val(val.week).change(); 25 $('#period_radio_week').prop('checked', true); 26 } else if (type === 'term') { 27 $('#priod-date02 select.w_year').val(val.yearFrom).change(); 28 $('#priod-date02 select.w_month').val(val.monthFrom).change(); 29 $('#priod-date02 select.w_week').val(val.weekFrom).change(); 30 $('#priod-date03 select.w_year').val(val.yearTo).change(); 31 $('#priod-date03 select.w_month').val(val.monthTo).change(); 32 $('#priod-date03 select.w_week').val(val.weekTo).change(); 33 $('#period_radio_term').prop('checked', true); 34 } 35 36 // 表示 37 $('.ranking-sct-inner').css('opacity', '0'); 38 setTimeout(function () { 39 $('#update_btn_period .btn-update').click(); 40 $('.ranking-sct-inner').css('opacity', '1'); 41 }, 200); 42 } 43 44 let d = new $.Deferred(); 45 app.datesJson = result; 46 47 if (app.page === 'chart') { 48 let latestDate = result[result.length - 1]; // ææ°ã®æ¥ä» 49 50 // 忥ä»ã2é±éåã«å¤æ 51 let newArray = []; 52 for (let n = 0; n < result.length; n++) { 53 let day = new Date(result[n]); 54 day = app.getNowYMD(new Date(day.setDate(day.getDate() - 14))); 55 newArray.push(day); 56 } 57 result = newArray; 58 59 // ãã¼ã¿å±æ§å ¥ãæ¿ããåæã®æ¥ä»è¡¨ç¤º 60 if (initDate !== '' && initFlag) { 61 // è¡¨ç¤ºé±æ¤ç´¢ï¼initæï¼ 62 let dayStrInit = initDate.split(/[\-\/\s:]+/); 63 updateDuke(dayStrInit[0], dayStrInit[1], dayStrInit[2]); 64 $rankingNav.attr('data-date', initDate); 65 } else if (initFrom !== '' && initTo !== '' && initFlag) { 66 let dayStrFrom = initFrom.split(/[\-\/\s:]+/); 67 let dayStrTo = initTo.split(/[\-\/\s:]+/); 68 updateDukeTerm(dayStrFrom[0], dayStrFrom[1], dayStrFrom[2], dayStrTo[0], dayStrTo[1], dayStrTo[2]); 69 70 // 表示æéæ¤ç´¢ï¼initæï¼ 71 $rankingNav.attr('data-from', initFrom); 72 $rankingNav.attr('data-to', initTo); 73 } else { 74 let dayStrLatest = latestDate.split(/[\-\/\s:]+/); 75 updateDuke(dayStrLatest[0], dayStrLatest[1], dayStrLatest[2]); 76 $rankingNav.attr('data-date', latestDate.replace(/\u002f/g, '-')); 77 } 78 79 // é åã« 80 for (let i = 0; i < result.length; i++) { 81 // year 82 let year = String(result[i].split('/', 1)); 83 if (yearArray.indexOf(year) === -1) yearArray.push(year); 84 85 // month 86 let mLen = monthArray.length; 87 let month = { 88 y: Number(result[i].split('/', 2)[0]), 89 m: Number(result[i].split('/', 2)[1]), 90 }; 91 if (mLen !== 0) { 92 if (monthArray[mLen - 1].m !== month.m) monthArray.push(month); 93 } else { 94 monthArray.push(month); 95 } 96 97 // day 98 let dLen = dayArray.length; 99 let day = { 100 y: Number(result[i].split('/', 3)[0]), 101 m: Number(result[i].split('/', 3)[1]), 102 d: Number(result[i].split('/', 3)[2]), 103 v: Number(result[i].split('/', 3)[2]), 104 }; 105 106 const before = new Date(day.y, day.m - 1, day.d); 107 const after = new Date(day.y, day.m - 1, day.d); 108 before.setDate(before.getDate() - 4); 109 after.setDate(after.getDate() + 2); 110 111 day.d = `${before.getDate()}æ¥ã${after.getDate()}æ¥`; 112 dayArray.push(day); // 鱿¥ä»ãã¼ã¿ãé åã«æ¿å ¥ 113 114 if (i === result.length - 1) d.resolve(); 115 } 116 } 117 118 d.then(function () { 119 if (callback !== undefined) callback(); // ã³ã¼ã«ããã¯å®è¡ 120 121 if (app.page === 'chart') { 122 // initæã®è¡¨ç¤ºè¨å® 123 if (initFlag) { 124 let year, month, day, toYear, toMonth, toDay, initDateNotDuke1, initDateNotDuke2; 125 126 if (initDate !== '' && initFrom === '' && initTo === '') { 127 // é± 128 year = $rankingNav.attr('data-date').slice(0, 4);
129 month = $rankingNav.attr('data-date').slice(5, 7).replace('0', ''); 130 day = $rankingNav.attr('data-date').slice(8, 10).replace('0', ''); 131 132 // 2é±éå 133 initDateNotDuke1 = new Date(year, month - 1, day); 134 initDateNotDuke1 = new Date(initDateNotDuke1.setDate(initDateNotDuke1.getDate() - 14)); 135 year = String(initDateNotDuke1.getFullYear()); 136 month = String(initDateNotDuke1.getMonth() + 1); 137 day = String(initDateNotDuke1.getDate()); 138 139 $pri01.find('.w_year option').filter(function () { 140 if ($(this).val() === year) $(this).prop('selected', true); 141 $(this).trigger('change'); 142 }); 143 $pri01.find('.w_month option').filter(function () { 144 if ($(this).val() === month) $(this).prop('selected', true); 145 $(this).trigger('change'); 146 }); 147 $pri01.find('.w_week option').filter(function () { 148 if ($(this).val() === day) $(this).prop('selected', true); 149 }); 150 } else if (initFrom !== '' && initTo !== '') { 151 // æé 152 year = $rankingNav.attr('data-from').slice(0, 4); 153 month = $rankingNav.attr('data-from').slice(5, 7).replace('0', ''); 154 day = $rankingNav.attr('data-from').slice(8, 10).replace('0', ''); 155 toYear = $rankingNav.attr('data-to').slice(0, 4); 156 toMonth = $rankingNav.attr('data-to').slice(5, 7).replace('0', ''); 157 toDay = $rankingNav.attr('data-to').slice(8, 10).replace('0', ''); 158 159 // 2é±éå 160 initDateNotDuke1 = new Date(year, month - 1, day); 161 initDateNotDuke1 = new Date(initDateNotDuke1.setDate(initDateNotDuke1.getDate() - 14)); 162 year = String(initDateNotDuke1.getFullYear()); 163 month = String(initDateNotDuke1.getMonth() + 1); 164 day = String(initDateNotDuke1.getDate()); 165 166 initDateNotDuke2 = new Date(toYear, toMonth - 1, toDay); 167 initDateNotDuke2 = new Date(initDateNotDuke2.setDate(initDateNotDuke2.getDate() - 14)); 168 toYear = String(initDateNotDuke2.getFullYear()); 169 toMonth = String(initDateNotDuke2.getMonth() + 1); 170 toDay = String(initDateNotDuke2.getDate()); 171 172 $pri02.find('.w_year option').filter(function () { 173 if ($(this).val() === year) $(this).prop('selected', true); 174 $(this).trigger('change'); 175 }); 176 $pri02.find('.w_month option').filter(function () { 177 if ($(this).val() === month) $(this).prop('selected', true); 178 $(this).trigger('change'); 179 }); 180 $pri02.find('.w_week option').filter(function () { 181 if ($(this).val() === day) $(this).prop('selected', true); 182 }); 183 $pri03.find('.w_year option').filter(function () { 184 if ($(this).val() === toYear) $(this).prop('selected', true); 185 $(this).trigger('change'); 186 }); 187 $pri03.find('.w_month option').filter(function () { 188 if ($(this).val() === toMonth) $(this).prop('selected', true); 189 $(this).trigger('change'); 190 }); 191 $pri03.find('.w_week option').filter(function () { 192 if ($(this).val() === toDay) $(this).prop('selected', true); 193 }); 194 } 195 } 196 197 /* ç¾å¨ã®æ¥ä»æ¤ç´¢ */ 198 if (showDateType === 'period_radio_week') { 199 if (app.datesJson.indexOf(showDate[0]) !== -1) { 200 // å®éã®valueã»ãã 201 showDateUpdate('week', showDateVal); 202 } 203 } else if (showDateType === 'period_radio_term') { 204 if (app.datesJson.indexOf(showDate[0]) !== -1 && app.datesJson.indexOf(showDate[1]) !== -1) { 205 // å®éã®valueã»ãã 206 showDateUpdate('term', showDateVal); 207 } 208 } 209 } 210 }); 211 }, 212 error: function () { 213 console.error(`error ${url}`); 214 }, 215 }); 216};
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.