qipn_side = function(){ var n = this; n.s = document.querySelector('#qipn_side').getAttribute('data-siteurl'); n.l = document.querySelector('#qipn_side').getAttribute('data-lang'); n.t = n.s + "app/app/qipn_side/"; n.v = '1.2.1'; //手机端 n.xs = function(){ n.json(function(j){ var pc = j.pc; if(pc['ok'] == 1&&pc['md']==1){ $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/css/side.css?"+n.v}).appendTo("head"); $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/Font-Awesome/css/font-awesome.min.css"}).appendTo("head"); var get = n.colorRgb(pc['bg']), to = n.colorRgb(pc['bgto']), opacity = pc['opacity']; var style = ''; $("head").append(style); var html = '
',script = ''; var count = j.count>6?6:j.count; html += ''; html+= '
'; html+=script; if(pc['size']!='')$("body").addClass(pc['size']); $("body").addClass('qipn_side_mb_body').append(html); $('.qipn_side').show().removeClass('qipn_side_hide'); n.w(1);//微信弹框 } }); } // n.smmdlg = function(){ n.json(function(j){ var pc = j.pc; if(pc['ok'] == 1&&pc['pc']==1){ $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/css/side.css?"+n.v}).appendTo("head"); $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/Font-Awesome/css/font-awesome.min.css"}).appendTo("head"); var get = n.colorRgb(pc['bg']), to = n.colorRgb(pc['bgto']), opacity = pc['opacity']; var style = ''; $("head").append(style); $("body").append(n.h(j,pc)); $('.qipn_side').show().removeClass('qipn_side_hide'); n.w();//微信弹框 n.b();//鼠标经过事件绑定 } }); } //获取数据 n.json = function(fun){ $.ajax({ type: "get", dataType:"jsonp", url: n.t + "plugin/qipn_side.php?lang=" + n.l, success: function(json){ fun(json); } }); } //媒体查询 n.z = function(){ if($("body.no_qipn_side").length==0){ n.e(function(){ Breakpoints(); if(Breakpoints.is('xs')){ n.xs(); }else{ n.smmdlg(); } }); } } //终端类型 n.e = function(fun){ if(typeof(Breakpoints)=='function'){ fun(); }else{ n.q(n.t + "web/js/breakpoints.min.js",function(){ fun(); }); } } //鼠标经过处理 n.b = function(){ var dw = 54; if($(".qipn_side").hasClass('qipn_side_sm'))dw = 44; if($(".qipn_side").hasClass('qipn_side_lg'))dw = 64; $(document).on('mouseover mouseout','.qipn_side ul li .sidebox',function(event){ if(!$(this).data("wno")){ if (event.type == 'mouseover') { $(this).find("span").addClass("qipn_side_whitespace"); var wd = $(this).find("span").width() + dw + 12; $(this).find("span").removeClass("qipn_side_whitespace"); $(this).width(wd); } else { $(this).width(dw); } } }); } //判断JQ加载 n.side = function(){ if (typeof jQuery == "undefined") { n.qok = true; n.q(n.t + "web/js/jquery.min.js",function(){ if(n.qok){ n.z(); n.qok = false; } }); } else { n.z(); } } //Jquery加载 n.q = function(src, fun){ var script = null; script = document.createElement("script"); script.type = "text/javascript"; script.src = src; if(typeof fun === "function"){ script.onload = script.onreadystatechange = function() { var r = script.readyState; if (!r || r === 'loaded' || r === 'complete') { script.onload = script.onreadystatechange = null; fun(); } }; } document.getElementsByTagName("head")[0].appendChild(script); } //处理数据 n.h = function(j,pc){ var pt = pc['pt'] == 'left'?'qipn_side_left':''; var html = '
',script = ''; html += ''; html+= '
'; return html+script; } //微信弹框 n.w = function(mb){ var ger = $(".qipn_side [data-modal],.qipn_side_mb [data-modal]"); var len = ger.lengt; if(len!=0){ ger.each(function(){ var $self=$(this); if($.support.leadingWhitespace||(typeof is_lteie9 != 'undefined' && !is_lteie9)||mb){ $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/Modal/css/component.css?"+n.v}).appendTo("head"); // console.log(n.t); /*$.getScript( n.t + "web/Modal/js/modernizr.custom.js",function(){ $.getScript( n.t + "web/Modal/js/classie.js",function(){ $.getScript( n.t + "web/Modal/js/modalEffects.js",function(){ }); }); });*/ $.getScript( n.t + "web/Modal/js/classie.js",function(){ $.getScript( n.t + "web/Modal/js/modalEffects.js",function(){ }); }); //console.log($(this)); n.f($(this)); }else{//IE8 $("").attr({ rel: "stylesheet",type: "text/css",href: n.t + "web/AlertBox/AlertBox.css?"+n.v}).appendTo("head"); $.getScript( n.t + "web/AlertBox/CJL.0.1.min.js",function(){ $.getScript( n.t + "web/AlertBox/AlertBox.js",function(){ n.f($self); $("#"+$self.attr("mdid")).css({'top':'30%','left':'50%'}); var ab = new AlertBox($("#"+$self.attr("mdid"))[0]); $(document).on('click','.qipn_side [data-modal]',function(event){ ab.show(); OverLay.show(); }); $(document).on('click','.qipn_side_close',function(event){ ab.close(); OverLay.close(); }); }); }); } }) } } n.f = function(ger){ var tid = ger.attr("mdid"); var i = ger.attr("data-value"); //var h = '
'; var h = '
'; i = i.replace("../", n.s ); h += '
'; h += ''; h += ''; h += '
'; h += '
'; h += '
'; $("body").append(h); } //返回顶部 n.p = function(){ $('html,body').animate({'scrollTop':0},600); } //颜色转换 n.colorRgb = function(color){ var sColor = color.toLowerCase(); var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; if(sColor && reg.test(sColor)){ if(sColor.length === 4){ var sColorNew = "#"; for(var i=1; i<4; i+=1){ sColorNew += sColor.slice(i,i+1).concat(sColor.slice(i,i+1)); } sColor = sColorNew; } var sColorChange = []; for(var i=1; i<7; i+=2){ sColorChange.push(parseInt("0x"+sColor.slice(i,i+2))); } return sColorChange.join(","); }else{ return sColor; } }; n.show = function(id){ $(".md-modal").removeClass("md-show") // console.log(id) // console.log($("#" + id)[0]); $("#" + id).addClass("md-show") } n.close = function(){ $(".md-modal").removeClass("md-show") } } var qipn_side = new qipn_side(); window.onload = function(){ qipn_side.side(); }