zhongrj
2023-06-27 d74b495736f0c04522ec54274b70fed0ded2878d
public/map/env.js
New file
@@ -0,0 +1,110 @@
//处理IE8以前版本不支持console.log()方法
if (!window["console"]) {
    window["console"] = {
        log: function () {
        }
    };
}
//检测用户的浏览器版本
function checkBrowder() {
    if (navigator.userAgent.indexOf("Opera") != -1) {
        alert('Opera');
    }
    else if (navigator.userAgent.indexOf("MSIE") != -1) {
        var ieversion = checkIEVersion();
        if (ieversion < 9) {
            alert('为了使您得到更好的用户体验,建议您使用IE9.0及以上版本的IE、火狐(Firefox)浏览器或Chrome浏览器。');
        }
    }
    else if (navigator.userAgent.indexOf("Firefox") != -1) {
    }
    else if (navigator.userAgent.indexOf("Netscape") != -1) {
    }
    else if (navigator.userAgent.indexOf("Chrome") != -1) {
        console.log("Chrome");
    }
    else if (navigator.userAgent.indexOf("Safari") != -1) {
    }
    else {
        if (isIE11()) {
        }
        else {
            alert('无法识别您的浏览器类型,为了使您得到更好的用户体验,建议您使用IE9.0及以上版本的IE、火狐(Firefox)浏览器或Chrome浏览器。');
        }
    }
}
function checkIEVersion() {
    var ua = navigator.userAgent;
    var b = ua.indexOf("MSIE ");
    if (b < 0) {
        return 0;
    }
    var v = parseFloat(ua.substring(b + 5, ua.indexOf(";", b)));
    return v;
}
function isIE11() {
    return ("ActiveXObject" in window);
}
checkBrowder();
String.prototype.trim = function () {
    return this.replace(/(^\s*)|(\s*$)/g, '');
}
var getIndexUrl = function (app) {
    var indexPath = location.protocol + "//" + location.host + app;
    return indexPath;
};
function uuid() {
    var s = [];
    var hexDigits = "0123456789abcdef";
    for (var i = 0; i < 36; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
    }
    s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
    s[8] = s[13] = s[18] = s[23] = "-";
    var uuid = s.join("");
    return uuid;
}
var baseUrl = getIndexUrl("/map");
// var baseUrl = getIndexUrl("/views/map");
//var baseUrl = getIndexUrl("/wnga/Police");
dojoConfig = {
    parseOnLoad: false,
    async: true,
    packages: [
        // Any references to a "demo" resource should load modules locally, *not* from CDN
        {
            name: "base",
            location: baseUrl + "/core"
        },
        {
            name: "manager",
            location: baseUrl + "/core/manager"
        },
        {
            name: "widgets",
            location: baseUrl + "/widgets"
        },
        {
            name: "esrichina",
            location: baseUrl + "/core/esrichina"
        },
        {
            name: "controls",
            location: baseUrl + "/controls"
        },
        {
            name: "utils",
            location: baseUrl + "/core/utils"
        }
    ]
};