Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fengfei committed Mar 29, 2018
1 parent 674a2dc commit 13c98b2
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions html/static/js/main.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
function api_invoke(uri, params, callback){
function api_invoke(uri, params, callback) {
$.ajax({
url:uri,
data:params,
type:'POST',
cache:false,
dataType:'json',
success:function(data) {
url: uri,
data: params,
type: 'POST',
cache: false,
dataType: 'json',
success: function (data) {
callback(data);
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
if ("undefined" == typeof(XMLHttpRequest.responseJSON)) {
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.status == 302) {
location.href = "/login.html";
return;
}
if ("undefined" == typeof(XMLHttpRequest.responseJSON)) {
alert("System error, please try again later.");
return;
};
alert(XMLHttpRequest.responseJSON.msg);
}
}
alert(XMLHttpRequest.responseJSON.msg);
}
});
}

function load_page(pageUrl){
function load_page(pageUrl) {
$(".content-wrapper").load(pageUrl);
}

function get_query_string(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
function get_query_string(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)return unescape(r[2]);
return null;
}

function is_ip(ip)
{
var re = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return re.test(ip);
function is_ip(ip) {
var re = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return re.test(ip);
}

function check_port(port)
{
if (port>65535) {
function check_port(port) {
if (port > 65535) {
return false;
}
var re = /^[1-9]+[0-9]*]*$/
return re.test(port);
}

function check_weight(weight)
{
function check_weight(weight) {
var re = /^[1-9]+[0-9]*]*$/
return re.test(weight);
}
Expand Down

0 comments on commit 13c98b2

Please sign in to comment.