2 a2421864133 A2421864133 于 2017.01.06 14:53 提问

var plugver=""中plugver=“1.2”

var plugver=""中plugver=“1.2”时chrome插件无法显示,设置为空或其他值时可以显示是为什么

var miguanPlugin=function(){
var _self=this;
var siteurl="//news.gozone17.com";
var plugver="";
var plugbrowser="";
var plugid="";
var pluginstd="";
var plugchan="";

var keywordData=[];

this.run=function(){
    var miguan_plugin_close=_self.cookie.get('tuibaozhushou_close');
    if(!miguan_plugin_close || miguan_plugin_close==0){
        _self.$c('tbzs_tbzs').style.display="block";
    }   
    _self.$c("tuibaozhushou_close").onclick=function(){
        var w=120+10;
        //_self.$c("tbzs_tbzs").style.right='-'+w+'px';
        _self.$c("tbzs_tbzs").style.display='none';
        _self.cookie.add('miguan_plugin_close',1);
    }
    _self.$c("tbzs_tbzs_hyz").onclick=function(){
        var url=window.location.href;
        var title=document.title;
        var time=parseInt(10*Math.random());
        $.get(siteurl+"/chrome/index",{"type":"main","id":plugid,"instd":pluginstd,"ver":plugver,"br":plugbrowser,"title":title,"url":url,"chan":plugchan},function(jsondata){
            jsondata=strToJson(jsondata);
            if(jsondata.state>0){
                _self.$c("tbzs_tbzs_ul").innerHTML=jsondata.data;
            }else{
                //alert(jsondata.data)
            }
        })  
    };  
};
this.$c=function (classname){
    var classElements = [],allElements = document.getElementsByTagName('*');
    for (var i=0; i< allElements.length; i++ ){
        if (allElements[i].className == classname ) {
            classElements[classElements.length] = allElements[i];
            return allElements[i];
        }
    }
    return false;
};
this.cookie={
    "add":function (name,value,expiresHours){ 
        var cookieString=name+"="+escape(value); 
        if(expiresHours>0){ 
            var date=new Date(); 
            date.setTime(date.getTime+expiresHours*3600*1000); 
            cookieString=cookieString+"; expires="+date.toGMTString(); 
        } 
        document.cookie=cookieString; 
    } ,
    "get":function (name){ 
        var strCookie=document.cookie; 
        var arrCookie=strCookie.split("; "); 
        for(var i=0;i<arrCookie.length;i++){ 
            var arr=arrCookie[i].split("="); 
            if(arr[0]==name)return arr[1]; 
        } 
        return ""; 
    },
    "delete":function (name){ 
        var date=new Date(); 
        date.setTime(date.getTime()-10000); 
        document.cookie=name+"=v; expires="+date.toGMTString(); 
    } 

};
this.postData=function(){
    var title = $("title").text();
    var url   = window.location.href ;
    $.get(siteurl+"/chrome/index",{"id":plugid,"instd":pluginstd,"ver":plugver,"br":plugbrowser,"title":title,"url":url,"chan":plugchan},function(result){
        try{
        var jsondata=strToJson(result);
        var state = jsondata.state ;
        if( state > 0 ){
            $("body").append(jsondata.data);
            if($("#zhitui_plugin_mode").val()==0){
                $miguanplugin.run();
            }
        }
        }catch(e){
            //alert(e.message);
            $miguanplugin.run();
        }

    })
};

};

var $miguanplugin=new miguanPlugin();
$miguanplugin.postData();

1个回答

dabocaiqq
dabocaiqq   2017.01.14 23:11
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!