PageSourceSearch

https://cdn.okaapps.com/js/main_20260910.js

js okaapps.com collected 2026-10-02 07:19:32 UTC 6,113 bytes, 176 lines download raw bytes

1const header = document.querySelector('header');
2const navCenter = document.querySelector('.nav-center');
3const navItems = document.querySelectorAll('.nav-center .lia');
4const burger = document.querySelector('.burger');
5const container = document.querySelector('.container');
6const footer = document.querySelector('footer');
7const body = document.querySelector('body');
8const navProduct = document.querySelector('.nav-product');
9const blogItems = document.querySelectorAll('.blog .tag li');
10const product = document.querySelector('.product');
11const productImg = document.querySelector('.product img');
12const promotionDialog = document.querySelector('.promotion-dialog');
13const promotionClose = document.querySelector('#promotionClose');
14const promotionBg = document.querySelector('.promotion-bg');
15const productList = document.querySelector('#product-list');
16
17const urlItems = ['/','/blog','/support','/partners'];
18var openMenu = true;
19var openProduct = true;
20var pathName = window.location.pathname.substring(0,window.location.pathname.substr(1).indexOf('/')+1 > 0?window.location.pathname.substr(1).indexOf('/')+1:window.location.pathname.length);
21
22//设置cookie
23function setCookie(key,value,expires){
24  document.cookie=encodeURIComponent(key)+'='+encodeURIComponent(value)+';expires='+ddate(expires);
25}
26function ddate(expires){
27  var ddate=new Date();
28  ddate.setDate(ddate.getDate()+expires);
29  return ddate
30}
31//读取cookie
32function getCookie(name){
33  var arrStr=document.cookie.split('; ');
34  for(var i=0;i<arrStr.length;i++){
35    var arr=arrStr[i].split('=');
36    if(arr[0]==name){return decodeURIComponent(arr[1]) }
37  }
38  return false;
39}
40//删除cookie
41function removeCookie(name){
42  setCookie(name,'',-1)
43}
44
45window.addEventListener("load",function(){
46  if(urlItems.includes(pathName)) {
47    navItems[urlItems.indexOf(pathName)].classList.add('lib');
48  }
49  if(this.innerWidth > 695) {
50    navCenter.style.transition = '0s ease-in-out';
51    navProduct.style.maxWidth = '1200px';
52    navProduct.style.top = '45px';
53    navProduct.style.left = '50%';
54  } else {
55    navCenter.style.transition = '0.1s ease-in-out';
56    navProduct.style.maxWidth = '100%';
57    navProduct.style.top = '45px';
58    navProduct.style.left = '50%';
59  }
60  if (promotionDialog != undefined && promotionBg != undefined) {
61    const href = window.location.href;
62    console.log(href)
63    if(!getCookie('openPromotion') && href.indexOf('1659622164') === -1) {
64      promotionDialog.style.display = 'block';
65      promotionBg.style.display = 'block';
66      setCookie('openPromotion','true',1);
67    }
68  }
69
70
71});
72
73product.addEventListener('mouseover',() => {
74  if (window.innerWidth > 705) productList.style.display = 'block'
75})
76
77if (promotionClose != undefined) {
78  promotionClose.addEventListener('click',function () {
79    promotionDialog.style.display = 'none';
80    promotionBg.style.display = 'none';
81  });
82}
83
84window.addEventListener("resize",function(){
85  if(this.innerWidth > 695) {
86    navCenter.style.transition = '0s ease-in-out';
87    navProduct.style.maxWidth = '90%';
88    navProduct.style.top = '45px';
89    navProduct.style.left = '50%';
90    if(urlItems.includes(pathName)) {
91      navItems[urlItems.indexOf(pathName)].classList.add('lib');
92    }
93  } else {
94    navCenter.style.transition = '0.1s ease-in-out';
95    navProduct.style.maxWidth = '100%';
96    navProduct.style.top = '45px';
97    navProduct.style.left = '50%';
98    if(urlItems.includes(pathName)) {
99      navItems[urlItems.indexOf(pathName)].classList.remove('lib');
100    }
101  }
102});
103
104burger.addEventListener('click',() => {
105  burger.classList.toggle('burger-active');
106  navCenter.classList.toggle('mobile-menu-open', openMenu);
107  burger.setAttribute('aria-expanded', String(openMenu));
108  productToggle.setAttribute('aria-expanded', 'false');
109  if(urlItems.includes(pathName)) {
110    navItems[urlItems.indexOf(pathName)].classList.remove('lib');
111  }
112  if (openMenu) {
113    navCenter.style.top = '45px';
114    navCenter.style.zIndex = '1';
115  } else {
116    navCenter.style.top = '-95%';
117    navCenter.style.zIndex= '-1';
118  }
119  openMenu = !openMenu;
120  if(!openProduct) {
121    navProduct.classList.toggle('productActive');
122    openProduct = true;
123    productImg.src = '/icon/chevron-down.svg';
124  }
125});
126
127const productToggle = product.querySelector('a');
128const mobileNavigation = window.matchMedia('(max-width: 705px)');
129
130productToggle.addEventListener('click', event => {
131  if (!mobileNavigation.matches) return;
132  event.preventDefault();
133  const expanded = navProduct.classList.toggle('productActive');
134  productToggle.setAttribute('aria-expanded', String(expanded));
135  openProduct = !expanded;
136});
137
138// Reset mobile disclosure state when switching between desktop and mobile.
139mobileNavigation.addEventListener('change', () => {
140  navCenter.classList.remove('mobile-menu-open');
141  burger.classList.remove('burger-active');
142  burger.setAttribute('aria-expanded', 'false');
143  navProduct.classList.remove('productActive');
144  productToggle.setAttribute('aria-expanded', 'false');
145  openMenu = true;
146  openProduct = true;
147});
148
149document.addEventListener('keydown', event => {
150  if (event.key !== 'Escape' || !mobileNavigation.matches) return;
151  if (navProduct.classList.contains('productActive')) {
152    navProduct.classList.remove('productActive');
153    productToggle.setAttribute('aria-expanded', 'false');
154    openProduct = true;
155    productToggle.focus();
156  } else if (navCenter.classList.contains('mobile-menu-open')) {
157    burger.click();
158    burger.focus();
159  }
160});
161
162const colors = ['#C9F59B','#F5EC9B','#F5BB9B','#9BAFF5','#D49BF5','#9BDFF5', '#F59B9B', '#9BF5A1', '#9BC6F5', '#F5DC9B', '#B
16279BF5', '#9BF5E7', '#EE9BF5', '#E0F59B', '#F59BC6', '#9BF5C6'];
163let tags = {};
164let i = 0;
165for (let key of blogItems) {
166  if (!(key.textContent in tags)) {
167    tags[key.textContent] = colors[i];
168    i += 1
169    if (i >= colors.length - 1) {
170      i = 0
171    }
172  }
173  key.style.backgroundColor = tags[key.textContent]
174}
175
176

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.