Commit b8bac284 authored by liyang's avatar liyang

fix:debug

parent b3961490
Pipeline #657 failed with stages
console.log("------ datav3.q.common.js debug ------")
var map = null;
var phyTopoin =null;
var phyInterRouter =null;
......
console.log("------ datav3.q.exportdata.js debug ------")
$('#logic-export').click(function(){
var inputValue = $(this).siblings('input').val();
......
console.log("------ datav3.q.initwebgl.js debug ------")
// 声明变量,用于存储渲染器、场景、相机、容器宽高、控制器和克隆相机
var renderer;
var scene;
......
console.log("------ datav3.q.left.js debug ------")
$(function(){
var leftinfo = $('.leftinfo');
var leftinfoR =$('.right');
......
var PhyInterRouter = function(as1,as2,searchip){
console.log("------ datav3.q.lemap.js debug ------");
var _ajax_url_ =datav_config.server_url;
removeAllMap();
init_map();
$("#asoutiframe").hide();
// $("#WebGL-output").show();
var PhyInterRouter = function (as1, as2, searchip) {
var _ajax_url_ = datav_config.server_url;
removeAllMap();
init_map();
$("#asoutiframe").hide();
// $("#WebGL-output").show();
// map.setView([32.30,14.36], 2);
// map.setView([32.30,14.36], 2);
var intermediateIcon = L.divIcon({
className: 'interIcon iconfont icon-luyou',
iconAnchor: [12, 12],
iconSize: [30, 30],
shadowAnchor: [0, 0],
popupAnchor: [0, -5]
});
var intermediateIcon = L.divIcon({
className: "interIcon iconfont icon-luyou",
iconAnchor: [12, 12],
iconSize: [30, 30],
shadowAnchor: [0, 0],
popupAnchor: [0, -5],
});
var areaIcon = L.divIcon({
className: 'areaIcon iconfont icon-luyou',
iconAnchor: [12, 12],
iconSize: [30, 30],
shadowAnchor: [0, 0],
popupAnchor: [0, -5]
});
var areaIcon = L.divIcon({
className: "areaIcon iconfont icon-luyou",
iconAnchor: [12, 12],
iconSize: [30, 30],
shadowAnchor: [0, 0],
popupAnchor: [0, -5],
});
var overlay = new L.echartsLayer(map, echarts);
var chartsContainer=overlay.getEchartsContainer();
$(chartsContainer).css({zIndex:999})
var myChart=overlay.initECharts(chartsContainer);
window.onresize = myChart.onresize;
var option = {
color: ['gold','aqua','lime'],
title : {
text: '',
subtext:'',
x:'center',
textStyle : {
color: '#fff'
}
var overlay = new L.echartsLayer(map, echarts);
var chartsContainer = overlay.getEchartsContainer();
$(chartsContainer).css({ zIndex: 999 });
var myChart = overlay.initECharts(chartsContainer);
window.onresize = myChart.onresize;
var option = {
color: ["gold", "aqua", "lime"],
title: {
text: "",
subtext: "",
x: "center",
textStyle: {
color: "#fff",
},
},
tooltip: {
trigger: "item",
formatter: "{b}",
},
toolbox: {
show: false,
orient: "vertical",
x: "right",
y: "center",
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
series: [
{
name: "all lines",
type: "map",
roam: true,
hoverable: true,
mapType: "none",
itemStyle: {
normal: {
borderColor: "rgba(100,149,237,1)",
borderWidth: 1,
areaStyle: {
color: "#1b1b1b",
},
},
},
tooltip : {
trigger: 'item',
formatter: '{b}'
data: [],
markLine: {
effect: {
color: "rgba(204, 246, 255, 0.5)",
show: true,
period: 40,
},
// bundling: {
// // enable: true
// },
// large: true,
smooth: true,
smoothness: 0.1,
symbol: ["none", "none"],
symbolSize: 3,
itemStyle: {
normal: {
color: "#fff",
borderWidth: 1,
borderColor: "rgba(255, 0, 0,0.5)",
lineStyle: {
// color: 'rgba(255, 69, 0,0.7)',
color: "rgba(102, 255, 103,0.6)",
type: "solid",
width: 0.7,
// opacity: 0.6
},
},
},
data: [],
},
toolbox: {
show : false,
orient : 'vertical',
x: 'right',
y: 'center',
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
restore : {show: true},
saveAsImage : {show: true}
}
geoCoord: {},
},
{
name: "source ip",
// type: 'map',
type: "map",
mapType: "none",
data: [],
markPoint: {
// symbol:'emptyCircle',
// symbol:'circle',
symbol: "image://images/intermediaterouter.png",
symbolSize: function (v) {
// return 10 + v/10
return [10, 10];
},
// effect : {
// show: true,
// shadowBlur : 0
// },
// itemStyle:{
// normal:{
// color: 'rgba(251, 118, 123,0.5)',
// // color: 'rgba(25, 183, 207,0.5)',
// label:{show:false}
// },
// emphasis: {
// label:{position:'top'},
// offset: 1,
// color: 'rgba(204, 46, 72,0.5)',
// symbolSize: 6,
// shadowColor: 'rgba(204, 46, 72,0.5)',
// shadowBlur: 100,
// borderWidth: 10
// }
// },
data: [],
},
series : [
{
name: 'all lines',
type: 'map',
roam: true,
hoverable: true,
mapType: 'none',
itemStyle:{
normal:{
borderColor:'rgba(100,149,237,1)',
borderWidth:1,
areaStyle:{
color: '#1b1b1b'
}
}
},
data:[],
markLine : {
effect: {
color: 'rgba(204, 246, 255, 0.5)',
show: true,
period: 40
},
// bundling: {
// // enable: true
// },
// large: true,
smooth: true,
smoothness: 0.1,
symbol: ['none', 'none'],
symbolSize : 3,
itemStyle : {
normal: {
color:'#fff',
borderWidth:1,
borderColor:'rgba(255, 0, 0,0.5)',
lineStyle: {
// color: 'rgba(255, 69, 0,0.7)',
color: 'rgba(102, 255, 103,0.6)',
type: 'solid',
width: 0.7,
// opacity: 0.6
}
}
},
data : [],
},
geoCoord: {}
},
{
name: "destnation ip",
type: "map",
mapType: "none",
data: [],
markPoint: {
// symbol:'emptyCircle',
symbol: "circle",
symbol: "image://images/arearouter.png",
symbolSize: function (v) {
// return 10 + v/10
return [10, 10];
},
// effect : {
// show: true,
// shadowBlur : 0
// },
itemStyle: {
normal: {
color: "rgba(129, 227, 238,0.5)",
label: { show: false },
},
{
name: 'source ip',
// type: 'map',
type: 'map',
mapType: 'none',
data:[],
markPoint : {
// symbol:'emptyCircle',
// symbol:'circle',
symbol:"image://images/intermediaterouter.png",
symbolSize : function (v){
// return 10 + v/10
return [10,10]
},
// effect : {
// show: true,
// shadowBlur : 0
// },
// itemStyle:{
// normal:{
// color: 'rgba(251, 118, 123,0.5)',
// // color: 'rgba(25, 183, 207,0.5)',
// label:{show:false}
// },
// emphasis: {
// label:{position:'top'},
// offset: 1,
// color: 'rgba(204, 46, 72,0.5)',
// symbolSize: 6,
// shadowColor: 'rgba(204, 46, 72,0.5)',
// shadowBlur: 100,
// borderWidth: 10
// }
// },
data : []
}
emphasis: {
label: { position: "top" },
offset: 1,
color: "rgba(25, 183, 20,0.5)",
size: 16,
shadowColor: "rgba(25, 183, 20,0.5)",
shadowBlur: 100,
borderWidth: 10,
},
{
name: 'destnation ip',
type: 'map',
mapType: 'none',
data:[],
markPoint : {
// symbol:'emptyCircle',
symbol:'circle',
symbol:"image://images/arearouter.png",
symbolSize : function (v){
// return 10 + v/10
return [10,10]
},
// effect : {
// show: true,
// shadowBlur : 0
// },
itemStyle:{
normal:{
color: 'rgba(129, 227, 238,0.5)',
label:{show:false}
},
emphasis: {
label:{position:'top'},
offset: 1,
color: 'rgba(25, 183, 20,0.5)',
size: 16,
shadowColor: 'rgba(25, 183, 20,0.5)',
shadowBlur: 100,
borderWidth: 10
}
},
data : []
}
},
]
};
},
data: [],
},
},
],
};
//数据格式
// option.series[0].markLine.data = alldata;
// option.series[0].geoCoord = geoCoord;
// var alldata = [
// [{name:'北京'},{name:'包头'}],
// [{name:'北京'},{name:'北海'}],
// [{name:'北京'},{name:'广州'}],
// [{name:'北京'},{name:'郑州'}],
// [{name:'北京'},{name:'成都'}],
// [{name:'广州'},{name:'盐城'}]
// ];
//数据格式
// option.series[0].markLine.data = alldata;
// option.series[0].geoCoord = geoCoord;
// var alldata = [
// [{name:'北京'},{name:'包头'}],
// [{name:'北京'},{name:'北海'}],
// [{name:'北京'},{name:'广州'}],
// [{name:'北京'},{name:'郑州'}],
// [{name:'北京'},{name:'成都'}],
// [{name:'广州'},{name:'盐城'}]
// ];
// var geoCoord = {
// '上海': [121.4648,31.2891],
// '东莞': [113.8953,22.901],
// '东营': [118.7073,37.5513],
// '中山': [113.4229,22.478],
// '临汾': [111.4783,36.1615],
// '阳泉': [113.4778,38.0951],
// '青岛': [120.4651,36.3373],
// '韶关': [113.7964,24.7028]
// };
// var geoCoord = {
// '上海': [121.4648,31.2891],
// '东莞': [113.8953,22.901],
// '东营': [118.7073,37.5513],
// '中山': [113.4229,22.478],
// '临汾': [111.4783,36.1615],
// '阳泉': [113.4778,38.0951],
// '青岛': [120.4651,36.3373],
// '韶关': [113.7964,24.7028]
// };
var markers = L.markerClusterGroup({
// spiderfyOnMaxZoom: false,
showCoverageOnHover: false,
zoomToBoundsOnClick: false,
maxClusterRadius: 0.0001,
// maxClusterRadius: 500,
spiderfyDistanceMultiplier:1,
});
var allLines = [];
// var sPoints = [];
// var dPoints = [];
var sPointsM = [];
var dPointsM = [];
var geoCoord = {};
var markers = L.markerClusterGroup({
// spiderfyOnMaxZoom: false,
showCoverageOnHover: false,
zoomToBoundsOnClick: false,
maxClusterRadius: 0.0001,
// maxClusterRadius: 500,
spiderfyDistanceMultiplier: 1,
});
var allLines = [];
// var sPoints = [];
// var dPoints = [];
var sPointsM = [];
var dPointsM = [];
var geoCoord = {};
$.ajax({
url: _ajax_url_ + "visual/control/vs/v3/topology/getInterfaceByASnumber",
type: "post",
datatype: "json",
headers: { "Content-type": "application/json;charset=UTF-8" },
// data: JSON.stringify({
// "as1":"10010",
// "as2":"17682"
// })
// data: JSON.stringify({
// "as1":"9808",
// "as2":"24400"
// })
// data: JSON.stringify({
// "as1":"4134",
// "as2":"3356"
// })
data: JSON.stringify({
as1: as1,
as2: as2,
}),
})
.done(function (data) {
if (data && data.list && data.list.length > 0) {
$.each(data.list, function (i, d) {
//echart连线数据
geoCoord[d.ip1] = [d.ip1_info.j, d.ip1_info.w];
geoCoord[d.ip2] = [d.ip2_info.j, d.ip2_info.w];
allLines.push([{ name: d.ip1 }, { name: d.ip2 }]);
sPointsM.push(d.ip1);
dPointsM.push(d.ip2);
});
$.ajax({
url:_ajax_url_+'visual/control/vs/v3/topology/getInterfaceByASnumber',
type:'post',
datatype:'json',
headers: {'Content-type': 'application/json;charset=UTF-8'},
// data: JSON.stringify({
// "as1":"10010",
// "as2":"17682"
// })
// data: JSON.stringify({
// "as1":"9808",
// "as2":"24400"
// })
// data: JSON.stringify({
// "as1":"4134",
// "as2":"3356"
// })
data: JSON.stringify({
"as1":as1,
"as2":as2
})
}).done(function(data){
if(data && data.list && data.list.length>0){
$.each(data.list,function(i,d){
//echart连线数据
geoCoord[d.ip1] = [d.ip1_info.j,d.ip1_info.w];
geoCoord[d.ip2] = [d.ip2_info.j,d.ip2_info.w];
allLines.push([{name:d.ip1},{name:d.ip2}]);
sPointsM.push(d.ip1);
dPointsM.push(d.ip2);
})
sPointsM = _.uniq(sPointsM);
dPointsM = _.uniq(dPointsM);
//聚簇点
sPointsM = _.uniq(sPointsM);
dPointsM = _.uniq(dPointsM);
//聚簇点
$.each(sPointsM,function(i,d){
var m1 = L.marker([geoCoord[d][1],geoCoord[d][0]],{//这里需传入纬度,经度,echart中的数据为经度,纬度
icon: intermediateIcon,
// ip:d.ip1
name:d
}).bindPopup('<div>起始IP:'+d+'</div>');
m1.on('click',handleClickM)
markers.addLayer(m1);
})
$.each(dPointsM,function(i,d){
var m2 = L.marker([geoCoord[d][1],geoCoord[d][0]],{
icon: areaIcon,
// ip:d.ip2
name:d
}).bindPopup('<div>目的IP:'+d+'</div>');
m2.on('click',handleClickM)
markers.addLayer(m2);
})
map.addLayer(markers);
map.fitBounds(markers.getBounds());
$.each(sPointsM, function (i, d) {
var m1 = L.marker([geoCoord[d][1], geoCoord[d][0]], {
//这里需传入纬度,经度,echart中的数据为经度,纬度
icon: intermediateIcon,
// ip:d.ip1
name: d,
}).bindPopup("<div>起始IP:" + d + "</div>");
m1.on("click", handleClickM);
markers.addLayer(m1);
});
option.series[0].geoCoord = geoCoord;
// option.series[1].markPoint.data = sPoints;
// option.series[2].markPoint.data = dPoints;
if(!searchip){
option.series[0].markLine.data = allLines;
}
myChart=overlay.initECharts(chartsContainer);
overlay.setOption(option);
// searchRouter(ip)
}else{
console.log('无相连路由器')
}
}).done(function(){
if(searchip){
setTimeout(function(){
searchRouter(searchip);
},500)
$.each(dPointsM, function (i, d) {
var m2 = L.marker([geoCoord[d][1], geoCoord[d][0]], {
icon: areaIcon,
// ip:d.ip2
name: d,
}).bindPopup("<div>目的IP:" + d + "</div>");
m2.on("click", handleClickM);
markers.addLayer(m2);
});
map.addLayer(markers);
map.fitBounds(markers.getBounds());
option.series[0].geoCoord = geoCoord;
// option.series[1].markPoint.data = sPoints;
// option.series[2].markPoint.data = dPoints;
if (!searchip) {
option.series[0].markLine.data = allLines;
}
}).fail(function(err){
// handleError()
myChart = overlay.initECharts(chartsContainer);
overlay.setOption(option);
// searchRouter(ip)
} else {
console.log("无相连路由器");
}
})
.done(function () {
if (searchip) {
setTimeout(function () {
searchRouter(searchip);
}, 500);
}
})
.fail(function (err) {
// handleError()
});
// 添加图例
showLengend()
function showLengend(){
$('.logrouter_tips').hide();
$('.tips').hide();
$('.phyrouter_tips').hide();
$('.backtodomainouter').hide();
$('.intodomain').hide();
$('.chose_icon .myicon').hide();
$('.inter_r_tips').show();
}
// 添加图例
showLengend();
function showLengend() {
$(".logrouter_tips").hide();
$(".tips").hide();
$(".phyrouter_tips").hide();
$(".backtodomainouter").hide();
$(".intodomain").hide();
$(".chose_icon .myicon").hide();
$(".inter_r_tips").show();
}
function handleClickM(e){
var searchValue = e.target.options.name;
var asNumber = input_record.input_value;
$('#export-form .search-input').val(searchValue);
fetchData.getInterfaceByASnumber({ as1: asNumber[0], as2: asNumber[1],key:searchValue });
redrawLines(searchValue);
}
function handleClickM(e) {
var searchValue = e.target.options.name;
var asNumber = input_record.input_value;
$("#export-form .search-input").val(searchValue);
fetchData.getInterfaceByASnumber({
as1: asNumber[0],
as2: asNumber[1],
key: searchValue,
});
redrawLines(searchValue);
}
function searchRouter(ip){
spiderfy(ip);
redrawLines(ip);
}
function spiderfy(ip){
if(ip){
//展开聚簇
markers.eachLayer(function(layer){
if(layer.options.name == ip){
if(!layer.getElement()){
layer.__parent.spiderfy();
layer.openPopup();
}
}
})
}else{
markers._unspiderfy();
}
function searchRouter(ip) {
spiderfy(ip);
redrawLines(ip);
}
function spiderfy(ip) {
if (ip) {
//展开聚簇
markers.eachLayer(function (layer) {
if (layer.options.name == ip) {
if (!layer.getElement()) {
layer.__parent.spiderfy();
layer.openPopup();
}
}
});
} else {
markers._unspiderfy();
}
}
function redrawLines(ip){
if(ip){
//重新绘制连线
var new_lines = [];
for(var j=0;j<allLines.length;j++){
if(allLines[j][0].name == ip || allLines[j][1].name == ip) {
new_lines.push(allLines[j]);
}
}
option.series[0].markLine.data = new_lines;
myChart=overlay.initECharts(chartsContainer);
overlay.setOption(option);
}else{
option.series[0].markLine.data = allLines;
myChart=overlay.initECharts(chartsContainer);
overlay.setOption(option);
function redrawLines(ip) {
if (ip) {
//重新绘制连线
var new_lines = [];
for (var j = 0; j < allLines.length; j++) {
if (allLines[j][0].name == ip || allLines[j][1].name == ip) {
new_lines.push(allLines[j]);
}
}
// searchRouter();
return {
searchRouter:searchRouter
}
option.series[0].markLine.data = new_lines;
myChart = overlay.initECharts(chartsContainer);
overlay.setOption(option);
} else {
option.series[0].markLine.data = allLines;
myChart = overlay.initECharts(chartsContainer);
overlay.setOption(option);
}
}
\ No newline at end of file
}
// searchRouter();
return {
searchRouter: searchRouter,
};
};
//自动执行函数
(function () {
console.log("------ datav3.q.map debug ------")
console.log("------ datav3.q.map debug ------");
// 公共鼠标拾取变量
var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();
......@@ -492,7 +492,10 @@
transformSVGPathExposed(path(feature)),
extrudeSettings
),
new THREE.MeshLambertMaterial({ color: 0xffffff, depthTest: true })
new THREE.MeshLambertMaterial({
color: 0xffffff,
depthTest: true,
})
);
map_mesh.name = "map_" + country_code;
country_geomap_map.add(map_mesh);
......@@ -525,7 +528,7 @@
country_AScount_list.push(_.size(country_ASes));
}
var country_AScount_max = _.max(country_AScount_list);
console.log("------------")
console.log("------------");
// 点处理
var Land_points = new THREE.Geometry();
valid_country_names = []; // 实际有效的绘图国家列表
......
console.log("------ datav3.q.right.js debug ------");
//***********右侧信息展示中供index调用的接口封装***********/
// 右下按钮动画
$(function(){
var right_btm = $('.right-btm');
var content = right_btm.find('.content');
var content_list = content.find('.content-list');
right_btm.find('.rb-btn').each(function(){
rbBtnAnimate($(this));
})
// rbBtnAnimate(right_btm.find('.rb-btn2'));
function rbBtnAnimate($ele){
var btn_country = $ele.find('.rb-btn-center');
var rb_btn_outer = $ele.find('.rb-btn-outer');
var btn_transition_time = 500;
var img_len = rb_btn_outer.find('img').length;
var per_deg = 360/img_len;
// var init_rotate = 140;
if(img_len == 2){
btn_country.click(function(){
$_this = $(this);
var anim1 = scaleBtnCountry($_this);
anim1.then(function(){
resetBtnCountry($_this); ;
})
})
}else{
btn_country.click(function(){
$_this = $(this);
var anim1 = transiteBtnOuterDown($_this,-200);
anim1.then(function(){
resetBtnOuter($_this); ;
})
})
}
function scaleBtnCountry($_el){
var dtd = $.Deferred();
$_el.transition({
transform: 'scale(0.8) rotate(-40deg)'
},btn_transition_time,function(){
dtd.resolve();
})
return dtd.promise();
}
function resetBtnCountry($_el){
var dtd = $.Deferred();
$(function () {
var right_btm = $(".right-btm");
var content = right_btm.find(".content");
var content_list = content.find(".content-list");
right_btm.find(".rb-btn").each(function () {
rbBtnAnimate($(this));
});
// rbBtnAnimate(right_btm.find('.rb-btn2'));
function rbBtnAnimate($ele) {
var btn_country = $ele.find(".rb-btn-center");
var rb_btn_outer = $ele.find(".rb-btn-outer");
var btn_transition_time = 500;
var img_len = rb_btn_outer.find("img").length;
var per_deg = 360 / img_len;
// var init_rotate = 140;
if (img_len == 2) {
btn_country.click(function () {
$_this = $(this);
var anim1 = scaleBtnCountry($_this);
anim1.then(function () {
resetBtnCountry($_this);
});
});
} else {
btn_country.click(function () {
$_this = $(this);
var anim1 = transiteBtnOuterDown($_this, -200);
anim1.then(function () {
resetBtnOuter($_this);
});
});
}
$_el.transition({
transform: 'scale(1) rotate(-40deg)'
},btn_transition_time,function(){
dtd.resolve();
})
function scaleBtnCountry($_el) {
var dtd = $.Deferred();
return dtd.promise();
}
$_el.transition(
{
transform: "scale(0.8) rotate(-40deg)",
},
btn_transition_time,
function () {
dtd.resolve();
}
);
rb_btn_outer.find('img').each(function(i,d){
$(this).on('click.animate',function(){
var $_this = $(this);
var rotate_deg = i*per_deg;
var anim1 = transiteBtnOuterDown($_this);
anim1 .then(function(){
transiteBtnOuterUp($_this)
return rotateBtn($_this,rotate_deg);
}).then(function(){
resetBtnOuter($_this);
})
// $_this.addClass('active');
})
})
return dtd.promise();
}
function transiteBtnOuterDown($_el,transZ){
var dtd = $.Deferred();
var transZ = transZ || -40;
function resetBtnCountry($_el) {
var dtd = $.Deferred();
$_el.transition({
transform: 'translate3d(0px,0px,'+transZ+'px)'
},btn_transition_time,function(){
dtd.resolve();
})
$_el.transition(
{
transform: "scale(1) rotate(-40deg)",
},
btn_transition_time,
function () {
dtd.resolve();
}
);
return dtd.promise();
}
return dtd.promise();
}
function transiteBtnOuterUp($_el,transZ){
var dtd = $.Deferred();
var transZ = transZ || 50;
rb_btn_outer.find("img").each(function (i, d) {
$(this).on("click.animate", function () {
var $_this = $(this);
var rotate_deg = i * per_deg;
$_el.transition({
transform: 'translate3d(0px,0px,'+transZ+'px)'
},btn_transition_time,function(){
dtd.resolve();
var anim1 = transiteBtnOuterDown($_this);
anim1
.then(function () {
transiteBtnOuterUp($_this);
return rotateBtn($_this, rotate_deg);
})
.then(function () {
resetBtnOuter($_this);
});
// $_this.addClass('active');
});
});
function transiteBtnOuterDown($_el, transZ) {
var dtd = $.Deferred();
var transZ = transZ || -40;
$_el.transition(
{
transform: "translate3d(0px,0px," + transZ + "px)",
},
btn_transition_time,
function () {
dtd.resolve();
}
);
return dtd.promise();
}
return dtd.promise();
}
function rotateBtn($_el,rotate_deg){
var dtd = $.Deferred();
$_el.parent().transition({
transform: 'rotate(-'+rotate_deg+'deg)'
},btn_transition_time,function(){
dtd.resolve();
})
function transiteBtnOuterUp($_el, transZ) {
var dtd = $.Deferred();
var transZ = transZ || 50;
$_el.transition(
{
transform: "translate3d(0px,0px," + transZ + "px)",
},
btn_transition_time,
function () {
dtd.resolve();
}
);
return dtd.promise();
}
return dtd.promise();
}
function rotateBtn($_el, rotate_deg) {
var dtd = $.Deferred();
function resetBtnOuter($_el){
$_el.parent().transition(
{
transform: "rotate(-" + rotate_deg + "deg)",
},
btn_transition_time,
function () {
dtd.resolve();
}
);
$_el.transition({
transform: 'translate3d(0px,0px,0px)'
},btn_transition_time)
}
return dtd.promise();
}
function resetBtnOuter($_el) {
$_el.transition(
{
transform: "translate3d(0px,0px,0px)",
},
btn_transition_time
);
}
}
//右下信息中交互操作
$('.aslist .content-list').each(function(){
$(this).hover(function(){
$(this).addClass('active');
},function(){
$(this).removeClass('active')
})
})
})
$(".aslist .content-list").each(function () {
$(this).hover(
function () {
$(this).addClass("active");
},
function () {
$(this).removeClass("active");
}
);
});
});
console.log("------ datav3.q.utils.js debug ------");
function isAsnumber(val) {
var regAs = /^[0-9]*$/;
if (val !== '' && regAs.test(val) && 0 <= val && val <= 4294967295) {
return true;
} else {
return false;
}
var regAs = /^[0-9]*$/;
if (val !== "" && regAs.test(val) && 0 <= val && val <= 4294967295) {
return true;
} else {
return false;
}
}
function isReservedPrivateAs(val) {
var regAs = /^[0-9]*$/;
if (
(val !== "" && regAs.test(val) && 64512 <= val && val <= 65534) ||
(4200000000 <= val && val <= 4294967294)
) {
return true;
} else {
return false;
}
}
function isReservedAs(val) {
var regAs = /^[0-9]*$/;
if (
(val !== "" && regAs.test(val) && val == 0) ||
(64496 <= val && val <= 64511) ||
(65535 <= val && val <= 131071) ||
val == 4294967295
) {
return true;
} else {
return false;
}
function isReservedPrivateAs(val) {
var regAs = /^[0-9]*$/;
if ((val !== '' && regAs.test(val) && 64512 <= val && val <= 65534) || (4200000000 <= val && val <= 4294967294)) {
}
function isCountry(val) {
var regCountry = /[a-zA-Z\u4e00-\u9fa5]+/;
// var regCountry = /[a-zA-Z]+/;
return regCountry.test(val);
}
function isTopoinAS(as) {
var topoinASNumber = [
10026, 131588, 133038, 133893, 135373, 17990, 24058, 38197, 45485, 4862,
58451, 63946, 9266, 10032, 131589, 133054, 133904, 135386, 18040, 24077,
38277, 45496, 5017, 58453, 63955, 9269, 10082, 131590, 133077, 133905,
135387, 18042, 24112, 38385, 45504, 5018, 58516, 63959, 9289, 10085, 131591,
133089, 133929, 135391, 18045, 24115, 38452, 45508, 55298, 58579, 63977,
9293, 10098, 131593, 133107, 133946, 135413, 18046, 24154, 38469, 45561,
55334, 58627, 63981, 9304, 10099, 131596, 133115, 133948, 135414, 18047,
24155, 38475, 45562, 55350, 58683, 64033, 9311, 10103, 131597, 133126,
133953, 1659, 18049, 24157, 38478, 45572, 55355, 58708, 64047, 9346, 10108,
131599, 133142, 134094, 17408, 18116, 24158, 38486, 45590, 55361, 58730,
64067, 9381, 10116, 131603, 133158, 134121, 17416, 18177, 24160, 38531,
45597, 55367, 58744, 64078, 9409, 10118, 131994, 133190, 134127, 17420,
18179, 24163, 38574, 45599, 55369, 58779, 64087, 9415, 10126, 132017,
133199, 134167, 17421, 18181, 24164, 38578, 45640, 55417, 58797, 7468, 9416,
10127, 132056, 133201, 134175, 17444, 18182, 24165, 38580, 45750, 55480,
58807, 7478, 9420, 10135, 132057, 133204, 134243, 17485, 18183, 24167,
38591, 45753, 55489, 58815, 7479, 9444, 10138, 132157, 133209, 134366,
17487, 18185, 24168, 38603, 45761, 55512, 58908, 7481, 9468, 10147, 132169,
133322, 134379, 17537, 18218, 24182, 38658, 45816, 55517, 58931, 7482, 9474,
10202, 132252, 133325, 134387, 17540, 18382, 24224, 38797, 45855, 55536,
58933, 7484, 9502, 10205, 132295, 133372, 134401, 17554, 18410, 24235,
38802, 45908, 55552, 58944, 7499, 9505, 10229, 132310, 133380, 134446,
17555, 18411, 24236, 38814, 45910, 55558, 58958, 7532, 9513, 10231, 132342,
133398, 134449, 17619, 18413, 24246, 38819, 45911, 55639, 58985, 7533, 9520,
10232, 132364, 133405, 134518, 17630, 18415, 24304, 38837, 45930, 55649,
59207, 7535, 9536, 10238, 132368, 133424, 134519, 17651, 18417, 24329,
38841, 45932, 55725, 59214, 7539, 9538, 131091, 132422, 133428, 134523,
17653, 18419, 24333, 38843, 4594, 55743, 59217, 7540, 9584, 131142, 132490,
133448, 134524, 17657, 18420, 24334, 38844, 4605, 55750, 59234, 7577, 9590,
131143, 132499, 133460, 134544, 17706, 18421, 24396, 38845, 4616, 55778,
59237, 7581, 9660, 131144, 132506, 133467, 134548, 17709, 18422, 24399,
38847, 4623, 55789, 59248, 7617, 9671, 131146, 132549, 133485, 134608,
17710, 18424, 24449, 38848, 4635, 55807, 59268, 7619, 9674, 131148, 132585,
133486, 134670, 17711, 18426, 24462, 38850, 4637, 55852, 59270, 7649, 9676,
131149, 132591, 133488, 134684, 17712, 18429, 24506, 38866, 4641, 55858,
59337, 7650, 9680, 131150, 132593, 133549, 134687, 17713, 201223, 24545,
38870, 4642, 55940, 59352, 7651, 9729, 131184, 132597, 133578, 134700,
17714, 203926, 24549, 38873, 4645, 55952, 59371, 7656, 9732, 131188, 132609,
133617, 134705, 17716, 23648, 24568, 4058, 4655, 55953, 62294, 7695, 9735,
131189, 132610, 133734, 134706, 17744, 23709, 2706, 4158, 4656, 56059,
63527, 7710, 9831, 131224, 132698, 133741, 134729, 17759, 23712, 3363, 4352,
4658, 56080, 63834, 9216, 9879, 131234, 132702, 133747, 134795, 17764,
23730, 3462, 45136, 4662, 56103, 63845, 9221, 9906, 131271, 132714, 133752,
134823, 17793, 23749, 3661, 4515, 4748, 56136, 63849, 9229, 9908, 131274,
132737, 133771, 134835, 17794, 23875, 3662, 45165, 4760, 56180, 63855, 9231,
9916, 131278, 132742, 133772, 134969, 17809, 23881, 3693, 45187, 4780,
56190, 63889, 9237, 9918, 131280, 132818, 133777, 135062, 17814, 23890,
38056, 45247, 4781, 56195, 63911, 9242, 9919, 131324, 132837, 133779,
135081, 17888, 23985, 38059, 45250, 4782, 56276, 63915, 9244, 9924, 131337,
132865, 133783, 135140, 17924, 24002, 38166, 4528, 4783, 56302, 63916, 9253,
9925, 131584, 132883, 133789, 135147, 17929, 24010, 38176, 45327, 4828,
58411, 63927, 9259, 131586, 132899, 133793, 135166, 17975, 24023, 38177,
45346, 4845, 58426, 63928, 9263, 131587, 133027, 133849, 135314, 17988,
24043, 38186, 45474, 4849, 58441, 63929, 9264,
];
for (var i = 0; i < topoinASNumber.length; i++) {
if (topoinASNumber[i] == as) {
return true;
} else {
return false;
}
}
function isReservedAs(val) {
var regAs = /^[0-9]*$/;
return false;
}
var util = {};
// util.countries =[{"country_cn":"欧盟","countrycode":"EU"},{"country_cn":"不丹","countrycode":"BT"},{"country_cn":"中国","countrycode":"CN"},{"country_cn":"中非","countrycode":"CF"},{"country_cn":"丹麦","countrycode":"DK"},{"country_cn":"乌克兰","countrycode":"UA"},{"country_cn":"乌兹别克斯坦","countrycode":"UZ"},{"country_cn":"乌干达","countrycode":"UG"},{"country_cn":"乌拉圭","countrycode":"UY"},{"country_cn":"乍得","countrycode":"TD"},{"country_cn":"也门","countrycode":"YE"},{"country_cn":"亚美尼亚","countrycode":"AM"},{"country_cn":"以色列","countrycode":"IL"},{"country_cn":"伊拉克","countrycode":"IQ"},{"country_cn":"伊朗","countrycode":"IR"},{"country_cn":"伯里兹","countrycode":"BZ"},{"country_cn":"佛得角","countrycode":"CV"},{"country_cn":"俄罗斯","countrycode":"RU"},{"country_cn":"保加利亚","countrycode":"BG"},{"country_cn":"克罗地亚","countrycode":"HR"},{"country_cn":"关岛","countrycode":"GU"},{"country_cn":"冈比亚","countrycode":"GM"},{"country_cn":"冰岛","countrycode":"IS"},{"country_cn":"几内亚","countrycode":"GN"},{"country_cn":"几内亚比绍","countrycode":"GW"},{"country_cn":"列支顿士登","countrycode":"LI"},{"country_cn":"刚果(布)","countrycode":"CG"},{"country_cn":"刚果(金)","countrycode":"CD"},{"country_cn":"利比亚","countrycode":"LY"},{"country_cn":"利比里亚","countrycode":"LR"},{"country_cn":"加拿大","countrycode":"CA"},{"country_cn":"加纳","countrycode":"GH"},{"country_cn":"加蓬","countrycode":"GA"},{"country_cn":"匈牙利","countrycode":"HU"},{"country_cn":"南苏丹","countrycode":"SS"},{"country_cn":"南非","countrycode":"ZA"},{"country_cn":"博茨瓦纳","countrycode":"BW"},{"country_cn":"卡塔尔","countrycode":"QA"},{"country_cn":"卢旺达","countrycode":"RW"},{"country_cn":"卢森堡","countrycode":"LU"},{"country_cn":"印度","countrycode":"IN"},{"country_cn":"印度尼西亚","countrycode":"ID"},{"country_cn":"危地马拉","countrycode":"GT"},{"country_cn":"厄瓜多尔","countrycode":"EC"},{"country_cn":"厄立特里亚","countrycode":"ER"},{"country_cn":"叙利亚","countrycode":"SY"},{"country_cn":"古巴","countrycode":"CU"},{"country_cn":"吉尔吉斯斯坦","countrycode":"KG"},{"country_cn":"吉布提","countrycode":"DJ"},{"country_cn":"哈萨克斯坦","countrycode":"KZ"},{"country_cn":"哥伦比亚","countrycode":"CO"},{"country_cn":"哥斯达黎加","countrycode":"CR"},{"country_cn":"喀麦隆","countrycode":"CM"},{"country_cn":"图瓦卢","countrycode":"TV"},{"country_cn":"土尔其","countrycode":"TR"},{"country_cn":"土库曼斯坦","countrycode":"TM"},{"country_cn":"圣基茨和尼维斯","countrycode":"KN"},{"country_cn":"圣多美和普林西比","countrycode":"ST"},{"country_cn":"圣巴泰勒米岛","countrycode":"BL"},{"country_cn":"圣文森特和格陵纳丁斯","countrycode":"VC"},{"country_cn":"圣皮埃尔和密克隆","countrycode":"PM"},{"country_cn":"圣马力诺","countrycode":"SM"},{"country_cn":"圭亚那","countrycode":"GY"},{"country_cn":"坦桑尼亚","countrycode":"TZ"},{"country_cn":"埃及","countrycode":"EG"},{"country_cn":"埃塞俄比亚","countrycode":"ET"},{"country_cn":"基里巴斯","countrycode":"KI"},{"country_cn":"塔吉克斯坦","countrycode":"TJ"},{"country_cn":"塞内加尔","countrycode":"SN"},{"country_cn":"塞尔维亚","countrycode":"RS"},{"country_cn":"塞拉利昂","countrycode":"SL"},{"country_cn":"塞普路斯","countrycode":"CY"},{"country_cn":"塞舌尔","countrycode":"SC"},{"country_cn":"墨西哥","countrycode":"MX"},{"country_cn":"多哥","countrycode":"TG"},{"country_cn":"多米尼加共和国","countrycode":"DM"},{"country_cn":"多米尼加联邦","countrycode":"DO"},{"country_cn":"奥兰群岛","countrycode":"AX"},{"country_cn":"奥地利","countrycode":"AT"},{"country_cn":"委内瑞拉","countrycode":"VE"},{"country_cn":"孟加拉","countrycode":"BD"},{"country_cn":"安哥拉","countrycode":"AO"},{"country_cn":"安圭拉","countrycode":"AI"},{"country_cn":"安提瓜和巴布达","countrycode":"AG"},{"country_cn":"安道尔","countrycode":"AD"},{"country_cn":"尼加拉瓜","countrycode":"NI"},{"country_cn":"尼日利亚","countrycode":"NG"},{"country_cn":"尼日尔","countrycode":"NE"},{"country_cn":"尼泊尔","countrycode":"NP"},{"country_cn":"巴勒斯坦","countrycode":"PS"},{"country_cn":"巴哈马","countrycode":"BS"},{"country_cn":"巴基斯坦","countrycode":"PK"},{"country_cn":"巴巴多斯","countrycode":"BB"},{"country_cn":"巴布亚新几内亚","countrycode":"PG"},{"country_cn":"巴拉圭","countrycode":"PY"},{"country_cn":"巴拿马","countrycode":"PA"},{"country_cn":"巴林","countrycode":"BH"},{"country_cn":"巴西","countrycode":"BR"},{"country_cn":"布基纳法索","countrycode":"BF"},{"country_cn":"布隆迪","countrycode":"BI"},{"country_cn":"希腊","countrycode":"GR"},{"country_cn":"帕劳","countrycode":"PW"},{"country_cn":"库克群岛","countrycode":"CK"},{"country_cn":"库拉索","countrycode":"CW"},{"country_cn":"开曼群岛","countrycode":"KY"},{"country_cn":"德国","countrycode":"DE"},{"country_cn":"意大利","countrycode":"IT"},{"country_cn":"所罗门群岛","countrycode":"SB"},{"country_cn":"拉托维亚","countrycode":"LV"},{"country_cn":"挪威","countrycode":"NO"},{"country_cn":"捷克","countrycode":"CZ"},{"country_cn":"摩尔多瓦","countrycode":"MD"},{"country_cn":"摩洛哥","countrycode":"MA"},{"country_cn":"摩纳哥","countrycode":"MC"},{"country_cn":"文莱布鲁萨兰","countrycode":"BN"},{"country_cn":"斐济","countrycode":"FJ"},{"country_cn":"斯威士兰","countrycode":"SZ"},{"country_cn":"斯洛伐克","countrycode":"SK"},{"country_cn":"斯罗文尼亚","countrycode":"SI"},{"country_cn":"斯里兰卡","countrycode":"LK"},{"country_cn":"新加坡","countrycode":"SG"},{"country_cn":"新卡里多尼亚","countrycode":"NC"},{"country_cn":"新西兰","countrycode":"NZ"},{"country_cn":"日本","countrycode":"JP"},{"country_cn":"智利","countrycode":"CL"},{"country_cn":"朝鲜","countrycode":"KP"},{"country_cn":"柬埔寨","countrycode":"KH"},{"country_cn":"根西岛","countrycode":"GG"},{"country_cn":"格林纳达","countrycode":"GD"},{"country_cn":"格陵兰岛","countrycode":"GL"},{"country_cn":"格鲁吉亚","countrycode":"GE"},{"country_cn":"梵蒂岗","countrycode":"VA"},{"country_cn":"比利时","countrycode":"BE"},{"country_cn":"毛里塔尼亚","countrycode":"MR"},{"country_cn":"毛里求斯","countrycode":"MU"},{"country_cn":"汤加","countrycode":"TO"},{"country_cn":"沙特阿拉伯","countrycode":"SA"},{"country_cn":"法国","countrycode":"FR"},{"country_cn":"法属圣马丁","countrycode":"MF"},{"country_cn":"法属圭亚那","countrycode":"GF"},{"country_cn":"法属尼留旺岛","countrycode":"RE"},{"country_cn":"中国香港","countrycode":"HK"},{"country_cn":"法属玻里尼西亚","countrycode":"PF"},{"country_cn":"法罗群岛","countrycode":"FO"},{"country_cn":"波兰","countrycode":"PL"},{"country_cn":"波多黎各","countrycode":"PR"},{"country_cn":"波黑","countrycode":"BA"},{"country_cn":"泰国","countrycode":"TH"},{"country_cn":"泽西岛","countrycode":"JE"},{"country_cn":"津巴布韦","countrycode":"ZW"},{"country_cn":"洪都拉斯","countrycode":"HN"},{"country_cn":"海地","countrycode":"HT"},{"country_cn":"澳大利亚","countrycode":"AU"},{"country_cn":"中国台湾","countrycode":"TW"},{"country_cn":"爱尔兰","countrycode":"IE"},{"country_cn":"爱沙尼亚","countrycode":"EE"},{"country_cn":"牙买加","countrycode":"JM"},{"country_cn":"特克斯和凯科斯群岛","countrycode":"TC"},{"country_cn":"特立尼达和多巴哥","countrycode":"TT"},{"country_cn":"玻利维亚","countrycode":"BO"},{"country_cn":"瑙鲁","countrycode":"NR"},{"country_cn":"瑞典","countrycode":"SE"},{"country_cn":"瑞士","countrycode":"CH"},{"country_cn":"瓦努阿鲁","countrycode":"VU"},{"country_cn":"白俄罗斯","countrycode":"BY"},{"country_cn":"百慕大","countrycode":"BM"},{"country_cn":"直布罗陀","countrycode":"GI"},{"country_cn":"科威特","countrycode":"KW"},{"country_cn":"科摩罗","countrycode":"KM"},{"country_cn":"科特迪瓦","countrycode":"CI"},{"country_cn":"秘鲁","countrycode":"PE"},{"country_cn":"突尼斯","countrycode":"TN"},{"country_cn":"立陶宛","countrycode":"LT"},{"country_cn":"米克罗尼西亚","countrycode":"FM"},{"country_cn":"索马里","countrycode":"SO"},{"country_cn":"约旦","countrycode":"JO"},{"country_cn":"纳米比亚","countrycode":"NA"},{"country_cn":"缅甸","countrycode":"MM"},{"country_cn":"罗马尼亚","countrycode":"RO"},{"country_cn":"美国","countrycode":"US"},{"country_cn":"美属维尔京群岛","countrycode":"VI"},{"country_cn":"老挝","countrycode":"LA"},{"country_cn":"肯尼亚","countrycode":"KE"},{"country_cn":"芬兰","countrycode":"FI"},{"country_cn":"苏丹","countrycode":"SD"},{"country_cn":"苏里南","countrycode":"SR"},{"country_cn":"英国","countrycode":"GB"},{"country_cn":"英属印度洋领地","countrycode":"IO"},{"country_cn":"英属维京群岛","countrycode":"VG"},{"country_cn":"荷兰","countrycode":"NL"},{"country_cn":"荷兰加勒比区","countrycode":"BQ"},{"country_cn":"荷属圣马丁","countrycode":"SX"},{"country_cn":"莫桑比克","countrycode":"MZ"},{"country_cn":"莱索托","countrycode":"LS"},{"country_cn":"菲律宾","countrycode":"PH"},{"country_cn":"萨尔瓦多","countrycode":"SV"},{"country_cn":"萨摩亚","countrycode":"WS"},{"country_cn":"葡萄牙","countrycode":"PT"},{"country_cn":"蒙古","countrycode":"MN"},{"country_cn":"西班牙","countrycode":"ES"},{"country_cn":"诺福克岛","countrycode":"NF"},{"country_cn":"贝宁","countrycode":"BJ"},{"country_cn":"赞比亚","countrycode":"ZM"},{"country_cn":"赤道几内亚","countrycode":"GQ"},{"country_cn":"越南","countrycode":"VN"},{"country_cn":"阿塞拜疆","countrycode":"AZ"},{"country_cn":"阿富汗","countrycode":"AF"},{"country_cn":"阿尔及利亚","countrycode":"DZ"},{"country_cn":"阿尔巴尼亚","countrycode":"AL"},{"country_cn":"阿曼","countrycode":"OM"},{"country_cn":"阿根廷","countrycode":"AR"},{"country_cn":"阿联酋","countrycode":"AE"},{"country_cn":"阿鲁巴","countrycode":"AW"},{"country_cn":"韩国","countrycode":"KR"},{"country_cn":"马其顿","countrycode":"MK"},{"country_cn":"马尔代夫","countrycode":"MV"},{"country_cn":"马恩岛","countrycode":"IM"},{"country_cn":"马拉维","countrycode":"MW"},{"country_cn":"马来西亚","countrycode":"MY"},{"country_cn":"马绍尔群岛","countrycode":"MH"},{"country_cn":"马耳他","countrycode":"MT"},{"country_cn":"马达加斯加","countrycode":"MG"},{"country_cn":"马里","countrycode":"ML"},{"country_cn":"黎巴嫩","countrycode":"LB"},{"country_cn":"黑山","countrycode":"ME"},{"country_cn":"东萨摩亚","countrycode":"AS"}];
util.countries = [
// { country_cn: '欧盟', countrycode: 'EU' },
{ country_cn: "不丹", countrycode: "BT" },
{ country_cn: "中国", countrycode: "CN" },
{ country_cn: "中非", countrycode: "CF" },
{ country_cn: "丹麦", countrycode: "DK" },
{ country_cn: "乌克兰", countrycode: "UA" },
{ country_cn: "乌兹别克斯坦", countrycode: "UZ" },
{ country_cn: "乌干达", countrycode: "UG" },
{ country_cn: "乌拉圭", countrycode: "UY" },
{ country_cn: "乍得", countrycode: "TD" },
{ country_cn: "也门", countrycode: "YE" },
{ country_cn: "亚美尼亚", countrycode: "AM" },
{ country_cn: "以色列", countrycode: "IL" },
{ country_cn: "伊拉克", countrycode: "IQ" },
{ country_cn: "伊朗", countrycode: "IR" },
{ country_cn: "伯利兹", countrycode: "BZ" },
{ country_cn: "佛得角", countrycode: "CV" },
{ country_cn: "俄罗斯", countrycode: "RU" },
{ country_cn: "保加利亚", countrycode: "BG" },
{ country_cn: "克罗地亚", countrycode: "HR" },
{ country_cn: "关岛", countrycode: "GU" },
{ country_cn: "冈比亚", countrycode: "GM" },
{ country_cn: "冰岛", countrycode: "IS" },
{ country_cn: "几内亚", countrycode: "GN" },
{ country_cn: "几内亚比绍", countrycode: "GW" },
// { country_cn: '列支顿士登', countrycode: 'LI' },
{ country_cn: "列支敦士登", countrycode: "LI" },
{ country_cn: "刚果(布)", countrycode: "CG" },
{ country_cn: "刚果(金)", countrycode: "CD" },
{ country_cn: "利比亚", countrycode: "LY" },
{ country_cn: "利比里亚", countrycode: "LR" },
{ country_cn: "加拿大", countrycode: "CA" },
{ country_cn: "加纳", countrycode: "GH" },
{ country_cn: "加蓬", countrycode: "GA" },
{ country_cn: "匈牙利", countrycode: "HU" },
{ country_cn: "南苏丹", countrycode: "SS" },
{ country_cn: "南非", countrycode: "ZA" },
{ country_cn: "博茨瓦纳", countrycode: "BW" },
{ country_cn: "卡塔尔", countrycode: "QA" },
{ country_cn: "卢旺达", countrycode: "RW" },
{ country_cn: "卢森堡", countrycode: "LU" },
{ country_cn: "印度", countrycode: "IN" },
{ country_cn: "印度尼西亚", countrycode: "ID" },
{ country_cn: "危地马拉", countrycode: "GT" },
{ country_cn: "厄瓜多尔", countrycode: "EC" },
{ country_cn: "厄立特里亚", countrycode: "ER" },
{ country_cn: "叙利亚", countrycode: "SY" },
{ country_cn: "古巴", countrycode: "CU" },
{ country_cn: "吉尔吉斯斯坦", countrycode: "KG" },
{ country_cn: "吉布提", countrycode: "DJ" },
{ country_cn: "哈萨克斯坦", countrycode: "KZ" },
{ country_cn: "哥伦比亚", countrycode: "CO" },
{ country_cn: "哥斯达黎加", countrycode: "CR" },
{ country_cn: "喀麦隆", countrycode: "CM" },
{ country_cn: "图瓦卢", countrycode: "TV" },
// { country_cn: '土尔其', countrycode: 'TR' },
{ country_cn: "土耳其", countrycode: "TR" },
{ country_cn: "土库曼斯坦", countrycode: "TM" },
{ country_cn: "圣基茨和尼维斯", countrycode: "KN" },
{ country_cn: "圣多美和普林西比", countrycode: "ST" },
{ country_cn: "圣巴泰勒米岛", countrycode: "BL" },
// { country_cn: '圣文森特和格陵纳丁斯', countrycode: 'VC' },
{ country_cn: "圣文森特和格林纳丁斯", countrycode: "VC" },
// { country_cn: '圣皮埃尔和密克隆', countrycode: 'PM' },
{ country_cn: "圣皮埃尔和密克隆群岛", countrycode: "PM" },
{ country_cn: "圣马力诺", countrycode: "SM" },
{ country_cn: "圭亚那", countrycode: "GY" },
{ country_cn: "坦桑尼亚", countrycode: "TZ" },
{ country_cn: "埃及", countrycode: "EG" },
{ country_cn: "埃塞俄比亚", countrycode: "ET" },
{ country_cn: "基里巴斯", countrycode: "KI" },
{ country_cn: "塔吉克斯坦", countrycode: "TJ" },
{ country_cn: "塞内加尔", countrycode: "SN" },
{ country_cn: "塞尔维亚", countrycode: "RS" },
{ country_cn: "塞拉利昂", countrycode: "SL" },
// { country_cn: '塞普路斯', countrycode: 'CY' },
{ country_cn: "塞浦路斯", countrycode: "CY" },
{ country_cn: "塞舌尔", countrycode: "SC" },
{ country_cn: "墨西哥", countrycode: "MX" },
{ country_cn: "多哥", countrycode: "TG" },
// { country_cn: '多米尼加共和国', countrycode: 'DM' },
{ country_cn: "多米尼克", countrycode: "DM" },
{ country_cn: "多米尼加共和国", countrycode: "DO" },
// { country_cn: '多米尼加联邦', countrycode: 'DO' },
{ country_cn: "奥兰群岛", countrycode: "AX" },
{ country_cn: "奥地利", countrycode: "AT" },
{ country_cn: "委内瑞拉", countrycode: "VE" },
{ country_cn: "孟加拉", countrycode: "BD" },
{ country_cn: "安哥拉", countrycode: "AO" },
{ country_cn: "安圭拉", countrycode: "AI" },
{ country_cn: "安提瓜和巴布达", countrycode: "AG" },
{ country_cn: "安道尔", countrycode: "AD" },
{ country_cn: "尼加拉瓜", countrycode: "NI" },
{ country_cn: "尼日利亚", countrycode: "NG" },
{ country_cn: "尼日尔", countrycode: "NE" },
{ country_cn: "尼泊尔", countrycode: "NP" },
{ country_cn: "巴勒斯坦", countrycode: "PS" },
{ country_cn: "巴哈马", countrycode: "BS" },
{ country_cn: "巴基斯坦", countrycode: "PK" },
{ country_cn: "巴巴多斯", countrycode: "BB" },
{ country_cn: "巴布亚新几内亚", countrycode: "PG" },
{ country_cn: "巴拉圭", countrycode: "PY" },
{ country_cn: "巴拿马", countrycode: "PA" },
{ country_cn: "巴林", countrycode: "BH" },
{ country_cn: "巴西", countrycode: "BR" },
{ country_cn: "布基纳法索", countrycode: "BF" },
{ country_cn: "布隆迪", countrycode: "BI" },
{ country_cn: "希腊", countrycode: "GR" },
{ country_cn: "帕劳", countrycode: "PW" },
{ country_cn: "库克群岛", countrycode: "CK" },
{ country_cn: "库拉索岛", countrycode: "CW" },
{ country_cn: "开曼群岛", countrycode: "KY" },
{ country_cn: "德国", countrycode: "DE" },
{ country_cn: "意大利", countrycode: "IT" },
{ country_cn: "所罗门群岛", countrycode: "SB" },
// { country_cn: '拉托维亚', countrycode: 'LV' },
{ country_cn: "拉脱维亚", countrycode: "LV" },
{ country_cn: "挪威", countrycode: "NO" },
{ country_cn: "捷克", countrycode: "CZ" },
{ country_cn: "摩尔多瓦", countrycode: "MD" },
{ country_cn: "摩洛哥", countrycode: "MA" },
{ country_cn: "摩纳哥", countrycode: "MC" },
{ country_cn: "文莱", countrycode: "BN" },
{ country_cn: "斐济", countrycode: "FJ" },
{ country_cn: "斯威士兰", countrycode: "SZ" },
{ country_cn: "斯洛伐克", countrycode: "SK" },
// { country_cn: '斯罗文尼亚', countrycode: 'SI' },
{ country_cn: "斯洛文尼亚", countrycode: "SI" },
{ country_cn: "斯里兰卡", countrycode: "LK" },
{ country_cn: "新加坡", countrycode: "SG" },
// { country_cn: '新卡里多尼亚', countrycode: 'NC' },
{ country_cn: "新喀里多尼亚", countrycode: "NC" },
{ country_cn: "新西兰", countrycode: "NZ" },
{ country_cn: "日本", countrycode: "JP" },
{ country_cn: "智利", countrycode: "CL" },
{ country_cn: "朝鲜", countrycode: "KP" },
{ country_cn: "柬埔寨", countrycode: "KH" },
{ country_cn: "根西岛", countrycode: "GG" },
{ country_cn: "格林纳达", countrycode: "GD" },
// { country_cn: '格陵兰岛', countrycode: 'GL' },
{ country_cn: "格陵兰", countrycode: "GL" },
{ country_cn: "格鲁吉亚", countrycode: "GE" },
// { country_cn: '梵蒂岗', countrycode: 'VA' },
{ country_cn: "梵蒂冈", countrycode: "VA" },
{ country_cn: "比利时", countrycode: "BE" },
{ country_cn: "毛里塔尼亚", countrycode: "MR" },
{ country_cn: "毛里求斯", countrycode: "MU" },
{ country_cn: "汤加", countrycode: "TO" },
{ country_cn: "沙特阿拉伯", countrycode: "SA" },
{ country_cn: "法国", countrycode: "FR" },
{ country_cn: "法属圣马丁", countrycode: "MF" },
{ country_cn: "法属圭亚那", countrycode: "GF" },
// { country_cn: '法属尼留旺岛', countrycode: 'RE' },
{ country_cn: "留尼汪岛", countrycode: "RE" },
{ country_cn: "中国香港", countrycode: "HK" },
// { country_cn: '法属玻里尼西亚', countrycode: 'PF' },
{ country_cn: "法属波利尼西亚", countrycode: "PF" },
{ country_cn: "法罗群岛", countrycode: "FO" },
{ country_cn: "波兰", countrycode: "PL" },
{ country_cn: "波多黎各", countrycode: "PR" },
{ country_cn: "波黑", countrycode: "BA" },
{ country_cn: "泰国", countrycode: "TH" },
{ country_cn: "泽西岛", countrycode: "JE" },
{ country_cn: "津巴布韦", countrycode: "ZW" },
{ country_cn: "洪都拉斯", countrycode: "HN" },
{ country_cn: "海地", countrycode: "HT" },
{ country_cn: "澳大利亚", countrycode: "AU" },
{ country_cn: "中国台湾", countrycode: "TW" },
{ country_cn: "爱尔兰", countrycode: "IE" },
{ country_cn: "爱沙尼亚", countrycode: "EE" },
{ country_cn: "牙买加", countrycode: "JM" },
{ country_cn: "特克斯和凯科斯群岛", countrycode: "TC" },
{ country_cn: "特立尼达和多巴哥", countrycode: "TT" },
{ country_cn: "玻利维亚", countrycode: "BO" },
{ country_cn: "瑙鲁", countrycode: "NR" },
{ country_cn: "瑞典", countrycode: "SE" },
{ country_cn: "瑞士", countrycode: "CH" },
// { country_cn: '瓦努阿鲁', countrycode: 'VU' },
{ country_cn: "瓦努阿图", countrycode: "VU" },
{ country_cn: "白俄罗斯", countrycode: "BY" },
{ country_cn: "百慕大", countrycode: "BM" },
{ country_cn: "直布罗陀", countrycode: "GI" },
{ country_cn: "科威特", countrycode: "KW" },
{ country_cn: "科摩罗", countrycode: "KM" },
{ country_cn: "科特迪瓦", countrycode: "CI" },
{ country_cn: "秘鲁", countrycode: "PE" },
{ country_cn: "突尼斯", countrycode: "TN" },
{ country_cn: "立陶宛", countrycode: "LT" },
// { country_cn: '米克罗尼西亚', countrycode: 'FM' },
{ country_cn: "密克罗尼西亚联邦", countrycode: "FM" },
{ country_cn: "索马里", countrycode: "SO" },
{ country_cn: "约旦", countrycode: "JO" },
{ country_cn: "纳米比亚", countrycode: "NA" },
{ country_cn: "缅甸", countrycode: "MM" },
{ country_cn: "罗马尼亚", countrycode: "RO" },
{ country_cn: "美国", countrycode: "US" },
{ country_cn: "美属维尔京群岛", countrycode: "VI" },
{ country_cn: "老挝", countrycode: "LA" },
{ country_cn: "肯尼亚", countrycode: "KE" },
{ country_cn: "芬兰", countrycode: "FI" },
{ country_cn: "苏丹", countrycode: "SD" },
{ country_cn: "苏里南", countrycode: "SR" },
{ country_cn: "英国", countrycode: "GB" },
{ country_cn: "英属印度洋领地", countrycode: "IO" },
// { country_cn: '英属维京群岛', countrycode: 'VG' },
{ country_cn: "英属维尔京群岛", countrycode: "VG" },
{ country_cn: "荷兰", countrycode: "NL" },
{ country_cn: "荷兰加勒比区", countrycode: "BQ" },
// { country_cn: '荷属圣马丁', countrycode: 'SX' },
{ country_cn: "圣马丁岛", countrycode: "SX" },
{ country_cn: "莫桑比克", countrycode: "MZ" },
{ country_cn: "莱索托", countrycode: "LS" },
{ country_cn: "菲律宾", countrycode: "PH" },
{ country_cn: "萨尔瓦多", countrycode: "SV" },
{ country_cn: "萨摩亚", countrycode: "WS" },
{ country_cn: "葡萄牙", countrycode: "PT" },
{ country_cn: "蒙古", countrycode: "MN" },
{ country_cn: "西班牙", countrycode: "ES" },
{ country_cn: "诺福克岛", countrycode: "NF" },
{ country_cn: "贝宁", countrycode: "BJ" },
{ country_cn: "赞比亚", countrycode: "ZM" },
{ country_cn: "赤道几内亚", countrycode: "GQ" },
{ country_cn: "越南", countrycode: "VN" },
{ country_cn: "阿塞拜疆", countrycode: "AZ" },
{ country_cn: "阿富汗", countrycode: "AF" },
{ country_cn: "阿尔及利亚", countrycode: "DZ" },
{ country_cn: "阿尔巴尼亚", countrycode: "AL" },
{ country_cn: "阿曼", countrycode: "OM" },
{ country_cn: "阿根廷", countrycode: "AR" },
{ country_cn: "阿联酋", countrycode: "AE" },
{ country_cn: "阿鲁巴", countrycode: "AW" },
{ country_cn: "韩国", countrycode: "KR" },
{ country_cn: "马其顿", countrycode: "MK" },
{ country_cn: "马尔代夫", countrycode: "MV" },
{ country_cn: "马恩岛", countrycode: "IM" },
{ country_cn: "马拉维", countrycode: "MW" },
{ country_cn: "马来西亚", countrycode: "MY" },
{ country_cn: "马绍尔群岛", countrycode: "MH" },
{ country_cn: "马耳他", countrycode: "MT" },
{ country_cn: "马达加斯加", countrycode: "MG" },
{ country_cn: "马里", countrycode: "ML" },
{ country_cn: "黎巴嫩", countrycode: "LB" },
{ country_cn: "黑山", countrycode: "ME" },
// { country_cn: '东萨摩亚', countrycode: 'AS' },
{ country_cn: "美属萨摩亚", countrycode: "AS" },
{ country_cn: "东帝汶", countrycode: "TL" },
{ country_cn: "圣卢西亚", countrycode: "LC" },
{ country_cn: "瓜德罗普", countrycode: "GP" },
{ country_cn: "马约特", countrycode: "YT" },
{ country_cn: "马提尼克", countrycode: "MQ" },
{ country_cn: "美国本土外小岛屿", countrycode: "UM" },
{ country_cn: "福克兰群岛", countrycode: "FK" },
{ country_cn: "北马里亚纳群岛", countrycode: "MP" },
{ country_cn: "瓦利斯和富图纳群岛", countrycode: "WF" },
{ country_cn: "圣诞岛", countrycode: "CX" },
{ country_cn: "科科斯群岛", countrycode: "CC" },
{ country_cn: "蒙塞拉特岛", countrycode: "MS" },
{ country_cn: "南乔治亚岛与南桑威奇群岛", countrycode: "GS" },
{ country_cn: "布韦岛", countrycode: "BV" },
{ country_cn: "托克劳群岛", countrycode: "TK" },
{ country_cn: "皮特凯恩群岛", countrycode: "PN" },
{ country_cn: "纽埃", countrycode: "NU" },
{ country_cn: "斯瓦尔巴群岛和扬马延岛", countrycode: "SJ" },
{ country_cn: "圣赫勒拿岛", countrycode: "SH" },
{ country_cn: "西撒哈拉", countrycode: "EH" },
{ country_cn: "赫德岛和麦克唐纳群岛", countrycode: "HM" },
{ country_cn: "法属南部领地", countrycode: "TF" },
{ country_cn: "科索沃", countrycode: "XK" },
];
util.judgeCountry = function (input_value) {
var countries = this.countries;
for (var j = 0; j < countries.length; j++) {
// var country = country_code[j]["country"]; //全称
var countrycode = countries[j]["countrycode"]; //简称
var country_cn = countries[j]["country_cn"]; //中文名称
if (
(val !== '' && regAs.test(val) && val == 0) ||
(64496 <= val && val <= 64511) ||
(65535 <= val && val <= 131071) ||
val == 4294967295
input_value.toUpperCase() == countrycode.toUpperCase() ||
input_value.toLowerCase() == countrycode.toLowerCase() ||
input_value == country_cn
) {
return true;
} else {
return false;
}
}
function isCountry(val) {
var regCountry = /[a-zA-Z\u4e00-\u9fa5]+/;
// var regCountry = /[a-zA-Z]+/;
return regCountry.test(val);
}
function isTopoinAS(as) {
var topoinASNumber = [
10026,
131588,
133038,
133893,
135373,
17990,
24058,
38197,
45485,
4862,
58451,
63946,
9266,
10032,
131589,
133054,
133904,
135386,
18040,
24077,
38277,
45496,
5017,
58453,
63955,
9269,
10082,
131590,
133077,
133905,
135387,
18042,
24112,
38385,
45504,
5018,
58516,
63959,
9289,
10085,
131591,
133089,
133929,
135391,
18045,
24115,
38452,
45508,
55298,
58579,
63977,
9293,
10098,
131593,
133107,
133946,
135413,
18046,
24154,
38469,
45561,
55334,
58627,
63981,
9304,
10099,
131596,
133115,
133948,
135414,
18047,
24155,
38475,
45562,
55350,
58683,
64033,
9311,
10103,
131597,
133126,
133953,
1659,
18049,
24157,
38478,
45572,
55355,
58708,
64047,
9346,
10108,
131599,
133142,
134094,
17408,
18116,
24158,
38486,
45590,
55361,
58730,
64067,
9381,
10116,
131603,
133158,
134121,
17416,
18177,
24160,
38531,
45597,
55367,
58744,
64078,
9409,
10118,
131994,
133190,
134127,
17420,
18179,
24163,
38574,
45599,
55369,
58779,
64087,
9415,
10126,
132017,
133199,
134167,
17421,
18181,
24164,
38578,
45640,
55417,
58797,
7468,
9416,
10127,
132056,
133201,
134175,
17444,
18182,
24165,
38580,
45750,
55480,
58807,
7478,
9420,
10135,
132057,
133204,
134243,
17485,
18183,
24167,
38591,
45753,
55489,
58815,
7479,
9444,
10138,
132157,
133209,
134366,
17487,
18185,
24168,
38603,
45761,
55512,
58908,
7481,
9468,
10147,
132169,
133322,
134379,
17537,
18218,
24182,
38658,
45816,
55517,
58931,
7482,
9474,
10202,
132252,
133325,
134387,
17540,
18382,
24224,
38797,
45855,
55536,
58933,
7484,
9502,
10205,
132295,
133372,
134401,
17554,
18410,
24235,
38802,
45908,
55552,
58944,
7499,
9505,
10229,
132310,
133380,
134446,
17555,
18411,
24236,
38814,
45910,
55558,
58958,
7532,
9513,
10231,
132342,
133398,
134449,
17619,
18413,
24246,
38819,
45911,
55639,
58985,
7533,
9520,
10232,
132364,
133405,
134518,
17630,
18415,
24304,
38837,
45930,
55649,
59207,
7535,
9536,
10238,
132368,
133424,
134519,
17651,
18417,
24329,
38841,
45932,
55725,
59214,
7539,
9538,
131091,
132422,
133428,
134523,
17653,
18419,
24333,
38843,
4594,
55743,
59217,
7540,
9584,
131142,
132490,
133448,
134524,
17657,
18420,
24334,
38844,
4605,
55750,
59234,
7577,
9590,
131143,
132499,
133460,
134544,
17706,
18421,
24396,
38845,
4616,
55778,
59237,
7581,
9660,
131144,
132506,
133467,
134548,
17709,
18422,
24399,
38847,
4623,
55789,
59248,
7617,
9671,
131146,
132549,
133485,
134608,
17710,
18424,
24449,
38848,
4635,
55807,
59268,
7619,
9674,
131148,
132585,
133486,
134670,
17711,
18426,
24462,
38850,
4637,
55852,
59270,
7649,
9676,
131149,
132591,
133488,
134684,
17712,
18429,
24506,
38866,
4641,
55858,
59337,
7650,
9680,
131150,
132593,
133549,
134687,
17713,
201223,
24545,
38870,
4642,
55940,
59352,
7651,
9729,
131184,
132597,
133578,
134700,
17714,
203926,
24549,
38873,
4645,
55952,
59371,
7656,
9732,
131188,
132609,
133617,
134705,
17716,
23648,
24568,
4058,
4655,
55953,
62294,
7695,
9735,
131189,
132610,
133734,
134706,
17744,
23709,
2706,
4158,
4656,
56059,
63527,
7710,
9831,
131224,
132698,
133741,
134729,
17759,
23712,
3363,
4352,
4658,
56080,
63834,
9216,
9879,
131234,
132702,
133747,
134795,
17764,
23730,
3462,
45136,
4662,
56103,
63845,
9221,
9906,
131271,
132714,
133752,
134823,
17793,
23749,
3661,
4515,
4748,
56136,
63849,
9229,
9908,
131274,
132737,
133771,
134835,
17794,
23875,
3662,
45165,
4760,
56180,
63855,
9231,
9916,
131278,
132742,
133772,
134969,
17809,
23881,
3693,
45187,
4780,
56190,
63889,
9237,
9918,
131280,
132818,
133777,
135062,
17814,
23890,
38056,
45247,
4781,
56195,
63911,
9242,
9919,
131324,
132837,
133779,
135081,
17888,
23985,
38059,
45250,
4782,
56276,
63915,
9244,
9924,
131337,
132865,
133783,
135140,
17924,
24002,
38166,
4528,
4783,
56302,
63916,
9253,
9925,
131584,
132883,
133789,
135147,
17929,
24010,
38176,
45327,
4828,
58411,
63927,
9259,
131586,
132899,
133793,
135166,
17975,
24023,
38177,
45346,
4845,
58426,
63928,
9263,
131587,
133027,
133849,
135314,
17988,
24043,
38186,
45474,
4849,
58441,
63929,
9264,
];
for (var i = 0; i < topoinASNumber.length; i++) {
if (topoinASNumber[i] == as) {
return true;
}
return countries[j]["countrycode"];
}
return false;
}
var util = {};
// util.countries =[{"country_cn":"欧盟","countrycode":"EU"},{"country_cn":"不丹","countrycode":"BT"},{"country_cn":"中国","countrycode":"CN"},{"country_cn":"中非","countrycode":"CF"},{"country_cn":"丹麦","countrycode":"DK"},{"country_cn":"乌克兰","countrycode":"UA"},{"country_cn":"乌兹别克斯坦","countrycode":"UZ"},{"country_cn":"乌干达","countrycode":"UG"},{"country_cn":"乌拉圭","countrycode":"UY"},{"country_cn":"乍得","countrycode":"TD"},{"country_cn":"也门","countrycode":"YE"},{"country_cn":"亚美尼亚","countrycode":"AM"},{"country_cn":"以色列","countrycode":"IL"},{"country_cn":"伊拉克","countrycode":"IQ"},{"country_cn":"伊朗","countrycode":"IR"},{"country_cn":"伯里兹","countrycode":"BZ"},{"country_cn":"佛得角","countrycode":"CV"},{"country_cn":"俄罗斯","countrycode":"RU"},{"country_cn":"保加利亚","countrycode":"BG"},{"country_cn":"克罗地亚","countrycode":"HR"},{"country_cn":"关岛","countrycode":"GU"},{"country_cn":"冈比亚","countrycode":"GM"},{"country_cn":"冰岛","countrycode":"IS"},{"country_cn":"几内亚","countrycode":"GN"},{"country_cn":"几内亚比绍","countrycode":"GW"},{"country_cn":"列支顿士登","countrycode":"LI"},{"country_cn":"刚果(布)","countrycode":"CG"},{"country_cn":"刚果(金)","countrycode":"CD"},{"country_cn":"利比亚","countrycode":"LY"},{"country_cn":"利比里亚","countrycode":"LR"},{"country_cn":"加拿大","countrycode":"CA"},{"country_cn":"加纳","countrycode":"GH"},{"country_cn":"加蓬","countrycode":"GA"},{"country_cn":"匈牙利","countrycode":"HU"},{"country_cn":"南苏丹","countrycode":"SS"},{"country_cn":"南非","countrycode":"ZA"},{"country_cn":"博茨瓦纳","countrycode":"BW"},{"country_cn":"卡塔尔","countrycode":"QA"},{"country_cn":"卢旺达","countrycode":"RW"},{"country_cn":"卢森堡","countrycode":"LU"},{"country_cn":"印度","countrycode":"IN"},{"country_cn":"印度尼西亚","countrycode":"ID"},{"country_cn":"危地马拉","countrycode":"GT"},{"country_cn":"厄瓜多尔","countrycode":"EC"},{"country_cn":"厄立特里亚","countrycode":"ER"},{"country_cn":"叙利亚","countrycode":"SY"},{"country_cn":"古巴","countrycode":"CU"},{"country_cn":"吉尔吉斯斯坦","countrycode":"KG"},{"country_cn":"吉布提","countrycode":"DJ"},{"country_cn":"哈萨克斯坦","countrycode":"KZ"},{"country_cn":"哥伦比亚","countrycode":"CO"},{"country_cn":"哥斯达黎加","countrycode":"CR"},{"country_cn":"喀麦隆","countrycode":"CM"},{"country_cn":"图瓦卢","countrycode":"TV"},{"country_cn":"土尔其","countrycode":"TR"},{"country_cn":"土库曼斯坦","countrycode":"TM"},{"country_cn":"圣基茨和尼维斯","countrycode":"KN"},{"country_cn":"圣多美和普林西比","countrycode":"ST"},{"country_cn":"圣巴泰勒米岛","countrycode":"BL"},{"country_cn":"圣文森特和格陵纳丁斯","countrycode":"VC"},{"country_cn":"圣皮埃尔和密克隆","countrycode":"PM"},{"country_cn":"圣马力诺","countrycode":"SM"},{"country_cn":"圭亚那","countrycode":"GY"},{"country_cn":"坦桑尼亚","countrycode":"TZ"},{"country_cn":"埃及","countrycode":"EG"},{"country_cn":"埃塞俄比亚","countrycode":"ET"},{"country_cn":"基里巴斯","countrycode":"KI"},{"country_cn":"塔吉克斯坦","countrycode":"TJ"},{"country_cn":"塞内加尔","countrycode":"SN"},{"country_cn":"塞尔维亚","countrycode":"RS"},{"country_cn":"塞拉利昂","countrycode":"SL"},{"country_cn":"塞普路斯","countrycode":"CY"},{"country_cn":"塞舌尔","countrycode":"SC"},{"country_cn":"墨西哥","countrycode":"MX"},{"country_cn":"多哥","countrycode":"TG"},{"country_cn":"多米尼加共和国","countrycode":"DM"},{"country_cn":"多米尼加联邦","countrycode":"DO"},{"country_cn":"奥兰群岛","countrycode":"AX"},{"country_cn":"奥地利","countrycode":"AT"},{"country_cn":"委内瑞拉","countrycode":"VE"},{"country_cn":"孟加拉","countrycode":"BD"},{"country_cn":"安哥拉","countrycode":"AO"},{"country_cn":"安圭拉","countrycode":"AI"},{"country_cn":"安提瓜和巴布达","countrycode":"AG"},{"country_cn":"安道尔","countrycode":"AD"},{"country_cn":"尼加拉瓜","countrycode":"NI"},{"country_cn":"尼日利亚","countrycode":"NG"},{"country_cn":"尼日尔","countrycode":"NE"},{"country_cn":"尼泊尔","countrycode":"NP"},{"country_cn":"巴勒斯坦","countrycode":"PS"},{"country_cn":"巴哈马","countrycode":"BS"},{"country_cn":"巴基斯坦","countrycode":"PK"},{"country_cn":"巴巴多斯","countrycode":"BB"},{"country_cn":"巴布亚新几内亚","countrycode":"PG"},{"country_cn":"巴拉圭","countrycode":"PY"},{"country_cn":"巴拿马","countrycode":"PA"},{"country_cn":"巴林","countrycode":"BH"},{"country_cn":"巴西","countrycode":"BR"},{"country_cn":"布基纳法索","countrycode":"BF"},{"country_cn":"布隆迪","countrycode":"BI"},{"country_cn":"希腊","countrycode":"GR"},{"country_cn":"帕劳","countrycode":"PW"},{"country_cn":"库克群岛","countrycode":"CK"},{"country_cn":"库拉索","countrycode":"CW"},{"country_cn":"开曼群岛","countrycode":"KY"},{"country_cn":"德国","countrycode":"DE"},{"country_cn":"意大利","countrycode":"IT"},{"country_cn":"所罗门群岛","countrycode":"SB"},{"country_cn":"拉托维亚","countrycode":"LV"},{"country_cn":"挪威","countrycode":"NO"},{"country_cn":"捷克","countrycode":"CZ"},{"country_cn":"摩尔多瓦","countrycode":"MD"},{"country_cn":"摩洛哥","countrycode":"MA"},{"country_cn":"摩纳哥","countrycode":"MC"},{"country_cn":"文莱布鲁萨兰","countrycode":"BN"},{"country_cn":"斐济","countrycode":"FJ"},{"country_cn":"斯威士兰","countrycode":"SZ"},{"country_cn":"斯洛伐克","countrycode":"SK"},{"country_cn":"斯罗文尼亚","countrycode":"SI"},{"country_cn":"斯里兰卡","countrycode":"LK"},{"country_cn":"新加坡","countrycode":"SG"},{"country_cn":"新卡里多尼亚","countrycode":"NC"},{"country_cn":"新西兰","countrycode":"NZ"},{"country_cn":"日本","countrycode":"JP"},{"country_cn":"智利","countrycode":"CL"},{"country_cn":"朝鲜","countrycode":"KP"},{"country_cn":"柬埔寨","countrycode":"KH"},{"country_cn":"根西岛","countrycode":"GG"},{"country_cn":"格林纳达","countrycode":"GD"},{"country_cn":"格陵兰岛","countrycode":"GL"},{"country_cn":"格鲁吉亚","countrycode":"GE"},{"country_cn":"梵蒂岗","countrycode":"VA"},{"country_cn":"比利时","countrycode":"BE"},{"country_cn":"毛里塔尼亚","countrycode":"MR"},{"country_cn":"毛里求斯","countrycode":"MU"},{"country_cn":"汤加","countrycode":"TO"},{"country_cn":"沙特阿拉伯","countrycode":"SA"},{"country_cn":"法国","countrycode":"FR"},{"country_cn":"法属圣马丁","countrycode":"MF"},{"country_cn":"法属圭亚那","countrycode":"GF"},{"country_cn":"法属尼留旺岛","countrycode":"RE"},{"country_cn":"中国香港","countrycode":"HK"},{"country_cn":"法属玻里尼西亚","countrycode":"PF"},{"country_cn":"法罗群岛","countrycode":"FO"},{"country_cn":"波兰","countrycode":"PL"},{"country_cn":"波多黎各","countrycode":"PR"},{"country_cn":"波黑","countrycode":"BA"},{"country_cn":"泰国","countrycode":"TH"},{"country_cn":"泽西岛","countrycode":"JE"},{"country_cn":"津巴布韦","countrycode":"ZW"},{"country_cn":"洪都拉斯","countrycode":"HN"},{"country_cn":"海地","countrycode":"HT"},{"country_cn":"澳大利亚","countrycode":"AU"},{"country_cn":"中国台湾","countrycode":"TW"},{"country_cn":"爱尔兰","countrycode":"IE"},{"country_cn":"爱沙尼亚","countrycode":"EE"},{"country_cn":"牙买加","countrycode":"JM"},{"country_cn":"特克斯和凯科斯群岛","countrycode":"TC"},{"country_cn":"特立尼达和多巴哥","countrycode":"TT"},{"country_cn":"玻利维亚","countrycode":"BO"},{"country_cn":"瑙鲁","countrycode":"NR"},{"country_cn":"瑞典","countrycode":"SE"},{"country_cn":"瑞士","countrycode":"CH"},{"country_cn":"瓦努阿鲁","countrycode":"VU"},{"country_cn":"白俄罗斯","countrycode":"BY"},{"country_cn":"百慕大","countrycode":"BM"},{"country_cn":"直布罗陀","countrycode":"GI"},{"country_cn":"科威特","countrycode":"KW"},{"country_cn":"科摩罗","countrycode":"KM"},{"country_cn":"科特迪瓦","countrycode":"CI"},{"country_cn":"秘鲁","countrycode":"PE"},{"country_cn":"突尼斯","countrycode":"TN"},{"country_cn":"立陶宛","countrycode":"LT"},{"country_cn":"米克罗尼西亚","countrycode":"FM"},{"country_cn":"索马里","countrycode":"SO"},{"country_cn":"约旦","countrycode":"JO"},{"country_cn":"纳米比亚","countrycode":"NA"},{"country_cn":"缅甸","countrycode":"MM"},{"country_cn":"罗马尼亚","countrycode":"RO"},{"country_cn":"美国","countrycode":"US"},{"country_cn":"美属维尔京群岛","countrycode":"VI"},{"country_cn":"老挝","countrycode":"LA"},{"country_cn":"肯尼亚","countrycode":"KE"},{"country_cn":"芬兰","countrycode":"FI"},{"country_cn":"苏丹","countrycode":"SD"},{"country_cn":"苏里南","countrycode":"SR"},{"country_cn":"英国","countrycode":"GB"},{"country_cn":"英属印度洋领地","countrycode":"IO"},{"country_cn":"英属维京群岛","countrycode":"VG"},{"country_cn":"荷兰","countrycode":"NL"},{"country_cn":"荷兰加勒比区","countrycode":"BQ"},{"country_cn":"荷属圣马丁","countrycode":"SX"},{"country_cn":"莫桑比克","countrycode":"MZ"},{"country_cn":"莱索托","countrycode":"LS"},{"country_cn":"菲律宾","countrycode":"PH"},{"country_cn":"萨尔瓦多","countrycode":"SV"},{"country_cn":"萨摩亚","countrycode":"WS"},{"country_cn":"葡萄牙","countrycode":"PT"},{"country_cn":"蒙古","countrycode":"MN"},{"country_cn":"西班牙","countrycode":"ES"},{"country_cn":"诺福克岛","countrycode":"NF"},{"country_cn":"贝宁","countrycode":"BJ"},{"country_cn":"赞比亚","countrycode":"ZM"},{"country_cn":"赤道几内亚","countrycode":"GQ"},{"country_cn":"越南","countrycode":"VN"},{"country_cn":"阿塞拜疆","countrycode":"AZ"},{"country_cn":"阿富汗","countrycode":"AF"},{"country_cn":"阿尔及利亚","countrycode":"DZ"},{"country_cn":"阿尔巴尼亚","countrycode":"AL"},{"country_cn":"阿曼","countrycode":"OM"},{"country_cn":"阿根廷","countrycode":"AR"},{"country_cn":"阿联酋","countrycode":"AE"},{"country_cn":"阿鲁巴","countrycode":"AW"},{"country_cn":"韩国","countrycode":"KR"},{"country_cn":"马其顿","countrycode":"MK"},{"country_cn":"马尔代夫","countrycode":"MV"},{"country_cn":"马恩岛","countrycode":"IM"},{"country_cn":"马拉维","countrycode":"MW"},{"country_cn":"马来西亚","countrycode":"MY"},{"country_cn":"马绍尔群岛","countrycode":"MH"},{"country_cn":"马耳他","countrycode":"MT"},{"country_cn":"马达加斯加","countrycode":"MG"},{"country_cn":"马里","countrycode":"ML"},{"country_cn":"黎巴嫩","countrycode":"LB"},{"country_cn":"黑山","countrycode":"ME"},{"country_cn":"东萨摩亚","countrycode":"AS"}];
util.countries = [
// { country_cn: '欧盟', countrycode: 'EU' },
{ country_cn: '不丹', countrycode: 'BT' },
{ country_cn: '中国', countrycode: 'CN' },
{ country_cn: '中非', countrycode: 'CF' },
{ country_cn: '丹麦', countrycode: 'DK' },
{ country_cn: '乌克兰', countrycode: 'UA' },
{ country_cn: '乌兹别克斯坦', countrycode: 'UZ' },
{ country_cn: '乌干达', countrycode: 'UG' },
{ country_cn: '乌拉圭', countrycode: 'UY' },
{ country_cn: '乍得', countrycode: 'TD' },
{ country_cn: '也门', countrycode: 'YE' },
{ country_cn: '亚美尼亚', countrycode: 'AM' },
{ country_cn: '以色列', countrycode: 'IL' },
{ country_cn: '伊拉克', countrycode: 'IQ' },
{ country_cn: '伊朗', countrycode: 'IR' },
{ country_cn: '伯利兹', countrycode: 'BZ' },
{ country_cn: '佛得角', countrycode: 'CV' },
{ country_cn: '俄罗斯', countrycode: 'RU' },
{ country_cn: '保加利亚', countrycode: 'BG' },
{ country_cn: '克罗地亚', countrycode: 'HR' },
{ country_cn: '关岛', countrycode: 'GU' },
{ country_cn: '冈比亚', countrycode: 'GM' },
{ country_cn: '冰岛', countrycode: 'IS' },
{ country_cn: '几内亚', countrycode: 'GN' },
{ country_cn: '几内亚比绍', countrycode: 'GW' },
// { country_cn: '列支顿士登', countrycode: 'LI' },
{ country_cn: '列支敦士登', countrycode: 'LI' },
{ country_cn: '刚果(布)', countrycode: 'CG' },
{ country_cn: '刚果(金)', countrycode: 'CD' },
{ country_cn: '利比亚', countrycode: 'LY' },
{ country_cn: '利比里亚', countrycode: 'LR' },
{ country_cn: '加拿大', countrycode: 'CA' },
{ country_cn: '加纳', countrycode: 'GH' },
{ country_cn: '加蓬', countrycode: 'GA' },
{ country_cn: '匈牙利', countrycode: 'HU' },
{ country_cn: '南苏丹', countrycode: 'SS' },
{ country_cn: '南非', countrycode: 'ZA' },
{ country_cn: '博茨瓦纳', countrycode: 'BW' },
{ country_cn: '卡塔尔', countrycode: 'QA' },
{ country_cn: '卢旺达', countrycode: 'RW' },
{ country_cn: '卢森堡', countrycode: 'LU' },
{ country_cn: '印度', countrycode: 'IN' },
{ country_cn: '印度尼西亚', countrycode: 'ID' },
{ country_cn: '危地马拉', countrycode: 'GT' },
{ country_cn: '厄瓜多尔', countrycode: 'EC' },
{ country_cn: '厄立特里亚', countrycode: 'ER' },
{ country_cn: '叙利亚', countrycode: 'SY' },
{ country_cn: '古巴', countrycode: 'CU' },
{ country_cn: '吉尔吉斯斯坦', countrycode: 'KG' },
{ country_cn: '吉布提', countrycode: 'DJ' },
{ country_cn: '哈萨克斯坦', countrycode: 'KZ' },
{ country_cn: '哥伦比亚', countrycode: 'CO' },
{ country_cn: '哥斯达黎加', countrycode: 'CR' },
{ country_cn: '喀麦隆', countrycode: 'CM' },
{ country_cn: '图瓦卢', countrycode: 'TV' },
// { country_cn: '土尔其', countrycode: 'TR' },
{ country_cn: '土耳其', countrycode: 'TR' },
{ country_cn: '土库曼斯坦', countrycode: 'TM' },
{ country_cn: '圣基茨和尼维斯', countrycode: 'KN' },
{ country_cn: '圣多美和普林西比', countrycode: 'ST' },
{ country_cn: '圣巴泰勒米岛', countrycode: 'BL' },
// { country_cn: '圣文森特和格陵纳丁斯', countrycode: 'VC' },
{ country_cn: '圣文森特和格林纳丁斯', countrycode: 'VC' },
// { country_cn: '圣皮埃尔和密克隆', countrycode: 'PM' },
{ country_cn: '圣皮埃尔和密克隆群岛', countrycode: 'PM' },
{ country_cn: '圣马力诺', countrycode: 'SM' },
{ country_cn: '圭亚那', countrycode: 'GY' },
{ country_cn: '坦桑尼亚', countrycode: 'TZ' },
{ country_cn: '埃及', countrycode: 'EG' },
{ country_cn: '埃塞俄比亚', countrycode: 'ET' },
{ country_cn: '基里巴斯', countrycode: 'KI' },
{ country_cn: '塔吉克斯坦', countrycode: 'TJ' },
{ country_cn: '塞内加尔', countrycode: 'SN' },
{ country_cn: '塞尔维亚', countrycode: 'RS' },
{ country_cn: '塞拉利昂', countrycode: 'SL' },
// { country_cn: '塞普路斯', countrycode: 'CY' },
{ country_cn: '塞浦路斯', countrycode: 'CY' },
{ country_cn: '塞舌尔', countrycode: 'SC' },
{ country_cn: '墨西哥', countrycode: 'MX' },
{ country_cn: '多哥', countrycode: 'TG' },
// { country_cn: '多米尼加共和国', countrycode: 'DM' },
{ country_cn: '多米尼克', countrycode: 'DM' },
{ country_cn: '多米尼加共和国', countrycode: 'DO' },
// { country_cn: '多米尼加联邦', countrycode: 'DO' },
{ country_cn: '奥兰群岛', countrycode: 'AX' },
{ country_cn: '奥地利', countrycode: 'AT' },
{ country_cn: '委内瑞拉', countrycode: 'VE' },
{ country_cn: '孟加拉', countrycode: 'BD' },
{ country_cn: '安哥拉', countrycode: 'AO' },
{ country_cn: '安圭拉', countrycode: 'AI' },
{ country_cn: '安提瓜和巴布达', countrycode: 'AG' },
{ country_cn: '安道尔', countrycode: 'AD' },
{ country_cn: '尼加拉瓜', countrycode: 'NI' },
{ country_cn: '尼日利亚', countrycode: 'NG' },
{ country_cn: '尼日尔', countrycode: 'NE' },
{ country_cn: '尼泊尔', countrycode: 'NP' },
{ country_cn: '巴勒斯坦', countrycode: 'PS' },
{ country_cn: '巴哈马', countrycode: 'BS' },
{ country_cn: '巴基斯坦', countrycode: 'PK' },
{ country_cn: '巴巴多斯', countrycode: 'BB' },
{ country_cn: '巴布亚新几内亚', countrycode: 'PG' },
{ country_cn: '巴拉圭', countrycode: 'PY' },
{ country_cn: '巴拿马', countrycode: 'PA' },
{ country_cn: '巴林', countrycode: 'BH' },
{ country_cn: '巴西', countrycode: 'BR' },
{ country_cn: '布基纳法索', countrycode: 'BF' },
{ country_cn: '布隆迪', countrycode: 'BI' },
{ country_cn: '希腊', countrycode: 'GR' },
{ country_cn: '帕劳', countrycode: 'PW' },
{ country_cn: '库克群岛', countrycode: 'CK' },
{ country_cn: '库拉索岛', countrycode: 'CW' },
{ country_cn: '开曼群岛', countrycode: 'KY' },
{ country_cn: '德国', countrycode: 'DE' },
{ country_cn: '意大利', countrycode: 'IT' },
{ country_cn: '所罗门群岛', countrycode: 'SB' },
// { country_cn: '拉托维亚', countrycode: 'LV' },
{ country_cn: '拉脱维亚', countrycode: 'LV' },
{ country_cn: '挪威', countrycode: 'NO' },
{ country_cn: '捷克', countrycode: 'CZ' },
{ country_cn: '摩尔多瓦', countrycode: 'MD' },
{ country_cn: '摩洛哥', countrycode: 'MA' },
{ country_cn: '摩纳哥', countrycode: 'MC' },
{ country_cn: '文莱', countrycode: 'BN' },
{ country_cn: '斐济', countrycode: 'FJ' },
{ country_cn: '斯威士兰', countrycode: 'SZ' },
{ country_cn: '斯洛伐克', countrycode: 'SK' },
// { country_cn: '斯罗文尼亚', countrycode: 'SI' },
{ country_cn: '斯洛文尼亚', countrycode: 'SI' },
{ country_cn: '斯里兰卡', countrycode: 'LK' },
{ country_cn: '新加坡', countrycode: 'SG' },
// { country_cn: '新卡里多尼亚', countrycode: 'NC' },
{ country_cn: '新喀里多尼亚', countrycode: 'NC' },
{ country_cn: '新西兰', countrycode: 'NZ' },
{ country_cn: '日本', countrycode: 'JP' },
{ country_cn: '智利', countrycode: 'CL' },
{ country_cn: '朝鲜', countrycode: 'KP' },
{ country_cn: '柬埔寨', countrycode: 'KH' },
{ country_cn: '根西岛', countrycode: 'GG' },
{ country_cn: '格林纳达', countrycode: 'GD' },
// { country_cn: '格陵兰岛', countrycode: 'GL' },
{ country_cn: '格陵兰', countrycode: 'GL' },
{ country_cn: '格鲁吉亚', countrycode: 'GE' },
// { country_cn: '梵蒂岗', countrycode: 'VA' },
{ country_cn: '梵蒂冈', countrycode: 'VA' },
{ country_cn: '比利时', countrycode: 'BE' },
{ country_cn: '毛里塔尼亚', countrycode: 'MR' },
{ country_cn: '毛里求斯', countrycode: 'MU' },
{ country_cn: '汤加', countrycode: 'TO' },
{ country_cn: '沙特阿拉伯', countrycode: 'SA' },
{ country_cn: '法国', countrycode: 'FR' },
{ country_cn: '法属圣马丁', countrycode: 'MF' },
{ country_cn: '法属圭亚那', countrycode: 'GF' },
// { country_cn: '法属尼留旺岛', countrycode: 'RE' },
{ country_cn: '留尼汪岛', countrycode: 'RE' },
{ country_cn: '中国香港', countrycode: 'HK' },
// { country_cn: '法属玻里尼西亚', countrycode: 'PF' },
{ country_cn: '法属波利尼西亚', countrycode: 'PF' },
{ country_cn: '法罗群岛', countrycode: 'FO' },
{ country_cn: '波兰', countrycode: 'PL' },
{ country_cn: '波多黎各', countrycode: 'PR' },
{ country_cn: '波黑', countrycode: 'BA' },
{ country_cn: '泰国', countrycode: 'TH' },
{ country_cn: '泽西岛', countrycode: 'JE' },
{ country_cn: '津巴布韦', countrycode: 'ZW' },
{ country_cn: '洪都拉斯', countrycode: 'HN' },
{ country_cn: '海地', countrycode: 'HT' },
{ country_cn: '澳大利亚', countrycode: 'AU' },
{ country_cn: '中国台湾', countrycode: 'TW' },
{ country_cn: '爱尔兰', countrycode: 'IE' },
{ country_cn: '爱沙尼亚', countrycode: 'EE' },
{ country_cn: '牙买加', countrycode: 'JM' },
{ country_cn: '特克斯和凯科斯群岛', countrycode: 'TC' },
{ country_cn: '特立尼达和多巴哥', countrycode: 'TT' },
{ country_cn: '玻利维亚', countrycode: 'BO' },
{ country_cn: '瑙鲁', countrycode: 'NR' },
{ country_cn: '瑞典', countrycode: 'SE' },
{ country_cn: '瑞士', countrycode: 'CH' },
// { country_cn: '瓦努阿鲁', countrycode: 'VU' },
{ country_cn: '瓦努阿图', countrycode: 'VU' },
{ country_cn: '白俄罗斯', countrycode: 'BY' },
{ country_cn: '百慕大', countrycode: 'BM' },
{ country_cn: '直布罗陀', countrycode: 'GI' },
{ country_cn: '科威特', countrycode: 'KW' },
{ country_cn: '科摩罗', countrycode: 'KM' },
{ country_cn: '科特迪瓦', countrycode: 'CI' },
{ country_cn: '秘鲁', countrycode: 'PE' },
{ country_cn: '突尼斯', countrycode: 'TN' },
{ country_cn: '立陶宛', countrycode: 'LT' },
// { country_cn: '米克罗尼西亚', countrycode: 'FM' },
{ country_cn: '密克罗尼西亚联邦', countrycode: 'FM' },
{ country_cn: '索马里', countrycode: 'SO' },
{ country_cn: '约旦', countrycode: 'JO' },
{ country_cn: '纳米比亚', countrycode: 'NA' },
{ country_cn: '缅甸', countrycode: 'MM' },
{ country_cn: '罗马尼亚', countrycode: 'RO' },
{ country_cn: '美国', countrycode: 'US' },
{ country_cn: '美属维尔京群岛', countrycode: 'VI' },
{ country_cn: '老挝', countrycode: 'LA' },
{ country_cn: '肯尼亚', countrycode: 'KE' },
{ country_cn: '芬兰', countrycode: 'FI' },
{ country_cn: '苏丹', countrycode: 'SD' },
{ country_cn: '苏里南', countrycode: 'SR' },
{ country_cn: '英国', countrycode: 'GB' },
{ country_cn: '英属印度洋领地', countrycode: 'IO' },
// { country_cn: '英属维京群岛', countrycode: 'VG' },
{ country_cn: '英属维尔京群岛', countrycode: 'VG' },
{ country_cn: '荷兰', countrycode: 'NL' },
{ country_cn: '荷兰加勒比区', countrycode: 'BQ' },
// { country_cn: '荷属圣马丁', countrycode: 'SX' },
{ country_cn: '圣马丁岛', countrycode: 'SX' },
{ country_cn: '莫桑比克', countrycode: 'MZ' },
{ country_cn: '莱索托', countrycode: 'LS' },
{ country_cn: '菲律宾', countrycode: 'PH' },
{ country_cn: '萨尔瓦多', countrycode: 'SV' },
{ country_cn: '萨摩亚', countrycode: 'WS' },
{ country_cn: '葡萄牙', countrycode: 'PT' },
{ country_cn: '蒙古', countrycode: 'MN' },
{ country_cn: '西班牙', countrycode: 'ES' },
{ country_cn: '诺福克岛', countrycode: 'NF' },
{ country_cn: '贝宁', countrycode: 'BJ' },
{ country_cn: '赞比亚', countrycode: 'ZM' },
{ country_cn: '赤道几内亚', countrycode: 'GQ' },
{ country_cn: '越南', countrycode: 'VN' },
{ country_cn: '阿塞拜疆', countrycode: 'AZ' },
{ country_cn: '阿富汗', countrycode: 'AF' },
{ country_cn: '阿尔及利亚', countrycode: 'DZ' },
{ country_cn: '阿尔巴尼亚', countrycode: 'AL' },
{ country_cn: '阿曼', countrycode: 'OM' },
{ country_cn: '阿根廷', countrycode: 'AR' },
{ country_cn: '阿联酋', countrycode: 'AE' },
{ country_cn: '阿鲁巴', countrycode: 'AW' },
{ country_cn: '韩国', countrycode: 'KR' },
{ country_cn: '马其顿', countrycode: 'MK' },
{ country_cn: '马尔代夫', countrycode: 'MV' },
{ country_cn: '马恩岛', countrycode: 'IM' },
{ country_cn: '马拉维', countrycode: 'MW' },
{ country_cn: '马来西亚', countrycode: 'MY' },
{ country_cn: '马绍尔群岛', countrycode: 'MH' },
{ country_cn: '马耳他', countrycode: 'MT' },
{ country_cn: '马达加斯加', countrycode: 'MG' },
{ country_cn: '马里', countrycode: 'ML' },
{ country_cn: '黎巴嫩', countrycode: 'LB' },
{ country_cn: '黑山', countrycode: 'ME' },
// { country_cn: '东萨摩亚', countrycode: 'AS' },
{ country_cn: '美属萨摩亚', countrycode: 'AS' },
{ country_cn: '东帝汶', countrycode: 'TL' },
{ country_cn: '圣卢西亚', countrycode: 'LC' },
{ country_cn: '瓜德罗普', countrycode: 'GP' },
{ country_cn: '马约特', countrycode: 'YT' },
{ country_cn: '马提尼克', countrycode: 'MQ' },
{ country_cn: '美国本土外小岛屿', countrycode: 'UM' },
{ country_cn: '福克兰群岛', countrycode: 'FK' },
{ country_cn: '北马里亚纳群岛', countrycode: 'MP' },
{ country_cn: '瓦利斯和富图纳群岛', countrycode: 'WF' },
{ country_cn: '圣诞岛', countrycode: 'CX' },
{ country_cn: '科科斯群岛', countrycode: 'CC' },
{ country_cn: '蒙塞拉特岛', countrycode: 'MS' },
{ country_cn: '南乔治亚岛与南桑威奇群岛', countrycode: 'GS' },
{ country_cn: '布韦岛', countrycode: 'BV' },
{ country_cn: '托克劳群岛', countrycode: 'TK' },
{ country_cn: '皮特凯恩群岛', countrycode: 'PN' },
{ country_cn: '纽埃', countrycode: 'NU' },
{ country_cn: '斯瓦尔巴群岛和扬马延岛', countrycode: 'SJ' },
{ country_cn: '圣赫勒拿岛', countrycode: 'SH' },
{ country_cn: '西撒哈拉', countrycode: 'EH' },
{ country_cn: '赫德岛和麦克唐纳群岛', countrycode: 'HM' },
{ country_cn: '法属南部领地', countrycode: 'TF' },
{ country_cn: '科索沃', countrycode: 'XK' },
];
util.judgeCountry = function (input_value) {
var countries = this.countries;
for (var j = 0; j < countries.length; j++) {
// var country = country_code[j]["country"]; //全称
var countrycode = countries[j]['countrycode']; //简称
var country_cn = countries[j]['country_cn']; //中文名称
if (
input_value.toUpperCase() == countrycode.toUpperCase() ||
input_value.toLowerCase() == countrycode.toLowerCase() ||
input_value == country_cn
) {
return countries[j]['countrycode'];
}
}
return false;
};
\ No newline at end of file
return false;
};
console.log("------ q/json.js debug ------");
/** @license
* RequireJS plugin for loading JSON files
* - depends on Text plugin and it was HEAVILY "inspired" by it as well.
......@@ -5,68 +7,89 @@
* Version: 0.4.0 (2014/04/10)
* Released under the MIT license
*/
define(['text'], function(text){
var CACHE_BUST_QUERY_PARAM = 'bust',
CACHE_BUST_FLAG = '!bust',
jsonParse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function')? JSON.parse : function(val){
return eval('('+ val +')'); //quick and dirty
},
buildMap = {};
function cacheBust(url){
url = url.replace(CACHE_BUST_FLAG, '');
url += (url.indexOf('?') < 0)? '?' : '&';
return url + CACHE_BUST_QUERY_PARAM +'='+ Math.round(2147483647 * Math.random());
}
define(["text"], function (text) {
var CACHE_BUST_QUERY_PARAM = "bust",
CACHE_BUST_FLAG = "!bust",
jsonParse =
typeof JSON !== "undefined" && typeof JSON.parse === "function"
? JSON.parse
: function (val) {
return eval("(" + val + ")"); //quick and dirty
},
buildMap = {};
//API
return {
function cacheBust(url) {
url = url.replace(CACHE_BUST_FLAG, "");
url += url.indexOf("?") < 0 ? "?" : "&";
return (
url +
CACHE_BUST_QUERY_PARAM +
"=" +
Math.round(2147483647 * Math.random())
);
}
load : function(name, req, onLoad, config) {
if (( config.isBuild && (config.inlineJSON === false || name.indexOf(CACHE_BUST_QUERY_PARAM +'=') !== -1)) || (req.toUrl(name).indexOf('empty:') === 0)) {
//avoid inlining cache busted JSON or if inlineJSON:false
//and don't inline files marked as empty!
onLoad(null);
//API
return {
load: function (name, req, onLoad, config) {
if (
(config.isBuild &&
(config.inlineJSON === false ||
name.indexOf(CACHE_BUST_QUERY_PARAM + "=") !== -1)) ||
req.toUrl(name).indexOf("empty:") === 0
) {
//avoid inlining cache busted JSON or if inlineJSON:false
//and don't inline files marked as empty!
onLoad(null);
} else {
text.get(
req.toUrl(name),
function (data) {
var parsed;
if (config.isBuild) {
buildMap[name] = data;
onLoad(data);
} else {
text.get(req.toUrl(name), function(data){
var parsed;
if (config.isBuild) {
buildMap[name] = data;
onLoad(data);
} else {
try {
parsed = jsonParse(data);
} catch (e) {
onLoad.error(e);
}
onLoad(parsed);
}
},
onLoad.error, {
accept: 'application/json'
}
);
try {
parsed = jsonParse(data);
} catch (e) {
onLoad.error(e);
}
onLoad(parsed);
}
},
},
onLoad.error,
{
accept: "application/json",
}
);
}
},
normalize : function (name, normalize) {
// used normalize to avoid caching references to a "cache busted" request
if (name.indexOf(CACHE_BUST_FLAG) !== -1) {
name = cacheBust(name);
}
// resolve any relative paths
return normalize(name);
},
//write method based on RequireJS official text plugin by James Burke
//https://github.com/jrburke/requirejs/blob/master/text.js
write : function(pluginName, moduleName, write){
if(moduleName in buildMap){
var content = buildMap[moduleName];
write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
}
}
normalize: function (name, normalize) {
// used normalize to avoid caching references to a "cache busted" request
if (name.indexOf(CACHE_BUST_FLAG) !== -1) {
name = cacheBust(name);
}
// resolve any relative paths
return normalize(name);
},
};
//write method based on RequireJS official text plugin by James Burke
//https://github.com/jrburke/requirejs/blob/master/text.js
write: function (pluginName, moduleName, write) {
if (moduleName in buildMap) {
var content = buildMap[moduleName];
write(
'define("' +
pluginName +
"!" +
moduleName +
'", function(){ return ' +
content +
";});\n"
);
}
},
};
});
var SvgHeader = function(el,textid){
var el = el;
var width = 180;
var height = 180;
var NS = "http://www.w3.org/2000/svg";
var xlinkNS = "http://www.w3.org/1999/xlink";
var svg = document.createElementNS(NS, "svg");
// var rec1 = document.createElementNS(NS, "path");
// var rec2 = document.createElementNS(NS, "path");
var circle= document.createElementNS(NS, "path");
var text = document.createElementNS(NS, "text");
var textPath = document.createElementNS(NS, "textPath");
svg.setAttribute("viewBox", "0 0"+' '+width+' '+height);
circle.setAttribute("d", "m 90,12 A 78,78 0 1,0 91,12");
circle.setAttribute("id", textid);
circle.setAttribute("class", "text_circle");
textPath.setAttributeNS(xlinkNS, "xlink:href", "#"+textid);
textPath.setAttribute('id','textpath'+textid);
text.appendChild(textPath);
svg.appendChild(circle);
svg.appendChild(text);
textPath.textContent = '';
el.appendChild(svg);
var textend_deg = 120;
var r_text = 80;
svg.querySelectorAll('.circle')
function setContent(content){
// textPath.textContent = '';
textPath.textContent = content;
// console.log('content')
// console.log(content)
// console.log(text.textLength)//暂不能删除
// console.log(text.getComputedTextLength())
// console.log(text.getNumberOfChars())
// var textstart_deg =text.textLength.animVal.value; //使用svg内部精确的计算值计算
var textstart_deg =186-content.length*9/2; // 每个字符按10度计算
// console.log(textstart_deg)
function degToArc(deg){
return deg*2*Math.PI*r_text/360;
}
// var m=document.querySelectorAll("circle")[3];
circle.setAttribute('transform','rotate(-'+textstart_deg+' 90 90)');
// midcircle.setAttribute('stroke-dasharray', arc_length+' '+(2*Math.PI*r_text-arc_length));
textstart_deg = 0;
}
return {
setContent: setContent
}
}
console.log("------ q/svgHeader2.js debug ------");
var SvgHeader = function (el, textid) {
var el = el;
var width = 180;
var height = 180;
var NS = "http://www.w3.org/2000/svg";
var xlinkNS = "http://www.w3.org/1999/xlink";
var svg = document.createElementNS(NS, "svg");
// var rec1 = document.createElementNS(NS, "path");
// var rec2 = document.createElementNS(NS, "path");
var circle = document.createElementNS(NS, "path");
var text = document.createElementNS(NS, "text");
var textPath = document.createElementNS(NS, "textPath");
svg.setAttribute("viewBox", "0 0" + " " + width + " " + height);
circle.setAttribute("d", "m 90,12 A 78,78 0 1,0 91,12");
circle.setAttribute("id", textid);
circle.setAttribute("class", "text_circle");
textPath.setAttributeNS(xlinkNS, "xlink:href", "#" + textid);
textPath.setAttribute("id", "textpath" + textid);
text.appendChild(textPath);
svg.appendChild(circle);
svg.appendChild(text);
textPath.textContent = "";
el.appendChild(svg);
var textend_deg = 120;
var r_text = 80;
svg.querySelectorAll(".circle");
function setContent(content) {
// textPath.textContent = '';
textPath.textContent = content;
// console.log('content')
// console.log(content)
// console.log(text.textLength)//暂不能删除
// console.log(text.getComputedTextLength())
// console.log(text.getNumberOfChars())
// var textstart_deg =text.textLength.animVal.value; //使用svg内部精确的计算值计算
var textstart_deg = 186 - (content.length * 9) / 2; // 每个字符按10度计算
// console.log(textstart_deg)
function degToArc(deg) {
return (deg * 2 * Math.PI * r_text) / 360;
}
// var m=document.querySelectorAll("circle")[3];
circle.setAttribute("transform", "rotate(-" + textstart_deg + " 90 90)");
// midcircle.setAttribute('stroke-dasharray', arc_length+' '+(2*Math.PI*r_text-arc_length));
textstart_deg = 0;
}
return {
setContent: setContent,
};
};
// var circular_as = $('.circular').eq(0).get()[0];
// var svgHeaderAs = new SvgHeader(circular_as,'textcircleas');
// svgHeaderAs.setContent('333333333333')
console.log("------ q/text.js debug ------");
/**
* @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
......@@ -8,325 +10,365 @@
define: false, window: false, process: false, Packages: false,
java: false, location: false */
define(['module'], function (module) {
'use strict';
var text, fs,
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
hasLocation = typeof location !== 'undefined' && location.href,
defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
defaultHostName = hasLocation && location.hostname,
defaultPort = hasLocation && (location.port || undefined),
buildMap = [],
masterConfig = (module.config && module.config()) || {};
text = {
version: '2.0.5',
strip: function (content) {
//Strips <?xml ...?> declarations so that external SVG and XML
//documents can be added to a document without worry. Also, if the string
//is an HTML document, only the part inside the body tag is returned.
if (content) {
content = content.replace(xmlRegExp, "");
var matches = content.match(bodyRegExp);
if (matches) {
content = matches[1];
}
} else {
content = "";
}
return content;
},
jsEscape: function (content) {
return content.replace(/(['\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r")
.replace(/[\u2028]/g, "\\u2028")
.replace(/[\u2029]/g, "\\u2029");
},
createXhr: masterConfig.createXhr || function () {
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else if (typeof ActiveXObject !== "undefined") {
for (i = 0; i < 3; i += 1) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {}
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
}
}
return xhr;
},
/**
* Parses a resource name into its component parts. Resource names
* look like: module/name.ext!strip, where the !strip part is
* optional.
* @param {String} name the resource name
* @returns {Object} with properties "moduleName", "ext" and "strip"
* where strip is a boolean.
*/
parseName: function (name) {
var modName, ext, temp,
strip = false,
index = name.indexOf("."),
isRelative = name.indexOf('./') === 0 ||
name.indexOf('../') === 0;
if (index !== -1 && (!isRelative || index > 1)) {
modName = name.substring(0, index);
ext = name.substring(index + 1, name.length);
} else {
modName = name;
}
temp = ext || modName;
index = temp.indexOf("!");
if (index !== -1) {
//Pull off the strip arg.
strip = temp.substring(index + 1) === "strip";
temp = temp.substring(0, index);
if (ext) {
ext = temp;
} else {
modName = temp;
}
}
return {
moduleName: modName,
ext: ext,
strip: strip
};
},
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
/**
* Is an URL on another domain. Only works for browser use, returns
* false in non-browser environments. Only used to know if an
* optimized .js version of a text resource should be loaded
* instead.
* @param {String} url
* @returns Boolean
*/
useXhr: function (url, protocol, hostname, port) {
var uProtocol, uHostName, uPort,
match = text.xdRegExp.exec(url);
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];
uHostName = uHostName.split(':');
uPort = uHostName[1];
uHostName = uHostName[0];
return (!uProtocol || uProtocol === protocol) &&
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
((!uPort && !uHostName) || uPort === port);
},
finishLoad: function (name, strip, content, onLoad) {
content = strip ? text.strip(content) : content;
if (masterConfig.isBuild) {
buildMap[name] = content;
}
onLoad(content);
},
load: function (name, req, onLoad, config) {
//Name has format: some.module.filext!strip
//The strip part is optional.
//if strip is present, then that means only get the string contents
//inside a body tag in an HTML string. For XML/SVG content it means
//removing the <?xml ...?> declarations so the content can be inserted
//into the current doc without problems.
// Do not bother with the work if a build and text will
// not be inlined.
if (config.isBuild && !config.inlineText) {
onLoad();
return;
}
define(["module"], function (module) {
"use strict";
var text,
fs,
progIds = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"],
xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
hasLocation = typeof location !== "undefined" && location.href,
defaultProtocol =
hasLocation && location.protocol && location.protocol.replace(/\:/, ""),
defaultHostName = hasLocation && location.hostname,
defaultPort = hasLocation && (location.port || undefined),
buildMap = [],
masterConfig = (module.config && module.config()) || {};
text = {
version: "2.0.5",
strip: function (content) {
//Strips <?xml ...?> declarations so that external SVG and XML
//documents can be added to a document without worry. Also, if the string
//is an HTML document, only the part inside the body tag is returned.
if (content) {
content = content.replace(xmlRegExp, "");
var matches = content.match(bodyRegExp);
if (matches) {
content = matches[1];
}
} else {
content = "";
}
return content;
},
jsEscape: function (content) {
return content
.replace(/(['\\])/g, "\\$1")
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r")
.replace(/[\u2028]/g, "\\u2028")
.replace(/[\u2029]/g, "\\u2029");
},
createXhr:
masterConfig.createXhr ||
function () {
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else if (typeof ActiveXObject !== "undefined") {
for (i = 0; i < 3; i += 1) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {}
masterConfig.isBuild = config.isBuild;
var parsed = text.parseName(name),
nonStripName = parsed.moduleName +
(parsed.ext ? '.' + parsed.ext : ''),
url = req.toUrl(nonStripName),
useXhr = (masterConfig.useXhr) ||
text.useXhr;
//Load the text. Use XHR if possible and in a browser.
if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
text.get(url, function (content) {
text.finishLoad(name, parsed.strip, content, onLoad);
}, function (err) {
if (onLoad.error) {
onLoad.error(err);
}
});
} else {
//Need to fetch the resource across domains. Assume
//the resource has been optimized into a JS module. Fetch
//by the module name + extension, but do not include the
//!strip part to avoid file system issues.
req([nonStripName], function (content) {
text.finishLoad(parsed.moduleName + '.' + parsed.ext,
parsed.strip, content, onLoad);
});
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
},
}
}
write: function (pluginName, moduleName, write, config) {
if (buildMap.hasOwnProperty(moduleName)) {
var content = text.jsEscape(buildMap[moduleName]);
write.asModule(pluginName + "!" + moduleName,
"define(function () { return '" +
content +
"';});\n");
return xhr;
},
/**
* Parses a resource name into its component parts. Resource names
* look like: module/name.ext!strip, where the !strip part is
* optional.
* @param {String} name the resource name
* @returns {Object} with properties "moduleName", "ext" and "strip"
* where strip is a boolean.
*/
parseName: function (name) {
var modName,
ext,
temp,
strip = false,
index = name.indexOf("."),
isRelative = name.indexOf("./") === 0 || name.indexOf("../") === 0;
if (index !== -1 && (!isRelative || index > 1)) {
modName = name.substring(0, index);
ext = name.substring(index + 1, name.length);
} else {
modName = name;
}
temp = ext || modName;
index = temp.indexOf("!");
if (index !== -1) {
//Pull off the strip arg.
strip = temp.substring(index + 1) === "strip";
temp = temp.substring(0, index);
if (ext) {
ext = temp;
} else {
modName = temp;
}
}
return {
moduleName: modName,
ext: ext,
strip: strip,
};
},
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
/**
* Is an URL on another domain. Only works for browser use, returns
* false in non-browser environments. Only used to know if an
* optimized .js version of a text resource should be loaded
* instead.
* @param {String} url
* @returns Boolean
*/
useXhr: function (url, protocol, hostname, port) {
var uProtocol,
uHostName,
uPort,
match = text.xdRegExp.exec(url);
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];
uHostName = uHostName.split(":");
uPort = uHostName[1];
uHostName = uHostName[0];
return (
(!uProtocol || uProtocol === protocol) &&
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
((!uPort && !uHostName) || uPort === port)
);
},
finishLoad: function (name, strip, content, onLoad) {
content = strip ? text.strip(content) : content;
if (masterConfig.isBuild) {
buildMap[name] = content;
}
onLoad(content);
},
load: function (name, req, onLoad, config) {
//Name has format: some.module.filext!strip
//The strip part is optional.
//if strip is present, then that means only get the string contents
//inside a body tag in an HTML string. For XML/SVG content it means
//removing the <?xml ...?> declarations so the content can be inserted
//into the current doc without problems.
// Do not bother with the work if a build and text will
// not be inlined.
if (config.isBuild && !config.inlineText) {
onLoad();
return;
}
masterConfig.isBuild = config.isBuild;
var parsed = text.parseName(name),
nonStripName = parsed.moduleName + (parsed.ext ? "." + parsed.ext : ""),
url = req.toUrl(nonStripName),
useXhr = masterConfig.useXhr || text.useXhr;
//Load the text. Use XHR if possible and in a browser.
if (
!hasLocation ||
useXhr(url, defaultProtocol, defaultHostName, defaultPort)
) {
text.get(
url,
function (content) {
text.finishLoad(name, parsed.strip, content, onLoad);
},
function (err) {
if (onLoad.error) {
onLoad.error(err);
}
}
);
} else {
//Need to fetch the resource across domains. Assume
//the resource has been optimized into a JS module. Fetch
//by the module name + extension, but do not include the
//!strip part to avoid file system issues.
req([nonStripName], function (content) {
text.finishLoad(
parsed.moduleName + "." + parsed.ext,
parsed.strip,
content,
onLoad
);
});
}
},
write: function (pluginName, moduleName, write, config) {
if (buildMap.hasOwnProperty(moduleName)) {
var content = text.jsEscape(buildMap[moduleName]);
write.asModule(
pluginName + "!" + moduleName,
"define(function () { return '" + content + "';});\n"
);
}
},
writeFile: function (pluginName, moduleName, req, write, config) {
var parsed = text.parseName(moduleName),
extPart = parsed.ext ? "." + parsed.ext : "",
nonStripName = parsed.moduleName + extPart,
//Use a '.js' file name so that it indicates it is a
//script that can be loaded across domains.
fileName = req.toUrl(parsed.moduleName + extPart) + ".js";
//Leverage own load() method to load plugin value, but only
//write out values that do not have the strip argument,
//to avoid any potential issues with ! in file names.
text.load(
nonStripName,
req,
function (value) {
//Use own write() method to construct full module value.
//But need to create shell that translates writeFile's
//write() to the right interface.
var textWrite = function (contents) {
return write(fileName, contents);
};
textWrite.asModule = function (moduleName, contents) {
return write.asModule(moduleName, fileName, contents);
};
text.write(pluginName, nonStripName, textWrite, config);
},
writeFile: function (pluginName, moduleName, req, write, config) {
var parsed = text.parseName(moduleName),
extPart = parsed.ext ? '.' + parsed.ext : '',
nonStripName = parsed.moduleName + extPart,
//Use a '.js' file name so that it indicates it is a
//script that can be loaded across domains.
fileName = req.toUrl(parsed.moduleName + extPart) + '.js';
//Leverage own load() method to load plugin value, but only
//write out values that do not have the strip argument,
//to avoid any potential issues with ! in file names.
text.load(nonStripName, req, function (value) {
//Use own write() method to construct full module value.
//But need to create shell that translates writeFile's
//write() to the right interface.
var textWrite = function (contents) {
return write(fileName, contents);
};
textWrite.asModule = function (moduleName, contents) {
return write.asModule(moduleName, fileName, contents);
};
text.write(pluginName, nonStripName, textWrite, config);
}, config);
config
);
},
};
if (
masterConfig.env === "node" ||
(!masterConfig.env &&
typeof process !== "undefined" &&
process.versions &&
!!process.versions.node)
) {
//Using special require.nodeRequire, something added by r.js.
fs = require.nodeRequire("fs");
text.get = function (url, callback) {
var file = fs.readFileSync(url, "utf8");
//Remove BOM (Byte Mark Order) from utf8 files if it is there.
if (file.indexOf("\uFEFF") === 0) {
file = file.substring(1);
}
callback(file);
};
} else if (
masterConfig.env === "xhr" ||
(!masterConfig.env && text.createXhr())
) {
text.get = function (url, callback, errback, headers) {
var xhr = text.createXhr(),
header;
xhr.open("GET", url, true);
//Allow plugins direct access to xhr headers
if (headers) {
for (header in headers) {
if (headers.hasOwnProperty(header)) {
xhr.setRequestHeader(header.toLowerCase(), headers[header]);
}
}
}
//Allow overrides specified in config
if (masterConfig.onXhr) {
masterConfig.onXhr(xhr, url);
}
xhr.onreadystatechange = function (evt) {
var status, err;
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
status = xhr.status;
if (status > 399 && status < 600) {
//An http 4xx or 5xx error. Signal an error.
err = new Error(url + " HTTP status: " + status);
err.xhr = xhr;
errback(err);
} else {
callback(xhr.responseText);
}
}
};
xhr.send(null);
};
} else if (
masterConfig.env === "rhino" ||
(!masterConfig.env &&
typeof Packages !== "undefined" &&
typeof java !== "undefined")
) {
//Why Java, why is this so awkward?
text.get = function (url, callback) {
var stringBuffer,
line,
encoding = "utf-8",
file = new java.io.File(url),
lineSeparator = java.lang.System.getProperty("line.separator"),
input = new java.io.BufferedReader(
new java.io.InputStreamReader(
new java.io.FileInputStream(file),
encoding
)
),
content = "";
try {
stringBuffer = new java.lang.StringBuffer();
line = input.readLine();
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
// http://www.unicode.org/faq/utf_bom.html
// Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
if (line && line.length() && line.charAt(0) === 0xfeff) {
// Eat the BOM, since we've already found the encoding on this file,
// and we plan to concatenating this buffer with others; the BOM should
// only appear at the top of a file.
line = line.substring(1);
}
if (masterConfig.env === 'node' || (!masterConfig.env &&
typeof process !== "undefined" &&
process.versions &&
!!process.versions.node)) {
//Using special require.nodeRequire, something added by r.js.
fs = require.nodeRequire('fs');
text.get = function (url, callback) {
var file = fs.readFileSync(url, 'utf8');
//Remove BOM (Byte Mark Order) from utf8 files if it is there.
if (file.indexOf('\uFEFF') === 0) {
file = file.substring(1);
}
callback(file);
};
} else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
text.createXhr())) {
text.get = function (url, callback, errback, headers) {
var xhr = text.createXhr(), header;
xhr.open('GET', url, true);
//Allow plugins direct access to xhr headers
if (headers) {
for (header in headers) {
if (headers.hasOwnProperty(header)) {
xhr.setRequestHeader(header.toLowerCase(), headers[header]);
}
}
}
//Allow overrides specified in config
if (masterConfig.onXhr) {
masterConfig.onXhr(xhr, url);
}
stringBuffer.append(line);
xhr.onreadystatechange = function (evt) {
var status, err;
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
status = xhr.status;
if (status > 399 && status < 600) {
//An http 4xx or 5xx error. Signal an error.
err = new Error(url + ' HTTP status: ' + status);
err.xhr = xhr;
errback(err);
} else {
callback(xhr.responseText);
}
}
};
xhr.send(null);
};
} else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
//Why Java, why is this so awkward?
text.get = function (url, callback) {
var stringBuffer, line,
encoding = "utf-8",
file = new java.io.File(url),
lineSeparator = java.lang.System.getProperty("line.separator"),
input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
content = '';
try {
stringBuffer = new java.lang.StringBuffer();
line = input.readLine();
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
// http://www.unicode.org/faq/utf_bom.html
// Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
if (line && line.length() && line.charAt(0) === 0xfeff) {
// Eat the BOM, since we've already found the encoding on this file,
// and we plan to concatenating this buffer with others; the BOM should
// only appear at the top of a file.
line = line.substring(1);
}
stringBuffer.append(line);
while ((line = input.readLine()) !== null) {
stringBuffer.append(lineSeparator);
stringBuffer.append(line);
}
//Make sure we return a JavaScript string and not a Java string.
content = String(stringBuffer.toString()); //String
} finally {
input.close();
}
callback(content);
};
}
while ((line = input.readLine()) !== null) {
stringBuffer.append(lineSeparator);
stringBuffer.append(line);
}
//Make sure we return a JavaScript string and not a Java string.
content = String(stringBuffer.toString()); //String
} finally {
input.close();
}
callback(content);
};
}
return text;
return text;
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment