1/* Naviå ±éç¨ */ 2$ = jQuery; 3var naviCommon = { 4 $dialog: null, 5 $dialogInput: null, 6 $dialogHidden: null, 7 // ã¤ãã³ãè¨ç½®ã»åæè¨å® 8 init: function() { 9 $('#headerUser,#headerFixProfile').on('click', function(){ 10 naviCommon.switchPopMenu(); 11 return false; 12 }); 13 $('#popMenu').on('click', function(){ 14 return false; 15 }); 16 $('body').on('click', function(){ 17 $('#popMenu').hide(); 18 }); 19 20 activeValidationJ($('#changePasswordForm')); 21 22 // ã¡ãã¥ã¼å¶å¾¡ 23 $('#btnMenu').on('click', function() { 24 $('#menuArea').show().animate({'left':'0'}, 250); 25 }); 26 $('#btnCloseMenu').on('click', function() { 27 $('#menuArea').animate({'left':'100vw'}, { 28 'duration': 250, 29 'complete': function(){ 30 $(this).hide(); 31 } 32 }); 33 }); 34 35 // æ¥ç¨ãã¤ã¢ãã°ç¨ 36 $('#dialogPrevMonth').on('click',function(){ 37 naviCommon.prevMonth(); 38 }); 39 $('#dialogNextMonth').on('click',function(){ 40 naviCommon.nextMonth(); 41 }); 42 $('#dateSelection tbody td').on('click',function(){ 43 naviCommon.selectDay($(this)); 44 }); 45 $('#dialogLinksArea .linkDays').on('click',function(){ 46 let days = $(this).attr('data-days'); 47 if(days == '1M') { 48 let today = new Date(prjutils.getToday()); 49 let end = prjutils.addMonth(today, 1); 50 days = prjutils.getBetweenDays(today, end); 51 days++; // å·®å30ãªã彿¥å«ãã¦31æ¥éã¨ãããã 52 } else if(days == 'clear') { 53 days = 0; 54 } 55 naviCommon.setDaysFromToday(days); 56 }); 57 58 59 // ãã¤ã¢ãã°ã®æ å¤ãã¯ãªãã¯ããå ´åãéãããã¿ã³ãæ¼ä¸ããã¨ãã¨åãå¦çãå¼ã³åºã 60 var common_dialog_closable = false; 61 $('.dialog').on('click', function(e) { 62 if(!common_dialog_closable) { 63 return; 64 } 65 let $target = $(e.target); 66 let $dialogParent = $target.parent('.dialog'); 67 if($dialogParent.length) { 68 $dialogParent.find('.button_dialog_close').click(); 69 } else if ($target.hasClass('dialog') || $target.hasClass('buttons_inner')) { 70 $target.find('.button_dialog_close').click(); 71 } 72 }); 73 74 // ãã¤ã¢ãã°ã®å¤æ ã§ãã¦ã¹ãæ¼ãå§ããæã ãæ å¤ã¯ãªãã¯ãæå¹åãã 75 $('.dialog').on('mousedown', function(e) { 76 let $target = $(e.target); 77 let $dialogParent = $target.parent('.dialog'); 78 if($dialogParent.length || 79 $target.hasClass('dialog') || $target.hasClass('buttons_inner') 80 ) { 81 common_dialog_closable = true; 82 } else { 83 common_dialog_closable = false; 84 } 85 }); 86 }, 87 88 // ãããã¢ããã¡ãã¥ã¼ãOpen/Closeãã 89 switchPopMenu: function() { 90 $('#popMenu').toggle(); 91 }, 92 93 // ãã°ã¤ã³ç»é¢ã«é·ç§»ãã 94 fowardLogin: function() { 95 let url = new URL(window.location.href); 96 let href = '/navi_login'; 97 let club = url.searchParams.get('club'); 98 if (url.pathname.indexOf('/navi_login/') >= 0) { 99 // ãã°ã¤ã³ç»é¢ããããã°ã¤ã³ãªã³ã¯ãæ¼ããæã¯ãã©ã¡ã¼ã¿ä¸è¦ 100 } else if(club) { 101 href += '/?club=' + encodeURIComponent(club); 102 } else { 103 let page = location.pathname; 104 href += '/?pag=' + encodeURIComponent(page); 105 } 106 window.location.href = href; 107 }, 108 109 // æ°è¦ç»é²ç»é¢ã«é·ç§»ãã 110 fowardRegistration: function() { 111 let url = new URL(window.location.href); 112 let page = location.pathname; 113 let href = '/navi_registration/?pag=' + encodeURIComponent(page); 114 // let id = url.searchParams.get('id'); 115 // if(id) { 116 // href += '/?pid=' + encodeURIComponent(id); 117 // } 118 window.location.href = href; 119 }, 120
121 // ãã¹ã¯ã¼ã夿´ãéä¿¡ãã 122 changePassword: function(){ 123 password_confirm_msg(pwd_modify_caution, function(){ 124 let $form = $('#changePasswordForm'); 125 let postParam = new FormData($form.get(0)); 126 postParam.append('action', 'changeFanPassword'); 127 $.ajax({ 128 type: 'POST', 129 url: binds['ajaxurl'], 130 data: postParam, 131 contentType : false, 132 processData : false, 133 success: function(res) { 134 if(res['result'] === true) { 135 prjutils.putMsgInfo('夿´ãå®äºãã¾ããã'); 136 naviCommon.closeDialog($form); 137 } else { 138 prjutils.putMsg('夿´ã§ãã¾ããã§ããã'); 139 } 140 } 141 }); 142 }); 143 }, 144 145 // ãã°ã¢ã¦ããã 146 logout: function() { 147 let postParam = new FormData(); 148 postParam.append('action', 'logout_res'); 149 $.ajax({ 150 type: 'POST', 151 url: binds['ajaxurl'], 152 data: postParam, 153 contentType: false, 154 processData: false, 155 success: function (res) { 156 window.location.reload(); 157 } 158 }); 159 }, 160 // ãã°ã¤ã³ä¸ãç¢ºèª 161 isLogin: function() { 162 return !!$('#loginUser').length; 163 }, 164 // ãã¤ã¢ãã°ãéãã 165 closeDialog: function(element) { 166 let $dialog = $(element).closest('.dialog'); 167 $dialog.fadeOut('fast'); 168 }, 169 170 // æ¥ç¨é¸æãã¤ã¢ãã° // 171 selectedDates: {}, 172 // ãã¤ã¢ãã°ãéã 173 openDateSelection: function($input, $hidden){ 174 naviCommon.$dialogInput = $input; 175 naviCommon.$dialogHidden = $hidden; 176 naviCommon.clearDateSelection(); 177 // é¸æç¶æ åæ 178 let csv = naviCommon.$dialogHidden.val(); 179 let dateList = csv.split(','); 180 let firstDate = ''; 181 for(let date of dateList){ 182 if(!date) { 183 continue; 184 } 185 if(!firstDate){ 186 firstDate = date; 187 } 188 naviCommon.selectedDates[date] = date; 189 } 190 if(firstDate){ 191 let ym = prjutils.toYM(new Date(firstDate)); 192 $('#dialogSelectedMonth').val(ym); 193 } 194 195 naviCommon.loadDateSelection(); 196 prjutils.showDialog($('#dialogDateSelection')); 197 }, 198 // ãã¤ã¢ãã°ãéããã«hiddenå¤ã表示åç§°ã«åæ ãã 199 resetDateSelection: function($input, $hidden) { 200 naviCommon.$dialogInput = $input; 201 naviCommon.$dialogHidden = $hidden; 202 naviCommon.clearDateSelection(); 203 // é¸æç¶æ åæ 204 let csv = naviCommon.$dialogHidden.val(); 205 let dateList = csv.split(','); 206 for(let date of dateList){ 207 if(!date) { 208 continue; 209 } 210 naviCommon.selectedDates[date] = date; 211 } 212 naviCommon.loadDateSelection(); 213 naviCommon.setDateSelection(); 214 }, 215 // ç¾å¨ã®ç¶æ ããã¤ã¢ãã°ã«åæ ãã 216 loadDateSelection: function(){ 217 $('#dateSelection').find('.selected').removeClass('selected'); 218 $('#dateSelection').find('.old').removeClass('old'); 219 $('#dateSelection').find('.current_month').removeClass('current_month'); 220 221 let today = new Date(prjutils.getToday()); 222 let selectedMonth = new Date($('#dialogSelectedMonth').val() + '-01'); 223 let currentMonthIdx = selectedMonth.getMonth(); 224 225 // ã¿ã¤ãã«è¨å® 226 let yearMonth = selectedMonth.getFullYear() + "å¹´ " + String(selectedMonth.getMonth() + 1) + "æ"; 227 $('#dialogMonthName').text(yearMonth); 228 // æ¥ä»çæ 229 let tmpDate = prjutils.getStartOfWeek(selectedMonth); 230 for(let weekIdx = 0; weekIdx < 6; weekIdx++){ 231 let $week = $('#week' + weekIdx); 232 for(let dayIdx = 0; dayIdx < 7; dayIdx++){
233 let $day = $week.find('.day' + dayIdx); 234 let ymd = prjutils.toYMD(tmpDate) 235 $day.text(tmpDate.getDate()); 236 $day.attr('data-date', prjutils.toYMD(tmpDate)); 237 if(tmpDate < today) { 238 $day.addClass('old'); 239 } 240 if(tmpDate.getMonth() == currentMonthIdx) { 241 $day.addClass('current_month'); 242 } 243 if(naviCommon.selectedDates[ymd]) { 244 $day.addClass('selected'); 245 } 246 tmpDate.setDate(tmpDate.getDate() + 1); 247 } 248 } 249 // 鏿æ¥ä»è¡¨ç¤º 250 let datesCsv = naviCommon.getSelectedLabelCsv(); 251 if(!datesCsv) { 252 datesCsv = 'ãã¹ã¦ã®é嬿¥'; 253 } 254 datesCsv = '<span class="date_label">' + datesCsv.replaceAll('ã', '</span><span class="date_label">') + '</span>'; 255 $('#dialogSelectedDateList').html(datesCsv); 256 }, 257 // 鏿æ¸ã¿æ¥ç¨ã®è¡¨ç¤ºæååãåå¾ 258 getSelectedLabelCsv: function(){ 259 let strDates = ''; 260 let sortedEntries = Object.entries(naviCommon.selectedDates).sort((a, b) => a[0].localeCompare(b[0])); 261 for (let [key, value] of sortedEntries) { 262 let tmpDate = new Date(naviCommon.selectedDates[key]); 263 if(strDates){ 264 strDates += 'ã'; 265 } 266 strDates += prjutils.formatMonthDate(tmpDate); 267 } 268 return strDates; 269 }, 270 // 鏿æ¸ã¿æ¥ç¨ã®è¡¨ç¤ºæååãåå¾ 271 getSelectedDatesCsv: function(){ 272 let strDates = ''; 273 let sortedEntries = Object.entries(naviCommon.selectedDates).sort((a, b) => a[0].localeCompare(b[0])); 274 for (let [key, value] of sortedEntries) { 275 let tmpDate = new Date(naviCommon.selectedDates[key]); 276 if(strDates){ 277 strDates += ','; 278 } 279 strDates += prjutils.toYMD(tmpDate); 280 } 281 return strDates; 282 }, 283 // 鏿ã親ç»é¢ã«åæ ãã 284 setDateSelection: function(){ 285 naviCommon.$dialogInput.val(naviCommon.getSelectedLabelCsv()); 286 naviCommon.$dialogHidden.val(naviCommon.getSelectedDatesCsv()); 287 prjutils.hideDialog($('#dialogDateSelection')); 288 }, 289 // 鏿ãã¯ãªã¢ 290 clearDateSelection: function() { 291 naviCommon.selectedDates = []; 292 $('#dialogSelectedMonth').val(prjutils.getThisMonth()); 293 naviCommon.loadDateSelection(); 294 }, 295 // åæã¸ 296 prevMonth: function() { 297 let selectedMonth = new Date($('#dialogSelectedMonth').val() + '-01'); 298 selectedMonth.setMonth(selectedMonth.getMonth() - 1); 299 let ym = prjutils.toYM(selectedMonth); 300 $('#dialogSelectedMonth').val(ym); 301 naviCommon.loadDateSelection(); 302 }, 303 // ç¿æã¸ 304 nextMonth: function() { 305 let selectedMonth = new Date($('#dialogSelectedMonth').val() + '-01'); 306 selectedMonth.setMonth(selectedMonth.getMonth() + 1); 307 let ym = prjutils.toYM(selectedMonth); 308 $('#dialogSelectedMonth').val(ym); 309 naviCommon.loadDateSelection(); 310 }, 311 // æ¬æ¥ããæå®æ¥æ°é¸æãã 312 setDaysFromToday: function(days){ 313 naviCommon.selectedDates = []; 314 $('#dialogSelectedMonth').val(prjutils.getThisMonth()); 315 let tmpDate = new Date(prjutils.getToday()); 316 for(let i = 0; i < days; i++) { 317 let strDate = prjutils.toYMD(tmpDate); 318 naviCommon.selectedDates[strDate] = strDate; 319 tmpDate.setDate(tmpDate.getDate() + 1); 320 } 321 naviCommon.loadDateSelection(); 322 }, 323 // æ¥ç¨é¸æç¶æ³ã®å¤æ´ 324 selectDay: function($day) { 325 if($day.is('.old')) { 326 // ç¡å¹æ¥ä» 327 return; 328 } 329 let selectedDay = $day.attr('data-date'); 330 if ($day.is('.selected')) { 331 delete naviCommon.selectedDates[selectedDay]; 332 } else { 333 naviCommon.selectedDates[selectedDay] = selectedDay; 334 } 335 naviCommon.loadDateSelection(); 336 }, 337 338 // 鍿´»é¸æãã¤ã¢ãã° // 339 // ãã¤ã¢ãã°ãéã 340 openClubSelection: function($input, $hidden){ 341 naviCommon.$dialogInput = $input; 342 naviCommon.$dialogHidden = $hidden; 343 naviCommon.loadClubSelection(); 344 prjutils.showDialog($('#dialogClubSelection')); 345 }, 346 // ç¾å¨ã®ç¶æ ããã¤ã¢ãã°ã«åæ ãã 347 loadClubSelection: function(){ 348 naviCommon.clearClubSelection(); 349 let csv = naviCommon.$dialogHidden.val(); 350 let clubList = csv.split(','); 351 for(let clubCd of clubList){ 352 let $clubBox = $('#dialogClubSelection').find('[data-club="' + clubCd + '"]'); 353 $clubBox.addClass('selected'); 354 } 355 }, 356 // 鏿ã親ç»é¢ã«åæ ãã 357 setClubSelection: function(){ 358 let cdCsv = ""; 359 let names = ""; 360 $('#dialogClubSelection').find('.club-box.selected').each(function(){ 361 let $clubBox = $(this); 362 if(cdCsv) { 363 cdCsv += ','; 364 names += 'ã'; 365 } 366 cdCsv += $clubBox.attr('data-club'); 367 names += $clubBox.text().trim(); 368 }); 369 naviCommon.$dialogInput.val(names); 370 naviCommon.$dialogHidden.val(cdCsv); 371 prjutils.hideDialog($('#dialogClubSelection')); 372 }, 373 // 鏿ãã¯ãªã¢ 374 clearClubSelection: function() { 375 $('#dialogClubSelection').find('.club-box.selected').removeClass('selected'); 376 }, 377 378 // ã¨ãªã¢é¸æãã¤ã¢ãã° // 379 // ãã¤ã¢ãã°ãéã 380 openAreaSelection: function($input, $hidden){ 381 naviCommon.$dialogInput = $input; 382 naviCommon.$dialogHidden = $hidden; 383 naviCommon.loadAreaSelection(); 384 prjutils.showDialog($('#dialogAreaSelection')); 385 }, 386 // ç¾å¨ã®ç¶æ ããã¤ã¢ãã°ã«åæ ãã 387 loadAreaSelection: function(){ 388 naviCommon.clearAreaSelection(); 389 let csv = naviCommon.$dialogHidden.val(); 390 let prefectureList = csv.split(','); 391 for(let prefectureCd of prefectureList){ 392 let $prefecture = $('#prefectureArea').find('[data-prefecture="' + prefectureCd + '"]'); 393 $prefecture.addClass('selected'); 394 } 395 }, 396 // 鏿ã親ç»é¢ã«åæ ãã 397 setAreaSelection: function(){ 398 let cdCsv = ""; 399 let names = ""; 400 $('#prefectureArea').find('.selected').each(function(){ 401 let $prefecture = $(this); 402 if(cdCsv) { 403 cdCsv += ','; 404 names += 'ã'; 405 } 406 cdCsv += $prefecture.attr('data-prefecture'); 407 names += $prefecture.text().trim(); 408 }); 409 naviCommon.$dialogInput.val(names); 410 naviCommon.$dialogHidden.val(cdCsv); 411 prjutils.hideDialog($('#dialogAreaSelection')); 412 }, 413 // 鏿ãã¯ãªã¢ 414 clearAreaSelection: function() { 415 $('#prefectureArea').find('.selected').removeClass('selected'); 416 }, 417}; // naviCommon 418 419naviCommon.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.