PageSourceSearch

https://hansmatrix.com/static/themes/default/js/website.js?t=1791447738

js hansmatrix.com collected 2026-10-08 08:22:40 UTC 12,697 bytes, 406 lines download raw bytes

1
2$href = location.href.replace(location.protocol+'//'+location.host,'');
3/*
4 * 退出登录
5 *
6**/
7$(document).on('click', '[logout]', function() {
8    $.post('/api/member/logout', {}, function(data) {
9        if (data.ret == 1) {
10            location.href = '/';
11        } else {
12            $.alert(data.msg, 1);
13        }
14    }, 'json');
15});
16
17
18$(document).ready(function () {
19
20    /*
21     * 提交留言
22     *
23    **/
24    $('[feedback]').form({
25        url: '/api/web/feedback',
26        end: function(data, f) {
27            if (data.ret == 1) {
28                f[0].reset();
29            }
30            jQ.alert(data.msg, 1);
31        }
32    });
33
34    /*
35     * 提交留言
36     *
37    **/
38    $('[newsletter]').form({
39        url: '/api/web/newsletter',
40        end: function(data, f) {
41            if (data.ret == 1) {
42                f[0].reset();
43            }
44            jQ.alert({
45                str: data.msg,
46                init: function (a) {
47                    a.close.remove();
48                },
49                btn: 1
50            });
51        }
52    });
53
54});
55
56
57// 首页证书轮播
58$.extend({
59    // 判断移动端
60    mobile: function() {
61        var a = navigator.userAgent.toLowerCase(),
62            b = a.match(/ipad/) == 'ipad',
63            c = a.match(/iphone os/) == 'iphone os',
64            d = a.match(/midp/) == 'midp',
65            e = a.match(/rv:1.2.3.4/) == 'rv:1.2.3.4',
66            f = a.match(/ucweb/) == 'ucweb',
67            g = a.match(/android/) == 'android',
68            h = a.match(/windows ce/) == 'windows ce',
69            i = a.match(/windows mobile/) == 'windows mobile';
70        return b || c || d || e || f || g || h || i;
71    }
72});
73
74$.fn.extend({
75    // 鼠标移的距离
76    // $('.title').move('.div',{});
77    move: function(a, v) {
78        var thi = this;
79        if ($.isFunction($.fn.moveDIV)) {
80            thi.each(function(){
81                $(this).moveDIV(a, v);
82            });
83        } else {
84            $.jxinclude(jextpath + 'web/move.js', 1);
85            setTimeout(function() {
86                thi.move(a, v);
87            }, 200);
88        }
89        return thi;
90    },
91    // 鼠标移的距离
92    // $('.title').move('.div',{});
93    moveDIV: function(a, v) {
94        var thi = this;
95        var a = a || thi;
96        var mubiao = $(a);
97        var x, y, xx, yy, x0, y0, x1, y1, t0, w, h, l, t, start, end, left, top;
98        var down = $.mobile() ? 'touchstart' : 'mousedown';
99        var move = $.mobile() ? 'touchmove' : 'mousemove';
100        var up = $.mobile() ? 'touchend' : 'mouseup';
101        var v = $.extend({
102            not: 0
103        }, v);
104        thi.v = v;
105        this.find('input,textarea,[notmove]').on(down, function(e) {
106            e.stopPropagation();
107        });
108        this.addClass('notcopy').on(down, function(e0) {
109            if (v.box) {
110                var box = v.box==1?thi.parent():$(v.box);
111                v.boxs = {
112                    left: 0,
113                    top: 0,
114                    width: box.width() - mubiao.width(),
115                    height: box.height() - mubiao.height()
116                };
117            }
118            if (e0.which == 3) { //右键
119                return;
120            }
121            e0.preventDefault();
122            x = x0 = e0.pageX ? e0.pageX : e0.originalEvent.changedTouches[0].pageX;
123            y = y0 = e0.pageY ? e0.pageY : e0.originalEvent.changedTouches[0].pageY;
124            if ($.mobile() && e0.originalEvent.touches.length > 1) {
125                t0 = 1;
126                start = e0.originalEvent.touches;
127                var hy0 = 0, hy1 = 0;
128            } else {
129                t0 = 0;
130            }
131            w = $(window).width();
132            h = $(window).height();
133            var mx = $(a).css('transform').match(/matrix\(([^\)]*)\)/); //transform:matrix
134            if (mx) {
135                mx = mx[1].replace(/ /g,'').split(',');
136                l = parseInt(mx[4]);
137                t = parseInt(mx[5]);
138            } else {
139                l = 0;
140                t = 0;
141            }
142            $('body').addClass('notcopy');
143            if (typeof(v.down) == 'function') {
144                var down_status = v.down.call(thi,{x: 0, y: 0, left: l, top: t});
145            }
146            $(window).on(move, function(e1) { //window 还需要继续优化
147                if ($(a).is(':hidden')) {
148                    return;
149                }
150                if ($.mobile() && e1.originalEvent.touches.length > 1) {
151                    function distance(p1, p2) {
152                        var x = p2.pageX - p1.pageX,
153                            y = p2.pageY - p1.pageY;
154                        return Math.sqrt((x*x) + (y*y));
155                    }
156                    end = e1.originalEvent.touches;
157                    if (!hy0) hy0 = distance(start[0], start[1]);
158                    hy1 = distance(end[0], end[1]);
159                    var scale = hy0 > hy1 ? -0.05 : 0.05;
160                    if (hy0!=hy1 && typeof(v.scale) == 'function') {
161                        hy0 = hy1;
162                        v.scale(hy0 > hy1 ? -scale : scale);
163                    }
164                }
165                if (t0 || v.not) {
166                    return;
167                }
168                //x1 = e1.pageX ? e1.pageX : e1.originalEvent.changedTouches[0].pageX;
169                //y1 = e1.pageY ? e1.pageY : e1.originalEvent.changedTouches[0].pageY;
170                x1 = e1.pageX;
171                y1 = e1.pageY;
172                var xx0 = x > x1 ? -1 : (x == x1 ? 0 : 1);
173                var yy0 = y > y1 ? -1 : (y == y1 ? 0 : 1);
174                x = x1;
175                y = y1;
176                if (v.x && xx0 == 0) {
177                    return;
178                } else if (v.y && yy0 == 0) {
179                    return;
180                } else if (xx0 == 0 && yy0 == 0) {
181                    return;
182                }
183                xx = xx0;
184                yy = yy0;
185                if (v.boxs) {
186                    left = (l+x1-x0) < v.boxs.left ? v.boxs.left : (l+x1-x0);
187                    left = left > v.boxs.width ? v.boxs.width : left;
188                    top = (t+y1-y0) < v.boxs.top ? v.boxs.top : (t+y1-y0);
189                    top = top > v.boxs.height ? v.boxs.height : top;
190                } else {
191                    left = l + x1 - x0;
192                    top = t + y1 - y0;
193                }
194                if (typeof(v.move) == 'function') {
195                    var move_ = v.move.call(thi,{x: xx, y: yy, left: left, top: top});
196                    if (move_){
197                        top = move_.top || top;
198                        left = move_.left || left;
199                    }
200                }
201                if (v.x) {
202                    mx = 'matrix(1,0,0,1,'+left+',0)';
203                } else if (v.y) {
204                    mx = 'matrix(1,0,0,1,0,'+top+')';
205                } else {
206                    mx = 'matrix(1,0,0,1,'+left+','+top+')';
207                }
208                $(a).css({transform:mx});
209            }).off(up).on(up, function(e2) {
210                $(window).off(move);
211                $(window).off(down);
212                $(window).off(up);
213                if ($(a).is(':hidden')) {
214                    return;
215                }
216                t0 = 1;
217                $('body').removeClass('notcopy');
218                if (typeof(v.up) == 'function') {
219                    v.up.call(thi, {x: xx, y: yy, left: left, top: top});
220                }
221            });
222        });
223    }
224});
225
226// scroll
227/*
228var scroll = {
229	init: function(){
230		var a = this;
231		a.car_o = $('.carousel');
232		a.item = $('.carousel .item');
233		a.scr_o = $('.scroll-outer');
234		a.bar = $('.scroll-outer .scroll-btn');
235		a.item_length = a.item.length;
236
237		a.bar.move('',{
238			x: 1,
239			box: $('.scroll-outer'),
240			down: function(){
241				clearInterval(a.time);
242			},
243			move: function(s){
244				a.move(s);
245			},
246			up: function(s){
247				var thi = this;
248				//鼠标移开回调
249				var bar_box_w = a.scr_o.width() / a.item_length;    //获取滚动条盒子宽度
250				var j = Math.round(s.left / bar_box_w);
251				var w = j * bar_box_w;
252
253				a.time = setInterval(function(){
254					if(s.left < w){
255						s.left+=2;
256						if(s.left > w){
257							s.left = w;
258						}
259					}else if(s.left > w){
260						s.left-=2;
261						if(s.left < w){
262							s.left = w;
263						}
264					}else{
265						clearInterval(a.time);
266					}
267					console.log(a.time);
268					thi.v.move(s);
269					mx = 'matrix(1,0,0,1,'+s.left+',0)';
270					a.bar.css({transform : mx});
271				}, 10);
272			}
273		});
274		//滚动条宽度
275		a.bar_width();
276
277		//无限循环
278		a.copy();
279
280		//无限循环
281		a.move({left:0});
282	},
283	bar_width: function(){
284		var a = this;
285		var mw1 = a.item.width();
286		var sw1 = a.item_length * mw1;
287		var mw2 = a.scr_o.width() / sw1 * mw1;
288		a.bar.css({'width': mw2});
289	},
290	copy: function(){
291		var a = this;
292		var cop = [];
293
294		//复制一份
295		a.item.each(function(){
296			cop.push($(this).clone());
297			a.car_o.append($(this).clone());
298		});
299
300		//复制两份
301		for(var i = 0; i < cop.length; i++){
302			a.car_o.append(cop[i]);
303		}
304
305		var width = a.car_o.width() - a.item.width();
306		var mw1 = a.item.width() * a.item_length;
307		a.car_o.css({'left': -mw1 + parseFloat(width / 2)});
308	},
309	move: function(s){
310		var a = this;
311		//滚动距离
312		var w = a.item.width();
313		var w1 = a.item_length * a.item.width();
314		var w2 = a.scr_o.width();
315		//var w3 = a.item.width();
316		var x2 = s.left;        //滚动条位置
317		var x1 = x2*(w1/w2);
318		var bar_w = a.bar.width();
319		var bar_j = x2 / bar_w;
320
321		mx = 'matrix(1,0,0,1,-'+x1+',0)';
322		a.car_o.css({transform : mx});
323		var modify2 = 0, modify = 0;
324		for(var i = 0; i < (a.item_length*3); i++){
325			var j = i - a.item_length;
326			var slideProgress = j - bar_j;
327			var negative = slideProgress>0?1:-1;
328			// transform:scale(0.8) rotateY(-30deg);
329			var rotate = -slideProgress * 30;
330			// modify2 = slideProgress * w * (0.1 + (j - 2) * 0.05);
331
332			modify = slideProgress * w * 0.67; //+ slideProgress * w;
333			var translate = -modify + 'px';
334			var zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
335			var scale = 1 - Math.abs(slideProgress) * 0.4;
336			if(scale < 0.7){
337				scale = 0.7;
338			}
339			if(rotate > 30){
340				rotate = 30;
341			}else if(rotate < -30){
342				rotate = -30;
343			}
344			$('.carousel .item').eq(i).css({transform:' translateX(' + translate + ')', zIndex:zIndex}).find('div').css({transform:'scale(' + scale + ') rotateY('+rotate+'deg)'});
345
346			if(Math.abs(Math.round(slideProgress)) >= 4){
347				$('.carousel .item').eq(i).css({opacity: 0});
348			}else{
349				$('.carousel .item').eq(i).css({opacity: 1});
350			}
351		}
352	}
353};
354*/
355
356//产品样式效果
357$(function(){
358    $('.lang .btn').on('click', function(){
359        if($('.lang .list').hasClass('hide')){
360            $('.lang .list').removeClass('hide');
361        }else{
362            $('.lang .list').addClass('hide');
363        }
364    });
365
366    if($('#pro-detail').length>0){
367        console.log(1);
368        var galleryTop = new Swiper('.detail-img-top', {
369            pagination: '.swiper-pagination',
370            paginationClickable: true,
371            spaceBetween: 16,
372            navigation: {
373                nextEl: '.pro-detail-next',
374                prevEl: '.pro-detail-prev',
375            },
376            on: {
377                slideChangeTransitionStart: function () {
378                    galleryThumbs.slideTo(this.activeIndex);
379                    $(galleryThumbs.slides[this.activeIndex]).addClass('swiper-slide-active').siblings().removeClass('swiper-slide-active');
380                }
381            }
382        });
383        var galleryThumbs = new Swiper('.detail-img-thumbs', {
384            spaceBetween: 16,
385            slidesPerView: '3',
386            touchRatio: 0.2,
387            direction: 'vertical',
388            slideToClickedSlide: true,
389            breakpoints: {
390                750:{
391                    direction: 'horizontal',
392                    slidesPerView: 3,
393                },
394            },
395            on: {
396                init: function () {
397                    this.slides.on('click', function (e) {
398                        var i = $(this).index();
399                        galleryTop.slideTo(i);
400                        $(this).addClass('swiper-slide-active').siblings().removeClass('swiper-slide-active');
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.