1'use strict'; 2 3(function ($) { 4 5 // --- è¨å®æ å ± --- 6 const INFO_CONFIG = { 7 error: { 8 jsonUrl: '/errorInfoData/errorInfo.json', 9 dataKey: 'errorHandle', 10 linkPage: '/surugabank/errorInfo.html', 11 containerId: '#errorMessage' 12 }, 13 maintenance: { 14 jsonUrl: '/errorInfoData/maintenanceInfo.json', 15 dataKey: 'maintenanceHandle', 16 linkPage: '/surugabank/maintenanceInfo.html', 17 containerId: '#maintenanceMessage' 18 } 19 }; 20 21 /** 22 * é»è©±çªå·è¡¨ç¤ºããã³ãªã³ã¯åå¦ç 23 */ 24 function loadTel() { 25 $('[data-tel]').each(function () { 26 const $this = $(this); 27 const filePath = `/surugabank/includes/tel/${$this.data('tel')}.html`; 28 29 $.ajax({ 30 type: 'GET', 31 url: filePath, 32 cache: false, 33 dataType: 'html' 34 }).done(function(data) { 35 $this.html(data).wrap('<div class="c-contact">'); 36 37 if (/iPhone|Android.*Mobile/.test(navigator.userAgent)) { 38 $this.find('.dial').each(function () { 39 const $dial = $(this); 40 $dial.wrapInner(`<a href="tel:${$dial.text()}" />`); 41 }); 42 } 43 $this.children().unwrap('[data-tel]'); 44 }).fail(function() { 45 console.error(`é»è©±çªå·ã®èªã¿è¾¼ã¿ã«å¤±æãã¾ãã: ${filePath}`); 46 }); 47 }); 48 } 49 50 /** 51 * ãç¥ããæ å ±ãå¦çããå ±é颿° 52 */ 53 function handleInfo(type) { 54 const config = INFO_CONFIG[type];
55 const $importantError = $('#important-error'); 56 57 return $.ajax({ 58 url: config.jsonUrl, 59 cache: false 60 }).done(function(data) { 61 // jsonãã¼ã¿ãåå¾ 62 const infoData = data[config.dataKey]?.[0]; 63 64 // statusã'on'ã§ãªãå ´åã¯ä½ãããªã 65 if (!infoData || infoData.status !== 'on') { 66 return; 67 } 68 69 // ããããã¼ã¸ç¨ãªã³ã¯ã®è¿½å 70 if ($importantError.length > 0) { 71 const dateSuffix = infoData.date ? `ï¼${infoData.date}ï¼` : ''; 72 const linkHtml = ` 73 <li class="u-fz16 u-sp-fz15"> 74 <a href="${config.linkPage}" target="_blank" class="u-cl-warn">${infoData.title}${dateSuffix}</a> 75 </li> 76 `; 77 $importantError.find('ul.list-warn').append(linkHtml); 78 $importantError.show(); 79 } 80 81 // 詳細ãã¼ã¸ã¸ã®è»¢è¨å¦ç 82 const $messageContainer = $(config.containerId); 83 if ($messageContainer.length > 0) { 84 $('#pageTitle').text(infoData.title); // ãã¼ã¸ã¿ã¤ãã« 85 86 let contentHtml = ''; 87 if (infoData.date) { 88 const d = infoData.date.split('.'); 89 contentHtml += `<p class="date">${d[0]}å¹´${d[1]}æ${d[2]}æ¥</p>`; // æ¥ä» 90 } 91 contentHtml += `<p>${infoData.message}</p>`; // æ¬æ 92 93 if (infoData.tel) { 94 contentHtml += `<div data-tel="${infoData.tel}"></div>`; // é»è©±çªå· 95 } 96 97 // çæããHTMLãDOMã«æ¿å ¥ 98 $messageContainer.html(contentHtml); 99 100 // é»è©±çªå·ã®èªã¿è¾¼ã¿å¦çãå®è¡ 101 loadTel(); 102 } 103 }); 104 } 105 106 /** 107 * å®è¡å¦ç 108 */ 109 $(function() { 110 // HTMLã®ãã¼ã¿ã¿ã¤ããåå¾ 111 const dataType = $('body').attr('data-type'); 112 if (dataType.length === 0) { 113 return; 114 } 115 116 // ãã¼ã¿ã¿ã¤ãããããã¯ã¹ã®å ´åãã¡ã³ããã³ã¹æ å ±ã®ã¿æ²è¼ 117 if (dataType === 'topics') { 118 handleInfo('maintenance').fail(() => console.warn('ã¡ã³ããã³ã¹æ å ±ã®åå¾ã«å¤±æãã¾ããã')); 119 } else { 120 handleInfo('error').fail(() =>
120 console.warn('ç·æ¥ã¨ã©ã¼æ å ±ã®åå¾ã«å¤±æãã¾ããã')); 121 handleInfo('maintenance').fail(() => console.warn('ã¡ã³ããã³ã¹æ å ±ã®åå¾ã«å¤±æãã¾ããã')); 122 } 123 }); 124 125})(jQuery);
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.