PageSourceSearch

https://www.tainuofiberglassmesh.com/common/js/common.js

js tainuofiberglassmesh.com collected 2026-10-04 04:24:28 UTC 11,731 bytes, 353 lines download raw bytes

1;(function($){
2    $.fn.fix = function(options){
3        var defaults = {
4            float : 'left',
5			minStatue : false,
6			skin : 'blue',
7			durationTime : 1000	
8        }
9        var options = $.extend(defaults, options);		
10        this.each(function(){			
11			var thisBox = $(this),
12				closeBtn = thisBox.find('.close_btn' ),
13				show_btn = thisBox.find('.show_btn' ),
14				sideContent = thisBox.find('.side_content'),
15				sideList = thisBox.find('.side_list');	
16			var defaultTop = thisBox.offset().top;	//默top			
17			thisBox.css(options.float, 0);			
18			if(options.minStatue){
19				$(".show_btn").css("float", options.float);
20				sideContent.css({'width':0,'display':'none'});
21				show_btn.css('width', 37);				
22			}
23			$(window).bind("scroll",function(){
24				var offsetTop = defaultTop + $(window).scrollTop() + "px"; 
25	            thisBox.animate({
26	                top: offsetTop
27	            },
28	            {
29	                duration: options.durationTime,	
30	                queue: false
31	            });
32			});	
33
34			closeBtn.bind("click",function(){
35				sideContent.animate({width: '0px'},"fast");
36            	show_btn.stop(true, true).delay(300).animate({ width: '37px'},"fast");
37
38			});
39
40			 show_btn.click(function() {
41	            $(this).animate({width: '0px','display':'none'},"fast");
42	            sideContent.stop(true, true).delay(200).animate({ width: '166px'},"fast");
43	        });
44
45				
46
47        });	
48
49    };
50	//解决小语种表单不提交
51    if (!$('.ch_form').attr('action')) { $('.ch_form').attr('action','javascript:;') };
52    if (!$('.ch_forming').attr('action')) { $('.ch_forming').attr('action','javascript:;') };
53	if($('.hide_false')){$('.hide_false').remove();}
54})(jQuery);
55
56function makeMpdf(pdfName) {
57  if(confirm("Are you sure to download the PDF file?")){
58    var target = document.getElementsByClassName("pdfdiv")[0];
59    target.style.background = "#FFFFFF";
60    target.style.padding = "30px";
61    if(pdfName==''||pdfName==undefined) pdfName= getNowFormatDate();
62    
63    html2canvas(target, {
64        onrendered:function(canvas) {
65            var contentWidth = canvas.width;
66            var contentHeight = canvas.height;
67 
68            //一页pdf显示html页面生成的canvas高度;
69            var pageHeight = contentWidth / 592.28 * 841.89;
70            //未生成pdf的html页面高度
71            var leftHeight = contentHeight;
72            //页面偏移
73            var position = 0;
74            //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
75            var imgWidth = 595.28;
76            var imgHeight = 592.28/contentWidth * contentHeight;
77 
78            var pageData = canvas.toDataURL('image/jpeg', 1.0);
79 
80            var pdf = new jsPDF('', 'pt', 'a4');
81 
82            //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
83            //当内容未超过pdf一页显示的范围,无需分页
84            if (leftHeight < pageHeight) {
85            pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight );
86            } else {
87                while(leftHeight > 0) {
88                    pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
89                    leftHeight -= pageHeight;
90                    position -= 841.89;
91                    //避免添加空白页
92                    if(leftHeight > 0) {
93                      pdf.addPage();
94                    }
95                }
96            }
97            pdf.save(pdfName+".pdf");
98        }
99      })
100  }
101}
102function hideMsgPop(){$('.inquiry-pop-bd').fadeOut('fast')}
103function showMsgPop(){$('.inquiry-pop-bd').fadeIn('fast')}
104	if($('body .inquiry-form-wrap').length>0){
105		var webTop=$('body .inquiry-form-wrap').offset().top-80
106		$('.product-btn-wrap .email,.company_subscribe .button,.side_content .side_list .email').click(function(){
107			 $("html, body").animate({ scrollTop:webTop }, 1000);
108			 $(".ad_prompt").show().delay(3000).hide(300);
109			})
110		}else{
111// 		    $('.showquiry').click(function(){
112// 		    	$('.inquiry-pop-bd').fadeIn('fast')
113// 			})
114		}
115  
116 
117$('.stopPropagation').click(function(e) {e.stopPropagation();})
118 
119  var ajaxurl = '/wp-admin/admin-ajax.php';  
120 
121//$(document).click(function() {hideMsgPop()})
122function SendForm(addForm)
123{   
124 
125    var Form = $(addForm).parent().parent().parent(); 
126	
127    if(CheckPost(Form)) 
128    { 
129        var index = layer.load(1, {
130          shade: [0.1,'#fff'] //0.1透明度的白色背景
131        });
132		$.post(ajaxurl, $(Form[0]).serialize(), function(response) {
133		   var res = JSON.parse(response);
134		   switch(res.code){
135			   case 0: 
136					layer.msg('Information record failed', {
137                        icon: 2,
138                        time: 2000 
139                    });
140					break;
141				case 2: 
142					layer.msg('You have not submitted data', {
143                        icon: 2,
144                        time: 2000 
145                    });
146					break;
147				case 3: 
148					layer.msg('Email and phone cannot be empty at the same time.', {
149                        icon: 2,
150                        time: 2000 
151                    });
152					break;
153				case 4: 
154					layer.msg('The message cannot be empty.', {
155                        icon: 2,
156                        time: 2000
157                    });
158					break;
159				case 1: 
160					layer.closeAll('loading'); 
161					Form[0].reset();
162					hideMsgPop();
163					window.location.href = '/success.html'
164					break;
165				default: 
166					//layer.msg('Submitted successfully, customer service will contact you later.', {
167                    //   icon: 1,
168                    //    time: 2000 //2秒关闭(如果不配置,默认是3秒)
169                    //});
170					layer.closeAll('loading'); 
171					console.log(res.message);
172                    layer.msg('Network anomaly, please try again later', {
173                        icon: 2,
174                        time: 2000
175                    }); 
176					
177		   }
178		}); 
179    }
180}  
181function CheckPost(form) 
182{   
183   
184    var Fname = $(form[0].name);
185    var Femail = $(form[0].email);
186    var Fphone = $(form[0].phone);
187    var FMessage = $(form[0].message);  
188     console.log(Fname);
189	if (Fname.val() == "") 
190	{ 
191		 layer.msg('Name cannot be empty', {
192            icon: 2,
193            time: 2000 //2秒关闭(如果不配置,默认是3秒)
194        });
195		 Fname.focus();
196		 return false;
197	}
198	if (Femail.val() == "")
199	{ 
200		 layer.msg('The mailbox cannot be empty', {
201            icon: 2,
202            time: 2000 //2秒关闭(如果不配置,默认是3秒)
203        });
204		 Femail.focus();
205		 return false;
206	}else{ 
207         var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
208         //调用正则验证test()函数
209         isok= reg.test(Femail.val());
210           if(!isok) { 
211                layer.msg('The email format is incorrect, please reenter!', {
212                    icon: 2,
213                    time: 2000 //2秒关闭(如果不配置,默认是3秒)
214                });
215                Femail.focus();
216                return false;
217            } 
218	}
219	if (Fphone.val() == "")
220	{ 
221		 layer.msg('Phone cannot be empty', {
222            icon: 2,
223            time: 2000 //2秒关闭(如果不配置,默认是3秒)
224        });
225		 Fphone.focus();
226		 return false;
227	}
228	//else{
229	//	let phone = /^((13[0-9])|(14[5,7,9])|(15[^4])|(18[0-9])|(17[0,1,3,5,6,7,8]))[0-9]{8}$/
230	//	let ring = /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/
231	//	if(phone.test(Fphone.val()) || ring.test(Fphone.val())){
232			
233	//	}else{
234	//		layer.msg('The phone format is incorrect, please re-enter!', {
235    //                icon: 2,
236    //                time: 2000 //2秒关闭(如果不配置,默认是3秒)
237    //            });
238     //           Fphone.focus();
239     //           return false;
240	//	}
241          
242	//} 
243	if (FMessage.val() == "")
244	{ 
245		 layer.msg('FMessage cannot be empty', {
246            icon: 2,
247            time: 2000 //2秒关闭(如果不配置,默认是3秒)
248        });
249		 FMessage.focus();
250		 return false;
251	} 
252	return true;
253}
254
255//监控
256let isCooling = false; // 标记是否在冷却期
257// 初始化邮箱点击监听(事件委托方式)
258function setupEmailClickListener() {
259    // 监听整个文档的点击事件(事件委托)
260    document.addEventListener('click', function(event) {
261        // 获取被点击的元素
262        let target = event.target;
263
264        // 向上溯源,找到包含 mailto: 的 <a> 标签(处理图片/文字在<a>内部的情况)
265        while (target && (target.tagName).toLowerCase() !== 'a' && target !== document) {
266            target = target.parentElement;
267        }
268
269        // 判断是否是邮箱链接(href以mailto:开头)
270        if (target && (target.tagName).toLowerCase() === 'a' && target.href && target.href.startsWith('mailto:')) {
271            if (isCooling) return;
272            isCooling = true;
273            $.post('https://crm.cnmqh.com/api/website/addEmailClickLog', {url: window.location.href, email: target.href.replace('mailto:', '')}, function (res) {})
274            setTimeout(() => { isCooling = false; }, 3000);
275        }
276    });
277}
278
279// 页面加载完成后启动监听
280document.addEventListener('DOMContentLoaded', setupEmailClickListener);
281
282 
283$(document).ready(function() {
284    
285    $('.showquiry').click(function(){ 
286        showMsgPop()
287    })
288    
289
290    
291  $('.change-language .change-language-cont').append("<div class='change-empty'>Untranslated</div>")
292  $('.trp-language-wrap').append("<div class='lang-more'>More Language</div>")
293  if ($('body #trp-floater-ls-language-list').length > 0 && $('.change-language .prisna-wp-translate-seo').length < 1) {
294    $('#trp-floater-ls-language-list .trp-language-wrap').appendTo('.change-language .change-language-cont')
295    if ($('.change-language .change-language-cont .trp-language-wrap a').length > 0) {
296      $('.change-language .change-language-cont .change-empty').hide()
297      $('.change-language .change-language-cont .trp-language-wrap a').each(function(index) {
298        if (index > 14) {
299          $(this).addClass('lang-item lang-item-hide')
300          $('.change-language-cont').find('.lang-more').fadeIn()
301        } else {
302          $('.change-language-cont').find('.lang-more').fadeOut()
303        }
304      })
305      if ($('.change-language-cont .lang-more').length > 0) {
306        $('.change-language-cont .lang-more').click(function() {
307          if ($(this).parents('.change-language-cont').find('.trp-language-wrap a.lang-item').hasClass('lang-item-hide')) {
308            $(this).parents('.change-language-cont').find('.trp-language-wrap a.lang-item').removeClass('lang-item-hide')
309            $(this).addClass('more-active').text('x')
310          } else {
311            $(this).parents('.change-language-cont').find('.trp-language-wrap a.lang-item').addClass('lang-item-hide')
312            $(this).removeClass('more-active').text('More Language')
313          }
314        })
315      }
316    } else {
317      $('.change-language .change-language-cont .change-empty').fadeIn()
318    }
319  }
320  $("#trp-floater-ls").hide();
321  
322
323  
324  var swiperhoner = new Swiper('.page_honor',{
325    pagination: '.page_honor .swiper-pagination',   
326    paginationClickable: true,
327    slidesPerView: 4,
328    spaceBetween: 55,
329    // loop: true, 
330    // autoplay: 5000,
331    // speed: 500,
332    observer: true,
333    observeParents: true,
334    breakpoints: {
335        1440: {
336            slidesPerView: 4,
337            spaceBetween: 35,
338        },
339        1024: {
340            slidesPerView: 3,
341            spaceBetween: 40,
342        },
343        768: {
344            slidesPerView: 2,
345            spaceBetween: 40,
346        },
347        576: {
348            slidesPerView: 1,
349            spaceBetween: 20,
350        },
351    }
352    })
353})

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.