1/* 2 /magazine/content/themes/v03/js/func.pc.js 3 ----- 4 ver. 3.0 5 update: 2024/06/01 6 Copyright: CBC TELEVISION CO.,LTD. All rights Reserved. 7 ----- 8 [Revision] 9 ver. 3.0 [2024/06/01] 10*/ 11 12// $(function(){ 13 14 15// $('a[href^="#"]').click(function(){ 16// let adjust = 50; 17// let speed = 400; 18// let href= $(this).attr('href'); 19// let target = $((href == '#' || href == '') ? 'html' : href); 20// let pos = target.offset().top - adjust; 21// $('body,html').animate({scrollTop:pos}, speed, 'swing'); 22// return false; 23// }); 24 25 26 27// }); 28 29 30// ãã¬ã¤ã¯ãã¤ã³ããå®ç¾© 31const breakpoints = { 32 mobile: window.matchMedia('(max-width: 767px)'), 33 tablet: window.matchMedia('(min-width: 768px) and (max-width: 1279px)'), 34 desktop: window.matchMedia('(min-width: 1279px)') 35}; 36 37// åãã¬ã¤ã¯ãã¤ã³ãã«å¯¾ãã¦å¦çãå®ç¾© 38function handleBreakpointChange() { 39 smoothScrollToAnchor() 40 41 42 // ã©ã³ãã³ã°ã®ã¿ãåæ¿å¦ç 43 document.addEventListener('DOMContentLoaded', function() { 44 const tabButtons = document.querySelectorAll('.jsc-rankingTabItem'); 45 const tabContents = document.querySelectorAll('.jsc-rankingContent'); 46 47 tabButtons.forEach(button => { 48 button.addEventListener('click', () => { 49 const tabId = button.getAttribute('data-ranking-period'); 50 51 tabButtons.forEach(btn => btn.classList.remove('active')); 52 button.classList.add('active'); 53 54 tabContents.forEach(content => content.classList.remove('active')); 55 document.getElementById(tabId).classList.add('active'); 56 }); 57 }); 58 }); 59 60 61 // ãã¬ã¤ã¯ãã¤ã³ããã¨ã®å¦ç 62 if (breakpoints.mobile.matches) { 63 // console.log("Mobile view"); 64 } else if (breakpoints.tablet.matches) { 65 // console.log("Tablet view"); 66 } else if (breakpoints.desktop.matches) { 67 // console.log("Desktop view"); 68 } 69} 70 71// ãã¬ã¤ã¯ãã¤ã³ããå¤ãããã³ã«å¼ã°ããã¤ãã³ããªã¹ãã¼ãè¨å® 72Object.values(breakpoints).forEach(bp => { 73 bp.addListener(handleBreakpointChange); 74}); 75 76// åæè¡¨ç¤ºã®ããã«ä¸åº¦å®è¡ 77handleBreakpointChange(); 78 79 80 81// ã¢ã³ã«ã¼ãªã³ã¯ã®ã¹ã ã¼ãºã¹ã¯ãã¼ã«ãè¡ãå ±é颿° 82function smoothScrollToAnchor() { 83 const anchorLinks = document.querySelectorAll('a[href^="#"]'); 84 85 anchorLinks.forEach(link => { 86 link.addEventListener('click', (event) => { 87 event.preventDefault(); // ããã©ã«ãã®ã¢ã³ã«ã¼ãªã³ã¯åä½ããã£ã³ã»ã« 88 89 const targetId = link.getAttribute('href'); 90 const targetElement = document.querySelector(targetId); 91 console.log(targetId); 92 93 if (targetElement) { 94 smoothScrollTo(targetElement); // ã«ã¹ã¿ã ã¹ã¯ãã¼ã«é¢æ°ãå¼ã³åºã 95 } 96 }); 97 }); 98} 99 100 101// ã¹ã ã¼ãºã¹ã¯ãã¼ã«ãã«ã¹ã¿ãã¤ãºãã颿° 102function smoothScrollTo(targetElement) { 103 const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset; 104 const startPosition = window.pageYOffset; 105 const distance = targetPosition - startPosition; 106 const duration = 1000; // ã¢ãã¡ã¼ã·ã§ã³ã®é·ãï¼ããªç§ï¼ 107 let startTime = null; 108 109 // ã¢ãã¡ã¼ã·ã§ã³ã®é²è¡ã管çããã¤ã¼ã¸ã³ã°é¢æ° 110 function ease(t, b, c, d) { 111 t /= d / 2; 112 if (t < 1) return c / 2 * t * t + b; 113 t--; 114 return -c / 2 * (t * (t - 2) - 1) + b; 115 } 116 117 // ã¹ã¯ãã¼ã«ã¢ãã¡ã¼ã·ã§ã³ 118 function animation(currentTime) { 119 if (startTime === null) startTime = currentTime; 120 const timeElapsed = currentTime - startTime; 121 const run = ease(timeElapsed, startPosition, distance, duration); 122 window.scrollTo(0, run); 123 if (timeElapsed < duration) requestAnimationFrame(animation); 124 } 125 126 // ã¢ãã¡ã¼ã·ã§ã³ãéå§ 127 requestAnimationFrame(animation); 128} 129 130// Scroll 131// const lenis = new Lenis(); 132// function raf(time) { 133// lenis.raf(time); 134// requestAnimationFrame(raf); 135// } 136// requestAnimationFrame(raf); 137 138 139// Search for Tag [Vue] 140// ---------- 141const app = new Vue({ 142 el: '#jsi-tagSearch', 143 data: { 144 loadFlag: false, 145 tag: '', 146 listOrg: [], 147 }, 148 computed: { 149 list() { 150 if (this.tag === '') { 151 return []; 152 } else {
153 return this.listOrg.filter(item => item.tag.match(this.tag) !== null) 154 } 155 }, 156 formalTag() { 157 return function (tag) { 158 return tag.replace(/^\d+_/g, '') 159 } 160 } 161 }, 162 mounted() { 163 fetch('/magazine/assets/tag.list.json') 164 .then( response => response.json()) 165 .then(data => { 166 this.listOrg = data; 167 this.loadFlag = true; 168 }); 169 }, 170})
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.