|  | @@ -3,8 +3,8 @@ window.SpecInject = {};
 | 
	
		
			
				|  |  |      //Change File Name
 | 
	
		
			
				|  |  |      var protocol = ('https:'==window.location.protocol)?'https://':'http://';
 | 
	
		
			
				|  |  |      var requestURL = protocol+'192.168.31.210:8000/post';
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    var __FILENAME__ = 'specinject.js'
 | 
	
		
			
				|  |  | +    var __FILENAME__ = 'inject.js'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      var __FILE__, scripts = document.getElementsByTagName("script");
 | 
	
		
			
				|  |  |      for(var i=0;i<scripts.length;i++){
 | 
	
		
			
				|  |  |          var src =scripts.item(i).getAttribute("src");
 | 
	
	
		
			
				|  | @@ -19,25 +19,27 @@ window.SpecInject = {};
 | 
	
		
			
				|  |  |      var tmpObj = {};
 | 
	
		
			
				|  |  |      for(var i in attribute){attribute[i]=attribute[i].split('=');tmpObj[attribute[i][0]]=attribute[i][1]};
 | 
	
		
			
				|  |  |      //Params
 | 
	
		
			
				|  |  | -    var ADID = tmpObj['aid'],
 | 
	
		
			
				|  |  | -        ADTYPE = tmpObj['type'];
 | 
	
		
			
				|  |  | +    var ADID = tmpObj['mediakey'],
 | 
	
		
			
				|  |  | +        ADTYPE = tmpObj['type'],
 | 
	
		
			
				|  |  | +        ADPos = Number(tmpObj['position']),ADRatio=6.4,ADURL;
 | 
	
		
			
				|  |  |      if(!ADID || !ADTYPE) return;
 | 
	
		
			
				|  |  |      var browser={
 | 
	
		
			
				|  |  |          versions:function(){
 | 
	
		
			
				|  |  |              var u = navigator.userAgent, app = navigator.appVersion;
 | 
	
		
			
				|  |  |              return {
 | 
	
		
			
				|  |  | -                mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
 | 
	
		
			
				|  |  | -                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
 | 
	
		
			
				|  |  | -                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
 | 
	
		
			
				|  |  | -                iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
 | 
	
		
			
				|  |  | -                iPad: u.indexOf('iPad') > -1, //是否iPad
 | 
	
		
			
				|  |  | -                webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
 | 
	
		
			
				|  |  | -                weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
 | 
	
		
			
				|  |  | +                mobile: !!u.match(/AppleWebKit.*Mobile.*/),
 | 
	
		
			
				|  |  | +                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
 | 
	
		
			
				|  |  | +                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
 | 
	
		
			
				|  |  | +                iPhone: u.indexOf('iPhone') > -1,
 | 
	
		
			
				|  |  | +                iPad: u.indexOf('iPad') > -1,
 | 
	
		
			
				|  |  | +                webApp: u.indexOf('Safari') == -1,
 | 
	
		
			
				|  |  | +                weixin: u.indexOf('MicroMessenger') > -1,
 | 
	
		
			
				|  |  |                  version:u.match(/Version\/(\d+\.+\d+)/)[1]
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  |          }(),
 | 
	
		
			
				|  |  |          language:(navigator.browserLanguage || navigator.language).toLowerCase()
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    if(!browser.versions.mobile) return;
 | 
	
		
			
				|  |  |      var keywords = document.querySelector('meta[name=Keywords]')?document.querySelector('meta[name=Keywords]'):document.querySelector('meta[name=keywords]');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      var xmlhttp;
 | 
	
	
		
			
				|  | @@ -65,17 +67,39 @@ window.SpecInject = {};
 | 
	
		
			
				|  |  |          if(data.status!=1) return;
 | 
	
		
			
				|  |  |          data = data.data;
 | 
	
		
			
				|  |  |          if(!data.adurl) return;
 | 
	
		
			
				|  |  | +        ADURL = data.adurl;
 | 
	
		
			
				|  |  | +        ADRatio = data.ratio;
 | 
	
		
			
				|  |  | +        var opt = getTypeOption();
 | 
	
		
			
				|  |  |          var style = document.createElement('style');
 | 
	
		
			
				|  |  |              style.innerText = '#__ADInject__{position:fixed;z-index:9999;box-sizing:border-box}#__ADInject__.bottom{bottom:5px}#__ADInject__ iframe{position:relative;left:0;right:0;bottom:0;top:0;overflow:hidden;border:none;padding:0;margin:0;z-index:10}#__ADInject__ .__ADInjectClose__{position:absolute;right:0;top:0;display:block;color:#fff;font-size:12px;width:20px;height:20px;line-height:20px;text-align:center;background:rgba(0,0,0,.2);z-index:999}';
 | 
	
		
			
				|  |  |          var script = document.createElement('script');
 | 
	
		
			
				|  |  |              script.innerText = 'function __ADInjectFeedback__(){SpecInject.feedback()};function __ADInjectClose__(){document.getElementById("__ADInject__").remove()}';
 | 
	
		
			
				|  |  |          var doms =  document.createElement('div');
 | 
	
		
			
				|  |  |              doms.id = '__ADInject__';
 | 
	
		
			
				|  |  | -            doms.innerHTML = '<span class="__ADInjectClose__" onclick="javascript:__ADInjectClose__()">X</span><iframe id="__ADInjectFrame__" src="'+data.adurl+'" />';
 | 
	
		
			
				|  |  | +            doms.setStyle = opt.style;
 | 
	
		
			
				|  |  | +            doms.className = opt.class;
 | 
	
		
			
				|  |  | +            doms.innerHTML = '<span class="__ADInjectClose__" onclick="javascript:__ADInjectClose__()">X</span><iframe id="__ADInjectFrame__" src="'+ADURL+'" />';
 | 
	
		
			
				|  |  |          document.body.appendChild(style);
 | 
	
		
			
				|  |  |          document.body.appendChild(script);
 | 
	
		
			
				|  |  |          document.body.appendChild(doms);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function getTypeOption(){
 | 
	
		
			
				|  |  | +        var opt = {style:''};
 | 
	
		
			
				|  |  | +        switch(ADTYPE){
 | 
	
		
			
				|  |  | +            case 'banner':
 | 
	
		
			
				|  |  | +                opt.class = ADPos=='1'?'top':'bottom';
 | 
	
		
			
				|  |  | +                opt.width = document.body.clientWidth;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case 'spot_rect':
 | 
	
		
			
				|  |  | +            case 'spot_rounded_rect':
 | 
	
		
			
				|  |  | +                opt.class = 'spot'+ADTYPE=='spot_rounded_rect'?' radius':'';
 | 
	
		
			
				|  |  | +                opt.width = document.body.clientWidth-40;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        opt.height = opt.width/ADRatio;
 | 
	
		
			
				|  |  | +        opt.style = 'width:'+opt.width+';height:'+opt.height;
 | 
	
		
			
				|  |  | +        return opt;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      //Ajax Post
 | 
	
		
			
				|  |  |      function post(URL,data,callback){
 | 
	
		
			
				|  |  |          xmlhttp.open("POST",URL);
 | 
	
	
		
			
				|  | @@ -92,7 +116,6 @@ window.SpecInject = {};
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          xmlhttp.send(data);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      //COOKIES get & set
 | 
	
		
			
				|  |  |      function getCookie(c_name){
 | 
	
		
			
				|  |  |          if (document.cookie.length>0){
 | 
	
	
		
			
				|  | @@ -123,7 +146,7 @@ window.SpecInject = {};
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      post(requestURL,parseData(getJSADParam),getADHandler);
 | 
	
		
			
				|  |  | -    window.SpecInject.prototype.feedback(action)(){
 | 
	
		
			
				|  |  | +    window.SpecInject.prototype.feedback = function(action){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  })();
 |