var retData1=[{uid:"testn",id:3905,last_update:1417589085909,black_type:3,status:"U",black_name:"075561603020",datetime:"",reject_type:0,bid:98,black_number:"075561603020"},{uid:"testn",id:3906,last_update:1417589085909,black_type:3,status:"U",black_name:"保护",datetime:"",reject_type:0,bid:99,black_number:"075566639865"},{uid:"testn",id:3907,last_update:1417589085909,black_type:3,status:"U",black_name:"075595511",datetime:"",reject_type:0,bid:100,black_number:"075595511"},{uid:"testn",id:3909,last_update:1415868877542,black_type:3,status:"U",black_name:"122sd",datetime:"1413713982438",reject_type:1,bid:48,black_number:"112"},{uid:"testn",id:4100,last_update:1415868877542,black_type:3,status:"U",black_name:"test",datetime:"1412679339218",reject_type:1,bid:49,black_number:"123456789"},{uid:"testn",id:4101,last_update:1415868877542,black_type:3,status:"U",black_name:"云雨巫山",datetime:"1412679323444",reject_type:1,bid:50,black_number:"13421359751"},{uid:"testn",id:4702,last_update:1415868877542,black_type:3,status:"U",black_name:"115",datetime:"1413714241594",reject_type:1,bid:51,black_number:"1156"},{uid:"testn",id:4703,last_update:1415868877542,black_type:3,status:"U",black_name:"114",datetime:"1413714071224",reject_type:1,bid:52,black_number:"1145"},{uid:"testn",id:5000,last_update:1415868877542,black_type:3,status:"U",black_name:"98946945699",datetime:"1414632189740",reject_type:1,bid:53,black_number:"98946945699"},{uid:"testn",id:5400,last_update:1417589085909,black_type:3,status:"U",black_name:"075525330251",datetime:"1415182902658",reject_type:1,bid:101,black_number:"075525330251"},{uid:"testn",id:5402,last_update:1417589085909,black_type:3,status:"U",black_name:"10086",datetime:"1413796745063",reject_type:1,bid:103,black_number:"10086"},{uid:"testn",id:5403,last_update:1415868877542,black_type:3,status:"U",black_name:"123",datetime:"1413794742683",reject_type:1,bid:45,black_number:"123"}];var type=["","拦截短信息","拦截电话","拦截短信息和电话"];var rejectType=["","黑名单","关键字","号码段"];var blackList=new BlackList();$(document).ready(function(){console.log("ready");$("#loadding").show();blackList.getBlackList("http://clouddisk/getBlackList");$("#allSelect").on("click",function(){var a=$("#blacklistTable .item").length;if($(this).hasClass("snOn")){$(".sn").removeClass("snOn");$("#import2Phone").addClass("disable")}else{if(a>0){$(".sn").addClass("snOn");if(parent.getRomVersion()>=20&&parent.global.bConnected==1){$("#import2Phone").removeClass("disable")}}}});$("#blacklistTable").on("click",".sn",function(){console.log("hello world");if($(this).hasClass("snOn")){if($("#allSelect").hasClass("snOn")){$("#allSelect").removeClass("snOn")}$(this).removeClass("snOn")}else{$(this).addClass("snOn");if($("#blacklistTable .sn").length==$("#blacklistTable .snOn").length){$("#allSelect").addClass("snOn")}}if($("#blacklistTable .snOn").length!=0){if(parent.getRomVersion()>=20&&parent.global.bConnected==1){$("#import2Phone").removeClass("disable")}}else{$("#import2Phone").addClass("disable")}});$("#refresh").on("click",function(){if($(this).hasClass("disable")){return}$("#loadding").show();$("#fail").hide();$("#allSelect").removeClass("snOn");$("#import2Phone").addClass("disable");blackList.getBlackList("http://clouddisk/getBlackList")});$("#import2Phone").on("click",function(){if($(this).hasClass("disable")){return}var a=$("#blacklistTable .snOn");var b=new Array();for(var c=0;c<a.length;++c){var d=$(a[c]).parent().attr("id");b.push(blackList.getDataById(d))}blackList.import2Phone(JSON.stringify(b))})});function BlackList(){this.getBlackList=function(a){$.ajax({url:a,type:"GET",success:function(e){$("#loadding").hide();if(e=="error"){$("#fail").show()}else{var d={_dataList:JSON.parse(e),_type:type,_reject_type:rejectType};var c=template("blackListTemplate",d);$("#blacklistTable").html(c);$("#refresh").removeClass("disable");var b=$("#blacklistTable .item").length;parent.setBlacklistCount(b)}},error:function(b){$("#loadding").hide();$("#fail").show();$("#refresh").addClass("disable")},complete:function(b){}})};this.import2Phone=function(a){parent.showImportProcess("blacklist","正在导入黑名单");$.ajax({url:"http://clouddisk/importBlacklist",type:"POST",data:a,success:function(){},error:function(){},complete:function(){parent.CloseArtDialog()}})};this.getDataById=function(b){var a={};a.black_name=$("#"+b+" .name").attr("title");a.black_number=$("#"+b+" .number").attr("title");a.black_type=parseInt($("#"+b+" .type").attr("value"));a.reject_type=parseInt($("#"+b+" .rejectType").attr("value"));a.datetime=parseInt($("#"+b).attr("datetime"));return a}}function onConnected(a){if(a==1){if($("#blacklistTable .snOn").length!=0){if(parent.getRomVersion()>=20){$("#import2Phone").removeClass("disable")}}else{$("#import2Phone").addClass("disable")}}else{$("#import2Phone").addClass("disable")}};