1class FFooter extends HTMLElement { 2 constructor() { 3 super(); // è°ç¨ç¶ç±»æé 彿° 4 this.init(); // åå§å彿° 5 6 } 7 connectedCallback(){ 8 this.addEvents()//æç¹äºä»¶ 9 } 10 addEvents() { 11 try { 12 // éæ©ææ data-type="phone" å data-type="email" ç <a> æ ç¾ 13 const phoneLinks = this.querySelectorAll('a[data-type="phone"], a[data-type="email"]'); 14 15 // 为æ¯ä¸ªé¾æ¥æ·»å ç¹å»äºä»¶çå¬å¨ 16 phoneLinks.forEach(link => { 17 link.addEventListener('click', function(event) { 18 // å¨ç¹å»æ¶ï¼ä½ å¯ä»¥æ ¹æ®éè¦è¿è¡å¤ç 19 $log('Clicked on:', event.target,link.dataset); 20 let addonsGoogle = document.querySelector('addons-google') 21 if (addonsGoogle) {//妿æ ç¾åå¨è¯´ææä»¶å¼å¯äº 22 if (link.dataset.type === 'email'){ 23 addonsGoogle.sidebarSendTrace('email') 24 25 }else if(link.dataset.type === 'phone'){ 26 addonsGoogle.sidebarSendTrace('phone') 27 28 } 29 } 30 // å¦æä½ éè¦æ§è¡é»è®¤è¡ä¸ºï¼ä¾å¦æ¨æçµè¯æåéé®ä»¶ï¼å¯ä»¥å¨è¿éå¤ç 31 // 妿éè¦é»æ¢é»è®¤è¡ä¸ºï¼å¯ä»¥ä½¿ç¨ event.preventDefault(); 32 }); 33 }); 34 } catch(e) { 35 console.error(e); 36 } 37 38 } 39 init() { 40 // æ¥æ¾å½åfooterå ç´ å ç坿å åºåï¼æé£ç´ï¼ 41 const mobileAccordion = this.querySelector(".f-footer--accordion"); 42 // æ¥æ¾é¡µé¢ä¸çç§»å¨ç«¯åºé¨ç²æ§æ¡ 43 const mobileStickyBar = document.querySelector(".f-mobile-sticky-bar"); 44 // 妿ææå åºå 45 if (mobileAccordion) { 46 // 妿å½å为移å¨ç«¯ï¼ååå§åæé£ç´ 47 if ($isMobile) { 48 this.acc = new FecLibs.Accordion(mobileAccordion, { 49 presetContentHeight: true, // é¢è®¾å 容é«åº¦ 50 onload: true // 页é¢å è½½æ¶æ¿æ´» 51 }); 52 } 53 // çå¬å±å¹åæ¢å°ç§»å¨ç«¯æ¶ï¼éæ°åå§åæé£ç´ 54 document.addEventListener("matchMobile", () => { 55 this.acc = new FecLibs.Accordion(mobileAccordion, { 56 presetContentHeight: true, 57 onload: true 58 }); 59 }); 60 } 61 62 // 设置移å¨ç«¯åºé¨ç²æ§æ¡çé«åº¦å°CSSåé 63 if (mobileStickyBar) { 64 document.documentElement.style.setProperty( 65 "--mobile-sticky-bar-height", 66 `${mobileStickyBar.offsetHeight}px` 67 ); 68 69 // å½å±å¹åæ¢å°ç§»å¨ç«¯æ¶ï¼æ´æ°CSSåé为å½åé«åº¦ 70 document.addEventListener("matchMobile", () => { 71 document.documentElement.style.setProperty( 72 "--mobile-sticky-bar-height", 73 `${mobileStickyBar.offsetHeight}px` 74 ); 75 }); 76 // å½å±å¹åæ¢ä¸ºéç§»å¨ç«¯æ¶ï¼ä¾ç¶æ´æ°åé为å½åé«åº¦ï¼æäºåºæ¯ä¸é«åº¦å¯è½ä¸åï¼ 77 document.addEventListener("unmatchMobile", () => { 78 document.documentElement.style.setProperty( 79 "--mobile-sticky-bar-height", 80 `${mobileStickyBar.offsetHeight}px` 81 ); 82 }); 83 } 84 } 85} 86 87// 注å f-footer èªå®ä¹å ç´ 88customElements.define("f-footer", FFooter);
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.