PageSourceSearch

https://52ae.cc/xx_dh/js.js

js 52ae.cc collected 2026-10-06 13:15:10 UTC 13,002 bytes, 406 lines download raw bytes

1window.onscroll = function(){
2  //回到顶部
3  var sllTop = document.documentElement.scrollTop||document.body.scrollTop;
4  if(sllTop>240){
5    $('#get-top').css('display','block')
6  }else{
7    $('#get-top').css('display','none')
8  }
9}
10$('#get-top').click(function(){ 
11  $('body,html').animate({
12    scrollTop: 0
13  }, 800);//点击回到顶部按钮,缓懂回到顶部,数字越小越快
14})
15// 显示/隐藏二级菜单
16$(".left-menu-btn").hover(function(){
17  $('#tow-nav').fadeIn(200);
18},function(){
19  $("#tow-nav").hover(function(){
20    $('#tow-nav').fadeIn(0);
21  },function(){
22    $('#tow-nav').fadeOut(0)
23  });
24  $('#tow-nav').fadeOut(0)
25})
26
27
28//判断用户使用的设备
29var deviceVal  = browserRedirect();
30function browserRedirect() {
31  var sUserAgent = navigator.userAgent.toLowerCase();
32  var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
33  var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
34  var bIsMidp = sUserAgent.match(/midp/i) == "midp";
35  var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
36  var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
37  var bIsAndroid = sUserAgent.match(/android/i) == "android";
38  var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
39  var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
40  if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
41    return 'phone';
42  } else {
43    return 'pc';
44  }
45}
46
47/*
48 * 2018-6-12更新
49 * 解决在低分辨率下首页内容过高导致滚动条出现,影响主题背景图片不全屏的问题
50 * 解决方式:对于屏幕分辨率高度低于845px显示器,改变首页的内容为6块区域。
51 */
52
53 (function(){
54  //当浏览器窗口被调整大小时触发
55  window.onresize = function(){
56    ShowHideElement("i-link-box","linkList-item",845);
57  }
58  window.onload = function(){
59    ShowHideElement("i-link-box","linkList-item",845); 
60  }
61  function ShowHideElement(Element1, Element2, Vaule){
62    var Person = document.getElementsByClassName(Element1);
63    var BoxHeight = document.getElementsByClassName(Element2);
64    var WindowHeight = window.innerHeight||document.body.clientHeight;
65    //遍历获取到的元素
66    for(var i=6; i<Person.length; i++){
67      if(WindowHeight <= Vaule && deviceVal === "pc"){
68        Person[i].style.display = "none";
69        BoxHeight[0].style.marginTop="5px";
70      }else{
71        Person[i].style.display = "block";
72        BoxHeight[0].style.marginTop="0px";
73      }
74    }
75  }
76  window.ShowHideElement = ShowHideElement;
77}());
78    
79var now = -1;
80var resLength = 0;
81var thisSearch = 'https://www.baidu.com/s?wd=';
82var thisSearchIcon = './logo.jpg';
83var storage = window.localStorage;
84if(!storage.stopHot){
85    storage.stopHot = true
86}
87storage.stopHot == 'false' ? $('#hot-btn').addClass('off') : $('#hot-btn').removeClass('off');
88var ssData = storage.searchEngine;
89if(storage.searchEngine != undefined){
90  ssData = ssData.split(','); 
91  thisSearch = ssData[0];
92  $('.search-icon').attr('src', ssData[1])
93}
94
95// 按键松开时执行
96$('#txt').keyup(function(e){
97  // 判断输入框是否有内容
98  if($('#txt').val() != ''){
99      $('.search-clear').css('display','block');
100    $('.search-clear').click(function(){
101      $('#txt').val('');
102      $('#box ul').html('');
103      $('.search-clear').css('display','none')
104    })
105  }else{
106    $('.search-clear').css('display','none')
107  }
108
109  if(e.keyCode == 38 || e.keyCode == 40 || storage.stopHot != 'true'){
110      return
111  };
112  var dat = {
113      wd: $('#txt').val()
114  };
115  if($('#txt').val()!=''){
116      $('#box ul').text('');
117      $('#box').css('display','block');
118        $.ajax({
119          type: "GET",
120          url: "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su",
121          async: true,
122          data: dat,
123          dataType : 'jsonp',
124          jsonp: 'cb',
125          success: function(res){
126              for(var i = 0; i < res.s.length; i++){
127                  resLength = res.s.length;
128                  oli_i = '<li>'+res.s[i]+'</li>';
129                  $('#box ul').append(oli_i);
130                  
131                  $('#box ul li').eq(i).click(function(){
132                      $('#txt').val(this.innerHTML);
133                      window.open(thisSearch + this.innerHTML);
134                      $('#box ul').html('');
135                      $('#box').css('display','none')
136                  })
137              };
138                    //$('#box ul').html() === '' ? $('#box').css('height','0px') : $('#box').css('height','auto');
139          },
140          error: function(res){
141              console.log(res)  
142          }
143      });
144  }else{
145      $('#box ul').html('')
146      //$('#box ul').html() === '' ? $('#box').css('height','0px') : $('#box').css('height','auto');
147  };
148});
149
150$('#txt').keydown(function(ev){
151    if(ev.keyCode==40){
152      now++;
153      if(now > resLength-1){   
154        now = 0;
155      }
156      $('#box ul li').eq(now).addClass('current').siblings().removeClass('current')
157      $('#txt').val($('#box ul li').eq(now).text())   
158    };
159    if(ev.keyCode==38){
160        if(now == -1 || now == 0){
161          now = resLength
162        }
163        now--
164        $('#box ul li').eq(now).addClass('current').siblings().removeClass('current');
165        $('#txt').val($('#box ul li').eq(now).text())
166    };
167    if(ev.keyCode==13){
168		var textValue = $('#txt').val();
169		if(textValue != ''){
170			window.open(thisSearch + $('#txt').val())
171			// $('#txt').val('');
172			$('#box ul').html('')
173		}else{
174			new $.zui.Messager('请输入关键字', {
175				icon: 'bell', // 定义消息图标
176				type: 'danger',
177				placement: 'top',
178				close: false
179			}).show();
180		}
181	}
182})
183
184$(function(){
185  //$('#box ul').html() === '' ? $('#box').css('height','0px') : $('#box').css('height','auto');
186  var search = {
187    data: [{
188      name: '百度',
189      img: '/images/logo.jpg',
190      url: 'https://www.baidu.com/s?wd='
191    }, {
192      name: '谷歌',
193      img: '/images/logo_2.jpg',
194      url: 'https://www.google.com/search?q='
195    }, {
196      name: '必应',
197      img: '/images/logo_3.jpg',
198      url: 'https://cn.bing.com/search?q='
199    }, {
200      name: '好搜',
201      img: '/images/logo_4.jpg',
202      url: 'https://www.so.com/s?q='
203    }, {
204      name: '搜狗',
205      img: '/images/logo_5.jpg',
206      url: 'https://www.sogou.com/web?query='
207    }]
208  }
209  for(var i = 0; i < search.data.length; i++){
210    var addList = '<li><img src="' + search.data[i].img + '"/>' + search.data[i].name + '</li>'
211    $('.search-engine-list').append(addList);
212  }
213
214  $('.search-icon, .search-engine').hover(function() {
215    $('.search-engine').css('display', 'block')
216  }, function() {
217    $('.search-engine').css('display', 'none')
218  });
219
220  $('#hot-btn').on('click', function() {
221    $(this).toggleClass('off');
222    if(storage.stopHot == 'true'){
223      storage.stopHot = false
224    }else{
225      storage.stopHot = true
226    }
227    console.log(storage.stopHot)
228  });
229
230  $('.search-engine-list li').click(function() {
231    var _index = $(this).index();
232    var thisImg = $(this).children().attr('src');
233    $('.search-icon').attr('src', thisImg)
234    thisSearch = search.data[_index].url;
235    $('.search-engine').css('display', 'none')
236
237    storage.searchEngine = [thisSearch, thisImg]
238  })
239})
240$("#search-btn").click(function(){
241  var textValue = $('#txt').val();
242  if(textValue != ''){
243            window.open(thisSearch + $('#txt').val())
244        // $('#txt').val('');
245        $('#box ul').html('')
246  }else{
247    new $.zui.Messager('请输入关键字', {
248      icon: 'bell', // 定义消息图标
249      type: 'danger',
250      placement: 'top',
251      close: false
252    }).show();
253  }
254});
255
256/*
257* @Author: Marte
258* @Date:   2018-05-20 09:03:53
259* @Last Modified by:   Marte
260* @Last Modified time: 2018-06-11 16:18:47
261*/
262
263'use strict';
264
265
266// 在这里修改id,和速度
267$(function(){
268    if(deviceVal == 'phone'){
269      $('#menu').css({'overflow':'hidden','overflow-y':'scroll'})
270      return
271    }
272    var api1 = new myApi();
273    api1.mouseScroll.inte($('#menu'),30);
274})
275
276
277//下面别动
278function myApi(){
279
280    this.mouseScroll = {
281
282        inte : function(obj,value){
283            this.OBJ = obj;
284            this.addscroll(obj);
285
286
287
288            var outH = obj.outerHeight(),
289                oScrollcontent = obj.children(':first'),
290                contentH = oScrollcontent.outerHeight(),
291                oYscrollinnerH = outH/contentH*outH,
292                oYscrollouter = obj.find('#Yscrollouter'),
293                oYscrollinner = obj.find('#Yscrollinner');
294
295            obj.css({'position': 'relative','overflow':'hidden'});
296            oScrollcontent.css('position', 'absolute');
297
298            if(contentH > outH){
299                this.mousehover(obj, oYscrollouter, oYscrollinner);
300                this.mousewheel(obj, value, oScrollcontent, oYscrollinner, outH, contentH, oYscrollinnerH );
301                this.mousemoved(obj, oScrollcontent, oYscrollouter, oYscrollinner, outH, contentH, oYscrollinnerH );
302            };
303        },
304
305        addscroll : function(obj,value){
306            obj.append('<div id="Yscrollouter"><div id="Yscrollinner"></div></div>');
307            $('#Yscrollinner').css('cursor','pointer');
308        },
309
310        mousehover : function(obj, outer, inner){
311
312            obj.hover(function() {
313                outer.fadeIn(400);
314            }, function() {
315                outer.fadeOut(400);
316            });
317
318            inner.hover(function() {
319                $('body').css({
320                    '-moz-user-select': 'none',
321                    '-webkit-user-select': 'none',
322                    '-ms-user-select': 'none',
323                    '-khtml-user-select': 'none',
324                    'user-select': 'none',});
325            }, function() {
326                $('body').css({
327                    '-moz-user-select': 'auto',
328                    '-webkit-user-select': 'auto',
329                    '-ms-user-select': 'auto',
330                    '-khtml-user-select': 'auto',
331                    'user-select': 'auto',});
332            });
333
334        },
335
336        mousewheel : function(obj, value, O, inner, H1, H2, H3){
337
338            var oScrollcontentVal = value/(H1 - H3)*(H2 - H1);
339
340                inner.height(H3);  //滚动条高度
341
342            obj.on('mousewheel',function(event,delta ){  //绑定滚轮事件
343
344                event.preventDefault();  //阻止浏览器默认为行
345
346                var delta = event.originalEvent.wheelDelta;
347                var oYscrollinnerTop = inner.position().top;
348
349                var oScrollcontentTop = O.position().top;
350
351                if(delta > 0){
352                    if(oYscrollinnerTop - value < 0){
353                        inner.css('top', 0);
354                        O.css('top', 0);
355                    }else{
356                        inner.css('top', oYscrollinnerTop - value);
357                        O.css('top', oScrollcontentTop + oScrollcontentVal);
358                    }
359                }else{
360                    if(oYscrollinnerTop + value > H1 - H3){
361                        inner.css('top', H1 - H3);
362                        O.css('top', H1 - H2);
363                    }else{
364                        inner.css('top', oYscrollinnerTop + value);
365                        O.css('top', oScrollcontentTop - oScrollcontentVal);
366                    }
367                };
368            });
369
370        },
371
372        mousemoved : function(obj, O, outer, inner, H1, H2, H3){
373            inner.on('mousedown',function(event){   //绑定鼠标事件
374
375                var clientY = event.clientY,
376                    oYscrollinnerTop = inner.position().top,
377                    oScrollcontentTop = O.position().top,
378
379                    moveY = 0;
380
381                    $(document).on('mousemove',function(event){
382                        moveY = event.clientY - clientY;
383                        var oScrollcontentMove = moveY/(H1 - H3)*(H2 - H1);
384
385                        if(oYscrollinnerTop + moveY < 0){
386                            inner.css('top', 0);
387                            O.css('top', 0);
388                        }else if(oYscrollinnerTop + moveY > H1 - H3){
389                            inner.css('top', H1 - H3);
390                            O.css('top', H1 - H2);
391                        }else{
392                            inner.css('top', oYscrollinnerTop + moveY);
393                            O.css('top', oScrollcontentTop - oScrollcontentMove);
394                        }
395                    });
396
397                    $(document).on('mouseup',function(event){
398                        $(document).off('mousemove');
399                    })
400
401            })
402        }
403
404    }
405}
406

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.