var kxData = { imgStar : '', // 星圖片 imgServer : '', // 星圖片 imgDated : '', // 星圖片 dated:false,// true 為過時 size:null,// 鏈接中參數size h:null,// 鏈接中參數高度h url:''//跳轉url};kxData.dated =false; kxData.imgStar ='/static/images/newLogo/star4.png'; kxData.imgServer ='/static/images/newLogo/5Y11M.png'; kxData.imgDated ='/static/images/newLogo/expire.png'; kxData.h =''; kxData.url ='https://ss.knet.cn/verifyseal.dll?sn=e16113043060065458grjc000000&ct=ma&pa=jHEeyEBzjE1yTjua';kxData.size ='2';(function(){ var logoAnimate = { certImg1:null, certImg2:null, sizeArr:['47','23','28','33','38'], testClassName:function(ele, els){ return !!ele.className.match(new RegExp("(\\s|^)" + els + "(\\s|$)")); }, replaceToNull:function(ele, els) { this.testClassName(ele, els) || (ele.className += "" + els); }, replaceToAct:function(ele, els) { this.testClassName(ele, els) && (ele.className = ele.className.replace(new RegExp("(\\s|^)" + els + "(\\s|$)"), "")); }, animateToNull:function(ele){ for (var i = 0; i <= 20; i++) ! function () { timeOut1 = null,clearTimeout(timeOut1); var num = 100-5*i; timeOut1 = setTimeout(function(){ ele.style.opacity = num / 100; ele.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + num + ')'; }, 25 * i); }(); }, animateToHave:function(ele){ ele.style.opacity = 0 / 100; for (var j = 0; j <= 20; j++) ! function () { timeOut2 = null,clearTimeout(timeOut2); var num = 5*j; timeOut2 = setTimeout(function(){ ele.style.opacity = num / 100; ele.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + num + ')'; }, 25 * j); }(); }, getRndId:function(){ var that = this,length = 15; for (var i = 0; i < 2; i++){ var rnd = Math.random().toString(36).substr(3,length),date = Date.now().toString(36); !i ? that.certImg1 = rnd + date : that.certImg2 = rnd + date; } }, animateFlag:false, initFun:function(){ var cert1 = document.getElementById(this.certImg1),cert2 = document.getElementById(this.certImg2); this.testClassName(cert1, "act") ? (this.animateToNull(cert1), this.animateToHave(cert2), this.replaceToAct(cert1, "act"), this.replaceToNull(cert2, "act")) : (this.replaceToNull(cert1, "act"), this.replaceToAct(cert2, "act"), this.animateToNull(cert2), this.animateToHave(cert1)); }, animationInitHave:function(imgUrl1,imgUrl2){ var that = this,imgHeight = 0,imgWidth = 0; if (kxData.h) { imgHeight = Math.abs(kxData.h); } else if(kxData.size){ imgHeight = that.sizeArr[kxData.size] ? that.sizeArr[kxData.size] : 47; } else { imgHeight = 47; } imgWidth = Math.ceil(imgHeight*(418/150)); var _widthHeightCssHtml = 'width:' + imgWidth + 'px !important;height:' + imgHeight + 'px !important;', _spanCssHtml = 'position: relative !important;display: inline-block !important;'+ _widthHeightCssHtml, _aCssHtml = 'display:inline-block !important;'+ _widthHeightCssHtml, _imgCssHtml = 'display:block !important;'+ _widthHeightCssHtml +'position:absolute !important;top:0 !important;left:0 !important;border:none !important;'; var html = '\可托網站\可托網站\', scriptDom = document.getElementById('kXScript'); scriptDom ? this.insertAfter(html, scriptDom) : document.write(html); that.animateFlag = true; }, insertAfter: function (newElement, targetElement) { var parent = targetElement.parentNode; if (parent.lastChild == targetElement) { if(typeof newElement === 'string'){ var temp = document.createElement('div'); temp.innerHTML = newElement; var frag = document.createDocumentFragment(); while (temp.firstChild) { frag.appendChild(temp.firstChild); } parent.appendChild(frag); }else{ parent.appendChild(newElement); } } else { if(typeof newElement === 'string'){ var temp = document.createElement('div'); temp.innerHTML = newElement; var frag = document.createDocumentFragment(); while (temp.firstChild) { frag.appendChild(temp.firstChild); } parent.insertBefore(frag, targetElement.nextSibling); }else{ parent.insertBefore(newElement, targetElement.nextSibling); } } } }; logoAnimate.getRndId(); var imgUrl1 = kxData.imgStar,imgUrl2 = null,timeOut1 = null,timeOut2 = null,set = null; !kxData.dated ? imgUrl2 = kxData.imgServer : imgUrl2 = kxData.imgDated; logoAnimate.animationInitHave(imgUrl1,imgUrl2); if (logoAnimate.animateFlag) { set = window.setInterval(function(){ set = null, clearInterval(set); logoAnimate.initFun(); },3e3); }})();