1/* ========================= 2 UAå¤å®ï¼no-webp ä»ä¸ï¼ 3========================= */ 4var ua = window.navigator.userAgent.toLowerCase(); 5if ( 6 ua.indexOf('trident') !== -1 || 7 (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1) 8) { 9 if (ua.indexOf('iphone') === -1) { 10 $('body').addClass('no-webp'); 11 } 12} 13 14document.addEventListener('DOMContentLoaded', function () { 15 16 /* ========================= 17 ãã³ãã¼ã¬ã¼ã¡ãã¥ã¼ 18 ========================= */ 19 const menuBtn = document.querySelector('.menu-btn'); 20 const fixMenu = document.querySelector('.fix-menu'); 21 22 if (menuBtn && fixMenu) { 23 menuBtn.addEventListener('click', function () { 24 this.classList.toggle('active'); 25 fixMenu.classList.toggle('active'); 26 }); 27 } 28 29 /* ========================= 30 ãããããã¦ã³ï¼ã«ã¯ã¤ãæ¹åï¼å®é«ã height ã¢ãã¡ï¼ 31 â»SPã¡ãã¥ã¼ãéãã¦ããæã ãåä½ï¼PCã¯é常é·ç§»ï¼ 32 ========================= */ 33 document.querySelectorAll('.fix-menu .dropdown > a').forEach(function (link) { 34 link.addEventListener('click', function (e) { 35 36 // ãã³ãã¼ã¬ã¼ãåå¨ããªããã¼ã¸ã§ã¯ä½ãããªãï¼JS忢鲿¢ï¼ 37 if (!fixMenu) return; 38 39 // SPã¡ãã¥ã¼ãéãã¦ãªãï¼PCæ±ãï¼ãªã³ã¯é·ç§»ãåªå 40 if (!fixMenu.classList.contains('active')) return; 41 42 // SPã¡ãã¥ã¼ãéãã¦ããæã ããããããã¦ã³éé 43 e.preventDefault(); 44 45 const parentLi = this.parentElement; 46 const menu = parentLi.querySelector('.dropdown-menu'); 47 if (!menu) return; 48 49 const isOpen = parentLi.classList.contains('open'); 50 51 if (isOpen) { 52 // éããï¼ç¾å¨ã®é«ã â 0 53 const current = menu.scrollHeight; 54 menu.style.height = current + 'px'; 55 menu.offsetHeight; // reflow 56 menu.style.height = '0px'; 57 parentLi.classList.remove('open'); 58 } else { 59 // éãï¼0 â å®é«ã 60 parentLi.classList.add('open'); 61 62 menu.style.height = 'auto'; 63 const target = menu.scrollHeight; 64 65 menu.style.height = '0px'; 66 menu.offsetHeight; // reflow 67 menu.style.height = target + 'px'; 68 69 // éãçµãã£ãã height:auto ã«æ»ãï¼ä¸èº«ã墿¸ãã¦ãå´©ããªãï¼ 70 const onEnd = function (ev) { 71 if (ev.propertyName !== 'height') return; 72 menu.style.height = 'auto'; 73 menu.removeEventListener('transitionend', onEnd); 74 }; 75 menu.addEventListener('transitionend', onEnd); 76 } 77 }); 78 }); 79 80}); 81 82 83 84 85 86/* ========================= 87 ã¹ã ã¼ãºã¹ã¯ãã¼ã« 88========================= */ 89$('a[href^="#"]').click(function () { 90 var speed = 500; 91 var href = $(this).attr('href'); 92 var target = $(href === '#' || href === '' ? 'html' : href); 93 var position = target.offset().top - 100; 94 $('html, body').animate({ scrollTop: position }, speed, 'swing'); 95 return false; 96}); 97 98/* ========================= 99 ããã·ã¥ä»ãé·ç§»è£æ£ 100========================= */ 101$(window).on('load', function () { 102 const hash = window.location.hash; 103 104 if ( 105 hash === '#staff_link' || 106 hash === '#attending_doctor_list' || 107 hash === '#questionnaire' 108 ) { 109 const target = $(hash); 110 if (target.length) { 111 const offset = target.offset().top - 80; 112 $('html, body').animate({ scrollTop: offset }, 500); 113 } 114 } 115});
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.