PageSourceSearch

https://www.opldisplaytec.com/templates/tradeSite/assets/js/common.js

js opldisplaytec.com collected 2026-10-08 01:28:38 UTC 4,139 bytes, 160 lines download raw bytes

1(function (window){
2  /**
3   * 显示语言下拉列表
4   */
5  function showLang(element){
6    var hasUp = element.classList.contains("up")
7    console.log("hasUp", hasUp)
8    if(hasUp){
9      // 展开操作
10      element.classList.remove("up")
11      element.classList.add("dp")
12    } else {
13      element.classList.add("up")
14      element.classList.remove("dp")
15    }
16    var parent = element.parentElement
17    var lis = parent.querySelectorAll("li")
18    var lislength = lis.length
19    function changeHeight(k){
20      setTimeout(()=>{
21        // console.log("setTimeout")
22        lis[k].style.height = hasUp ? "40px" : "0px"
23      })
24    }
25    function hideLi(i){
26      setTimeout(()=>{
27        lis[i].style.display = "none"
28      },500)
29    }
30    for(var i=0;i<lislength;i++){
31      if(i){
32        var hasbK = lis[i].classList.contains("bk")
33        if(!hasbK){
34          lis[i].classList.add("bk")
35        }
36        if(hasUp){
37          lis[i].style.display =  "list-item"
38        }else {
39          hideLi(i)
40        }
41        changeHeight(i)
42      }
43    }
44  }
45
46  /**
47   * 页面吸顶切换
48   */
49  function pageTogetherFixed(menuNav, headerDom){
50    var hasFixed = menuNav.classList.contains("fixed-menu-nav")
51    console.log("hasFixed", hasFixed)
52    var navDropdownMenu = document.querySelector(".nav-dropdown-menu")
53    if(!hasFixed){
54      if(window.scrollY > 50){
55        menuNav.classList.add("fixed-menu-nav")
56        headerDom.style.paddingTop = "80px"
57        navDropdownMenu.style.top = "80px"
58      }
59    } else {
60      if(window.scrollY < 50){
61        menuNav.classList.remove("fixed-menu-nav")
62        headerDom.style.paddingTop = "0"
63        navDropdownMenu.style.top = "136px"
64      }
65    }
66  }
67  /**
68   * 手机端底部弹出
69   */
70  function mobileBottomTogetherShow(mobileBottom, comparePanel){
71    var hasFixed = mobileBottom.getAttribute("style")
72    console.log("hasFixed", hasFixed)
73    if(!hasFixed || !/fixed/.test(hasFixed)){
74      if(window.scrollY > 50){
75        mobileBottom.style.position="fixed"
76        mobileBottom.style.bottom="0"
77       if(comparePanel){
78         comparePanel.style.bottom = "60px"
79       }
80      }
81    } else {
82      if(window.scrollY < 50){
83        mobileBottom.style.bottom="-100px"
84        setTimeout(()=>{
85          mobileBottom.style.position="static"
86        },500)
87        if(comparePanel){
88          comparePanel.style.bottom = "0"
89        }
90      }
91    }
92  }
93
94  /**
95   * 页面滚动
96   */
97  function pageScroll(){
98    var menuNav = document.querySelector(".menu-nav")
99    var headerDom = document.querySelector("header")
100    var mobileBottom = document.querySelector(".mobile-bottom")
101    var comparePanel = document.getElementById("compare-panel")
102    // console.log("windowY", window.scrollY)
103    pageTogetherFixed(menuNav, headerDom)
104    mobileBottomTogetherShow(mobileBottom,comparePanel)
105    window.addEventListener('scroll',function (e){
106      //执行操作
107      if(window.getIsMobile()){
108        // 移动端,底部菜单弹窗
109        mobileBottomTogetherShow(mobileBottom,comparePanel)
110      } else {
111        // pc端,吸顶
112        pageTogetherFixed(menuNav, headerDom)
113      }
114    })
115
116  }
117  pageScroll()
118  /**
119   * 暴露全局common模块和方法
120   * @type {{searchNow: Window.common.searchNow}}
121   */
122  window.common = {
123    /**
124     * 搜索
125     */
126    searchNow: function (content){
127
128    },
129    showLang,
130  }
131})(window)
132
133function UrlDecode(zipStr){ 
134  var uzipStr = ''; 
135  for (var i = 0; i < zipStr.length; i += 1) {
136    var chr = zipStr.charAt(i); 
137    if (chr === '+') { 
138      uzipStr += ' ';
139    } else if (chr === '%') { 
140      var asc = zipStr.substring(i + 1, i + 3); 
141      if (parseInt('0x' + asc) > 0x7f) {
142        uzipStr += decodeURI('%' + asc.toString() + zipStr.substring(i+3, i+9).toString()); 
143        i += 8;
144      }else{ 
145        uzipStr += AsciiToString(parseInt('0x' + asc)); 
146        i += 2;
147      } 
148    }else{ 
149      uzipStr += chr; 
150    } 
151  } 
152  return uzipStr; 
153} 
154  
155function StringToAscii(str){ 
156  return str.charCodeAt(0).toString(16); 
157}
158function AsciiToString(asccode){ 
159  return String.fromCharCode(asccode); 
160}

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.