PageSourceSearch

https://www.nayeef.com/dist/front/static/new_default_theme/footer.js?v=630

js nayeef.com collected 2026-10-02 01:37:33 UTC 3,229 bytes, 88 lines download raw bytes

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.