a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
");n.customDirectionNav?n.directionNav=n.customDirectionNav:n.controlsContainer?($(n.controlsContainer).append(e),n.directionNav=$("."+i+"direction-nav li a",n.controlsContainer)):(n.append(e),n.directionNav=$("."+i+"direction-nav li a",n)),f.directionNav.update(),n.directionNav.bind(o,function(e){e.preventDefault();var t;""!==l&&l!==e.type||(t=$(this).hasClass(i+"next")?n.getTarget("next"):n.getTarget("prev"),n.flexAnimate(t,n.vars.pauseOnAction)),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";1===n.pagingCount?n.directionNav.addClass(e).attr("tabindex","-1"):n.vars.animationLoop?n.directionNav.removeClass(e).removeAttr("tabindex"):0===n.animatingTo?n.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):n.animatingTo===n.last?n.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):n.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var e=$('
');n.controlsContainer?(n.controlsContainer.append(e),n.pausePlay=$("."+i+"pauseplay a",n.controlsContainer)):(n.append(e),n.pausePlay=$("."+i+"pauseplay a",n)),f.pausePlay.update(n.vars.slideshow?i+"pause":i+"play"),n.pausePlay.bind(o,function(e){e.preventDefault(),""!==l&&l!==e.type||($(this).hasClass(i+"pause")?(n.manualPause=!0,n.manualPlay=!1,n.pause()):(n.manualPause=!1,n.manualPlay=!0,n.play())),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(e){"play"===e?n.pausePlay.removeClass(i+"pause").addClass(i+"play").html(n.vars.playText):n.pausePlay.removeClass(i+"play").addClass(i+"pause").html(n.vars.pauseText)}},touch:function(){function e(e){e.stopPropagation(),n.animating?e.preventDefault():(n.pause(),t._gesture.addPointer(e.pointerId),T=0,c=d?n.h:n.w,f=Number(new Date),l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c)}function a(e){e.stopPropagation();var a=e.target._slider;if(a){var n=-e.translationX,i=-e.translationY;return T+=d?i:n,m=T,y=d?Math.abs(T)500)&&(e.preventDefault(),!p&&a.transitions&&(a.vars.animationLoop||(m=T/(0===a.currentSlide&&0>T||a.currentSlide===a.last&&T>0?Math.abs(T)/c+2:1)),a.setProps(l+m,"setTouch"))))}}function i(e){e.stopPropagation();var t=e.target._slider;if(t){if(t.animatingTo===t.currentSlide&&!y&&null!==m){var a=u?-m:m,n=a>0?t.getTarget("next"):t.getTarget("prev");t.canAdvance(n)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?t.flexAnimate(n,t.vars.pauseOnAction):p||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}r=null,o=null,m=null,l=null,T=0}}var r,o,l,c,m,f,g,h,S,y=!1,x=0,b=0,T=0;s?(t.style.msTouchAction="none",t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",e,!1),t._slider=n,t.addEventListener("MSGestureChange",a,!1),t.addEventListener("MSGestureEnd",i,!1)):(g=function(e){n.animating?e.preventDefault():(window.navigator.msPointerEnabled||1===e.touches.length)&&(n.pause(),c=d?n.h:n.w,f=Number(new Date),x=e.touches[0].pageX,b=e.touches[0].pageY,l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c,r=d?b:x,o=d?x:b,t.addEventListener("touchmove",h,!1),t.addEventListener("touchend",S,!1))},h=function(e){x=e.touches[0].pageX,b=e.touches[0].pageY,m=d?r-b:r-x,y=d?Math.abs(m)t)&&(e.preventDefault(),!p&&n.transitions&&(n.vars.animationLoop||(m/=0===n.currentSlide&&0>m||n.currentSlide===n.last&&m>0?Math.abs(m)/c+2:1),n.setProps(l+m,"setTouch")))},S=function(e){if(t.removeEventListener("touchmove",h,!1),n.animatingTo===n.currentSlide&&!y&&null!==m){var a=u?-m:m,i=a>0?n.getTarget("next"):n.getTarget("prev");n.canAdvance(i)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?n.flexAnimate(i,n.vars.pauseOnAction):p||n.flexAnimate(n.currentSlide,n.vars.pauseOnAction,!0)}t.removeEventListener("touchend",S,!1),r=null,o=null,m=null,l=null},t.addEventListener("touchstart",g,!1))},resize:function(){!n.animating&&n.is(":visible")&&(v||n.doMath(),p?f.smoothHeight():v?(n.slides.width(n.computedW),n.update(n.pagingCount),n.setProps()):d?(n.viewport.height(n.h),n.setProps(n.h,"setTotal")):(n.vars.smoothHeight&&f.smoothHeight(),n.newSlides.width(n.computedW),n.setProps(n.computedW,"setTotal")))},smoothHeight:function(e){if(!d||p){var t=p?n:n.viewport;e?t.animate({height:n.slides.eq(n.animatingTo).innerHeight()},e):t.innerHeight(n.slides.eq(n.animatingTo).innerHeight())}},sync:function(e){var t=$(n.vars.sync).data("flexslider"),a=n.animatingTo;switch(e){case"animate":t.flexAnimate(a,n.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=$(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=f.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){f.pauseInvisible.isHidden()?n.startTimeout?clearTimeout(n.startTimeout):n.pause():n.started?n.play():n.vars.initDelay>0?setTimeout(n.play,n.vars.initDelay):n.play()})}},isHidden:function(){var e=f.pauseInvisible.getHiddenProp();return e?document[e]:!1},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;tn.currentSlide?"next":"prev"),m&&1===n.pagingCount&&(n.direction=n.currentItemn.limit&&1!==n.visible?n.limit:S):h=0===n.currentSlide&&e===n.count-1&&n.vars.animationLoop&&"next"!==n.direction?u?(n.count+n.cloneOffset)*c:0:n.currentSlide===n.last&&0===e&&n.vars.animationLoop&&"prev"!==n.direction?u?0:(n.count+1)*c:u?(n.count-1-e+n.cloneOffset)*c:(e+n.cloneOffset)*c,n.setProps(h,"",n.vars.animationSpeed),n.transitions?(n.vars.animationLoop&&n.atEnd||(n.animating=!1,n.currentSlide=n.animatingTo),n.container.unbind("webkitTransitionEnd transitionend"),n.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(n.ensureAnimationEnd),n.wrapup(c)}),clearTimeout(n.ensureAnimationEnd),n.ensureAnimationEnd=setTimeout(function(){n.wrapup(c)},n.vars.animationSpeed+100)):n.container.animate(n.args,n.vars.animationSpeed,n.vars.easing,function(){n.wrapup(c)})}n.vars.smoothHeight&&f.smoothHeight(n.vars.animationSpeed)}},n.wrapup=function(e){p||v||(0===n.currentSlide&&n.animatingTo===n.last&&n.vars.animationLoop?n.setProps(e,"jumpEnd"):n.currentSlide===n.last&&0===n.animatingTo&&n.vars.animationLoop&&n.setProps(e,"jumpStart")),n.animating=!1,n.currentSlide=n.animatingTo,n.vars.after(n)},n.animateSlides=function(){!n.animating&&e&&n.flexAnimate(n.getTarget("next"))},n.pause=function(){clearInterval(n.animatedSlides),n.animatedSlides=null,n.playing=!1,n.vars.pausePlay&&f.pausePlay.update("play"),n.syncExists&&f.sync("pause")},n.play=function(){n.playing&&clearInterval(n.animatedSlides),n.animatedSlides=n.animatedSlides||setInterval(n.animateSlides,n.vars.slideshowSpeed),n.started=n.playing=!0,n.vars.pausePlay&&f.pausePlay.update("pause"),n.syncExists&&f.sync("play")},n.stop=function(){n.pause(),n.stopped=!0},n.canAdvance=function(e,t){var a=m?n.pagingCount-1:n.last;return t?!0:m&&n.currentItem===n.count-1&&0===e&&"prev"===n.direction?!0:m&&0===n.currentItem&&e===n.pagingCount-1&&"next"!==n.direction?!1:e!==n.currentSlide||m?n.vars.animationLoop?!0:n.atEnd&&0===n.currentSlide&&e===a&&"next"!==n.direction?!1:!n.atEnd||n.currentSlide!==a||0!==e||"next"!==n.direction:!1},n.getTarget=function(e){return n.direction=e,"next"===e?n.currentSlide===n.last?0:n.currentSlide+1:0===n.currentSlide?n.last:n.currentSlide-1},n.setProps=function(e,t,a){var i=function(){var a=e?e:(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo,i=function(){if(v)return"setTouch"===t?e:u&&n.animatingTo===n.last?0:u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:n.animatingTo===n.last?n.limit:a;switch(t){case"setTotal":return u?(n.count-1-n.currentSlide+n.cloneOffset)*e:(n.currentSlide+n.cloneOffset)*e;case"setTouch":return u?e:e;case"jumpEnd":return u?e:n.count*e;case"jumpStart":return u?n.count*e:e;default:return e}}();return-1*i+"px"}();n.transitions&&(i=d?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",a=void 0!==a?a/1e3+"s":"0s",n.container.css("-"+n.pfx+"-transition-duration",a),n.container.css("transition-duration",a)),n.args[n.prop]=i,(n.transitions||void 0===a)&&n.container.css(n.args),n.container.css("transform",i)},n.setup=function(e){if(p)n.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===e&&(r?n.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+n.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(n.currentSlide).css({opacity:1,zIndex:2}):0==n.vars.fadeFirstSlide?n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).css({opacity:1}):n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).animate({opacity:1},n.vars.animationSpeed,n.vars.easing)),n.vars.smoothHeight&&f.smoothHeight();else{var t,a;"init"===e&&(n.viewport=$('').css({overflow:"hidden",position:"relative"}).appendTo(n).append(n.container),n.cloneCount=0,n.cloneOffset=0,u&&(a=$.makeArray(n.slides).reverse(),n.slides=$(a),n.container.empty().append(n.slides))),n.vars.animationLoop&&!v&&(n.cloneCount=2,n.cloneOffset=1,"init"!==e&&n.container.find(".clone").remove(),n.container.append(f.uniqueID(n.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(f.uniqueID(n.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),n.newSlides=$(n.vars.selector,n),t=u?n.count-1-n.currentSlide+n.cloneOffset:n.currentSlide+n.cloneOffset,d&&!v?(n.container.height(200*(n.count+n.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){n.newSlides.css({display:"block"}),n.doMath(),n.viewport.height(n.h),n.setProps(t*n.h,"init")},"init"===e?100:0)):(n.container.width(200*(n.count+n.cloneCount)+"%"),n.setProps(t*n.computedW,"init"),setTimeout(function(){n.doMath(),n.newSlides.css({width:n.computedW,marginRight:n.computedM,"float":"left",display:"block"}),n.vars.smoothHeight&&f.smoothHeight()},"init"===e?100:0))}v||n.slides.removeClass(i+"active-slide").eq(n.currentSlide).addClass(i+"active-slide"),n.vars.init(n)},n.doMath=function(){var e=n.slides.first(),t=n.vars.itemMargin,a=n.vars.minItems,i=n.vars.maxItems;n.w=void 0===n.viewport?n.width():n.viewport.width(),n.h=e.height(),n.boxPadding=e.outerWidth()-e.width(),v?(n.itemT=n.vars.itemWidth+t,n.itemM=t,n.minW=a?a*n.itemT:n.w,n.maxW=i?i*n.itemT-t:n.w,n.itemW=n.minW>n.w?(n.w-t*(a-1))/a:n.maxWn.w?n.w:n.vars.itemWidth,n.visible=Math.floor(n.w/n.itemW),n.move=n.vars.move>0&&n.vars.moven.w?n.itemW*(n.count-1)+t*(n.count-1):(n.itemW+t)*n.count-n.w-t):(n.itemW=n.w,n.itemM=t,n.pagingCount=n.count,n.last=n.count-1),n.computedW=n.itemW-n.boxPadding,n.computedM=n.itemM},n.update=function(e,t){n.doMath(),v||(en.controlNav.length?f.controlNav.update("add"):("remove"===t&&!v||n.pagingCountn.last&&(n.currentSlide-=1,n.animatingTo-=1),f.controlNav.update("remove",n.last))),n.vars.directionNav&&f.directionNav.update()},n.addSlide=function(e,t){var a=$(e);n.count+=1,n.last=n.count-1,d&&u?void 0!==t?n.slides.eq(n.count-t).after(a):n.container.prepend(a):void 0!==t?n.slides.eq(t).before(a):n.container.append(a),n.update(t,"add"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.added(n)},n.removeSlide=function(e){var t=isNaN(e)?n.slides.index($(e)):e;n.count-=1,n.last=n.count-1,isNaN(e)?$(e,n.slides).remove():d&&u?n.slides.eq(n.last).remove():n.slides.eq(e).remove(),n.doMath(),n.update(t,"remove"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.removed(n)},f.init()},$(window).blur(function(t){e=!1}).focus(function(t){e=!0}),$.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},$.fn.flexslider=function(e){if(void 0===e&&(e={}),"object"==typeof e)return this.each(function(){var t=$(this),a=e.selector?e.selector:".slides > li",n=t.find(a);1===n.length&&e.allowOneSlide===!1||0===n.length?(n.fadeIn(400),e.start&&e.start(t)):void 0===t.data("flexslider")&&new $.flexslider(this,e)});var t=$(this).data("flexslider");switch(e){case"play":t.play();break;case"pause":t.pause();break;case"stop":t.stop();break;case"next":t.flexAnimate(t.getTarget("next"),!0);break;case"prev":case"previous":t.flexAnimate(t.getTarget("prev"),!0);break;default:"number"==typeof e&&t.flexAnimate(e,!0)}}}(jQuery);;// END OF /scripts/flexslider/jquery.flexslider-min.js
// STARTS OF /scripts/swiper.animate/swiper.animate1.0.2.min.js
//本插件由www.swiper.com.cn提供
function swiperAnimateCache(){for(allBoxes=window.document.documentElement.querySelectorAll(".ani"),i=0;i").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"Warning: No message defined for "+e.name+"")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
;jQuery.validator.addMethod("CellPhone", function (value, element, params) {
var reg = /^[1][358]\d{9}$/;
return this.optional(element) || reg.test(value.replace(/\s/ig,""));
}, "例13800138000");
jQuery.validator.addMethod("isTel", function (value) {
var tel = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/;
return value ? tel.test(value) : true;
}, "例0757-82345678");
jQuery.validator.addMethod("CkDN", function (value) {
var reg = /^([a-zA-Z0-9\u4e00-\u9fa5][-a-zA-Z0-9\u4e00-\u9fa5]{0,62}(\.[a-zA-Z0-9\u4e00-\u9fa5][-a-zA-Z0-9\u4e00-\u9fa5]{0,62})+\.?)/;
return value ? reg.test(value) : true;
}, "输入域名的域名不正确!");;// END OF /scripts/jQuery/jquery.validate.min.js
// STARTS OF /share/jquery.vticker-min.js
/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://plugins.jquery.com/project/vTicker
*/
(function (a) { a.fn.vTicker = function (b) { var c = { speed: 700, pause: 4000, showItems: 3, animation: "", mousePause: true, isPaused: false, direction: "up", height: 0 }; var b = a.extend(c, b); moveUp = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:first").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.animate({ top: "-=" + d + "px" }, e.speed, function () { a(this).children("li:first").remove(); a(this).css("top", "0px") }); if (e.animation == "fade") { f.children("li:first").fadeOut(e.speed); if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").hide().fadeIn(e.speed) } } h.appendTo(f) }; moveDown = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:last").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.css("top", "-" + d + "px").prepend(h); f.animate({ top: 0 }, e.speed, function () { a(this).children("li:last").remove() }); if (e.animation == "fade") { if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").fadeOut(e.speed) } f.children("li:first").hide().fadeIn(e.speed) } }; return this.each(function () { var f = a(this); var e = 0; f.css({ overflow: "hidden", position: "relative" }).children("ul").css({ position: "absolute", margin: 0, padding: 0 }).children("li").css({ margin: 0, padding: 0 }); if (b.height == 0) { f.children("ul").children("li").each(function () { if (a(this).height() > e) { e = a(this).height() } }); f.children("ul").children("li").each(function () { a(this).height(e) }); f.height(e * b.showItems) } else { f.height(b.height) } var d = setInterval(function () { if (b.direction == "up") { moveUp(f, e, b) } else { moveDown(f, e, b) } }, b.pause); if (b.mousePause) { f.bind("mouseenter", function () { b.isPaused = true }).bind("mouseleave", function () { b.isPaused = false }) } }) } })(jQuery);;// END OF /share/jquery.vticker-min.js
// STARTS OF /share/global.js
function isDomain(str){
if(/^[0-9a-z\.]+[0-9a-z\-0-9a-z]+[\.]+[0-9a-z]+$/.test(str)==false) return false;
else return true;
}
function isEmail(s){
var regx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regx.test(s);
}
function isTel(s){
var regx = /^(86\-)?\d{2,4}\-\d{6,10}(\-\d+)?$/;
return regx.test(s);
}
function isMobile(s){
var regx = /^(0)?(1)\d{10}$/;
// 非简体中文站走国际验证,只需验证是否按指定字符组合即可,不再验证格式
if (getCookie('Lang') != 'cn') {
regx = /^[\(\)\+\-\d]{8,17}$/;
}
return regx.test(s);
}
function isPostCode(s){
var regx = /^\d{6}$/;
return regx.test(s);
}
function isChinese(s){
var rxp = /^[\u4e00-\u9fa5]+$/g;
return rxp.test(s);
}
function isPostCode(str)
{
var reg = /^[0-9]{6}$/;
return (reg.test(str));
}
function isNumber(s)
{
var rxp = /^(-|\+)?\d+(\.\d+)?$/;
return rxp.test(s);
}
function isInt(s)
{
var rxp = /^\d+$/
return rxp.test(s);
}
function isIdCard(idCard) {
idCard = trim(idCard.replace(/ /g, "")); //去掉字符串头尾空格
if (idCard.length == 15) {
return isValidityBrithBy15IdCard(idCard); //进行15位身份证的验证
} else if (idCard.length == 18) {
var a_idCard = idCard.split(""); // 得到身份证数组
if (isValidityBrithBy18IdCard(idCard) && isTrueValidateCodeBy18IdCard(a_idCard)) { //进行18位身份证的基本验证和第18位的验证
return true;
} else {
return false;
}
} else {
return false;
}
}
function isValidityBrithBy15IdCard(idCard15) {
var year = idCard15.substring(6, 8);
var month = idCard15.substring(8, 10);
var day = idCard15.substring(10, 12);
var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
// 对于老身份证中的你年龄则不需考虑千年虫问题而使用getYear()方法
if (temp_date.getYear() != parseFloat(year)
|| temp_date.getMonth() != parseFloat(month) - 1
|| temp_date.getDate() != parseFloat(day)) {
return false;
} else {
return true;
}
}
function isTrueValidateCodeBy18IdCard(a_idCard) {
var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1]; // 加权因子
var ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2]; // 身份证验证位值.10代表X
var sum = 0; // 声明加权求和变量
if (a_idCard[17].toLowerCase() == 'x') {
a_idCard[17] = 10; // 将最后位为x的验证码替换为10方便后续操作
}
for (var i = 0; i < 17; i++) {
sum += Wi[i] * a_idCard[i]; // 加权求和
}
valCodePosition = sum % 11; // 得到验证码所位置
if (a_idCard[17] == ValideCode[valCodePosition]) {
return true;
} else {
return false;
}
}
function isValidityBrithBy18IdCard(idCard18) {
var year = idCard18.substring(6, 10);
var month = idCard18.substring(10, 12);
var day = idCard18.substring(12, 14);
var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
// 这里用getFullYear()获取年份,避免千年虫问题
if (temp_date.getFullYear() != parseFloat(year)
|| temp_date.getMonth() != parseFloat(month) - 1
|| temp_date.getDate() != parseFloat(day)) {
return false;
} else {
return true;
}
}
function trim(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function GetEvent(){
if(document.all) return window.event;//如果是ie
func = GetEvent.caller;
while(func != null){
var arg0 = func.arguments[0];
if(arg0)
{
if((arg0.constructor == Event || arg0.constructor == MouseEvent) ||(typeof(arg0) == "object" && arg0.preventDefault && arg0.stopPropagation))
{
return arg0;
}
}
func = func.caller;
}
return null;
}
//trim()
String.prototype.trim = function() {
return (this.replace(/^\s+|\s+$/g,""));
}
//ltrim()
String.prototype.ltrim = function() {
return (this.replace(/^\s*/,""));
}
//rtrim()
String.prototype.rtrim = function() {
return (this.replace(/\s*$/,""));
}
//delete html tags
String.prototype.stripTags = function() {
return this.replace(/<\/?[^>]+>/gi, '');
}
function numberCeil(num, digit) {
digit = parseInt(digit);
if (isNaN(digit)) {
digit = 0;
}
if (digit < 0)
throw Exception('digit must be greater or equal than 0');
var scale = 1;
for (var i = 0; i < digit; i++) {
scale *= 10;
}
return Math.ceil(num * scale) / scale;
}
//重载 setTimeout
var _st = window.setTimeout;
window.setTimeoutEx = function(fRef, mDelay)
{
if(typeof(fRef) == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu);});
return _st(f, mDelay);
}
return _st(fRef,mDelay);
}
// end of 重载 setTimeout
//重载 setInterval
var _setInterval = window.setInterval;
window.setIntervalEx = function(fRef, mDelay)
{
if(typeof(fRef) == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu);});
return _setInterval(f, mDelay);
}
return _setInterval(fRef,mDelay);
}
// end of 重载 setInterval
/*
Cookie 相关函数
*/
function getCookieVal(offset)
{
var endstr = document['coo'+'kie'].indexOf (";", offset);
if (endstr == -1) endstr = document['coo'+'kie'].length;
return unescape(document['coo'+'kie'].substring(offset, endstr));
}
function getCookie(cname)
{
var all = document['coo'+'kie'];
var cookie = {};
var list = all.split("; ");
for (var i = 0; i < list.length; i++) {
var temp = list[i];
var pos = temp.indexOf("=");
var name = temp.substring(0, pos);
var value = temp.substring(pos + 1);
try{
value = decodeURIComponent(value);
}catch(ex){
console.log(ex);
}
cookie[name] = value;
}
var result = cookie[cname];
if (result === "" || result === null || typeof result == "undefined") {
result = sessionStorage.getItem(cname);
}
if (result === "" || result === null || typeof result == "undefined") {
result = localStorage.getItem(cname);
}
return result;
}
function SetCookie(name, value) {
var argv = arguments;
var argc = arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : "/";
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
var cok = 'coo' + 'kie'; //为了处理坑爹的安全检测的误报
document[cok] = name + "=" + escape(value) +
((expires == null) ? "" : (typeof expires === "number" ? "; max-age=" + expires : "; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
";SameSite=Lax" +
((secure == true) ? "; secure" : "");
if (!expires) sessionStorage.setItem(name,value);
else localStorage.setItem(name,value);
}
if(typeof setCookie == 'undefined') setCookie = SetCookie;
/*
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); //一年后过期
SetCookie("WebTongCid", WebTongCid, expdate ,"/");
*/
//** end of Cookie 相关函数
if(typeof(formatColorHex) == 'undefined'){
function formatColorHex(color) {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
/*RGB颜色转换为16进制*/
if (/^(rgb)/i.test(color)) {
var aColor = color.replace(/(?:\(|\)|rgb)*/gi, "").split(",");
var strHex = "#";
for (var i = 0; i < aColor.length; i++) {
var hex = Number(aColor[i]).toString(16);
if (hex.length == 1) {
hex = "0" + hex;
} //问题出在这里
if (hex === "0") {
hex += hex;
}
strHex += hex;
}
if (strHex.length !== 7) {
strHex = color;
}
return strHex;
} else if (reg.test(color)) {
var aNum = color.replace(/#/, "").split("");
if (aNum.length === 6) {
return color;
} else if (aNum.length === 3) {
var numHex = "#";
for (var i = 0; i < aNum.length; i += 1) {
numHex += (aNum[i] + aNum[i]);
}
return numHex;
}
} else {
return color;
}
}
}
//动态加载 jscript
window.addedScript = {};
function addScript(path,callback,afterPageLoaded) {
if(window.ScriptCdn) {
if(!/^((https?:\/\/)|(\/\/))/i.test(path)) path = window.ScriptCdn + path;
}
if(window.addedScript[path]){
if(window.addedScript[path]== -1 && typeof callback == 'function'){
setTimeout(function(){addScript(path,callback,afterPageLoaded)},50);
return;
}
if(window.addedScript[path] == 1){
console.log(path + " have already loaded ");
if (typeof callback == 'function') callback();
return;
}
}
window.addedScript[path] = -1;
function addfun(){
var fileref = document.createElement("script")
fileref.type = "text/javascript";
fileref.src = path;
if (typeof fileref.onload != 'undefined') {
fileref.onload = function(){
window.addedScript[path] = 1;
if (typeof callback == 'function') callback();
};
}
else {
fileref.onreadystatechange = function () {
if (this.readyState == "loaded" || this.readyState == "complete") {
window.addedScript[path] = 1;
if (typeof callback == 'function') callback();
}
};
}
var headobj = document.getElementsByTagName('head')[0];
headobj.appendChild(fileref);
};
if(afterPageLoaded){
if(window.addEventListener) window.addEventListener('load', function(){ addfun(); }, false);
else window.attachEvent('onload', function(){ addfun(); });
}else addfun();
}
//动态加载一大波 jscript,保证按顺序加载
function addScripts(paths, callback, afterPageLoaded) {
paths = paths || [];
var lastCb = callback;
for (var i = 0; i < paths.length; i++) {
lastCb = (function () {
var path = paths[paths.length - 1 - i];
var cb = lastCb;
var afterPageLoaded1 = afterPageLoaded;
return function () {
addScript(path, cb, afterPageLoaded1);
}
})(i);
}
lastCb();
}
window.addedCss = {};
function loadStyleSheet(path,afterPageLoaded){
if(window.ScriptCdn) {
if(!/^((https?:\/\/)|(\/\/))/i.test(path)) path = window.ScriptCdn + path;
}
if(window.addedCss[path]){
console.log(path + " have already loaded ");
return;
}
if(afterPageLoaded) $(window).load(function(){ $('').appendTo('head'); });
else $('').appendTo('head');
window.addedCss[path] = true;
}
//判断一个变量是否是对象
function isObject(obj) {
if (obj && typeof obj == "object" && (obj instanceof Array) == false) {
return true;
}
return false;
}
//判断一个变量是否是数组
function isArray(obj) {
if (obj && typeof obj == "object" && (obj instanceof Array) == true) {
return true;
}
return false;
}
(function ($) {
$.fn.extend({
"addrSelector":function(options){
var defaults = {
loadDefaultAddr: null,
selectAddr: $.noop,
createNewAddr: $.noop,
selectedAddrID: 0,
isShowIdCardNo: false,
isManagePage:false//是不是地址管理页面 by hui
};
var opts = $.extend({}, defaults, options);
return this.each(function () {
if (typeof opts.loadDefaultAddr == 'function') {
$.getJSON('/index.php?c=front/Useraddr&a=GetDefaultAddr', {}, function (json) {
if (!json.success) {
alert(json.msg);
return;
}
opts.loadDefaultAddr(json.addr);
if (json && json.addr && !isNaN(Number(json.addr.ID)) && parseInt(json.addr.ID) > 0) {
opts.selectedAddrID = parseInt(json.addr.ID);
}
});
}
if(opts.isManagePage){
getUserAddrList(opts);
}else{
$(this).off('click.showAddrSelector').on('click.showAddrSelector', function () {
getUserAddrList(opts);
})
}
});
}
});
var getUserAddrList = function(opts){
if ($('#userAddrContent').length == 0) {
$.extend({
selectAddr: function (addr) {
if (typeof opts.selectAddr == 'function')
opts.selectAddr(addr);
},
createNewAddr: function (addr) {
if (typeof opts.createNewAddr == 'function')
opts.createNewAddr(addr);
},
selectedAddrID: opts.selectedAddrID,
isShowIdCardNo: opts.isShowIdCardNo,
isManagePage:opts.isManagePage
});
$.ajax({
type: 'get',
url: '/index.php?c=front/Useraddr',
dataType: 'html',
success: function (msg) {
$(msg).hide().appendTo('body');
$('#userAddrContent').stop().fadeIn();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
}
})
} else {
// $('#userAddrContent .addrList .addr .selectbtn').css('display','none');
// $('#userAddrContent .addrList .addr[addrID=' + $.selectedAddrID + '] .selectbtn').css('display','inline-block');
$('#userAddrContent .addrList .addr .select-status').hide();
$('#userAddrContent .addrList .addr[addrID=' + $.selectedAddrID + '] .select-status').show();
$('#userAddrContent').stop().fadeIn();
}
};
})(window.jQuery);
(function ($) {
$.fn.extend({
"districtSeletor": function (options) {
if (options == 'setValue') {
dataBind(arguments[1] || {}, this);
return this;
} else {
return this.each(function () {
var opts = $.extend({}, defaults, options);
var $this = $(this);
var sHtml = '';
sHtml = ''
sHtml += '';
sHtml += '';
sHtml += '';
sHtml += '';
$this.html(sHtml).addClass('districtSelector')//.attr('relid=' + relid);
if (opts.showCountry) {
$this.find('.level1').show();
} else {
$this.find('.level1').hide();
}
$this.find('.level1').on('change', function () {
if ($(this).val() == 1) {
$(this).nextAll('select').show();
getNextLevelList(this);
} else {
$(this).nextAll('select').hide();
}
})
$this.find('.level2, .level3').on('change', function () {
getNextLevelList(this);
});
dataBind(opts, $this);
});
}
}
});
var defaults = {
countryID: 1,
provinceID: null,
cityID: null,
districtID: null,
showCountry: 1
};
var getNextLevelList = function (selectElem) {
selectElem = $(selectElem);
var id = parseInt(selectElem.val());
if (isNaN(id)) return;
var level = parseInt(selectElem.attr('level'));
selectElem.nextAll('select').html('');
if (id <= 0) return;
$.ajax({
type: 'get',
url: '/index.php?c=front/district&a=getChildrenList',
data: { act: 'getChildrenList', id: id },
async: false,
dataType: 'json',
success: function (json) {
if (!json.success) {
alert(json.msg);
return;
}
var targetSelectElem = selectElem.nextAll('.level' + (level + 1));
var list = json.list || [];
for (var i = 0; i < list.length; i++) {
targetSelectElem.append('');
}
if (list.length == 0) {
targetSelectElem.hide();
targetSelectElem.nextAll('.level' + (level + 2)).hide();
targetSelectElem.nextAll('.level' + (level + 3)).hide();
} else {
targetSelectElem.show();
targetSelectElem.nextAll('.level' + (level + 2)).show();
targetSelectElem.nextAll('.level' + (level + 3)).show();
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
}
})
};
var dataBind = function (opts, $this) {
if (opts.countryID && parseInt(opts.countryID) > 0) {
$this.find('.level1').val(opts.countryID).change();
} else {
$this.find('.level1').val(-1).change();
}
if (opts.provinceID && parseInt(opts.provinceID) > 0) {
$this.find('.level2').val(opts.provinceID).change();
}
if (opts.cityID && parseInt(opts.cityID) > 0) {
$this.find('.level3').val(opts.cityID).change();
}
if (opts.districtID && parseInt(opts.districtID) > 0) {
$this.find('.level4').val(opts.districtID).change();
}
};
$.fn.districtSeletor.setValue = function (opts) {
dataBind(opts);
}
})(window.jQuery);
// 获取当前页面url参数
if (!window.location.getQueryString) window.location.getQueryString = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return (r[2]); return null;
}
var Base64 = {
// private property
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode: function(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode: function(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode: function(utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
};// END OF /share/global.js
// STARTS OF /share/JScript.js
var illegalHash = false;
var WeixinPupoplistdata = {}
if (location.hash && (location.hash.indexOf("<") > -1 || location.hash.indexOf("%3C") > -1)) {
location.hash = "";
alert('不允许的location.hash');
location.href = location.pathname + location.search;
illegalHash = true;
}
$(function () {
loadStyleSheet('/share/jquery.mCustomScrollbar.css');
//处理A标签以通过google的的检测 https://pagespeed.web.dev/report?url=URL&form_factor=desktop
var innerfunc = function () {
$("a").each(function (index, item) {
if (($(item).attr('href') && $(item).attr('href').indexOf('javascript:') > -1) || $(item).attr('href') === '') {
if ($(item).attr('href').indexOf('javascript:') > -1) {
var tmp = $(item).attr('href')
//如果是悬停弹出的
var r = /javascript\:hoverPupop\(\d+\)\;?/i;
if (r.test(tmp) == true) {
//禁止点击
$(item).off('click');
if (CanDesign == 'False') {
//增加鼠标悬停事件
var ModuleID = tmp.replace(/[^\d]/g, '');
var module = $('#module_' + ModuleID);
var module_clone = $('.module_' + ModuleID + '_clone');
if (module_clone.length == 0) {
var module_clone = module.clone().addClass('ModuleHoverPupop module_' + ModuleID + '_clone').prependTo($('body'))
module_clone.find('img').each(function (index, item) {
if ($(item).attr('data-src') && $(item).attr('data-src') != $(item).attr('src')) {
$(item).attr('src', $(item).attr('data-src'));
$(item).removeAttr('data-src');
$(item).css("background", "none")
}
})
module.remove()
}
var hoverobj = item
if ($(item).parent().hasClass('BodyCenter')) {
hoverobj = $(item).parent()[0]
}
hoverobj.addEventListener("mouseenter", function (e) {
if (module_clone.length > 0) {
module_clone.css({ 'position': 'relative', 'z-index': '100000' })
if (!module_clone.is(":visible")) showPupop(ModuleID)
var top = $(hoverobj).offset().top
var objheight = $(hoverobj).outerHeight(true)
var objwidth = $(hoverobj).outerWidth(true) / 2
var PupopContainerwidth = module_clone.find('.ModulePupopContainer' + ModuleID).outerWidth(true) / 2
var left = $(hoverobj).offset().left - PupopContainerwidth + objwidth
var pupopposition = module_clone.find('.ModulePupopContainer' + ModuleID).attr('pupopposition')
if (pupopposition == 1) {
top = top + objheight + (module_clone.find('.ModulePuponArrow').hasClass('PosTop') ? 21 : 0)
} else {
top = top - module_clone.find('.ModulePupopContainer' + ModuleID).outerHeight(true) - (module_clone.find('.ModulePuponArrow').hasClass('PosBottom') ? 21 : 0)
}
var cssstr = { 'top': Number(top) + 'px', left: Number(left) + 'px', transform: 'none' }
module_clone.find('.ModulePupopContainer' + ModuleID).css(cssstr)
module_clone.find('.ModulePupopGiant').css('background-color', 'transparent')
}
})
hoverobj.addEventListener("mouseleave", function () {
window["timeout" + ModuleID] = setTimeout(() => {
module_clone.hide();
}, 500);
})
if (module_clone.find('.ModulePupopContainer' + ModuleID)[0] != undefined) {
module_clone.find('.ModulePupopContainer' + ModuleID)[0].addEventListener("mouseenter", function () {
clearTimeout(window["timeout" + ModuleID])
})
module_clone.find('.ModulePupopContainer' + ModuleID)[0].addEventListener("mouseleave", function () {
module_clone.hide();
})
}
}
} else {
$(item).data('javascript', tmp)
item.addEventListener("click", function () {
eval(tmp.replace('javascript:', ''))
})
}
}
$(item).removeAttr('href');
$(item).attr('name', 'a' + parseInt(Math.random() * 10000));
}
if (!item.hasAttribute('href') && !item.hasAttribute('name')) {
$(item).attr('name', 'a' + parseInt(Math.random() * 10000));
}
});
}
innerfunc();
for (var m = 1; m < 10; m++) setTimeout(innerfunc, 100 * m);
processUETableResponsive();
loadWeixinPupopList()
window.addEventListener('load', function () {
if (getCookie("SiteType") == "1") {
$(window).resize(function (e) {
if (e.target === window) {
showhideNav();
computeFreeModulePosition();
computeJiuGondHeight();
}
});
showhideNav();
$(window).load(function () {
computeFreeModulePosition();
});
}
})
//加载公共分享的组件
if ($('.sharebox').length > 0) {
addScript('/share/social-share/social-share.js')
addScript('/scripts/jQPlugins/qrcode/qrcode.js')
addScript('/scripts/jQPlugins/qrcode/jquery.qrcode.js')
addScript('/skinp/common/mobile/js/html2canvas.js')
}
$(window).load(function () {
initHoverAnimate();
clearwatermark()
getGridsFixedTop()
});
doSomeWhanPreview();
keepFullScreenModules100Width();
//广告
if ($("#ChargeTips").height()) {
$("body > .ModuleItem").each(function (i, item) {
$(item).css("top", parseInt($(item).css("top")) + $("#ChargeTips").height());
});
}
setMobileNav();
matchNavAndFootNavBgColor();
setModuleCls();
NewsList();
TopNewLoad();
BindPagerAction(); //接管模块的分页链接,用ajax请求
SetImageWidth();
setZonePadding();
var $container = $('.masonry-container');
if ($container.length > 0) {
$container.imagesLoaded(function () {
$container.masonry({
columnWidth: '.productItem',
itemSelector: '.productItem'
});
});
}
replaceNewShopUrl(); // 强行改变建站的URL
clearCancelorRedoData();
timeRemindfunc();
});
function processUETableResponsive() {
$(".uetable").each(function (index, table) {
if ($(table).hasClass("uetable-mobile-1") || $(table).hasClass("uetable-mobile-2")) {
var html = "";
var oTable = $(html);
if ($(table).hasClass("uetable-mobile-1")) oTable.addClass("uetable-mobile-responsive-1");
if ($(table).hasClass("uetable-mobile-2")) oTable.addClass("uetable-mobile-responsive-2");
oTable.insertAfter(table);
//var row = $("#" + rowId);
var tds = $(table).find("td");
// 定义接收数据的空数组
var tdsGroup = [];
// num 控制几个为一组
var num = $(table).hasClass("uetable-mobile-2") ? 2 : tds.length;
for (var i = 0; i < tds.length; i += num) {
tdsGroup.push(tds.slice(i, i + num));
}
tdsGroup.forEach(function (row, rowIndex) {
var rowId = "uetable-row-" + (parseInt(Math.random() * 1000000));
var oRow = $("
");
oTable.append(oRow);
row.each(function (colIndex, td) {
var className = "col-xs-12";
var border = "border:" + $(td).css("border") + ";";
var textAlign = "text-align:" + $(td).css("text-align") + ";";
var verticalAlign = "vertical-align:" + $(td).css("vertical-align") + ";";
var background = "background:" + $(td).css("background") + ";";
var padding = "padding:" + $(td).css("padding") + ";";
var orderElse = "";
var flex = "";
if ($(table).hasClass("uetable-mobile-2")) {
className = "col-xs-6";
if (rowIndex > 0) orderElse = "border-top:none;";
if (colIndex % 2 > 0) orderElse += "border-left:none;";
flex = "display: flex;";
flex += "justify-content:" + $(td).css("text-align").replace("-webkit-", "") + ";"
if ($(td).css("vertical-align") == 'middle') flex += "align-items:center;"
if ($(td).css("vertical-align") == 'bottom') flex += "align-items:end;"
}
if ($(table).hasClass("uetable-mobile-1")) {
if (colIndex > 0) orderElse = "border-top:none;";
}
if (!$(table).hasClass("uetable-mobile-showborder")) {
border = "border:none;";
}
oRow.append("
" + td.outerHTML + "
");
});
});
}
});
}
function initScroll() {
window['curAnchorClick'] = false; // 判断是否为点击事件,以阻塞滚动、滚轮事件
window['curMobileNavClick'] = false;
// 获取当前页面url
// 对 url 进行相应处理
var urlParam = window.location.href.toString().split("//");
window['currUrlPath'] = urlParam[1].substring(urlParam[1].indexOf("/"));
// 过滤可能存在的 ? 后携带参数
if (window['currUrlPath'].indexOf('?') !== -1) {
window['currUrlPath'] = window['currUrlPath'].split('?')[0];
}
// 过滤可能存在的 # 后携带参数
if (window['currUrlPath'].indexOf('#') !== -1) {
window['currUrlPath'] = window['currUrlPath'].split('#')[0];
}
if (window['currUrlPath'] == '/index.php') {
window['currUrlPath'] = '/';
}
window['anchorVieArrOld'] = [];
window['anchorVieArr'] = [];
// 初始化时对当前可视区域锚点高亮
onAnchorActive();
onAnchorClick();
onAnchorDblClick();
onLoadScroll();
onMousewheel();
onMobileTouch();
}
var anchorInterval = null, // 锚点滚动定时器
viewH = $(window).height(); //可见高度
function getGridsFixedTop() {
var FixedTop = 0
var GridCustomList = $('#BodyMainZoneContainer').find('.GridCanFloat');
for (var i = 0; i <= GridCustomList.length - 1; i++) {
var GridCustom = $(GridCustomList[i]).closest('.ModuleItem')
if (GridCustom.attr('floattype') != 2) {
var ModuleItemHeight = GridCustom.height()
if (FixedTop < ModuleItemHeight) FixedTop = ModuleItemHeight
}
}
if (typeof (CanDesign) == 'undefined' || CanDesign != "True") {
var TopColumn = $('#BodyMainZoneContainer').find('.ModuleTopColumnContainer')
for (var i = 0; i <= TopColumn.length - 1; i++) {
if (FixedTop < $(TopColumn[i]).height()) FixedTop = $(TopColumn[i]).height()
}
}
var stickobj = $('#BodyMainZoneContainer').find('.ModuleSubGridCustomBox.sticky');
for (var i = 0; i <= stickobj.length - 1; i++) {
$(stickobj[i]).closest('.ModuleGridCustomContainer').addClass('sticky')
}
$('#BodyMainZoneContainer').find('.ModuleSubGridCustomBox.sticky').css('top', FixedTop + 'px');
}
// 获取锚点ModuleID
function getAnchorMID(href) {
if (href == '') return false;
href = href.toString();
var tempArr = href.match(/module_(\d+)/i);
return tempArr != null ? tempArr : false;
}
// 锚点或导航高亮
function onAnchorActive(id, delta) {
try {
var scroH = $(document).scrollTop(); //滚动高度
window['anchorVieArrOld'] = window['anchorVieArr'] ? window['anchorVieArr'] : [];
window['anchorVieArr'] = [];
// 获取当前可视区域锚点集合
$('.ModuleAnchorGiant').each(function () {
var itemOffTop = parseInt($(this).parent('.ModuleItem').offset().top);
if (itemOffTop >= scroH && itemOffTop <= (scroH + viewH)) {
window['anchorVieArr'].push($(this).parent('.ModuleItem').attr('id').replace('module_', ''));
}
});
if (!id) {
var index = 0;
if (window['anchorVieArr'].length > 0) {
index = $.inArray(window['anchorVieID'], window['anchorVieArr']);
if (delta != '') {
index = delta > 0 ? index + 1 : index - 1;
} else {
index = window['oldScroH'] < scroH ? index + 1 : index - 1;
}
}
index = index < 0 ? 0 : (index >= window['anchorVieArr'].length ? (window['anchorVieArr'].length - 1) : index);
id = window['anchorVieID'] = window['anchorVieArr'][index];
}
id = id ? id.replace('module_', '') : id;
// 锚导航高亮
$('.ModuleAnchorTextGiant a').each(function () {
if ($(this).attr('dataid') == id) {
$(this).closest('ul').find('.active').removeClass('active');
$(this).addClass('active');
$(this).parent('li').addClass('active');
}
});
// PC导航高亮
$('.ModuleNavGiant a').each(function () {
var hrefID = getAnchorMID($(this).attr('href'));
if (hrefID) {
if (hrefID[1] == id) {
var ModuleID = $(this).closest('.ModuleItem').attr('id').replace('module_', '')
$(this).closest('.main-nav-content').find('.main-nav-item').removeAttr('iscurrent');
$(this).closest('.main-nav-content').find('.on').removeClass('on');
$(this).closest('.main-nav-content').find('.main-nav-item-hover').removeClass('main-nav-item-hover');
$(this).closest('.main-nav-content').find('.navMainItemHover').removeClass('navMainItemHover');
$(this).closest('.main-nav-item-group').find('.main-nav-item').addClass('main-nav-item-hover');
$(this).closest('.main-nav-item-group').find('.main-nav-item').addClass('navMainItemHover');
$(this).closest('.main-nav-item-group').find('.main-nav-item').attr('iscurrent', 1);
$(this).closest('.main-nav-item-group').parent().addClass('on');
if ($("#navBorderTop" + ModuleID).length > 0) {
var css = { "left": ($(this)[0]).offsetLeft + "px", "width": $(this).width() + 'px' };
$("#navBorderTop" + ModuleID).css(css);
$("#navBorderTop_Clone" + ModuleID).css(css);
}
}
}
});
// Mobile导航高亮
$('.ModuleMobileNavGiant a').each(function () {
var hrefID = getAnchorMID($(this).attr('href'));
if (hrefID && window['curAnchorClick']) { //不是点击不用高亮,避免在PC滚动时收起面板
if (hrefID[1] == id) {
if ($('.containers.view-change').length > 0) {
$(this).closest('#accordion').find('.active').removeClass('active');
$(this).parent().addClass('active');
$('.lcbody').click();
$('.containers').removeClass('view-change');
}
}
}
});
} catch (e) { }
}
// 处理锚点点击事件
function handleAnchorClick(curHref, target, evt) {
var tempArr = curHref.split('#');
// 过滤可能存在的 ? 后携带参数
if (tempArr[0].indexOf('?') > -1) tempArr[0] = tempArr[0].split('?')[0];
if (window['currUrlPath'].indexOf(getCookie('Lang')) > -1 && tempArr[0] == '/' && tempArr[0].indexOf(getCookie('Lang')) < 0)
tempArr[0] = window['currUrlPath'];
var AnchorMID = getAnchorMID(curHref);
// 当前页面且是锚点不触发浏览器添加链接的冒泡
if (AnchorMID && (window.location.href.toString().indexOf(tempArr[0]) > -1 || tempArr[0] == window['currUrlPath'])) {
if ($("#" + AnchorMID[0]).length > 0) {
if (evt && evt.preventDefault) evt.preventDefault();
else window.event.returnValue = false;
window['curAnchorClick'] = true;
onAnchorActive(AnchorMID[0]);
// 移动端无法触发滚动条只能直接跳转
if (window.innerWidth < 768) {
window.location.href = "#" + AnchorMID[0];
window['curAnchorClick'] = false;
} else {
var firsttop = $("#" + AnchorMID[0]).offset().top
$('html,body').animate({ scrollTop: $("#" + AnchorMID[0]).offset().top }, 1000, 'linear', function () {
window['curAnchorClick'] = false;
});
//解决延时加载导致的高度问题
var aa = setInterval(function () {
if (firsttop != $("#" + AnchorMID[0]).offset().top) {
$('html,body').animate({ scrollTop: $("#" + AnchorMID[0]).offset().top }, 1000, 'linear', function () {
window['curAnchorClick'] = false;
clearInterval(aa);
});
}
else {
clearInterval(aa);
}
}, 1000)
}
} else {
if (target == '_blank') window.open(curHref);
else window.location.href = curHref;
}
} else {
if (target == '_blank') window.open(curHref);
else window.location.href = curHref;
}
return false;
}
// 监听滚轮事件,目前只为给锚点高亮
function onMousewheel() {
$(window).bind('mousewheel', function (event) {
var delta = -event.originalEvent.wheelDelta || event.originalEvent.detail; //firefox使用detail:下3上-3,其他浏览器使用whe
if (anchorInterval) clearTimeout(anchorInterval);
anchorInterval = setTimeout(onAnchorActive(0, delta), 200);
});
}
// 监听滚动事件,目前只为给锚点高亮
function onLoadScroll() {
$(window).scroll(function () {
//如果移动端顶部导航有动画
if ($(this).width() < 787 && $('.ModuleMobileNavGiant .MobileNavfadeout').length > 0 && window['curMobileNavClick'] == false) {
if ($(document).scrollTop() > 50) {
$('.ModuleMobileNavGiant .MobileNavfadeout').css({ 'top': '-50px', 'opacity': '0' });
} else {
$('.ModuleMobileNavGiant .MobileNavfadeout').css({ 'top': '0', 'opacity': '1' });
}
}
if (window['curAnchorClick']) return; // 当前触发滚动是因为点击事件则return
window['oldScroH'] = $(document).scrollTop();
if (anchorInterval) clearTimeout(anchorInterval);
anchorInterval = setTimeout(onAnchorActive, 150);
});
}
// 锚点、导航单击事件
function onAnchorClick() {
$(document).off('click.anchor_click').on('click.anchor_click', '.ModuleAnchorTextGiant a,.ModuleNavGiant a,.ModuleMobileNavGiant li a', function (evt) {
var javascript = $(this).data('javascript');
var curHref = $(this).attr('datahref') ? $(this).attr('datahref') : $(this).attr('href');
if (curHref) handleAnchorClick(curHref, $(this).attr('target'), evt);
else eval(javascript.replace('javascript:', ''))
return false;
})
}
// 锚点双击事件
function onAnchorDblClick() {
$('body').off('dblclick.anchor_dblclick').on("dblclick.anchor_dblclick", '.ModuleAnchorTextGiant a,.ModuleNavGiant a,.ModuleMobileNavGiant a', function (evt) {
var curHref = $(this).attr('datahref') ? $(this).attr('datahref') : $(this).attr('href');
var javascript = $(this).data('javascript');
if (curHref) handleAnchorClick(curHref, $(this).attr('target'), evt);
else eval(javascript.replace('javascript:', ''))
return false;
})
}
//移动端滑动监听
function onMobileTouch() {
$(window).on('touchmove', function (e) {
//如果移动端顶部导航有动画
if ($(this).width() < 787 && $('.ModuleMobileNavGiant .MobileNavfadeout').length > 0 && window['curMobileNavClick'] == false) {
if (e.pageY > 50) {
$('.ModuleMobileNavGiant .MobileNavfadeout').css({ 'top': '-50px', 'opacity': '0' });
} else {
$('.ModuleMobileNavGiant .MobileNavfadeout').css({ 'top': '0', 'opacity': '1' });
}
}
})
}
// 显示弹窗事件
function showPupop(ModuleID) {
if (Number(ModuleID) > 0) {
var module = $('#module_' + ModuleID);
if (module.length > 0) module.show();
var subModuleIDs = module.find('.ModuleItem')
$(subModuleIDs).each(function (index, element) {
var moduleid = $(element).attr('id').replace('module_', '')
var moduletype = $(element).attr('moduletype')
if (moduletype == 'ModuleSlideV2Giant' && $(element).find('.layout-107').length == 0) return;
var initFunc = window['initFunc' + moduleid];
var initSwiperFuncSiteGalleryByMobile = window['initSwiperFunc' + moduleid + 'SiteGalleryByMobile'];
var news121Multiple = window['news121Multiple' + moduleid];
var initSwiperFunc = window["initSwiperFunc" + moduleid]
if (moduletype == 'ModuleSiteGalleryV2Giant' && $(element).find('.layout-104').length > 0) {
setTimeout(function () {
$("#module_" + moduleid + ' .gallery-imagesLoaded').masonry('layout');
}, 500)
}
if (typeof initSwiperFunc == 'function') {
initSwiperFunc()
}
if (typeof initFunc == 'function') {
initFunc()
}
if (typeof initSwiperFuncSiteGalleryByMobile == 'function') {
initSwiperFuncSiteGalleryByMobile();
}
if (typeof news121Multiple == 'function') {
news121Multiple()
}
$('.ModulePupopContainer' + ModuleID + ' .ModuleSubPupopBox').scroll(function () {
if (moduletype == 'ModuleSiteGalleryV2Giant' && $(element).find('.layout-104').length > 0) {
$("#module_" + moduleid + ' .gallery-imagesLoaded').imagesLoaded(function () {
$("#module_" + moduleid + ' .gallery-imagesLoaded').masonry('layout');
});
}
})
});
}
return;
}
function clearCancelorRedoData() {
if (typeof (CanDesign) == 'undefined' || CanDesign != "True") return false;
$.ajax(
{
url: "/index.php?c=Front/CancelOrRedo&a=clearData",
dataType: "json",
success: function (json) {
var status = !window.cancelOrRedoObj
addScript('/scripts/CancelOrRedo.js', function () {
if (status) {
window.cancelOrRedoObj = new cancelorredo();
}
window.cancelOrRedoObj.cancellist = [];
window.cancelOrRedoObj.redolist = [];
window.cancelOrRedoObj.tempdata = [];
});
}
});
}
function isMobileBroswer() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
var bIsWeixin = sUserAgent.match(/micromessenger/i) == "micromessenger";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || bIsWeixin) {
return true;
} else {
return false;
}
}
function setZonePadding() {
if (SiteType == '1') return; // 响应式暂不需要设置内容区边距
if ($("#BodyLeftZone").length > 0 && $("#BodyLeftZone").css("display") != "none") $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({ "padding-left": "3px" });
else $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({ "padding-left": "0px" });
if ($("#BodyRightZone").length > 0 && $("#BodyRightZone").css("display") != "none") $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({ "padding-right": "3px" });
else $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({ "padding-right": "0px" });
if (typeof CanDesign != 'undefined' && CanDesign == "True" && SiteType == "0") setTimeout(setZonePadding, 300);
}
function hasAbsoluteObj() {
var flag = false;
if (SiteType == "1") {
$("#BodyHeaderZone,#BodyMain1Zone,#BodyFooterZone").find(".ModuleItem:visible").each(function (i, item) {
if ($(item).css("position") == "absolute") {
flag = true;
}
});
}
return flag;
}
function isJiFenPage() {
if ($('#isJiFen').val() === '1') {
return 1;
} else {
return 0;
}
}
// 详情页面重新计算区域高度
function computeZoneHeight(zoneElem) {
var oZone = $(zoneElem);
if (!oZone.hasClass('ModuleHoverBoxContainer')) resizeZone(oZone);
if (oZone.find(".ModuleProductDetail, .ModuleNewsDetail, .ModuleDownDetail").length > 0) {
$(zoneElem).find('img').each(function () {
this.onload = function () {
resizeZone(oZone);
}
});
}
if (!oZone.hasClass('ModuleTabsContent') && !oZone.hasClass('ModuleHoverBoxContainer')) {
setTimeout(function () {
resizeZone(zoneElem)
}, 500);
setTimeout(function () {
resizeZone(zoneElem)
}, 1000);
setTimeout(function () {
resizeZone(zoneElem)
}, 2000);
setTimeout(function () {
resizeZone(zoneElem)
}, 4000);
}
}
//h5 计算自由模块的横坐标
function zoneHasAbsoluteObj(zone) {
var hasAbsolute = false;
$(zone).find(".ModuleItem:visible").each(function (i, item) {
if ($(item).css("position") == "absolute") {
hasAbsolute = true;
}
});
return hasAbsolute;
}
function computeFreeModulePosition(module) {
if (SiteType != "1") return;
window.nodelayimg = true; //H5站混合静态和自由模块时,不能使用图片延时加载,因为图片延时加载会改变页面的高度
if (module) {
var m = null;
if (typeof module == 'object') m = $(module);
else m = $('#' + module);
var parent = m.closest("#HeaderZone,#FooterZone,#BodyMain1Zone");
if ($(window).width() > 993) {
if (m.attr('float') == 'free') {
var helperid = 'freemodulehelper';
var helper = $("#" + helperid);
var left = helper.offset().left + parseInt(m.attr('floatx'));
m.css({ 'visibility': 'visible', 'display': 'block', 'left': left + "px" });
}
m.parent().find('.ModuleGridContainer').each(function (i, grid) {
$(grid).css('min-width', $(grid).css('max-width'));
});
//处理产品列表模块的响应横版PAD的功能
m.parent().find('.productsBox').each(function (i, prolist) {
for (var k = 1; k < 11; k++) {
$(prolist).removeClass('col-md-' + k);
$(prolist).removeClass('col-sm-' + k);
$(prolist).removeClass('col-xs-' + k);
}
$(prolist).addClass('col-xs-' + $(prolist).attr('pc-col'));
});
computeZoneHeight(parent);
} else {
m.css({ 'visibility': 'hidden', 'display': 'none' });
if (!zoneHasAbsoluteObj(parent)) parent.css("height", "auto");
m.parent().find('.ModuleGridContainer').each(function (i, grid) {
$(grid).css('min-width', '0');
});
}
} else {
var modules = $(".ModuleItem[float=free]");
$.each(modules, function (i, item) {
computeFreeModulePosition(item);
});
}
}
function resizeZone(oZone) {
if (oZone.children('.ModuleItem:visible').length > 0) {
var iZoneHeight = 0;
//var padscale = isPad();
oZone.children('.ModuleItem:visible').each(function () {
iZoneHeight = Math.max(iZoneHeight, $(this).outerHeight(false) + $(this).position().top);
});
oZone.css('height', iZoneHeight);
}
if (getCookie("SiteType") == "1" && !zoneHasAbsoluteObj(oZone)) {
$(oZone).css('height', 'auto');
}
}
//让图片根据上级容器的尺寸自动适应大小
function resizeImage(imgo) {
var img = new Image();
img.src = $(imgo).prop('src');
// 按比例缩放,原图小于外框不操作
var bw = $(imgo).parent().width();
var bh = $(imgo).parent().height();
var ow = img.width;
var oh = img.height;
var nw, nh;
if (ow > bw || oh > bh) {
if (ow / oh >= bw / bh) {
nw = bw;
nh = nw * oh / ow;
} else if (ow / oh < bw / bh) {
nh = bh;
nw = nh * ow / oh;
}
} else {
nw = ow;
nh = oh;
}
$(imgo).width(nw);
$(imgo).height(nh);
$(imgo).css({ 'margin-top': (bh - $(imgo).outerHeight(false)) / 2 + 'px' });
}
function SetImageWidth() {
if (SiteType == "1") {
$("img").each(function () {
if ($(this).closest('.ModuleNewsDetail').length > 0 || $(this).closest('.ModuleJiuGong,.ModuleJiuGongV2').length > 0) return true;
});
$('.goods-detail-content table').each(function () {
if ($(this).width() > $("#pagebody").width()) {
$(this).css('width', '100%');
}
});
}
$("img").each(function () {
if ($(this).closest('.ModuleNewsDetail').length > 0 || $(this).hasClass('vCodeImg')) return true;
if ($(this).width() > $("#pagebody").width() && $("#pagebody").length > 0) {
var oldh = $(this).height();
var oldw = $(this).width();
try {
var offsetp = $(this).closest(".ModuleItem").offset().left;
var offset = $(this).offset().left;
var offsetx = offset - offsetp;
if (offsetx < 0) offsetx = 0;
} catch (e) {
}
var w = parseInt($("#pagebody").width() * 0.95) - offsetx;
var h = parseInt(oldh / (oldw / w));
if (SiteType == 0) $(this).css({ "width": w, "height": h });
}
if ($(this).closest('.PIMG').length == 0) {
$(this).prop("src", $(this).attr("src"));
$(this).on('load', function () {
if ($(this).width > $("#pagebody").width()) {
var oldh = $(this).height();
var oldw = $(this).width();
try {
var offsetp = $(this).closest(".ModuleItem").offset().left;
var offset = $(this).offset().left;
var offsetx = offset - offsetp;
if (offsetx < 0) offsetx = 0;
} catch (e) {
}
var w = parseInt($("#pagebody").width() * 0.95) - offsetx;
var h = parseInt(oldh / (oldw / w));
$(this).css({ "width": w, "height": h });
}
});
}
});
}
function showhideNav() {
if ($("#MobileFootNav").attr("enable") == 1 && $("#pagebody").width() >= 751) {
$('#MobileFootNav,#MobileFootNavRenderElem').hide();
} else if ($("#MobileFootNav").attr("enable") == 1 && $("#pagebody").width() < 751) {
$('#MobileFootNav,#MobileFootNavRenderElem').show();
} else if ($("#MobileFootNav").attr("enable") == 0) {
$('#MobileFootNav,#MobileFootNavRenderElem').hide();
}
if ($("#MobileNav").attr("enable") == 1 && $("#pagebody").width() >= 1200 || $("#MobileNav").attr("enable") == 1 && ($("#pagebody").width() >= 975 && $("#pagebody").width() < 1200)) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').hide();
$('#pagebody').css("left", "0rem");
$("#MobileFootNav").removeClass("showFloatNav");
} else if ($("#MobileNav").attr("enable") == 1 && ($("#pagebody").width() >= 751 && $("#pagebody").width() < 975) || $("#MobileNav").attr("enable") == 1 && $("#pagebody").width() < 740) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').show();
if ($("#MobileNav").attr("navnum") == 4 || $("#MobileNav").attr("navnum") == 6 || $("#MobileNav").attr("navnum") == 7) {
$('#MobileNavRenderElem').hide();
} else {
$('#MobileNavRenderElem').show();
}
if ($("#MobileNavFloatLayer").hasClass("showFloatNav") == false) {
$('#pagebody').css("left", "0rem");
$("#MobileFootNav").removeClass("showFloatNav");
} else {
if ($("#MobileNav").attr("navnum") == 5) {
$('#pagebody').css("left", "6.25rem");
$("#MobileFootNav").addClass("showFloatNav");
} else if ($("#MobileNav").attr("navnum") == 1) {
$('#pagebody').css("left", "10rem");
$("#MobileFootNav").addClass("showFloatNav");
}
}
} else if ($("#MobileNav").attr("enable") == 0 && $("#pagebody").width() > 1200 || $("#MobileNav").attr("enable") == 0 && ($("#pagebody").width() >= 975 && $("#pagebody").width() < 1200) || $("#MobileNav").attr("enable") == 0 && ($("#pagebody").width() >= 751 && $("#pagebody").width() < 975) || $("#MobileNav").attr("enable") == 0 && $("#pagebody").width() < 740) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').hide();
}
if ($('#MobileNav').attr('navnum') == 4) {
if ($("#pagebody").width() < 740) {
$('#MobileNavFloatLayer').css("left", "18.9%")
} else if ($("#pagebody").width() > 500 && $("#pagebody").width() <= 751) {
$('#MobileNavFloatLayer').css("left", "13%")
} else if ($("#pagebody").width() > 751 && $("#pagebody").width() <= 975) {
$('#MobileNavFloatLayer').css("left", "11.5%")
} else {
$('#MobileNavFloatLayer').css("left", "8%")
}
}
if ($("#pagebody").width() > 768) {
$(".FootNavMask,.FootNavQRCodeImg,.QQList").hide();
$(".goods-btn").show();
} else {
$(".FootNavMask,.FootNavQRCodeImg,.QQList").show();
$(".goods-btn").hide();
}
if ($("#MobileFootNav").length > 0) {
if ($("#MobileFootNav").is(":hidden")) {
$('#pagebody').css('padding-bottom', "0")
} else {
$('#pagebody').css('padding-bottom', $("#MobileFootNav").height());
}
}
$(".FootNavQRCodeImg").css({
"width": "192px",
"height": "192px",
"top": "initial",
"bottom": $('#MobileFootNav').innerHeight(),
"left": ($('body').outerWidth() / 2 - $(".FootNavQRCodeImg").outerWidth() / 2)
});
}
function TopNewLoad() {
$(".TopNews").each(function () {
var repNum = Number($(this).attr("lang"));
var iWidth = ($(this).width() / repNum) - (repNum * 10); //($(this).find("li").width() / repNum) - (repNum * 10);
$(this).find("li>span").css({ "width": iWidth + "px", "margin-right": "8px" });
$(this).find("li").each(function () {
if ($(this).children("span").toArray().length > 1) {
$(this).children("span").last().css({ "margin-right": "0px", "float": "right" });
}
});
});
}
function NewsList() {
$(".BodyCenterNews").each(function () {
var repNum = parseInt($(this).attr("RepeatNum")) > 0 ? parseInt($(this).attr("RepeatNum")) : 1;
var iWidth = ($(this).find("li").width() / repNum) - (repNum * 9);
$(this).find("i").css({/*"width": iWidth + "px",*/"margin-right": "5px", "overflow": "hidden" });
$(this).find("li").each(function () {
if ($(this).children("i").length > 1) {
$(this).children("i").last().css({ "margin-right": "0px", "float": "right" });
}
});
if ($(this).attr("value") !== "") {
var itemHeight = $(this).find(".vTicker").find("li").height();
var iHeight = $(this).find(".vTicker>ul").height();
var showItems = parseInt(iHeight / itemHeight);
$(this).find(".vTicker").vTicker({
speed: 500,
pause: 3000,
direction: $(this).attr("value"),
mousePause: true,
showItems: showItems
}).css({ "height": iHeight + "px" }).find("li").css({ "padding": "0 5px" });
}
});
}
function ProductList() {
$(".ModuleProductList").each(function () {
if ($(this).find(".myslider").attr("value") !== "") {
$(this).find(".myslider").easySlider({
auto: true,
continuous: true,
vertical: false,
controlsShow: false
});
}
});
}
function SetProductListImage(module, sitetype) {
if (typeof (module) != "object") module = $('#module_' + module);
module.find('.PIMG>img').each(function () {
var src = $(this).attr("src");
$(this).attr("src", '');
$(this).on('load', function () {
resizeProductListImageSize(this);
});
$(this).attr("src", src);
});
initProductListEffect(module, sitetype);
}
function resizeProductListImageSize(img) {
$(img).css({ 'width': 'auto', 'height': 'auto' }); //先清除图片的高宽
var picWrapper = $(img).closest('.PicWrapper');
var imgParent = $(img).parent();
var imgp_pl = parseFloat(imgParent.css('padding-left') ? imgParent.css('padding-left') : 0);
var imgp_pr = parseFloat(imgParent.css('padding-right') ? imgParent.css('padding-right') : 0);
var imgp_pt = parseFloat(imgParent.css('padding-top') ? imgParent.css('padding-top') : 0);
var imgp_pb = parseFloat(imgParent.css('padding-bottom') ? imgParent.css('padding-bottom') : 0);
var imgp_bl = parseFloat(imgParent.css('border-left') ? imgParent.css('border-left') : 0);
var imgp_br = parseFloat(imgParent.css('border-right') ? imgParent.css('border-right') : 0);
var imgp_bt = parseFloat(imgParent.css('border-top') ? imgParent.css('border-top') : 0);
var imgp_bb = parseFloat(imgParent.css('border-bottom') ? imgParent.css('border-bottom') : 0);
var bw = picWrapper.innerWidth() - imgp_pl - imgp_pr - imgp_bl - imgp_br;
var bh = picWrapper.innerHeight() - imgp_pt - imgp_pb - imgp_bt - imgp_bb;
var ow = img.width;
var oh = img.height;
var nw, nh;
if (ow > bw || oh > bh) {
if (ow / oh >= bw / bh) {
nw = bw;
nh = nw * oh / ow;
} else if (ow / oh < bw / bh) {
nh = bh;
nw = nh * ow / oh;
}
} else {
nw = ow;
nh = oh;
}
$(img).css({
width: nw + 'px',
height: nh + 'px'
});
$(img).css({ 'margin-top': (bh - $(img).outerHeight(false)) / 2 + 'px' });
if ($(img).parent().css('text-align').toLowerCase() != 'center') {
$(img).css({ 'margin-left': (bw - $(img).outerWidth(false)) / 2 + 'px' });
}
}
function initProductListEffect(module, sitetype) {
if (typeof (module) != "object") module = $('#module_' + module);
var oProductList = $(module).find('.ProductList');
var showstyle = oProductList.attr('showstyle');
var direction = oProductList.attr('direction');
var countPerGroup = oProductList.attr('repeatnum');
if (CanDesign == "True" && showstyle > 0) {
module.resize(function () {
if (module.css("position") != 'absolute') oProductList.parent().css({
'position': 'relative',
overflow: 'hidden',
'width': module.width() + "px"
});
});
}
if (sitetype == 1) {
// 修复手机下,描述文字不确定导致".PDetail"高度不齐的的bug
if (!module.attr("haschangedetail")) {
iRepeatnum = parseFloat(oProductList.attr('repeatnum'));
if (iRepeatnum == 0 || showstyle == 1 || showstyle == 2) {
var iMaxHeight = 0;
module.find('.PDetail').each(function () {
iMaxHeight = Math.max(iMaxHeight, $(this).height());
})
module.find('.PDetail').css('height', iMaxHeight);
} else {
var iTotalLine = Math.ceil(module.find('.PDetail').length / iRepeatnum);
var oPDetails = module.find('.PDetail');
for (var i = 0; i < iTotalLine; i++) {
var iMaxHeight = 0;
oPDetails.each(function (j) {
if (i * iRepeatnum <= j && j < (i + 1) * iRepeatnum) {
iMaxHeight = Math.max(iMaxHeight, $(this).height());
}
})
oPDetails.slice(i * iRepeatnum, (i + 1) * iRepeatnum).css('height', iMaxHeight);
}
}
module.attr("haschangedetail", "1");
}
}
if (window['effectInterval_' + module.attr('id')]) {
clearInterval(window['effectInterval_' + module.attr('id')]);
}
if (module.length > 0) {
if (showstyle == 1) { // 连续滚动
var oProductBoxes = oProductList.children('.ProductBox').css({ float: 'left' });
if (sitetype == 1) {
oProductList.find('center').css('display', 'inline-block');
// 手机实际width通常是带小数的,但jquery所有方法返回宽度都是向下取的整数,所以为了计算准确,+1px
oProductBoxes.css({ width: 'auto' }).css({ width: oProductBoxes.width() + 1 });
}
var listWidth = module.width();
oProductList.parent().css({ 'position': 'relative', overflow: 'hidden', 'width': module.width() + "px" });
var iWidth = oProductBoxes.outerWidth(true) * oProductBoxes.length * 2;
var iHeight = oProductBoxes.outerHeight(true);
oProductList.css({
position: 'relative',
left: '0px',
width: iWidth + 'px',
height: iHeight + 'px',
overflow: 'hidden'
});
if (module.width() > iWidth) return;
if (module.attr('hasinit') != 1) {
oProductList.append(oProductList.clone(true).children());
module.attr('hasinit', 1);
}
;
var iRefreshInterval = 40;
var iStep = 1;
if (window['effectInterval_' + module.attr('id')]) {
clearInterval(window['effectInterval_' + module.attr('id')])
}
window['effectInterval_' + module.attr('id')] = setInterval(function () {
if (oProductList.attr('ishovering') == 1 && oProductList.attr('hoverstop') == 1) {
return;
}
if (direction == 'left') {
if (oProductList.position().left <= -oProductList.innerWidth() / 2) {
oProductList.css('left', (oProductList.position().left + oProductList.innerWidth() / 2) + 'px');
}
oProductList.css('left', (oProductList.position().left - parseInt(oProductList.parent().css('padding-left')) - iStep) + 'px');
} else {
if (oProductList.position().left >= 0) {
oProductList.css('left', (-oProductList.innerWidth() / 2) + 'px');
}
oProductList.css('left', (oProductList.position().left - parseInt(oProductList.parent().css('padding-left')) + iStep) + 'px');
}
}, iRefreshInterval);
} else if (showstyle == 2) { // 一屏屏滚动
var oProductBoxes = module.find('.ProductBox');
var iGroupCount = Math.ceil(oProductBoxes.length / countPerGroup);
for (var i = 0; i < iGroupCount; i++) {
$(oProductBoxes.slice(i * countPerGroup, i * countPerGroup + countPerGroup)).wrapAll('');
}
if (sitetype == 1) {
oProductBoxes.css({ width: 'auto', height: 'auto', padding: '2px' });
}
oProductList.parent().css({ 'position': 'relative', overflow: 'hidden', 'width': module.width() + "px" });
var oProductGroups = module.find('.ProductGroup');
if (!oProductGroups.parent().is('.ProductGroupList')) {
oProductGroups.wrapAll('');
}
var oProductGroupList = module.find('.ProductGroupList');
if (module.css("position") != "absolute") {
iHeight = $(oProductBoxes[0]).height();
}
oProductGroupList.css({
position: 'relative',
top: '0px',
width: module.innerWidth() * iGroupCount + 'px',
overflow: 'hidden'
});
oProductGroups.css({ float: 'left', width: module.innerWidth() + 'px', height: module.innerHeight() + 'px' });
if (iGroupCount <= 1) {
return;
}
if (direction == 'left') {
oProductGroupList.css({ left: '0px', right: 'auto' });
} else {
for (var i = 0; i < iGroupCount; i++) {
oProductGroups = module.find('.ProductGroup');
oProductGroups.eq(-1).insertBefore(oProductGroups.eq(i));
}
oProductGroupList.css({ left: 'auto', right: module.innerWidth() * (iGroupCount - 1) + 'px' });
}
module.find('.PDetail').css('width', module.find('.PicWrapper').width());
window['effectInterval_' + module.attr('id')] = setInterval(function () {
if (module.find('.ProductList').attr('ishovering') == 1 && module.find('.ProductList').attr('hoverstop') == 1) {
return;
}
var oProductGroupList = module.find('.ProductGroupList');
var oProductGroups = module.find('.ProductGroup');
if (direction == 'left') {
oProductGroupList.animate({
left: '-=' + oProductGroups.outerWidth(true) + 'px'
}, 1000, function () {
oProductGroups.eq(0).insertAfter(oProductGroups.eq(-1));
oProductGroupList.css('left', 0);
});
} else {
oProductGroupList.animate({
right: '-=' + oProductGroups.outerWidth(true) + 'px'
}, 1000, function () {
oProductGroups.eq(-1).insertBefore(oProductGroups.eq(0));
oProductGroupList.css('right', oProductGroups.outerWidth(true) * (iGroupCount - 1) + 'px');
});
}
}, 6000);
}
}
}
function showShopModal(productid, e, productShowType, DetailUrl, Param_Target, showMarketPrice) {
if (DetailUrl.indexOf('http') > -1) {
window.open(DetailUrl, Param_Target);
return false;
}
e = e || window.event;
e.stopPropagation && e.stopPropagation();
e.preventDefault && e.preventDefault();
e.cancelBubble = true;
if (!productid) {
return false;
}
if (typeof productShowType == 'undefined') {
productShowType = 0;
}
var productSkus = [];
$.ajax({
url: '/index.php?c=Front/ProductData',
type: 'get',
data: { id: productid, productShowType: productShowType },
dataType: 'json',
async: false,
cache: false,
success: function (json) {
if (!json) {
alert('无此商品');
return;
}
var lg = json.lg;//多语言
var windowWidth = $(window).width();
productShowType = json.productShowType;
productSkus = json.productSkus || [];
var html = '';
html += '';
var dialog = bootbox.dialog({
title: lg.quick_purchase,
message: html,
show: false,
className: 'shopCartModal',
buttons: {}
}).on('shown.bs.modal', function () {
$('.pro_appeal').height($('.pro_appeal').width());
}).on('hidden.bs.modal', function () {
if (!window.CanDesign) {
$('.swiper-container').each(function () {
$(this)[0].swiper.startAutoplay();
});
}
}).modal('show');
$('.shopCartModal').css('z-index', '10000');
var surplus = parseInt(json.surplus);
if (isNaN(surplus) || surplus == 0) {
$('.shopCartModal .Shtml').hide();
} else {
$('.shopCartModal .Shtml').show();
}
function checkValid() {
if (!/^\d+$/.test($('#ShopModalProNum').val() + '')) {
alert(lg.file_in_quantity);
return;
}
var enableInventory = $('.shopCartModal [name=enableInventory]').val();
if (enableInventory) {
var productQuantity = parseInt($('.shopCartModal .productQuantity').attr('productQuantity'));
if (!isNaN(productQuantity) && parseInt($('#ShopModalProNum').val()) > productQuantity) {
alert(lg.not_exceed_stock);
return false;
}
}
if (productSkus.length > 0 && !$('.shopCartModal [name="skuid"]').val()) {
alert(lg.select_spec);
return false;
}
return true;
}
$('.shopCartModal .pro_amount').disableSelection();
$('.shopCartModal .sys_spec_text>li').off().on('click', function () {
if ($(this).hasClass('outOfStock')) {
return;
}
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
var attrkeyid = $(this).attr('attrkeyid');
$('[attrkeyid=' + attrkeyid + ']').not(this).removeClass('selected');
$(this).addClass('selected');
}
var attrkeycount = $('.shopCartModal .sys_spec_text').length;
var attrvalselectedcount = $('.shopCartModal .sys_spec_text>li.selected').length;
if (attrkeycount - attrvalselectedcount == 1 || attrkeycount == attrvalselectedcount) {
$('.shopCartModal .sys_spec_text>li').removeClass('outOfStock');
var elemAttrVals = $('.shopCartModal .sys_spec_text>li').not('.selected');
elemAttrVals.each(function () {
var path = '';
var elemAttrValInOtherKeys = $('.shopCartModal .sys_spec_text').not($(this).closest('.shopCartModal .sys_spec_text')).find('li.selected');
elemAttrValInOtherKeys.each(function () {
path += $(this).attr('attrvalid') + ',';
});
path += $(this).attr('attrvalid');
path = path.split(',').sort().join(',');
for (var i = 0; i < productSkus.length; i++) {
var sku = productSkus[i];
var skuPath = (sku.Path || '').split(',').sort().join(',');
if (skuPath == path) {
if (sku.ProductQuantity <= 0) {
$(this).addClass('outOfStock');
} else {
$(this).removeClass('outOfStock');
}
break;
}
}
});
} else {
$('.shopCartModal .sys_spec_text>li').removeClass('outOfStock');
}
if (attrkeycount == attrvalselectedcount) {
var attrkeyid = $(this).attr('attrkeyid');
$('[attrkeyid=' + attrkeyid + ']').not(this).removeClass('selected');
$(this).addClass('selected');
var path = '';
$('.shopCartModal .sys_spec_text>li.selected').each(function () {
path += $(this).attr('attrvalid') + ',';
});
path = path.replace(/(^,)|(,$)/g, '');
path = path.split(',').sort().join(',');
var price = 0;
var point = 0;
var skuid = 0;
var surplus = 0;
var productQuantity = 0;
for (var i = 0; i < productSkus.length; i++) {
if (path == productSkus[i].Path.split(',').sort().join(',')) {
point = productSkus[i].Jf_convert;
price = productSkus[i].Price;
skuid = productSkus[i].SkuID;
surplus = productSkus[i].surplus;
productQuantity = productSkus[i].ProductQuantity;
break;
}
}
var priceHtml = '';
if (productShowType == 1) {
point = parseFloat(point).toFixed(2);
surplus = parseFloat(surplus).toFixed(2);
$('.shopCartModal .price').text(point).data('singlePrice', price);
$(".shopCartModal .Shtml").attr('surplus', surplus).html(lg.pay_extra + json.CurrencySymbols + surplus);
var surplus = parseInt(json.surplus);
if (isNaN(surplus) || surplus == 0) {
$('.shopCartModal .Shtml').hide();
} else {
$('.shopCartModal .Shtml').show();
}
priceHtml = point;
} else {
price = parseFloat(price).toFixed(2);
$('.shopCartModal .price').text(json.CurrencySymbols + price).data('singlePrice', price);
}
$(".shopCartModal input[name=skuid]").val(skuid);
$('.shopCartModal .productQuantity').text(productQuantity).attr('productQuantity', productQuantity);
} else {
var minVal = -1, maxVal = 0, productQuantity = 0;
for (var i = 0; i < productSkus.length; i++) {
var val = 0;
if (productShowType == 1) {
val = parseFloat(productSkus[i].Jf_convert);
} else {
val = parseFloat(productSkus[i].Price);
}
minVal = minVal == -1 ? val : Math.min(minVal, val);
maxVal = maxVal == -1 ? val : Math.max(maxVal, val);
productQuantity += parseInt(productSkus[i].ProductQuantity);
}
var pHtml = minVal.toFixed(2);
if (minVal != maxVal) {
pHtml = minVal.toFixed(2) + ' - ' + maxVal.toFixed(2);
}
if (productShowType != 1) {
pHtml = json.CurrencySymbols + pHtml;
}
$(".shopCartModal .Shtml").hide();
$('.shopCartModal .price').text(pHtml);//.data('singlePrice', price);
$(".shopCartModal input[name=skuid]").val(skuid);
$('.shopCartModal .productQuantity').text(productQuantity).attr('productQuantity', productQuantity);
}
});
$('.shopCartModal .sys_spec_text>li:nth-child(1)').each(function () {
$(this).click();
});
$(".shopCartModal .reduce").off().on('click', function () {
var num = parseInt($("#ShopModalProNum").val());
if (num == 1) return;
else $("#ShopModalProNum").val(num - 1);
var price = $('.shopCartModal .price').data('singlePrice');
});
$(".shopCartModal .add").off().on('click', function () {
var num = parseInt($("#ShopModalProNum").val());
$("#ShopModalProNum").val(num + 1);
var price = $('.shopCartModal .price').data('singlePrice');
});
$(".shopCartModal #ShopModalProNum").off().on('change', function () {
var num = parseInt($("#ShopModalProNum").val());
var price = $('.shopCartModal .price').data('singlePrice');
});
if (json.isSingleNorm) {
$('.shopCartModal .price').data('singlePrice', json.price);
}
$('.shopCartModal .ShopCart,.shopCartModal .Buy').off().on('click', function () {
var islocation = $(this).attr('islocation');
var skuid = $("form[name=ShopModalForm]").find("input[name=skuid]").val();
var num = $("form[name=ShopModalForm]").find("input[name=Num]").val();
if (!checkValid()) return false;
$('.add-cart-result').remove();
var hintHtml = '