|
@ -0,0 +1,4184 @@
|
|
|
|
window.TILE_VERSION = {
|
|
|
|
"ditu": {
|
|
|
|
"normal": {
|
|
|
|
"version": "088",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"satellite": {
|
|
|
|
"version": "009",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"normalTraffic": {
|
|
|
|
"version": "081",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"satelliteTraffic": {
|
|
|
|
"version": "083",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"mapJS": {
|
|
|
|
"version": "104",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"satelliteStreet": {
|
|
|
|
"version": "083",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"earthVector": {
|
|
|
|
"version": "001",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"webapp": {
|
|
|
|
"high_normal": {
|
|
|
|
"version": "001",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"lower_normal": {
|
|
|
|
"version": "002",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"api_for_mobile": {
|
|
|
|
"vector": {
|
|
|
|
"version": "002",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
},
|
|
|
|
"vectorIcon": {
|
|
|
|
"version": "002",
|
|
|
|
"updateDate": "20190929"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
window.BMAP_AUTHENTIC_KEY = "hlDtW6AATwvq3WZ7QGMbQKSNMvM59BLZ";
|
|
|
|
(function() {
|
|
|
|
(function() {
|
|
|
|
var g, J = g = J || {
|
|
|
|
version: "1.3.4"
|
|
|
|
};
|
|
|
|
J.guid = "$BAIDU$";
|
|
|
|
window[J.guid] = window[J.guid] || {};
|
|
|
|
J.object = J.object || {};
|
|
|
|
J.extend = J.object.extend = function(N, L) {
|
|
|
|
for (var M in L) {
|
|
|
|
if (L.hasOwnProperty(M)) {
|
|
|
|
N[M] = L[M]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
J.dom = J.dom || {};
|
|
|
|
J.dom.g = function(L) {
|
|
|
|
if ("string" == typeof L || L instanceof String) {
|
|
|
|
return document.getElementById(L)
|
|
|
|
} else {
|
|
|
|
if (L && L.nodeName && (L.nodeType == 1 || L.nodeType == 9)) {
|
|
|
|
return L
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
};
|
|
|
|
J.g = J.G = J.dom.g;
|
|
|
|
J.dom.hide = function(L) {
|
|
|
|
L = J.dom.g(L);
|
|
|
|
L.style.display = "none";
|
|
|
|
return L
|
|
|
|
};
|
|
|
|
J.hide = J.dom.hide;
|
|
|
|
J.lang = J.lang || {};
|
|
|
|
J.lang.isString = function(L) {
|
|
|
|
return "[object String]" == Object.prototype.toString.call(L)
|
|
|
|
};
|
|
|
|
J.isString = J.lang.isString;
|
|
|
|
J.dom._g = function(L) {
|
|
|
|
if (J.lang.isString(L)) {
|
|
|
|
return document.getElementById(L)
|
|
|
|
}
|
|
|
|
return L
|
|
|
|
};
|
|
|
|
J._g = J.dom._g;
|
|
|
|
J.dom.contains = function(L, M) {
|
|
|
|
var N = J.dom._g;
|
|
|
|
L = N(L);
|
|
|
|
M = N(M);
|
|
|
|
return L.contains ? L != M && L.contains(M) : !!(L.compareDocumentPosition(M) & 16)
|
|
|
|
};
|
|
|
|
J.browser = J.browser || {};
|
|
|
|
J.dom._NAME_ATTRS = (function() {
|
|
|
|
var L = {
|
|
|
|
cellpadding: "cellPadding",
|
|
|
|
cellspacing: "cellSpacing",
|
|
|
|
colspan: "colSpan",
|
|
|
|
rowspan: "rowSpan",
|
|
|
|
valign: "vAlign",
|
|
|
|
usemap: "useMap",
|
|
|
|
frameborder: "frameBorder"
|
|
|
|
};
|
|
|
|
L.htmlFor = "for";
|
|
|
|
L.className = "class";
|
|
|
|
return L
|
|
|
|
})();
|
|
|
|
J.dom.setAttr = function(M, L, N) {
|
|
|
|
M = J.dom.g(M);
|
|
|
|
if ("style" == L) {
|
|
|
|
M.style.cssText = N
|
|
|
|
} else {
|
|
|
|
L = J.dom._NAME_ATTRS[L] || L;
|
|
|
|
M.setAttribute(L, N)
|
|
|
|
}
|
|
|
|
return M
|
|
|
|
};
|
|
|
|
J.setAttr = J.dom.setAttr;
|
|
|
|
J.dom.setAttrs = function(N, L) {
|
|
|
|
N = J.dom.g(N);
|
|
|
|
for (var M in L) {
|
|
|
|
J.dom.setAttr(N, M, L[M])
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
J.setAttrs = J.dom.setAttrs;
|
|
|
|
J.string = J.string || {};
|
|
|
|
J.dom.removeClass = function(Q, R) {
|
|
|
|
Q = J.dom.g(Q);
|
|
|
|
var O = Q.className.split(/\s+/),
|
|
|
|
S = R.split(/\s+/),
|
|
|
|
M, L = S.length,
|
|
|
|
N, P = 0;
|
|
|
|
for (; P < L; ++P) {
|
|
|
|
for (N = 0, M = O.length; N < M; ++N) {
|
|
|
|
if (O[N] == S[P]) {
|
|
|
|
O.splice(N, 1);
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Q.className = O.join(" ");
|
|
|
|
return Q
|
|
|
|
};
|
|
|
|
J.removeClass = J.dom.removeClass;
|
|
|
|
J.dom.insertHTML = function(O, L, N) {
|
|
|
|
O = J.dom.g(O);
|
|
|
|
var M, P;
|
|
|
|
if (O.insertAdjacentHTML) {
|
|
|
|
O.insertAdjacentHTML(L, N)
|
|
|
|
} else {
|
|
|
|
M = O.ownerDocument.createRange();
|
|
|
|
L = L.toUpperCase();
|
|
|
|
if (L == "AFTERBEGIN" || L == "BEFOREEND") {
|
|
|
|
M.selectNodeContents(O);
|
|
|
|
M.collapse(L == "AFTERBEGIN")
|
|
|
|
} else {
|
|
|
|
P = L == "BEFOREBEGIN";
|
|
|
|
M[P ? "setStartBefore" : "setEndAfter"](O);
|
|
|
|
M.collapse(P)
|
|
|
|
}
|
|
|
|
M.insertNode(M.createContextualFragment(N))
|
|
|
|
}
|
|
|
|
return O
|
|
|
|
};
|
|
|
|
J.insertHTML = J.dom.insertHTML;
|
|
|
|
J.dom.show = function(L) {
|
|
|
|
L = J.dom.g(L);
|
|
|
|
L.style.display = "";
|
|
|
|
return L
|
|
|
|
};
|
|
|
|
J.show = J.dom.show;
|
|
|
|
J.dom.getDocument = function(L) {
|
|
|
|
L = J.dom.g(L);
|
|
|
|
return L.nodeType == 9 ? L : L.ownerDocument || L.document
|
|
|
|
};
|
|
|
|
J.dom.addClass = function(Q, R) {
|
|
|
|
Q = J.dom.g(Q);
|
|
|
|
var M = R.split(/\s+/),
|
|
|
|
L = Q.className,
|
|
|
|
P = " " + L + " ",
|
|
|
|
O = 0,
|
|
|
|
N = M.length;
|
|
|
|
for (; O < N; O++) {
|
|
|
|
if (P.indexOf(" " + M[O] + " ") < 0) {
|
|
|
|
L += " " + M[O]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Q.className = L;
|
|
|
|
return Q
|
|
|
|
};
|
|
|
|
J.addClass = J.dom.addClass;
|
|
|
|
J.dom._styleFixer = J.dom._styleFixer || {};
|
|
|
|
J.dom._styleFilter = J.dom._styleFilter || [];
|
|
|
|
J.dom._styleFilter.filter = function(M, P, Q) {
|
|
|
|
for (var L = 0, O = J.dom._styleFilter, N; N = O[L]; L++) {
|
|
|
|
if (N = N[Q]) {
|
|
|
|
P = N(M, P)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return P
|
|
|
|
};
|
|
|
|
J.string.toCamelCase = function(L) {
|
|
|
|
if (L.indexOf("-") < 0 && L.indexOf("_") < 0) {
|
|
|
|
return L
|
|
|
|
}
|
|
|
|
return L.replace(/[-_][^-_]/g, function(M) {
|
|
|
|
return M.charAt(1).toUpperCase()
|
|
|
|
})
|
|
|
|
};
|
|
|
|
J.dom.getStyle = function(N, M) {
|
|
|
|
var Q = J.dom;
|
|
|
|
N = Q.g(N);
|
|
|
|
M = J.string.toCamelCase(M);
|
|
|
|
var P = N.style[M];
|
|
|
|
if (!P) {
|
|
|
|
var L = Q._styleFixer[M],
|
|
|
|
O = N.currentStyle || getComputedStyle(N, null);
|
|
|
|
P = L && L.get ? L.get(N, O) : O[L || M]
|
|
|
|
}
|
|
|
|
if (L = Q._styleFilter) {
|
|
|
|
P = L.filter(M, P, "get")
|
|
|
|
}
|
|
|
|
return P
|
|
|
|
};
|
|
|
|
J.getStyle = J.dom.getStyle;
|
|
|
|
if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) {
|
|
|
|
J.browser.opera = +RegExp["\x241"]
|
|
|
|
}
|
|
|
|
J.browser.isWebkit = /webkit/i.test(navigator.userAgent);
|
|
|
|
J.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent);
|
|
|
|
J.browser.isStrict = document.compatMode == "CSS1Compat";
|
|
|
|
J.dom.getPosition = function(L) {
|
|
|
|
L = J.dom.g(L);
|
|
|
|
var U = J.dom.getDocument(L),
|
|
|
|
O = J.browser,
|
|
|
|
R = J.dom.getStyle,
|
|
|
|
N = O.isGecko > 0 && U.getBoxObjectFor && R(L, "position") == "absolute" && (L.style.top === "" || L.style.left ===
|
|
|
|
""),
|
|
|
|
S = {
|
|
|
|
left: 0,
|
|
|
|
top: 0
|
|
|
|
},
|
|
|
|
Q = (O.ie && !O.isStrict) ? U.body : U.documentElement,
|
|
|
|
V, M;
|
|
|
|
if (L == Q) {
|
|
|
|
return S
|
|
|
|
}
|
|
|
|
if (L.getBoundingClientRect) {
|
|
|
|
M = L.getBoundingClientRect();
|
|
|
|
S.left = Math.floor(M.left) + Math.max(U.documentElement.scrollLeft, U.body.scrollLeft);
|
|
|
|
S.top = Math.floor(M.top) + Math.max(U.documentElement.scrollTop, U.body.scrollTop);
|
|
|
|
S.left -= U.documentElement.clientLeft;
|
|
|
|
S.top -= U.documentElement.clientTop;
|
|
|
|
var T = U.body,
|
|
|
|
W = parseInt(R(T, "borderLeftWidth")),
|
|
|
|
P = parseInt(R(T, "borderTopWidth"));
|
|
|
|
if (O.ie && !O.isStrict) {
|
|
|
|
S.left -= isNaN(W) ? 2 : W;
|
|
|
|
S.top -= isNaN(P) ? 2 : P
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
V = L;
|
|
|
|
do {
|
|
|
|
S.left += V.offsetLeft;
|
|
|
|
S.top += V.offsetTop;
|
|
|
|
if (O.isWebkit > 0 && R(V, "position") == "fixed") {
|
|
|
|
S.left += U.body.scrollLeft;
|
|
|
|
S.top += U.body.scrollTop;
|
|
|
|
break
|
|
|
|
}
|
|
|
|
V = V.offsetParent
|
|
|
|
} while (V && V != L);
|
|
|
|
if (O.opera > 0 || (O.isWebkit > 0 && R(L, "position") == "absolute")) {
|
|
|
|
S.top -= U.body.offsetTop
|
|
|
|
}
|
|
|
|
V = L.offsetParent;
|
|
|
|
while (V && V != U.body) {
|
|
|
|
S.left -= V.scrollLeft;
|
|
|
|
if (!O.opera || V.tagName != "TR") {
|
|
|
|
S.top -= V.scrollTop
|
|
|
|
}
|
|
|
|
V = V.offsetParent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return S
|
|
|
|
};
|
|
|
|
if (/firefox\/(\d+\.\d)/i.test(navigator.userAgent)) {
|
|
|
|
J.browser.firefox = +RegExp["\x241"]
|
|
|
|
}(function() {
|
|
|
|
var L = navigator.userAgent;
|
|
|
|
if (/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(L) && !/chrome/i.test(L)) {
|
|
|
|
J.browser.safari = +(RegExp["\x241"] || RegExp["\x242"])
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
if (/chrome\/(\d+\.\d)/i.test(navigator.userAgent)) {
|
|
|
|
J.browser.chrome = +RegExp["\x241"]
|
|
|
|
}
|
|
|
|
J.array = J.array || {};
|
|
|
|
J.array.each = function(Q, O) {
|
|
|
|
var N, P, M, L = Q.length;
|
|
|
|
if ("function" == typeof O) {
|
|
|
|
for (M = 0; M < L; M++) {
|
|
|
|
P = Q[M];
|
|
|
|
N = O.call(Q, P, M);
|
|
|
|
if (N === false) {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Q
|
|
|
|
};
|
|
|
|
J.each = J.array.each;
|
|
|
|
J.lang.guid = function() {
|
|
|
|
return "GUID__" + (window[J.guid]._counter++).toString(36)
|
|
|
|
};
|
|
|
|
window[J.guid]._counter = window[J.guid]._counter || 1;
|
|
|
|
window[J.guid]._instances = window[J.guid]._instances || {};
|
|
|
|
J.lang.isFunction = function(L) {
|
|
|
|
return "[object Function]" == Object.prototype.toString.call(L)
|
|
|
|
};
|
|
|
|
J.lang.isNumber = function(L) {
|
|
|
|
return "[object Number]" == Object.prototype.toString.call(L)
|
|
|
|
};
|
|
|
|
J.lang.Class = function(L) {
|
|
|
|
this.guid = L || J.lang.guid();
|
|
|
|
window[J.guid]._instances[this.guid] = this
|
|
|
|
};
|
|
|
|
window[J.guid]._instances = window[J.guid]._instances || {};
|
|
|
|
J.lang.Class.prototype.dispose = function() {
|
|
|
|
delete window[J.guid]._instances[this.guid];
|
|
|
|
for (var L in this) {
|
|
|
|
if (!J.lang.isFunction(this[L])) {
|
|
|
|
delete this[L]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.disposed = true
|
|
|
|
};
|
|
|
|
J.lang.Class.prototype.toString = function() {
|
|
|
|
return "[object " + (this._className || "Object") + "]"
|
|
|
|
};
|
|
|
|
J.lang.Event = function(L, M) {
|
|
|
|
this.type = L;
|
|
|
|
this.returnValue = true;
|
|
|
|
this.target = M || null;
|
|
|
|
this.currentTarget = null
|
|
|
|
};
|
|
|
|
J.lang.Class.prototype.addEventListener = function(O, N, M) {
|
|
|
|
if (!J.lang.isFunction(N)) {
|
|
|
|
return
|
|
|
|
}!this.__listeners && (this.__listeners = {});
|
|
|
|
var L = this.__listeners,
|
|
|
|
P;
|
|
|
|
if (typeof M == "string" && M) {
|
|
|
|
if (/[^\w\-]/.test(M)) {
|
|
|
|
throw ("nonstandard key:" + M)
|
|
|
|
} else {
|
|
|
|
N.hashCode = M;
|
|
|
|
P = M
|
|
|
|
}
|
|
|
|
}
|
|
|
|
O.indexOf("on") != 0 && (O = "on" + O);
|
|
|
|
typeof L[O] != "object" && (L[O] = {});
|
|
|
|
P = P || J.lang.guid();
|
|
|
|
N.hashCode = P;
|
|
|
|
L[O][P] = N
|
|
|
|
};
|
|
|
|
J.lang.Class.prototype.removeEventListener = function(N, M) {
|
|
|
|
if (J.lang.isFunction(M)) {
|
|
|
|
M = M.hashCode
|
|
|
|
} else {
|
|
|
|
if (!J.lang.isString(M)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}!this.__listeners && (this.__listeners = {});
|
|
|
|
N.indexOf("on") != 0 && (N = "on" + N);
|
|
|
|
var L = this.__listeners;
|
|
|
|
if (!L[N]) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
L[N][M] && delete L[N][M]
|
|
|
|
};
|
|
|
|
J.lang.Class.prototype.dispatchEvent = function(O, L) {
|
|
|
|
if (J.lang.isString(O)) {
|
|
|
|
O = new J.lang.Event(O)
|
|
|
|
}!this.__listeners && (this.__listeners = {});
|
|
|
|
L = L || {};
|
|
|
|
for (var N in L) {
|
|
|
|
O[N] = L[N]
|
|
|
|
}
|
|
|
|
var N, M = this.__listeners,
|
|
|
|
P = O.type;
|
|
|
|
O.target = O.target || this;
|
|
|
|
O.currentTarget = this;
|
|
|
|
P.indexOf("on") != 0 && (P = "on" + P);
|
|
|
|
J.lang.isFunction(this[P]) && this[P].apply(this, arguments);
|
|
|
|
if (typeof M[P] == "object") {
|
|
|
|
for (N in M[P]) {
|
|
|
|
M[P][N].apply(this, arguments)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return O.returnValue
|
|
|
|
};
|
|
|
|
J.lang.inherits = function(R, P, O) {
|
|
|
|
var N, Q, L = R.prototype,
|
|
|
|
M = new Function();
|
|
|
|
M.prototype = P.prototype;
|
|
|
|
Q = R.prototype = new M();
|
|
|
|
for (N in L) {
|
|
|
|
Q[N] = L[N]
|
|
|
|
}
|
|
|
|
R.prototype.constructor = R;
|
|
|
|
R.superClass = P.prototype;
|
|
|
|
if ("string" == typeof O) {
|
|
|
|
Q._className = O
|
|
|
|
}
|
|
|
|
};
|
|
|
|
J.inherits = J.lang.inherits;
|
|
|
|
J.lang.instance = function(L) {
|
|
|
|
return window[J.guid]._instances[L] || null
|
|
|
|
};
|
|
|
|
J.platform = J.platform || {};
|
|
|
|
J.platform.isAndroid = /android/i.test(navigator.userAgent);
|
|
|
|
if (/android (\d+(\.\d)?)/i.test(navigator.userAgent)) {
|
|
|
|
J.platform.android = J.android = RegExp["\x241"]
|
|
|
|
}
|
|
|
|
J.platform.isIpad = /ipad/i.test(navigator.userAgent);
|
|
|
|
J.platform.isIphone = /iphone/i.test(navigator.userAgent);
|
|
|
|
J.platform.iosVersion = /iphone os (\d)\_/i.test(navigator.userAgent) ? +RegExp["\x241"] : 0;
|
|
|
|
J.lang.Event.prototype.inherit = function(N) {
|
|
|
|
var M = this;
|
|
|
|
this.domEvent = N = window.event || N;
|
|
|
|
M.clientX = N.clientX || N.pageX;
|
|
|
|
M.clientY = N.clientY || N.pageY;
|
|
|
|
M.offsetX = N.offsetX || N.layerX;
|
|
|
|
M.offsetY = N.offsetY || N.layerY;
|
|
|
|
M.screenX = N.screenX;
|
|
|
|
M.screenY = N.screenY;
|
|
|
|
M.ctrlKey = N.ctrlKey || N.metaKey;
|
|
|
|
M.shiftKey = N.shiftKey;
|
|
|
|
M.altKey = N.altKey;
|
|
|
|
if (N.touches) {
|
|
|
|
M.touches = [];
|
|
|
|
for (var L = 0; L < N.touches.length; L++) {
|
|
|
|
M.touches.push({
|
|
|
|
clientX: N.touches[L].clientX,
|
|
|
|
clientY: N.touches[L].clientY,
|
|
|
|
screenX: N.touches[L].screenX,
|
|
|
|
screenY: N.touches[L].screenY,
|
|
|
|
pageX: N.touches[L].pageX,
|
|
|
|
pageY: N.touches[L].pageY,
|
|
|
|
target: N.touches[L].target,
|
|
|
|
identifier: N.touches[L].identifier
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (N.changedTouches) {
|
|
|
|
M.changedTouches = [];
|
|
|
|
for (var L = 0; L < N.changedTouches.length; L++) {
|
|
|
|
M.changedTouches.push({
|
|
|
|
clientX: N.changedTouches[L].clientX,
|
|
|
|
clientY: N.changedTouches[L].clientY,
|
|
|
|
screenX: N.changedTouches[L].screenX,
|
|
|
|
screenY: N.changedTouches[L].screenY,
|
|
|
|
pageX: N.changedTouches[L].pageX,
|
|
|
|
pageY: N.changedTouches[L].pageY,
|
|
|
|
target: N.changedTouches[L].target,
|
|
|
|
identifier: N.changedTouches[L].identifier
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (N.targetTouches) {
|
|
|
|
M.targetTouches = [];
|
|
|
|
for (var L = 0; L < N.targetTouches.length; L++) {
|
|
|
|
M.targetTouches.push({
|
|
|
|
clientX: N.targetTouches[L].clientX,
|
|
|
|
clientY: N.targetTouches[L].clientY,
|
|
|
|
screenX: N.targetTouches[L].screenX,
|
|
|
|
screenY: N.targetTouches[L].screenY,
|
|
|
|
pageX: N.targetTouches[L].pageX,
|
|
|
|
pageY: N.targetTouches[L].pageY,
|
|
|
|
target: N.targetTouches[L].target,
|
|
|
|
identifier: N.targetTouches[L].identifier
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
M.rotation = N.rotation;
|
|
|
|
M.scale = N.scale;
|
|
|
|
return M
|
|
|
|
};
|
|
|
|
var F = J.lang.Event;
|
|
|
|
J.lang.decontrol = function(M) {
|
|
|
|
var L = window[J.guid];
|
|
|
|
L._instances && (delete L._instances[M])
|
|
|
|
};
|
|
|
|
J.event = {};
|
|
|
|
J.on = J.event.on = function(N, M, L) {
|
|
|
|
if (!(N = J.g(N))) {
|
|
|
|
return N
|
|
|
|
}
|
|
|
|
M = M.replace(/^on/, "");
|
|
|
|
if (N.addEventListener) {
|
|
|
|
N.addEventListener(M, L, false)
|
|
|
|
} else {
|
|
|
|
if (N.attachEvent) {
|
|
|
|
N.attachEvent("on" + M, L)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
J.un = J.event.un = function(N, M, L) {
|
|
|
|
if (!(N = J.g(N))) {
|
|
|
|
return N
|
|
|
|
}
|
|
|
|
M = M.replace(/^on/, "");
|
|
|
|
if (N.removeEventListener) {
|
|
|
|
N.removeEventListener(M, L, false)
|
|
|
|
} else {
|
|
|
|
if (N.detachEvent) {
|
|
|
|
N.detachEvent("on" + M, L)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
J.dom.hasClass = function(N, M) {
|
|
|
|
if (!N || !N.className || typeof N.className != "string") {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
var L = -1;
|
|
|
|
try {
|
|
|
|
L = N.className == M || N.className.indexOf(M)
|
|
|
|
} catch (O) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return L > -1
|
|
|
|
};
|
|
|
|
var u = u || {};
|
|
|
|
u._register = [];
|
|
|
|
u.register = function(L) {
|
|
|
|
this._register.push(L)
|
|
|
|
};
|
|
|
|
var G = window.BMAP_AUTHENTIC_KEY || "";
|
|
|
|
u._rd = {};
|
|
|
|
u.verify = function() {
|
|
|
|
var L = u.apiUrl + "?qt=verify&ak=" + G;
|
|
|
|
o.request(L, function(M) {
|
|
|
|
if (M && M.error !== 0) {
|
|
|
|
if (typeof map !== "undefined") {
|
|
|
|
map.getContainer().innerHTML = "";
|
|
|
|
map.__listeners = {}
|
|
|
|
}
|
|
|
|
u = null;
|
|
|
|
var N =
|
|
|
|
"百度未授权使用地图API,可能是因为您提供的密钥不是有效的百度LBS开放平台密钥,或此密钥未对本应用的百度地图JavaScriptAPI授权。您可以访问如下网址了解如何获取有效的密钥:http://lbsyun.baidu.com/apiconsole/key#。";
|
|
|
|
switch (M.error) {
|
|
|
|
case 101:
|
|
|
|
N = "开发者禁用了该ak的jsapi服务权限。您可以访问如下网址了解如何获取有效的密钥:http://lbsyun.baidu.com/apiconsole/key#。";
|
|
|
|
break;
|
|
|
|
case 102:
|
|
|
|
N = "开发者Referer不正确。您可以访问如下网址了解如何获取有效的密钥:http://lbsyun.baidu.com/apiconsole/key#。";
|
|
|
|
break
|
|
|
|
}
|
|
|
|
alert(N)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|
|
|
|
u.copyright = function() {};
|
|
|
|
window.BMap = u;
|
|
|
|
u.Map = m;
|
|
|
|
u.Point = w;
|
|
|
|
u.Pixel = j;
|
|
|
|
u.Size = d;
|
|
|
|
u.Bounds = f;
|
|
|
|
u.Projection = n;
|
|
|
|
u.MercatorProjection = r;
|
|
|
|
u.TileLayer = l;
|
|
|
|
u.Control = x;
|
|
|
|
u.ScaleControl = y;
|
|
|
|
u.ZoomControl = C;
|
|
|
|
u.CopyrightControl = k;
|
|
|
|
u.Overlay = E;
|
|
|
|
u.Marker = z;
|
|
|
|
u.Icon = h;
|
|
|
|
u.MassFeature = q;
|
|
|
|
|
|
|
|
function m(O, Q) {
|
|
|
|
O = J.g(O);
|
|
|
|
if (!O) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var P = this;
|
|
|
|
J.lang.Class.call(P);
|
|
|
|
P.config = {
|
|
|
|
useVectorMap: false,
|
|
|
|
enableDragging: true,
|
|
|
|
enableDblclickZoom: true,
|
|
|
|
enablePinchToZoom: true,
|
|
|
|
enableInertialDragging: true,
|
|
|
|
minZoom: 4,
|
|
|
|
maxZoom: 18,
|
|
|
|
dpr: 2,
|
|
|
|
tileSize: 256,
|
|
|
|
fixCenterWhenPinch: false,
|
|
|
|
fixCenterWhenResize: false,
|
|
|
|
backgroundColor: "#F5F3F0",
|
|
|
|
personalUrls: "dd",
|
|
|
|
mapStyle: null
|
|
|
|
};
|
|
|
|
J.extend(P.config, Q || {});
|
|
|
|
P.projection = new r();
|
|
|
|
P.container = O;
|
|
|
|
P._setStyle(O);
|
|
|
|
O.unselectable = "on";
|
|
|
|
O.innerHTML = "";
|
|
|
|
O.appendChild(P._render());
|
|
|
|
var M = P.getSize();
|
|
|
|
P.width = M.width;
|
|
|
|
P.height = M.height;
|
|
|
|
P.offsetX = 0;
|
|
|
|
P.offsetY = 0;
|
|
|
|
P.platform = O.firstChild;
|
|
|
|
P.preWebkitTransform = "";
|
|
|
|
P.maskLayer = P.platform.firstChild;
|
|
|
|
P.maskLayer.style.width = P.width + "px";
|
|
|
|
P.maskLayer.style.height = P.height + "px";
|
|
|
|
P._panes = {};
|
|
|
|
P.centerPoint = new w(0, 0);
|
|
|
|
P.zoomLevel = 3;
|
|
|
|
P.lastLevel = -1;
|
|
|
|
P.defaultZoomLevel = null;
|
|
|
|
P.defaultCenter = null;
|
|
|
|
P._checkZoom();
|
|
|
|
P.temp = {
|
|
|
|
lastDomMoveTime: 0,
|
|
|
|
registerIndex: -1
|
|
|
|
};
|
|
|
|
for (var N = 0; N < u._register.length; N++) {
|
|
|
|
u._register[N](P)
|
|
|
|
}
|
|
|
|
P.temp.registerIndex = N;
|
|
|
|
var L = P.config.useVectorMap;
|
|
|
|
if (L) {
|
|
|
|
P.vectorLayerMgr = new VectorLayerMgr(P)
|
|
|
|
} else {
|
|
|
|
P.rasterLayerMgr = new c(P)
|
|
|
|
}
|
|
|
|
P._bind();
|
|
|
|
p.load("opmb", function() {
|
|
|
|
P._asyncRegister()
|
|
|
|
});
|
|
|
|
O = null;
|
|
|
|
P.addCopyrightControl()
|
|
|
|
}
|
|
|
|
J.lang.inherits(m, J.lang.Class, "Map");
|
|
|
|
J.extend(m.prototype, {
|
|
|
|
_render: function() {
|
|
|
|
var L = document.createElement("div");
|
|
|
|
L.style.cssText = "position:absolute;overflow:visible;left:0;top:0;z-index:0;";
|
|
|
|
var M = document.createElement("div");
|
|
|
|
M.style.cssText = "position:absolute;left:0;top:0;z-index:10;overflow:hidden;";
|
|
|
|
L.appendChild(M);
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
_setStyle: function(O) {
|
|
|
|
var N = O.style;
|
|
|
|
var M = N.cssText;
|
|
|
|
if (o.getCurrentStyle(O).position != "absolute") {
|
|
|
|
M += "position: relative; z-index: 0;"
|
|
|
|
}
|
|
|
|
var L = this.config.backgroundColor;
|
|
|
|
M += ("overflow:hidden;background-color:" + L + ";color:#000;text-align:left");
|
|
|
|
N.cssText = M
|
|
|
|
},
|
|
|
|
_bind: function() {
|
|
|
|
var L = this;
|
|
|
|
L._watchSize = function() {
|
|
|
|
var M = L.getSize();
|
|
|
|
if (L.width !== M.width || L.height !== M.height) {
|
|
|
|
L.width = M.width;
|
|
|
|
L.height = M.height;
|
|
|
|
var O = new d(L.width, L.height);
|
|
|
|
var P = new F("onbeforeresize");
|
|
|
|
P.size = O;
|
|
|
|
L.dispatchEvent(P);
|
|
|
|
if (!L.config.fixCenterWhenResize) {
|
|
|
|
L._updateCenterPoint((M.width - L.width) / 2, (M.height - L.height) / 2)
|
|
|
|
}
|
|
|
|
L.maskLayer.style.width = L.width + "px";
|
|
|
|
L.maskLayer.style.height = L.height + "px";
|
|
|
|
var N = new F("onresize");
|
|
|
|
N.size = M;
|
|
|
|
L.dispatchEvent(N)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
L.temp.autoResizeTimer = setInterval(L._watchSize, 1000)
|
|
|
|
},
|
|
|
|
_zoomTo: function(N) {
|
|
|
|
if (!J.lang.isNumber(N)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
N = this._getProperZoom(N).zoom;
|
|
|
|
if (N == this.zoomLevel) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var M = this.temp;
|
|
|
|
if (M.dragAni) {
|
|
|
|
M.dragAni.stop()
|
|
|
|
}
|
|
|
|
this.lastLevel = this.zoomLevel;
|
|
|
|
this.zoomLevel = N;
|
|
|
|
var L = new F("onzoomstart");
|
|
|
|
L.evtSrc = "zoomTo";
|
|
|
|
this.dispatchEvent(L)
|
|
|
|
},
|
|
|
|
setZoom: function(L) {
|
|
|
|
this._zoomTo(L)
|
|
|
|
},
|
|
|
|
zoomIn: function() {
|
|
|
|
this._zoomTo(this.zoomLevel + 1)
|
|
|
|
},
|
|
|
|
zoomOut: function() {
|
|
|
|
this._zoomTo(this.zoomLevel - 1)
|
|
|
|
},
|
|
|
|
setCenter: function(L) {
|
|
|
|
if (L.equals(this.centerPoint)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.panTo(L, {
|
|
|
|
noAnimation: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
isLoaded: function() {
|
|
|
|
return !!this.loaded
|
|
|
|
},
|
|
|
|
centerAndZoom: function(L, P) {
|
|
|
|
var O = this;
|
|
|
|
P = parseInt(P, 10);
|
|
|
|
if (!(L instanceof w) || !P) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
L = O.projection.lngLatToMercator(L);
|
|
|
|
P = O._getProperZoom(P).zoom;
|
|
|
|
if (L.equals(O.getCenter()) && P === O.getZoom()) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
O.lastLevel = O.zoomLevel || P;
|
|
|
|
O.zoomLevel = P;
|
|
|
|
O.centerPoint = new w(L.lng, L.lat);
|
|
|
|
O.defaultZoomLevel = O.defaultZoomLevel || O.zoomLevel;
|
|
|
|
O.defaultCenter = O.defaultCenter || O.centerPoint;
|
|
|
|
var M = new F("oncenterzoomend");
|
|
|
|
M.point = new w(L.lng, L.lat);
|
|
|
|
M.pixel = O.pointToPixel(O.centerPoint);
|
|
|
|
M.zoom = O.zoomLevel;
|
|
|
|
O.dispatchEvent(M);
|
|
|
|
if (!O.loaded) {
|
|
|
|
var N = new F("onload");
|
|
|
|
N.point = new w(L.lng, L.lat);
|
|
|
|
N.pixel = O.pointToPixel(O.centerPoint);
|
|
|
|
N.zoom = P;
|
|
|
|
O.dispatchEvent(N)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
reset: function() {
|
|
|
|
this.centerAndZoom(this.defaultCenter, this.defaultZoomLevel)
|
|
|
|
},
|
|
|
|
getContainer: function() {
|
|
|
|
return this.container
|
|
|
|
},
|
|
|
|
getSize: function() {
|
|
|
|
return new d(this.container.clientWidth, this.container.clientHeight)
|
|
|
|
},
|
|
|
|
getCenter: function() {
|
|
|
|
var L = this.projection.mercatorToLngLat(this.centerPoint);
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
getZoom: function() {
|
|
|
|
return this.zoomLevel
|
|
|
|
},
|
|
|
|
_getProperZoom: function(N) {
|
|
|
|
var M = this.config.minZoom;
|
|
|
|
var L = this.config.maxZoom;
|
|
|
|
var O = false;
|
|
|
|
if (N < M) {
|
|
|
|
O = true;
|
|
|
|
N = M
|
|
|
|
}
|
|
|
|
if (N > L) {
|
|
|
|
O = true;
|
|
|
|
N = L
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
zoom: N,
|
|
|
|
exceeded: O
|
|
|
|
}
|
|
|
|
},
|
|
|
|
panTo: function(M, O) {
|
|
|
|
if (!(M instanceof w) || M.equals(this.centerPoint)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var N = this.pointToPixel(M);
|
|
|
|
var L = this.width / 2;
|
|
|
|
var P = this.height / 2;
|
|
|
|
O = O || {};
|
|
|
|
if (Math.abs(L - N.x) > this.width || Math.abs(P - N.y) > this.height || O.noAnimation) {
|
|
|
|
this._panTo(L - N.x, P - N.y)
|
|
|
|
} else {
|
|
|
|
this._panBy(L - N.x, P - N.y, {
|
|
|
|
duration: O.duration
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
_panTo: function(M, L) {
|
|
|
|
var N = this.temp;
|
|
|
|
if (N.dragAni) {
|
|
|
|
N.dragAni.stop()
|
|
|
|
}
|
|
|
|
this.dispatchEvent(new F("onmovestart"));
|
|
|
|
this._setPlatformPosition(this.offsetX + M, this.offsetY + L);
|
|
|
|
this.dispatchEvent(new F("onmoveend"))
|
|
|
|
},
|
|
|
|
panBy: function(M, L, N) {
|
|
|
|
M = M || 0;
|
|
|
|
L = L || 0;
|
|
|
|
N = N || {};
|
|
|
|
if (Math.abs(M) <= this.width && Math.abs(L) <= this.height && (!N.noAnimation)) {
|
|
|
|
this._panBy(M, L)
|
|
|
|
} else {
|
|
|
|
this._panTo(M, L)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
_panBy: function(N, M, Q) {
|
|
|
|
var P = this;
|
|
|
|
Q = Q || {};
|
|
|
|
this.dispatchEvent(new F("onmovestart"));
|
|
|
|
var L = P.offsetX;
|
|
|
|
var R = P.offsetY;
|
|
|
|
var O = P.temp;
|
|
|
|
if (O.dragAni) {
|
|
|
|
O.dragAni.stop()
|
|
|
|
}
|
|
|
|
if (O.panAni) {
|
|
|
|
O.panAni.stop()
|
|
|
|
}
|
|
|
|
O.panAni = new v({
|
|
|
|
fps: Q.fps || 30,
|
|
|
|
duration: Q.duration || 500,
|
|
|
|
transition: Q.transition || i.easeInOutQuad,
|
|
|
|
render: function(S) {
|
|
|
|
P._setPlatformPosition(L + N * S, R + M * S)
|
|
|
|
},
|
|
|
|
finish: function(S) {
|
|
|
|
P.dispatchEvent(new F("onmoveend"));
|
|
|
|
P.temp.panAni = null
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
_setPlatformPosition: function(L, M) {
|
|
|
|
if (isNaN(L) || isNaN(M)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (this.offsetX == L && this.offsetY == M) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this._updateCenterPoint(this.offsetX - L, this.offsetY - M);
|
|
|
|
this.offsetX = L;
|
|
|
|
this.offsetY = M;
|
|
|
|
o.css3TransformDom(this.platform, L, M);
|
|
|
|
o.css3TransformDom(this.maskLayer, -L, -M);
|
|
|
|
this.dispatchEvent(new F("onmoving"))
|
|
|
|
},
|
|
|
|
_updateCenterPoint: function(M, L) {
|
|
|
|
var N = this.getZoomUnits(this.zoomLevel);
|
|
|
|
var O = this.centerPoint;
|
|
|
|
this.centerPoint = new w(O.lng + M * N, O.lat - L * N)
|
|
|
|
},
|
|
|
|
getZoomUnits: function(L) {
|
|
|
|
return Math.pow(2, (this.config.maxZoom - L))
|
|
|
|
},
|
|
|
|
getTileUnits: function(L) {
|
|
|
|
return this.getZoomUnits(L) * this.config.tileSize
|
|
|
|
},
|
|
|
|
pointToPixel: function(M, P) {
|
|
|
|
if (!M) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
M = this.projection.lngLatToMercator(M);
|
|
|
|
P = P || {};
|
|
|
|
var O = P.zoom || this.zoomLevel;
|
|
|
|
var S = P.centerPoint || this.centerPoint;
|
|
|
|
var Q = P.basePoint || new j(this.width / 2, this.height / 2);
|
|
|
|
var N = this.getZoomUnits(O);
|
|
|
|
var L = (M.lng - S.lng) / N + Q.x;
|
|
|
|
var R = (S.lat - M.lat) / N + Q.y;
|
|
|
|
return new j(L, R)
|
|
|
|
},
|
|
|
|
pixelToPoint: function(N, M) {
|
|
|
|
if (!N) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
M = M || {};
|
|
|
|
var T = M.zoom || this.zoomLevel;
|
|
|
|
var O = M.centerPoint || this.centerPoint;
|
|
|
|
var L = M.basePoint || new j(this.width / 2, this.height / 2);
|
|
|
|
var S = this.getZoomUnits(T);
|
|
|
|
var Q = O.lng + S * (N.x - L.x);
|
|
|
|
var P = O.lat - S * (N.y - L.y);
|
|
|
|
var R = new w(Q, P);
|
|
|
|
R = this.projection.mercatorToLngLat(R);
|
|
|
|
return R
|
|
|
|
},
|
|
|
|
pointToOverlayPixel: function(L, N) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var M = this.pointToPixel(L, N);
|
|
|
|
M.x -= this.offsetX;
|
|
|
|
M.y -= this.offsetY;
|
|
|
|
return M
|
|
|
|
},
|
|
|
|
overlayPixelToPoint: function(L, N) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var M = new j(L.x, L.y);
|
|
|
|
M.x += this.offsetX;
|
|
|
|
M.y += this.offsetY;
|
|
|
|
return this.pixelToPoint(M, N)
|
|
|
|
},
|
|
|
|
getBounds: function() {
|
|
|
|
if (!this.isLoaded()) {
|
|
|
|
return new f()
|
|
|
|
}
|
|
|
|
var M = new j(0, this.height);
|
|
|
|
var L = new j(this.width, 0);
|
|
|
|
var O = this.pixelToPoint(M);
|
|
|
|
var N = this.pixelToPoint(L);
|
|
|
|
return new f(O, N)
|
|
|
|
},
|
|
|
|
_getBestLevel: function(M, N) {
|
|
|
|
var Q = N.margins || [10, 10, 10, 10];
|
|
|
|
var R = Q[1] + Q[3];
|
|
|
|
var P = Q[0] + Q[2];
|
|
|
|
var L = this.config.minZoom;
|
|
|
|
var T = this.config.maxZoom;
|
|
|
|
for (var O = T; O >= L; O--) {
|
|
|
|
var S = this.getZoomUnits(O);
|
|
|
|
if (M.toSpan().lng / S < this.width - R && M.toSpan().lat / S < this.height - P) {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (O < L) {
|
|
|
|
O = L
|
|
|
|
}
|
|
|
|
if (O > T) {
|
|
|
|
O = T
|
|
|
|
}
|
|
|
|
return O
|
|
|
|
},
|
|
|
|
getViewport: function(U, M) {
|
|
|
|
var Y = {
|
|
|
|
center: this.getCenter(),
|
|
|
|
zoom: this.getZoom()
|
|
|
|
};
|
|
|
|
if (!U || !U instanceof f && U.length == 0 || U instanceof f && U.isEmpty()) {
|
|
|
|
return Y
|
|
|
|
}
|
|
|
|
var W = [];
|
|
|
|
if (U instanceof f) {
|
|
|
|
W.push(U.getNorthEast());
|
|
|
|
W.push(U.getSouthWest())
|
|
|
|
} else {
|
|
|
|
W = U.slice(0)
|
|
|
|
}
|
|
|
|
M = M || {};
|
|
|
|
var Q = [];
|
|
|
|
for (var R = 0, P = W.length; R < P; R++) {
|
|
|
|
Q.push(this.projection.lngLatToMercator(W[R]))
|
|
|
|
}
|
|
|
|
var N = new f();
|
|
|
|
for (var R = Q.length - 1; R >= 0; R--) {
|
|
|
|
N.extend(Q[R])
|
|
|
|
}
|
|
|
|
if (N.isEmpty()) {
|
|
|
|
return Y
|
|
|
|
}
|
|
|
|
var L = N.getCenter();
|
|
|
|
var X = this._getBestLevel(N, M);
|
|
|
|
if (M.margins) {
|
|
|
|
var T = M.margins;
|
|
|
|
var S = (T[1] - T[3]) / 2;
|
|
|
|
var V = (T[0] - T[2]) / 2;
|
|
|
|
var O = this.getZoomUnits(X);
|
|
|
|
L.lng = L.lng + O * S;
|
|
|
|
L.lat = L.lat + O * V
|
|
|
|
}
|
|
|
|
L = this.projection.mercatorToLngLat(L);
|
|
|
|
return {
|
|
|
|
center: L,
|
|
|
|
zoom: X
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setViewport: function(M, N) {
|
|
|
|
var L;
|
|
|
|
if (M && M.center) {
|
|
|
|
L = M
|
|
|
|
} else {
|
|
|
|
L = this.getViewport(M, N)
|
|
|
|
}
|
|
|
|
N = N || {};
|
|
|
|
if (L.zoom == this.zoomLevel && N.enableAnimation !== false) {
|
|
|
|
this.panTo(L.center, {
|
|
|
|
duration: 210
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.centerAndZoom(L.center, L.zoom)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getPanes: function() {
|
|
|
|
return this._panes
|
|
|
|
},
|
|
|
|
getOverlays: function() {
|
|
|
|
var O = [];
|
|
|
|
var P = this._overlays;
|
|
|
|
var N = this._customOverlays;
|
|
|
|
if (P) {
|
|
|
|
for (var M in P) {
|
|
|
|
if (P[M] instanceof I) {
|
|
|
|
O.push(P[M])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (N) {
|
|
|
|
for (var M = 0, L = N.length; M < L; M++) {
|
|
|
|
O.push(N[M])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return O
|
|
|
|
},
|
|
|
|
_asyncRegister: function() {
|
|
|
|
for (var M = this.temp.registerIndex, L = u._register.length; M < L; M++) {
|
|
|
|
u._register[M](this)
|
|
|
|
}
|
|
|
|
this.temp.registerIndex = M
|
|
|
|
},
|
|
|
|
_checkZoom: function() {
|
|
|
|
var L = this.config;
|
|
|
|
if (L.minZoom < 3) {
|
|
|
|
L.minZoom = 3
|
|
|
|
}
|
|
|
|
if (L.maxZoom > 18) {
|
|
|
|
L.maxZoom = 18
|
|
|
|
}
|
|
|
|
},
|
|
|
|
addControl: function(L) {
|
|
|
|
if (L && J.lang.isFunction(L._i)) {
|
|
|
|
L._i(this);
|
|
|
|
this.dispatchEvent(new F("onaddcontrol", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
removeControl: function(L) {
|
|
|
|
if (L && J.lang.isFunction(L.remove)) {
|
|
|
|
L.remove();
|
|
|
|
this.dispatchEvent(new F("onremovecontrol", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
addOverlay: function(L) {
|
|
|
|
if (L && J.lang.isFunction(L._i)) {
|
|
|
|
L._i(this);
|
|
|
|
this.dispatchEvent(new F("onaddoverlay", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
removeOverlay: function(L) {
|
|
|
|
if (L && J.lang.isFunction(L.remove)) {
|
|
|
|
L.remove();
|
|
|
|
this.dispatchEvent(new F("onremoveoverlay", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clearOverlays: function() {
|
|
|
|
this.dispatchEvent(new F("onclearoverlays"))
|
|
|
|
},
|
|
|
|
addMassFeatures: function(M) {
|
|
|
|
var L = new F("onaddmassfeatures");
|
|
|
|
L.massFeatures = M;
|
|
|
|
this.dispatchEvent(L)
|
|
|
|
},
|
|
|
|
removeMassFeatures: function(M) {
|
|
|
|
var L = new F("onremovemassfeatures");
|
|
|
|
L.massFeatures = M;
|
|
|
|
this.dispatchEvent(L)
|
|
|
|
},
|
|
|
|
clearMassFeatures: function() {
|
|
|
|
var L = new F("onclearmassfeatures");
|
|
|
|
this.dispatchEvent(L)
|
|
|
|
},
|
|
|
|
addTileLayer: function(L) {
|
|
|
|
if (L) {
|
|
|
|
this.dispatchEvent(new F("onaddtilelayer", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
removeTileLayer: function(L) {
|
|
|
|
if (L) {
|
|
|
|
this.dispatchEvent(new F("onremovetilelayer", L))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
enableDragging: function() {
|
|
|
|
this.config.enableDragging = true
|
|
|
|
},
|
|
|
|
disableDragging: function() {
|
|
|
|
this.config.enableDragging = false
|
|
|
|
},
|
|
|
|
enableInertialDragging: function() {
|
|
|
|
this.config.enableInertialDragging = true
|
|
|
|
},
|
|
|
|
disableInertialDragging: function() {
|
|
|
|
this.config.enableInertialDragging = false
|
|
|
|
},
|
|
|
|
enableDoubleClickZoom: function() {
|
|
|
|
this.config.enableDblclickZoom = true
|
|
|
|
},
|
|
|
|
disableDoubleClickZoom: function() {
|
|
|
|
this.config.enableDblclickZoom = false
|
|
|
|
},
|
|
|
|
enablePinchToZoom: function() {
|
|
|
|
this.config.enablePinchToZoom = true
|
|
|
|
},
|
|
|
|
disablePinchToZoom: function() {
|
|
|
|
this.config.enablePinchToZoom = false
|
|
|
|
},
|
|
|
|
addCopyrightControl: function() {
|
|
|
|
var L = new k();
|
|
|
|
this.addControl(L)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function f(L, M) {
|
|
|
|
if (L && !M) {
|
|
|
|
M = L
|
|
|
|
}
|
|
|
|
this._sw = this._ne = null;
|
|
|
|
this._swLng = this._swLat = null;
|
|
|
|
this._neLng = this._neLat = null;
|
|
|
|
if (L) {
|
|
|
|
this._sw = new w(L.lng, L.lat);
|
|
|
|
this._ne = new w(M.lng, M.lat);
|
|
|
|
this._swLng = L.lng;
|
|
|
|
this._swLat = L.lat;
|
|
|
|
this._neLng = M.lng;
|
|
|
|
this._neLat = M.lat
|
|
|
|
}
|
|
|
|
}
|
|
|
|
J.object.extend(f.prototype, {
|
|
|
|
isEmpty: function() {
|
|
|
|
return !this._sw || !this._ne
|
|
|
|
},
|
|
|
|
equals: function(L) {
|
|
|
|
if (!(L instanceof f) || this.isEmpty()) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return this.getSouthWest().equals(L.getSouthWest()) && this.getNorthEast().equals(L.getNorthEast())
|
|
|
|
},
|
|
|
|
getSouthWest: function() {
|
|
|
|
return this._sw
|
|
|
|
},
|
|
|
|
getNorthEast: function() {
|
|
|
|
return this._ne
|
|
|
|
},
|
|
|
|
getCenter: function() {
|
|
|
|
if (this.isEmpty()) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
return new w((this._swLng + this._neLng) / 2, (this._swLat + this._neLat) / 2)
|
|
|
|
},
|
|
|
|
extend: function(L) {
|
|
|
|
if (!(L instanceof w)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var M = L.lng,
|
|
|
|
N = L.lat;
|
|
|
|
if (!this._sw) {
|
|
|
|
this._sw = new w(0, 0)
|
|
|
|
}
|
|
|
|
if (!this._ne) {
|
|
|
|
this._ne = new w(0, 0)
|
|
|
|
}
|
|
|
|
if (!this._swLng || this._swLng > M) {
|
|
|
|
this._sw.lng = this._swLng = M
|
|
|
|
}
|
|
|
|
if (!this._neLng || this._neLng < M) {
|
|
|
|
this._ne.lng = this._neLng = M
|
|
|
|
}
|
|
|
|
if (!this._swLat || this._swLat > N) {
|
|
|
|
this._sw.lat = this._swLat = N
|
|
|
|
}
|
|
|
|
if (!this._neLat || this._neLat < N) {
|
|
|
|
this._ne.lat = this._neLat = N
|
|
|
|
}
|
|
|
|
},
|
|
|
|
toSpan: function() {
|
|
|
|
if (this.isEmpty()) {
|
|
|
|
return new w(0, 0)
|
|
|
|
}
|
|
|
|
return new w(Math.abs(this._neLng - this._swLng), Math.abs(this._neLat - this._swLat))
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function w(L, M) {
|
|
|
|
this.lng = parseFloat(L);
|
|
|
|
this.lat = parseFloat(M)
|
|
|
|
}
|
|
|
|
w.prototype.equals = function(L) {
|
|
|
|
return L && this.lat == L.lat && this.lng == L.lng
|
|
|
|
};
|
|
|
|
|
|
|
|
function n() {}
|
|
|
|
n.prototype.lngLatToPoint = function() {};
|
|
|
|
n.prototype.pointToLngLat = function() {};
|
|
|
|
|
|
|
|
function r() {}
|
|
|
|
J.extend(r, {
|
|
|
|
EARTHRADIUS: 6370996.81,
|
|
|
|
MCBAND: [12890594.86, 8362377.87, 5591021, 3481989.83, 1678043.12, 0],
|
|
|
|
LLBAND: [75, 60, 45, 30, 15, 0],
|
|
|
|
MC2LL: [
|
|
|
|
[1.410526172116255e-8, 0.00000898305509648872, -1.9939833816331, 200.9824383106796, -187.2403703815547,
|
|
|
|
91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 17337981.2
|
|
|
|
],
|
|
|
|
[-7.435856389565537e-9, 0.000008983055097726239, -0.78625201886289, 96.32687599759846, -1.85204757529826, -
|
|
|
|
59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86
|
|
|
|
],
|
|
|
|
[-3.030883460898826e-8, 0.00000898305509983578, 0.30071316287616, 59.74293618442277, 7.357984074871, -
|
|
|
|
25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37
|
|
|
|
],
|
|
|
|
[-1.981981304930552e-8, 0.000008983055099779535, 0.03278182852591, 40.31678527705744, 0.65659298677277, -
|
|
|
|
4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06
|
|
|
|
],
|
|
|
|
[3.09191371068437e-9, 0.000008983055096812155, 0.00006995724062, 23.10934304144901, -0.00023663490511, -
|
|
|
|
0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4
|
|
|
|
],
|
|
|
|
[2.890871144776878e-9, 0.000008983055095805407, -3.068298e-8, 7.47137025468032, -0.00000353937994, -
|
|
|
|
0.02145144861037, -0.00001234426596, 0.00010322952773, -0.00000323890364, 826088.5
|
|
|
|
]
|
|
|
|
],
|
|
|
|
LL2MC: [
|
|
|
|
[-0.0015702102444, 111320.7020616939, 1704480524535203, -10338987376042340, 26112667856603880, -
|
|
|
|
35149669176653700, 26595700718403920, -10725012454188240, 1800819912950474, 82.5
|
|
|
|
],
|
|
|
|
[0.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -
|
|
|
|
15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5
|
|
|
|
],
|
|
|
|
[0.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -
|
|
|
|
115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5
|
|
|
|
],
|
|
|
|
[0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -
|
|
|
|
1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5
|
|
|
|
],
|
|
|
|
[-0.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378,
|
|
|
|
54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5
|
|
|
|
],
|
|
|
|
[-0.0003218135878613132, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093,
|
|
|
|
2351.343141331292, 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45
|
|
|
|
]
|
|
|
|
],
|
|
|
|
getDistanceByMC: function(Q, O) {
|
|
|
|
if (!Q || !O) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
var M;
|
|
|
|
var P;
|
|
|
|
var L;
|
|
|
|
var N;
|
|
|
|
Q = this.convertMC2LL(Q);
|
|
|
|
if (!Q) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
M = this.toRadians(Q.lng);
|
|
|
|
P = this.toRadians(Q.lat);
|
|
|
|
O = this.convertMC2LL(O);
|
|
|
|
if (!O) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
L = this.toRadians(O.lng);
|
|
|
|
N = this.toRadians(O.lat);
|
|
|
|
return this.getDistance(M, L, P, N)
|
|
|
|
},
|
|
|
|
getDistanceByLL: function(Q, O) {
|
|
|
|
if (!Q || !O) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
Q.lng = this.getLoop(Q.lng, -180, 180);
|
|
|
|
Q.lat = this.getRange(Q.lat, -74, 74);
|
|
|
|
O.lng = this.getLoop(O.lng, -180, 180);
|
|
|
|
O.lat = this.getRange(O.lat, -74, 74);
|
|
|
|
var M;
|
|
|
|
var L;
|
|
|
|
var P;
|
|
|
|
var N;
|
|
|
|
M = this.toRadians(Q.lng);
|
|
|
|
P = this.toRadians(Q.lat);
|
|
|
|
L = this.toRadians(O.lng);
|
|
|
|
N = this.toRadians(O.lat);
|
|
|
|
return this.getDistance(M, L, P, N)
|
|
|
|
},
|
|
|
|
convertMC2LL: function(M) {
|
|
|
|
if (M === null || M === undefined) {
|
|
|
|
return new w(0, 0)
|
|
|
|
}
|
|
|
|
var N;
|
|
|
|
var P;
|
|
|
|
N = new w(Math.abs(M.lng), Math.abs(M.lat));
|
|
|
|
for (var O = 0; O < this.MCBAND.length; O++) {
|
|
|
|
if (N.lat >= this.MCBAND[O]) {
|
|
|
|
P = this.MC2LL[O];
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var L = this.convertor(M, P);
|
|
|
|
var M = new w(L.lng.toFixed(6), L.lat.toFixed(6));
|
|
|
|
return M
|
|
|
|
},
|
|
|
|
convertLL2MC: function(L) {
|
|
|
|
if (L === null || L === undefined) {
|
|
|
|
return new w(0, 0)
|
|
|
|
}
|
|
|
|
if (L.lng > 180 || L.lng < -180 || L.lat > 90 || L.lat < -90) {
|
|
|
|
return new w(0, 0)
|
|
|
|
}
|
|
|
|
var M;
|
|
|
|
var O;
|
|
|
|
L.lng = this.getLoop(L.lng, -180, 180);
|
|
|
|
L.lat = this.getRange(L.lat, -74, 74);
|
|
|
|
M = new w(L.lng, L.lat);
|
|
|
|
for (var N = 0; N < this.LLBAND.length; N++) {
|
|
|
|
if (M.lat >= this.LLBAND[N]) {
|
|
|
|
O = this.LL2MC[N];
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!O) {
|
|
|
|
for (var N = 0; N < this.LLBAND.length; N++) {
|
|
|
|
if (M.lat <= -this.LLBAND[N]) {
|
|
|
|
O = this.LL2MC[N];
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var P = this.convertor(L, O);
|
|
|
|
var L = new w(P.lng.toFixed(2), P.lat.toFixed(2));
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
convertor: function(N, O) {
|
|
|
|
if (!N || !O) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var L = O[0] + O[1] * Math.abs(N.lng);
|
|
|
|
var M = Math.abs(N.lat) / O[9];
|
|
|
|
var P = O[2] + O[3] * M + O[4] * M * M + O[5] * M * M * M + O[6] * M * M * M * M + O[7] * M * M * M * M * M +
|
|
|
|
O[8] * M * M * M * M * M * M;
|
|
|
|
L *= (N.lng < 0 ? -1 : 1);
|
|
|
|
P *= (N.lat < 0 ? -1 : 1);
|
|
|
|
return new w(L, P)
|
|
|
|
},
|
|
|
|
getDistance: function(M, L, O, N) {
|
|
|
|
return this.EARTHRADIUS * Math.acos((Math.sin(O) * Math.sin(N) + Math.cos(O) * Math.cos(N) * Math.cos(L - M)))
|
|
|
|
},
|
|
|
|
toRadians: function(L) {
|
|
|
|
return Math.PI * L / 180
|
|
|
|
},
|
|
|
|
toDegrees: function(L) {
|
|
|
|
return (180 * L) / Math.PI
|
|
|
|
},
|
|
|
|
getRange: function(N, M, L) {
|
|
|
|
if (M != null) {
|
|
|
|
N = Math.max(N, M)
|
|
|
|
}
|
|
|
|
if (L != null) {
|
|
|
|
N = Math.min(N, L)
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
},
|
|
|
|
getLoop: function(N, M, L) {
|
|
|
|
while (N > L) {
|
|
|
|
N -= L - M
|
|
|
|
}
|
|
|
|
while (N < M) {
|
|
|
|
N += L - M
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
}
|
|
|
|
});
|
|
|
|
J.extend(r.prototype, {
|
|
|
|
lngLatToMercator: function(L) {
|
|
|
|
return r.convertLL2MC(L)
|
|
|
|
},
|
|
|
|
lngLatToPoint: function(L) {
|
|
|
|
var M = r.convertLL2MC(L);
|
|
|
|
return new j(M.lng, M.lat)
|
|
|
|
},
|
|
|
|
mercatorToLngLat: function(L) {
|
|
|
|
return r.convertMC2LL(L)
|
|
|
|
},
|
|
|
|
pointToLngLat: function(L) {
|
|
|
|
var M = new w(L.x, L.y);
|
|
|
|
return r.convertMC2LL(M)
|
|
|
|
},
|
|
|
|
pointToPixel: function(M, Q, P, O, R) {
|
|
|
|
if (!M) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
M = this.lngLatToMercator(M, R);
|
|
|
|
var N = this.getZoomUnits(Q);
|
|
|
|
var L = Math.round((M.lng - P.lng) / N + O.width / 2);
|
|
|
|
var S = Math.round((P.lat - M.lat) / N + O.height / 2);
|
|
|
|
return new j(L, S)
|
|
|
|
},
|
|
|
|
pixelToPoint: function(L, T, P, N, M) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var S = this.getZoomUnits(T);
|
|
|
|
var Q = P.lng + S * (L.x - N.width / 2);
|
|
|
|
var O = P.lat - S * (L.y - N.height / 2);
|
|
|
|
var R = new w(Q, O);
|
|
|
|
return this.mercatorToLngLat(R, M)
|
|
|
|
},
|
|
|
|
getZoomUnits: function(L) {
|
|
|
|
return Math.pow(2, (18 - L))
|
|
|
|
}
|
|
|
|
});
|
|
|
|
u.httpUrl = {
|
|
|
|
TILE_ONLINE_URLS: ["online0.map.bdimg.com", "online1.map.bdimg.com", "online2.map.bdimg.com",
|
|
|
|
"online3.map.bdimg.com", "online4.map.bdimg.com"
|
|
|
|
],
|
|
|
|
baidumap: "map.baidu.com",
|
|
|
|
main_domain_nocdn: {
|
|
|
|
baidu: "api.map.baidu.com"
|
|
|
|
},
|
|
|
|
main_domain_cdn: {
|
|
|
|
other: ["api.map.baidu.com"],
|
|
|
|
baidu: ["api0.map.bdimg.com", "api1.map.bdimg.com", "api2.map.bdimg.com"]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
u.httpsUrl = {
|
|
|
|
TILE_ONLINE_URLS: ["gss0.bdstatic.com/8bo_dTSlR1gBo1vgoIiO_jowehsv",
|
|
|
|
"gss0.bdstatic.com/8bo_dTSlRMgBo1vgoIiO_jowehsv", "gss0.bdstatic.com/8bo_dTSlRcgBo1vgoIiO_jowehsv",
|
|
|
|
"gss0.bdstatic.com/8bo_dTSlRsgBo1vgoIiO_jowehsv", "gss0.bdstatic.com/8bo_dTSlQ1gBo1vgoIiO_jowehsv"
|
|
|
|
],
|
|
|
|
baidumap: "gsp0.baidu.com/80MWsjip0QIZ8tyhnq",
|
|
|
|
main_domain_nocdn: {
|
|
|
|
baidu: "gsp0.baidu.com/9_Q4sjOpB1gCo2Kml5_Y_D3",
|
|
|
|
other: "api.map.baidu.com"
|
|
|
|
},
|
|
|
|
main_domain_cdn: {
|
|
|
|
other: "api.map.baidu.com",
|
|
|
|
baidu: ["gss0.bdstatic.com/9_Q4vHSd2RZ3otebn9fN2DJv", "gss0.baidu.com/9_Q4vXSd2RZ3otebn9fN2DJv",
|
|
|
|
"gss0.bdstatic.com/9_Q4vnSd2RZ3otebn9fN2DJv"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
u.urlType = {
|
|
|
|
"0": {
|
|
|
|
proto: "http://",
|
|
|
|
domain: u.httpUrl
|
|
|
|
},
|
|
|
|
"1": {
|
|
|
|
proto: "https://",
|
|
|
|
domain: u.httpsUrl
|
|
|
|
},
|
|
|
|
"2": {
|
|
|
|
proto: "https://",
|
|
|
|
domain: u.httpsUrl
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (window.BMAP_PROTOCOL && window.BMAP_PROTOCOL === "https") {
|
|
|
|
window.HOST_TYPE = 2
|
|
|
|
}
|
|
|
|
u.urlStr = window.HOST_TYPE || "0";
|
|
|
|
u.url = u.urlType[u.urlStr];
|
|
|
|
u.mapUrl = u.url.proto + u.url.domain["baidumap"] + "/";
|
|
|
|
u.apiUrl = u.url.proto + (u.urlStr == "2" ? u.url.domain["main_domain_nocdn"]["other"] : u.url.domain[
|
|
|
|
"main_domain_nocdn"]["baidu"]) + "/";
|
|
|
|
u.apiUrlCdn = u.url.proto + (u.urlStr == "2" ? u.url.domain["main_domain_cdn"]["other"] : u.url.domain[
|
|
|
|
"main_domain_cdn"]["baidu"][0]) + "/";
|
|
|
|
var o = {
|
|
|
|
setPosition: function(N, L) {
|
|
|
|
var M = N.style;
|
|
|
|
M.left = L[0] + "px";
|
|
|
|
M.top = L[1] + "px"
|
|
|
|
},
|
|
|
|
setUnSelectable: function(L) {
|
|
|
|
L.style.MozUserSelect = "none"
|
|
|
|
},
|
|
|
|
isInDocument: function(L) {
|
|
|
|
return L && L.parentNode && L.parentNode.nodeType != 11
|
|
|
|
},
|
|
|
|
beforeEndHTML: function(M, L) {
|
|
|
|
J.dom.insertHTML(M, "beforeEnd", L);
|
|
|
|
return M.lastChild
|
|
|
|
},
|
|
|
|
getPosition: function(L) {
|
|
|
|
var M = {
|
|
|
|
left: 0,
|
|
|
|
top: 0
|
|
|
|
};
|
|
|
|
while (L && L.offsetParent) {
|
|
|
|
M.left += L.offsetLeft;
|
|
|
|
M.top += L.offsetTop;
|
|
|
|
L = L.offsetParent
|
|
|
|
}
|
|
|
|
return M
|
|
|
|
},
|
|
|
|
stopBubble: function(L) {
|
|
|
|
var L = window.event || L;
|
|
|
|
L.stopPropagation ? L.stopPropagation() : L.cancelBubble = true
|
|
|
|
},
|
|
|
|
preventDefault: function(L) {
|
|
|
|
var L = window.event || L;
|
|
|
|
L.preventDefault ? L.preventDefault() : L.returnValue = false;
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
stopAndPrevent: function(L) {
|
|
|
|
this.stopBubble(L);
|
|
|
|
return this.preventDefault(L)
|
|
|
|
},
|
|
|
|
getScroll: function() {
|
|
|
|
var L = document.documentElement,
|
|
|
|
M = document.body;
|
|
|
|
if (L && (L.scrollTop || L.scrollLeft)) {
|
|
|
|
return [L.scrollTop, L.scrollLeft]
|
|
|
|
} else {
|
|
|
|
if (M) {
|
|
|
|
return [M.scrollTop, M.scrollLeft]
|
|
|
|
} else {
|
|
|
|
return [0, 0]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getDistanceByPixel: function(M, L) {
|
|
|
|
if (!M || !L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
return Math.round(Math.sqrt(Math.pow(M.x - L.x, 2) + Math.pow(M.y - L.y, 2)))
|
|
|
|
},
|
|
|
|
create: function(M, L, N) {
|
|
|
|
var O = document.createElement(M);
|
|
|
|
if (N) {
|
|
|
|
O = document.createElementNS(N, M)
|
|
|
|
}
|
|
|
|
return J.dom.setAttrs(O, L || {})
|
|
|
|
},
|
|
|
|
getCurrentStyle: function(L) {
|
|
|
|
if (L.currentStyle) {
|
|
|
|
return L.currentStyle
|
|
|
|
} else {
|
|
|
|
if (L.ownerDocument && L.ownerDocument.defaultView) {
|
|
|
|
return L.ownerDocument.defaultView.getComputedStyle(L, null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isDefined: function(L) {
|
|
|
|
return typeof L != "undefined"
|
|
|
|
},
|
|
|
|
isSupportCanvas: function() {
|
|
|
|
if (typeof this.isSupportCanvas.result != "boolean") {
|
|
|
|
this.isSupportCanvas.result = !!this.create("canvas").getContext
|
|
|
|
}
|
|
|
|
return this.isSupportCanvas.result
|
|
|
|
},
|
|
|
|
getCurrentTime: function() {
|
|
|
|
return (new Date).getTime()
|
|
|
|
},
|
|
|
|
isAndroid23More: function() {
|
|
|
|
if (J.platform.isAndroid && parseFloat(J.platform.android) > 2.3) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
canUseTranslate3d: function() {
|
|
|
|
if (typeof this.canUseTranslate3d.result !== "boolean") {
|
|
|
|
this.canUseTranslate3d.result = o.isAndroid23More() || J.platform.isIphone
|
|
|
|
}
|
|
|
|
return this.canUseTranslate3d.result
|
|
|
|
},
|
|
|
|
css3TransformDom: function(P, M, Q, O) {
|
|
|
|
var L = "";
|
|
|
|
if (O !== undefined) {
|
|
|
|
L = " scale(" + O + ")"
|
|
|
|
}
|
|
|
|
var N = "";
|
|
|
|
if (this.canUseTranslate3d()) {
|
|
|
|
N = "translate3d(" + M + "px," + Q + "px,0px)"
|
|
|
|
} else {
|
|
|
|
N = "translate(" + M + "px," + Q + "px)"
|
|
|
|
}
|
|
|
|
P.style.WebkitTransform = N + L
|
|
|
|
},
|
|
|
|
request: function(O, L) {
|
|
|
|
if (L) {
|
|
|
|
var N = (Math.random() * 100000).toFixed(0);
|
|
|
|
u._rd["_cbk" + N] = function(P) {
|
|
|
|
L && L(P);
|
|
|
|
delete u._rd["_cbk" + N]
|
|
|
|
};
|
|
|
|
O += "&callback=BMap._rd._cbk" + N
|
|
|
|
}
|
|
|
|
var M = this.create("script", {
|
|
|
|
src: O,
|
|
|
|
type: "text/javascript",
|
|
|
|
charset: "utf-8"
|
|
|
|
});
|
|
|
|
M.addEventListener("load", function(Q) {
|
|
|
|
var P = Q.target;
|
|
|
|
P.parentNode.removeChild(P)
|
|
|
|
}, false);
|
|
|
|
document.getElementsByTagName("head")[0].appendChild(M);
|
|
|
|
M = null
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function v(O) {
|
|
|
|
var L = {
|
|
|
|
duration: 1000,
|
|
|
|
fps: 30,
|
|
|
|
delay: 0,
|
|
|
|
transition: i.linear,
|
|
|
|
onStop: function() {}
|
|
|
|
};
|
|
|
|
this._anis = [];
|
|
|
|
if (O) {
|
|
|
|
for (var M in O) {
|
|
|
|
L[M] = O[M]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this._opts = L;
|
|
|
|
if (J.lang.isNumber(L.delay)) {
|
|
|
|
var N = this;
|
|
|
|
setTimeout(function() {
|
|
|
|
N.start()
|
|
|
|
}, L.delay)
|
|
|
|
} else {
|
|
|
|
if (L.delay != v.INFINITE) {
|
|
|
|
this.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v.INFINITE = "INFINITE";
|
|
|
|
v.prototype.start = function() {
|
|
|
|
if (window.requestAnimationFrame) {
|
|
|
|
var L = this;
|
|
|
|
L._timer = window.requestAnimationFrame(function(M) {
|
|
|
|
L._loop(M)
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this._beginTime = o.getCurrentTime();
|
|
|
|
this._endTime = this._beginTime + this._opts.duration;
|
|
|
|
this._loop()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
v.prototype._loop = function() {
|
|
|
|
var M = this;
|
|
|
|
var L = o.getCurrentTime();
|
|
|
|
if (!this._beginTime) {
|
|
|
|
this._beginTime = L;
|
|
|
|
this._endTime = this._beginTime + this._opts.duration
|
|
|
|
}
|
|
|
|
if (L >= M._endTime) {
|
|
|
|
if (J.lang.isFunction(M._opts.render)) {
|
|
|
|
M._opts.render(M._opts.transition(1))
|
|
|
|
}
|
|
|
|
if (J.lang.isFunction(M._opts.finish)) {
|
|
|
|
M._opts.finish()
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
M.schedule = M._opts.transition((L - M._beginTime) / M._opts.duration);
|
|
|
|
if (J.lang.isFunction(M._opts.render)) {
|
|
|
|
M._opts.render(M.schedule)
|
|
|
|
}
|
|
|
|
if (!M.terminative) {
|
|
|
|
if (window.requestAnimationFrame) {
|
|
|
|
M._timer = requestAnimationFrame(function(N) {
|
|
|
|
M._loop(N)
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
M._timer = setTimeout(function() {
|
|
|
|
M._loop()
|
|
|
|
}, 1000 / M._opts.fps)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
v.prototype.stop = function(M) {
|
|
|
|
this.terminative = true;
|
|
|
|
for (var L = 0; L < this._anis.length; L++) {
|
|
|
|
this._anis[L].stop();
|
|
|
|
this._anis[L] = null
|
|
|
|
}
|
|
|
|
this._anis.length = 0;
|
|
|
|
if (this._timer) {
|
|
|
|
if (window.cancelAnimationFrame) {
|
|
|
|
cancelAnimationFrame(this._timer)
|
|
|
|
} else {
|
|
|
|
clearTimeout(this._timer)
|
|
|
|
}
|
|
|
|
this._timer = null
|
|
|
|
}
|
|
|
|
this._opts.onStop(this.schedule);
|
|
|
|
if (M) {
|
|
|
|
this._endTime = this._beginTime;
|
|
|
|
this._loop()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var i = {
|
|
|
|
linear: function(L) {
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
reverse: function(L) {
|
|
|
|
return 1 - L
|
|
|
|
},
|
|
|
|
easeInQuad: function(L) {
|
|
|
|
return L * L
|
|
|
|
},
|
|
|
|
easeInCubic: function(L) {
|
|
|
|
return Math.pow(L, 3)
|
|
|
|
},
|
|
|
|
easeOutQuad: function(L) {
|
|
|
|
return -(L * (L - 2))
|
|
|
|
},
|
|
|
|
easeOutCubic: function(L) {
|
|
|
|
return Math.pow((L - 1), 3) + 1
|
|
|
|
},
|
|
|
|
easeInOutQuad: function(L) {
|
|
|
|
if (L < 0.5) {
|
|
|
|
return L * L * 2
|
|
|
|
} else {
|
|
|
|
return -2 * (L - 2) * L - 1
|
|
|
|
}
|
|
|
|
return
|
|
|
|
},
|
|
|
|
easeInOutCubic: function(L) {
|
|
|
|
if (L < 0.5) {
|
|
|
|
return Math.pow(L, 3) * 4
|
|
|
|
} else {
|
|
|
|
return Math.pow(L - 1, 3) * 4 + 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
easeInOutSine: function(L) {
|
|
|
|
return (1 - Math.cos(Math.PI * L)) / 2
|
|
|
|
}
|
|
|
|
};
|
|
|
|
i["ease-in"] = i.easeInQuad;
|
|
|
|
i["ease-out"] = i.easeOutQuad;
|
|
|
|
|
|
|
|
function j(L, M) {
|
|
|
|
this.x = L || 0;
|
|
|
|
this.y = M || 0
|
|
|
|
}
|
|
|
|
j.prototype.equals = function(L) {
|
|
|
|
return L && L.x == this.x && L.y == this.y
|
|
|
|
};
|
|
|
|
|
|
|
|
function d(M, L) {
|
|
|
|
this.width = M || 0;
|
|
|
|
this.height = L || 0
|
|
|
|
}
|
|
|
|
d.prototype.equals = function(L) {
|
|
|
|
return L && this.width == L.width && this.height == L.height
|
|
|
|
};
|
|
|
|
var B = 0;
|
|
|
|
|
|
|
|
function p() {}
|
|
|
|
J.object.extend(p, {
|
|
|
|
Request: {
|
|
|
|
INITIAL: -1,
|
|
|
|
WAITING: 0,
|
|
|
|
COMPLETED: 1
|
|
|
|
},
|
|
|
|
getDependency: function() {
|
|
|
|
return {
|
|
|
|
opmb: [],
|
|
|
|
control: [],
|
|
|
|
marker: [],
|
|
|
|
massfeatures: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Config: {
|
|
|
|
_baseUrl: "http://api.map.baidu.com/getmodules?type=lite"
|
|
|
|
},
|
|
|
|
delayFlag: false,
|
|
|
|
ModuleTree: {
|
|
|
|
_modules: {},
|
|
|
|
_arrMdls: []
|
|
|
|
},
|
|
|
|
load: function(N, P, M) {
|
|
|
|
var L = this.getModule(N);
|
|
|
|
if (L._status == this.Request.COMPLETED) {
|
|
|
|
if (M) {
|
|
|
|
P && P()
|
|
|
|
}
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
if (L._status == this.Request.INITIAL) {
|
|
|
|
this.combine(N);
|
|
|
|
this.pushUniqueMdl(N);
|
|
|
|
var O = this;
|
|
|
|
if (O.delayFlag == false) {
|
|
|
|
O.delayFlag = true;
|
|
|
|
window.setTimeout(function() {
|
|
|
|
var W = O.ModuleTree._arrMdls.slice(0);
|
|
|
|
var Y = [];
|
|
|
|
for (var S = 0, R = W.length; S < R; S++) {
|
|
|
|
var X = W[S],
|
|
|
|
Q = A.asyncMdlVer[X],
|
|
|
|
U = "async_" + X + "_" + Q;
|
|
|
|
if (!A.chkVersion(U)) {
|
|
|
|
W[W[S]] = "";
|
|
|
|
Y.push(X + "_" + Q)
|
|
|
|
} else {
|
|
|
|
W[W[S]] = A.getVersion(U)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Y.length == 0) {
|
|
|
|
for (var S = 0, R = W.length; S < R; S++) {
|
|
|
|
var Z = W[S],
|
|
|
|
U = "async_" + Z + "_" + A.asyncMdlVer[Z],
|
|
|
|
V = A.getVersion(U);
|
|
|
|
p.run(Z, V)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var T = O.Config._baseUrl + "&mod=" + Y.join(",") + "&sendSequenceNum=" + B + "&v=1.0";
|
|
|
|
o.request(T);
|
|
|
|
window["sendSequenceNum" + B] = W;
|
|
|
|
B++
|
|
|
|
}
|
|
|
|
O.delayFlag = false;
|
|
|
|
O.ModuleTree._arrMdls.length = 0
|
|
|
|
}, 1)
|
|
|
|
}
|
|
|
|
L._status = this.Request.WAITING
|
|
|
|
}
|
|
|
|
L._callbacks.push(P)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
combine: function(L) {
|
|
|
|
var N = this.getDependency();
|
|
|
|
if (L && N[L]) {
|
|
|
|
var N = N[L];
|
|
|
|
for (var M = 0; M < N.length; M++) {
|
|
|
|
this.combine(N[M]);
|
|
|
|
if (!this.ModuleTree._modules[N[M]]) {
|
|
|
|
this.pushUniqueMdl(N[M])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
pushUniqueMdl: function(O) {
|
|
|
|
var L = this.ModuleTree._arrMdls;
|
|
|
|
for (var N = 0, M = L.length; N < M; N++) {
|
|
|
|
if (L[N] == O) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
L.push(O)
|
|
|
|
},
|
|
|
|
getModule: function(M) {
|
|
|
|
var L;
|
|
|
|
if (!this.ModuleTree._modules[M]) {
|
|
|
|
this.ModuleTree._modules[M] = {};
|
|
|
|
this.ModuleTree._modules[M]._status = this.Request.INITIAL;
|
|
|
|
this.ModuleTree._modules[M]._callbacks = []
|
|
|
|
}
|
|
|
|
L = this.ModuleTree._modules[M];
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
run: function(O, R) {
|
|
|
|
var M = "async_" + O + "_" + A.asyncMdlVer[O],
|
|
|
|
Q = "async_" + O;
|
|
|
|
if (!A.chkVersion(M)) {
|
|
|
|
A.saveVersion(M, R, Q)
|
|
|
|
}
|
|
|
|
var N = this.getModule(O);
|
|
|
|
try {
|
|
|
|
eval(R)
|
|
|
|
} catch (S) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
N._status = this.Request.COMPLETED;
|
|
|
|
for (var P = 0, L = N._callbacks.length; P < L; P++) {
|
|
|
|
N._callbacks[P]()
|
|
|
|
}
|
|
|
|
N._callbacks.length = 0
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window._jsload = function(Q, S, R) {
|
|
|
|
var L = window["sendSequenceNum" + R],
|
|
|
|
N = Q.split("_")[0];
|
|
|
|
L[N] = S;
|
|
|
|
var P = true;
|
|
|
|
for (var O = 0, M = L.length; O < M; O++) {
|
|
|
|
if (L[L[O]].length <= 0) {
|
|
|
|
P = false;
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (P) {
|
|
|
|
for (var O = 0, M = L.length; O < M; O++) {
|
|
|
|
var Q = L[O],
|
|
|
|
S = L[Q];
|
|
|
|
p.run(Q, S)
|
|
|
|
}
|
|
|
|
L.length = 0;
|
|
|
|
delete window["sendSequenceNum" + R]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var A = {
|
|
|
|
asyncMdlVer: {
|
|
|
|
control: "ldhxzj",
|
|
|
|
marker: "01zsya",
|
|
|
|
opmb: "dt2tyx",
|
|
|
|
massfeatures: "j0omg2"
|
|
|
|
},
|
|
|
|
chkVersion: function(L) {
|
|
|
|
try {
|
|
|
|
var M = window.localStorage;
|
|
|
|
if (!M) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return M[L] && M[L].length > 0
|
|
|
|
} catch (N) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
saveVersion: function(L, R, P) {
|
|
|
|
try {
|
|
|
|
var N = window.localStorage;
|
|
|
|
if (N) {
|
|
|
|
for (var M = N.length, O = M - 1; O >= 0; O--) {
|
|
|
|
var S = N.key(O);
|
|
|
|
if (S.indexOf(P) > -1) {
|
|
|
|
N.removeItem(S)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
N.setItem(L, R)
|
|
|
|
}
|
|
|
|
} catch (Q) {}
|
|
|
|
},
|
|
|
|
getVersion: function(L) {
|
|
|
|
try {
|
|
|
|
var M = window.localStorage;
|
|
|
|
if (!M) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return M.getItem(L)
|
|
|
|
} catch (N) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
void
|
|
|
|
function(N, L, M) {
|
|
|
|
void
|
|
|
|
function(Y, ay, aa) {
|
|
|
|
var av = "alog";
|
|
|
|
var W = aa[av];
|
|
|
|
if (W && W.defined) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var am = ay.all && Y.attachEvent,
|
|
|
|
ar, R = (W && W.l) || +new Date,
|
|
|
|
ac = Y.logId || (+new Date).toString(36) + Math.random().toString(36).substr(2, 3),
|
|
|
|
ae = 0,
|
|
|
|
ag = {},
|
|
|
|
ak = function(aF) {
|
|
|
|
var aA = arguments;
|
|
|
|
var az, aC, aE, aD;
|
|
|
|
if (aF == "define" || aF == "require") {
|
|
|
|
for (var aB = 1; aB < aA.length; aB++) {
|
|
|
|
switch (typeof aA[aB]) {
|
|
|
|
case "string":
|
|
|
|
az = aA[aB];
|
|
|
|
break;
|
|
|
|
case "object":
|
|
|
|
aE = aA[aB];
|
|
|
|
break;
|
|
|
|
case "function":
|
|
|
|
aD = aA[aB];
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aF == "require") {
|
|
|
|
if (az && !aE) {
|
|
|
|
aE = [az]
|
|
|
|
}
|
|
|
|
az = null
|
|
|
|
}
|
|
|
|
az = !az ? "#" + (ae++) : az;
|
|
|
|
aC = ah[az] = (ah[az] || {});
|
|
|
|
if (!aC.defined) {
|
|
|
|
aC.name = az;
|
|
|
|
aC.requires = aE;
|
|
|
|
aC.creator = aD;
|
|
|
|
if (aF == "define") {
|
|
|
|
aC.defining = true
|
|
|
|
}
|
|
|
|
ab(aC)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (typeof aF == "function") {
|
|
|
|
aF(ak);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
String(aF).replace(/^(?:([\w$_]+)\.)?(\w+)$/, function(aG, aH, aI) {
|
|
|
|
aA[0] = aI;
|
|
|
|
Z.apply(ak.tracker(aH), aA)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
aq = {},
|
|
|
|
S = {},
|
|
|
|
ah = {
|
|
|
|
alog: {
|
|
|
|
name: "alog",
|
|
|
|
defined: true,
|
|
|
|
instance: ak
|
|
|
|
}
|
|
|
|
},
|
|
|
|
an;
|
|
|
|
|
|
|
|
function au(az) {
|
|
|
|
var aB = P.get("alias") || {};
|
|
|
|
var aC = aB[az] || (az + ".js");
|
|
|
|
if (ag[aC]) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ag[aC] = true;
|
|
|
|
var aA = "script";
|
|
|
|
var aE = ay.createElement(aA);
|
|
|
|
var aD = ay.getElementsByTagName(aA)[0];
|
|
|
|
aE.async = !0;
|
|
|
|
aE.src = aC;
|
|
|
|
aD.parentNode.insertBefore(aE, aD)
|
|
|
|
}
|
|
|
|
|
|
|
|
function ab(aB) {
|
|
|
|
if (aB.defined) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var aF = true;
|
|
|
|
var aE = [];
|
|
|
|
var aC = aB.requires;
|
|
|
|
for (var aA = 0; aC && aA < aC.length; aA++) {
|
|
|
|
var az = aC[aA];
|
|
|
|
var aD = ah[az] = (ah[az] || {});
|
|
|
|
if (aD.defined || aD == aB) {
|
|
|
|
aE.push(aD.instance)
|
|
|
|
} else {
|
|
|
|
aF = false;
|
|
|
|
if (!aD.defining) {
|
|
|
|
au(az)
|
|
|
|
}
|
|
|
|
aD.waiting = aD.waiting || {};
|
|
|
|
aD.waiting[aB.name] = aB
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aF) {
|
|
|
|
aB.defined = true;
|
|
|
|
if (aB.creator) {
|
|
|
|
aB.instance = aB.creator.apply(aB, aE)
|
|
|
|
}
|
|
|
|
ao(aB)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ao(az) {
|
|
|
|
for (var aA in az.waiting) {
|
|
|
|
ab(az.waiting[aA])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function V(az) {
|
|
|
|
return (az || new Date) - R
|
|
|
|
}
|
|
|
|
|
|
|
|
function aj(aB, az, aC) {
|
|
|
|
if (!aB) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (typeof aB == "string") {
|
|
|
|
aC = az;
|
|
|
|
az = aB;
|
|
|
|
aB = ak
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (aB == ak) {
|
|
|
|
aq[az] = aq[az] || [];
|
|
|
|
aq[az].unshift(aC);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (aB.addEventListener) {
|
|
|
|
aB.addEventListener(az, aC, false)
|
|
|
|
} else {
|
|
|
|
if (aB.attachEvent) {
|
|
|
|
aB.attachEvent("on" + az, aC)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (aA) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
function al(aC, az, aE) {
|
|
|
|
if (!aC) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (typeof aC == "string") {
|
|
|
|
aE = az;
|
|
|
|
az = aC;
|
|
|
|
aC = ak
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (aC == ak) {
|
|
|
|
var aD = aq[az];
|
|
|
|
if (!aD) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var aB = aD.length;
|
|
|
|
while (aB--) {
|
|
|
|
if (aD[aB] === aE) {
|
|
|
|
aD.splice(aB, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (aC.removeEventListener) {
|
|
|
|
aC.removeEventListener(az, aE, false)
|
|
|
|
} else {
|
|
|
|
aC.detachEvent && aC.detachEvent("on" + az, aE)
|
|
|
|
}
|
|
|
|
} catch (aA) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
function af(aB) {
|
|
|
|
var aE = aq[aB],
|
|
|
|
az = 0;
|
|
|
|
if (!aE) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var aA = [];
|
|
|
|
var aC = arguments;
|
|
|
|
for (var aD = 1; aD < aC.length; aD++) {
|
|
|
|
aA.push(aC[aD])
|
|
|
|
}
|
|
|
|
var aD = aE.length;
|
|
|
|
while (aD--) {
|
|
|
|
if (aE[aD].apply(this, aA)) {
|
|
|
|
az++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return az
|
|
|
|
}
|
|
|
|
|
|
|
|
function ax(aB, aD) {
|
|
|
|
if (!aB || !aD) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var aE = new Image(1, 1),
|
|
|
|
az = [],
|
|
|
|
aA = "img_" + (+new Date);
|
|
|
|
for (var aC in aD) {
|
|
|
|
if (aD[aC]) {
|
|
|
|
az.push(aC + "=" + encodeURIComponent(aD[aC]))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ak[aA] = aE;
|
|
|
|
aE.onload = aE.onerror = function() {
|
|
|
|
ak[aA] = aE = aE.onload = aE.onerror = null;
|
|
|
|
delete ak[aA]
|
|
|
|
};
|
|
|
|
aE.src = aB + "?" + az.join("&")
|
|
|
|
}
|
|
|
|
|
|
|
|
function X(aA, aB) {
|
|
|
|
if (!aA) {
|
|
|
|
return aB
|
|
|
|
}
|
|
|
|
var az = {};
|
|
|
|
for (var aC in aB) {
|
|
|
|
if (aA[aC] !== null) {
|
|
|
|
az[aA[aC] || aC] = aB[aC]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return az
|
|
|
|
}
|
|
|
|
|
|
|
|
function Z() {
|
|
|
|
var aA = arguments;
|
|
|
|
var aE = aA[0];
|
|
|
|
if (this.created || /^(on|un|set|get|create)$/.test(aE)) {
|
|
|
|
var aC = ai.prototype[aE];
|
|
|
|
var aD = [];
|
|
|
|
for (var aB = 1, az = aA.length; aB < az; aB++) {
|
|
|
|
aD.push(aA[aB])
|
|
|
|
}
|
|
|
|
if (typeof aC == "function") {
|
|
|
|
aC.apply(this, aD)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.argsList.push(aA)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ap(aB, aA) {
|
|
|
|
var az = {};
|
|
|
|
for (var aC in aB) {
|
|
|
|
if (aB.hasOwnProperty(aC)) {
|
|
|
|
az[aC] = aB[aC]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (var aC in aA) {
|
|
|
|
if (aA.hasOwnProperty(aC)) {
|
|
|
|
az[aC] = aA[aC]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return az
|
|
|
|
}
|
|
|
|
|
|
|
|
function ai(az) {
|
|
|
|
this.name = az;
|
|
|
|
this.fields = {
|
|
|
|
protocolParameter: {
|
|
|
|
postUrl: null,
|
|
|
|
protocolParameter: null
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.argsList = [];
|
|
|
|
this["alog"] = ak
|
|
|
|
}
|
|
|
|
|
|
|
|
function Q(aC) {
|
|
|
|
var az;
|
|
|
|
aC = aC || "default";
|
|
|
|
if (aC == "*") {
|
|
|
|
az = [];
|
|
|
|
for (var aB in S) {
|
|
|
|
az.push(S[aB])
|
|
|
|
}
|
|
|
|
return az
|
|
|
|
}
|
|
|
|
var aA = S[aC];
|
|
|
|
if (!aA) {
|
|
|
|
aA = S[aC] = new ai(aC)
|
|
|
|
}
|
|
|
|
return aA
|
|
|
|
}
|
|
|
|
ai.prototype.start = ai.prototype.create = function(az) {
|
|
|
|
if (this.created) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (typeof az == "object") {
|
|
|
|
this.set(az)
|
|
|
|
}
|
|
|
|
this.created = new Date;
|
|
|
|
this.fire("create", this);
|
|
|
|
var aA;
|
|
|
|
while (aA = this.argsList.shift()) {
|
|
|
|
Z.apply(this, aA)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ai.prototype.send = function(aC, aA) {
|
|
|
|
var aB = ap({
|
|
|
|
ts: V().toString(36),
|
|
|
|
t: aC,
|
|
|
|
sid: ac
|
|
|
|
}, this.fields);
|
|
|
|
if (typeof aA == "object") {
|
|
|
|
aB = ap(aB, aA)
|
|
|
|
} else {
|
|
|
|
var az = arguments;
|
|
|
|
switch (aC) {
|
|
|
|
case "pageview":
|
|
|
|
if (az[1]) {
|
|
|
|
aB.page = az[1]
|
|
|
|
}
|
|
|
|
if (az[2]) {
|
|
|
|
aB.title = az[2]
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "event":
|
|
|
|
if (az[1]) {
|
|
|
|
aB.eventCategory = az[1]
|
|
|
|
}
|
|
|
|
if (az[2]) {
|
|
|
|
aB.eventAction = az[2]
|
|
|
|
}
|
|
|
|
if (az[3]) {
|
|
|
|
aB.eventLabel = az[3]
|
|
|
|
}
|
|
|
|
if (az[4]) {
|
|
|
|
aB.eventValue = az[4]
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "timing":
|
|
|
|
if (az[1]) {
|
|
|
|
aB.timingCategory = az[1]
|
|
|
|
}
|
|
|
|
if (az[2]) {
|
|
|
|
aB.timingVar = az[2]
|
|
|
|
}
|
|
|
|
if (az[3]) {
|
|
|
|
aB.timingValue = az[3]
|
|
|
|
}
|
|
|
|
if (az[4]) {
|
|
|
|
aB.timingLabel = az[4]
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "exception":
|
|
|
|
if (az[1]) {
|
|
|
|
aB.exDescription = az[1]
|
|
|
|
}
|
|
|
|
if (az[2]) {
|
|
|
|
aB.exFatal = az[2]
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.fire("send", aB);
|
|
|
|
ax(this.fields.postUrl, X(this.fields.protocolParameter, aB))
|
|
|
|
};
|
|
|
|
ai.prototype.set = function(az, aA) {
|
|
|
|
if (typeof az == "string") {
|
|
|
|
if (az == "protocolParameter") {
|
|
|
|
aA = ap({
|
|
|
|
postUrl: null,
|
|
|
|
protocolParameter: null
|
|
|
|
}, aA)
|
|
|
|
}
|
|
|
|
this.fields[az] = aA
|
|
|
|
} else {
|
|
|
|
if (typeof az == "object") {
|
|
|
|
for (var aB in az) {
|
|
|
|
this.set(aB, az[aB])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ai.prototype.get = function(aA, aB) {
|
|
|
|
var az = this.fields[aA];
|
|
|
|
if (typeof aB == "function") {
|
|
|
|
aB(az)
|
|
|
|
}
|
|
|
|
return az
|
|
|
|
};
|
|
|
|
ai.prototype.fire = function(az, aA) {
|
|
|
|
return ak.fire(this.name + "." + az, aA)
|
|
|
|
};
|
|
|
|
ai.prototype.on = function(az, aA) {
|
|
|
|
ak.on(this.name + "." + az, aA)
|
|
|
|
};
|
|
|
|
ai.prototype.un = function(az, aA) {
|
|
|
|
ak.un(this.name + "." + az, aA)
|
|
|
|
};
|
|
|
|
ak.name = "alog";
|
|
|
|
ak.sid = ac;
|
|
|
|
ak.defined = true;
|
|
|
|
ak.timestamp = V;
|
|
|
|
ak.un = al;
|
|
|
|
ak.on = aj;
|
|
|
|
ak.fire = af;
|
|
|
|
ak.tracker = Q;
|
|
|
|
ak("init");
|
|
|
|
var O = ai.prototype;
|
|
|
|
s(O, {
|
|
|
|
start: O.start,
|
|
|
|
create: O.create,
|
|
|
|
send: O.send,
|
|
|
|
set: O.set,
|
|
|
|
get: O.get,
|
|
|
|
on: O.on,
|
|
|
|
un: O.un,
|
|
|
|
fire: O.fire
|
|
|
|
});
|
|
|
|
var P = Q();
|
|
|
|
P.set("protocolParameter", {
|
|
|
|
alias: null
|
|
|
|
});
|
|
|
|
if (W) {
|
|
|
|
var ad = [].concat(W.p || [], W.q || []);
|
|
|
|
W.p = W.q = null;
|
|
|
|
for (var at in ak) {
|
|
|
|
if (ak.hasOwnProperty(at)) {
|
|
|
|
W[at] = ak[at]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ak.p = ak.q = {
|
|
|
|
push: function(az) {
|
|
|
|
ak.apply(ak, az)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
for (var aw = 0; aw < ad.length; aw++) {
|
|
|
|
ak.apply(ak, ad[aw])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aa[av] = ak;
|
|
|
|
if (am) {
|
|
|
|
aj(ay, "mouseup", function(aA) {
|
|
|
|
var az = aA.target || aA.srcElement;
|
|
|
|
if (az.nodeType == 1 && /^ajavascript:/i.test(az.tagName + az.href)) {
|
|
|
|
ar = new Date
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function T() {
|
|
|
|
if (am && (new Date - ar < 50)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (an) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
an = true;
|
|
|
|
var az = 0;
|
|
|
|
for (var aB in S) {
|
|
|
|
var aA = S[aB];
|
|
|
|
if (aA.created) {
|
|
|
|
az += aA.fire("unload")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (az) {
|
|
|
|
var aC = new Date;
|
|
|
|
while (new Date - aC < 100) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var U = false;
|
|
|
|
Y.onerror = function(aD, aB, az, aC) {
|
|
|
|
var aA = true;
|
|
|
|
if (!aB && /^script error/i.test(aD)) {
|
|
|
|
if (U) {
|
|
|
|
aA = false
|
|
|
|
} else {
|
|
|
|
U = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aA) {
|
|
|
|
aa.alog("exception.send", "exception", {
|
|
|
|
msg: aD,
|
|
|
|
js: aB,
|
|
|
|
ln: az,
|
|
|
|
col: aC
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
};
|
|
|
|
aa.alog("exception.on", "catch", function(az) {
|
|
|
|
aa.alog("exception.send", "exception", {
|
|
|
|
msg: az.msg,
|
|
|
|
js: az.path,
|
|
|
|
ln: az.ln,
|
|
|
|
method: az.method,
|
|
|
|
flag: "catch"
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}(N, L, M);
|
|
|
|
void
|
|
|
|
function(aa, ba, bj) {
|
|
|
|
var at = "18_5";
|
|
|
|
var aF = {
|
|
|
|
product: "18",
|
|
|
|
page: at,
|
|
|
|
monkey_page: "",
|
|
|
|
speed_page: "",
|
|
|
|
monkey: {
|
|
|
|
sample: "0.1"
|
|
|
|
},
|
|
|
|
exception: {
|
|
|
|
sample: "0.1"
|
|
|
|
},
|
|
|
|
cus: {
|
|
|
|
sample: "0.1"
|
|
|
|
},
|
|
|
|
feature: {
|
|
|
|
sample: "0"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var aE = "http://fex.bdstatic.com";
|
|
|
|
var Y = "http://static.tieba.baidu.com";
|
|
|
|
var Q = Y;
|
|
|
|
if (aa.location.protocol === "https:") {
|
|
|
|
aE = "https://fex.bdstatic.com";
|
|
|
|
Y = "https://gsp0.baidu.com/5aAHeD3nKhI2p27j8IqW0jdnxx1xbK";
|
|
|
|
Q = Y
|
|
|
|
}
|
|
|
|
var ab = aF.product;
|
|
|
|
var aJ = aF.page;
|
|
|
|
var aZ = aF.monkey_page;
|
|
|
|
var aT = aF.speed_page;
|
|
|
|
var V = Math.random;
|
|
|
|
var az = Y + "/tb/pms/img/st.gif";
|
|
|
|
var ae = az;
|
|
|
|
var aA = aF.monkey;
|
|
|
|
var av = aF.exception;
|
|
|
|
var ai = aF.cus;
|
|
|
|
var aG = aF.feature;
|
|
|
|
if (aA && aA.sample && V() < aA.sample) {
|
|
|
|
var R = bj.alog.tracker("monkey");
|
|
|
|
var aM;
|
|
|
|
var X = aa.screen;
|
|
|
|
var bh = ba.referrer;
|
|
|
|
R.set("ver", 5);
|
|
|
|
R.set("pid", 241);
|
|
|
|
if (X) {
|
|
|
|
R.set("px", X.width + "*" + X.height)
|
|
|
|
}
|
|
|
|
R.set("ref", bh);
|
|
|
|
bj.alog("monkey.on", "create", function() {
|
|
|
|
aM = bj.alog.timestamp;
|
|
|
|
R.set("protocolParameter", {
|
|
|
|
reports: null
|
|
|
|
})
|
|
|
|
});
|
|
|
|
bj.alog("monkey.on", "send", function(bl) {
|
|
|
|
if (bl.t == "pageview") {
|
|
|
|
bl.cmd = "open"
|
|
|
|
}
|
|
|
|
if (bl.now) {
|
|
|
|
bl.ts = aM(bl.now).toString(36);
|
|
|
|
bl.now = ""
|
|
|
|
}
|
|
|
|
});
|
|
|
|
bj.alog("monkey.create", {
|
|
|
|
page: aJ,
|
|
|
|
pid: "241",
|
|
|
|
p: ab,
|
|
|
|
dv: 6,
|
|
|
|
postUrl: ae,
|
|
|
|
reports: {
|
|
|
|
refer: 1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
bj.alog("monkey.send", "pageview", {
|
|
|
|
now: +new Date
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (av && av.sample && V() < av.sample) {
|
|
|
|
var ap = false;
|
|
|
|
aa.onerror = function(bp, bn, bl, bo) {
|
|
|
|
var bm = true;
|
|
|
|
if (!bn && /^script error/i.test(bp)) {
|
|
|
|
if (ap) {
|
|
|
|
bm = false
|
|
|
|
} else {
|
|
|
|
ap = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bm) {
|
|
|
|
bj.alog("exception.send", "exception", {
|
|
|
|
msg: bp,
|
|
|
|
js: bn,
|
|
|
|
ln: bl,
|
|
|
|
col: bo
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
};
|
|
|
|
bj.alog("exception.on", "catch", function(bl) {
|
|
|
|
bj.alog("exception.send", "exception", {
|
|
|
|
msg: bl.msg,
|
|
|
|
js: bl.path,
|
|
|
|
ln: bl.ln,
|
|
|
|
method: bl.method,
|
|
|
|
flag: "catch"
|
|
|
|
})
|
|
|
|
});
|
|
|
|
bj.alog("exception.create", {
|
|
|
|
postUrl: ae,
|
|
|
|
dv: 7,
|
|
|
|
page: aZ ? aZ : aJ,
|
|
|
|
pid: "170",
|
|
|
|
p: ab
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (ai && ai.sample && V() < ai.sample) {
|
|
|
|
bj.alog("cus.on", "time", function(bo) {
|
|
|
|
var bn = {};
|
|
|
|
var bl = false;
|
|
|
|
var bp;
|
|
|
|
if (bo.toString() !== "[object Object]") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
for (var bm in bo) {
|
|
|
|
if (bm == "page") {
|
|
|
|
bn.page = bo[bm];
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
bp = parseInt(bo[bm]);
|
|
|
|
if (bp > 0 && /^z_/.test(bm)) {
|
|
|
|
bl = true;
|
|
|
|
bn[bm] = bp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bl) {
|
|
|
|
bj.alog("cus.send", "time", bn)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
bj.alog("cus.on", "count", function(bo) {
|
|
|
|
var bn = {};
|
|
|
|
var bl = false;
|
|
|
|
if (typeof bo === "string") {
|
|
|
|
bo = [bo]
|
|
|
|
}
|
|
|
|
if (bo instanceof Array) {
|
|
|
|
for (var bm = 0; bm < bo.length; bm++) {
|
|
|
|
if (/^z_/.test(bo[bm])) {
|
|
|
|
bl = true;
|
|
|
|
bn[bo[bm]] = 1
|
|
|
|
} else {
|
|
|
|
if (/^page:/.test(bo[bm])) {
|
|
|
|
bn.page = bo[bm].substring(5)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bl) {
|
|
|
|
bj.alog("cus.send", "count", bn)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
bj.alog("cus.create", {
|
|
|
|
dv: 3,
|
|
|
|
postUrl: az,
|
|
|
|
page: aJ,
|
|
|
|
p: ab
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (aG && aG.sample && V() < aG.sample) {
|
|
|
|
var a8 = ["Moz", "O", "ms", "Webkit"];
|
|
|
|
var ar = ["-webkit-", "-moz-", "-o-", "-ms-"];
|
|
|
|
var aC = function() {
|
|
|
|
if (typeof ba.createElement !== "function") {
|
|
|
|
return ba.createElement(arguments[0])
|
|
|
|
} else {
|
|
|
|
return ba.createElement.apply(ba, arguments)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var bf = {
|
|
|
|
elem: aC("dpFeatureTest")
|
|
|
|
};
|
|
|
|
var ac = {
|
|
|
|
style: bf.elem.style
|
|
|
|
};
|
|
|
|
|
|
|
|
function an(bm, bl) {
|
|
|
|
return typeof bm === bl
|
|
|
|
}
|
|
|
|
|
|
|
|
function U(bm, bp, bo) {
|
|
|
|
var bn;
|
|
|
|
for (var bl in bm) {
|
|
|
|
if (bm[bl] in bp) {
|
|
|
|
if (bo === false) {
|
|
|
|
return bm[bl]
|
|
|
|
}
|
|
|
|
bn = bp[bm[bl]];
|
|
|
|
if (an(bn, "function")) {
|
|
|
|
return fnBind(bn, bo || bp)
|
|
|
|
}
|
|
|
|
return bn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
function aj(bn, bl, bm) {
|
|
|
|
return bd(bn, undefined, undefined, bl, bm)
|
|
|
|
}
|
|
|
|
|
|
|
|
function bd(br, bl, bo, bp, bq) {
|
|
|
|
var bm = br.charAt(0).toUpperCase() + br.slice(1),
|
|
|
|
bn = (br + " " + a8.join(bm + " ") + bm).split(" ");
|
|
|
|
if (an(bl, "string") || an(bl, "undefined")) {
|
|
|
|
return aO(bn, bl, bp, bq)
|
|
|
|
} else {
|
|
|
|
bn = (br + " " + (a8).join(bm + " ") + bm).split(" ");
|
|
|
|
return U(bn, bl, bo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function aO(bp, bn, bs, bq) {
|
|
|
|
bq = an(bq, "undefined") ? false : bq;
|
|
|
|
var bt, bo, bl, bm, br;
|
|
|
|
bl = bp.length;
|
|
|
|
for (bo = 0; bo < bl; bo++) {
|
|
|
|
bm = bp[bo];
|
|
|
|
br = ac.style[bm];
|
|
|
|
if (!!~("" + bm).indexOf("-")) {
|
|
|
|
bm = al(bm)
|
|
|
|
}
|
|
|
|
if (ac.style[bm] !== undefined) {
|
|
|
|
return bn == "pfx" ? bm : true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
function al(bl) {
|
|
|
|
return bl.replace(/([a-z])-([a-z])/g, function(bo, bn, bm) {
|
|
|
|
return bn + bm.toUpperCase()
|
|
|
|
}).replace(/^-/, "")
|
|
|
|
}
|
|
|
|
var ax = function(bn, bm, bl) {
|
|
|
|
if (bn.indexOf("@") === 0) {
|
|
|
|
return atRule(bn)
|
|
|
|
}
|
|
|
|
if (bn.indexOf("-") != -1) {
|
|
|
|
bn = al(bn)
|
|
|
|
}
|
|
|
|
if (!bm) {
|
|
|
|
return bd(bn, "pfx")
|
|
|
|
} else {
|
|
|
|
return bd(bn, bm, bl)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function a4() {
|
|
|
|
var bl = aC("canvas");
|
|
|
|
return !!(bl.getContext && bl.getContext("2d"))
|
|
|
|
}
|
|
|
|
|
|
|
|
function aV() {
|
|
|
|
var bl = aC("div");
|
|
|
|
return ("draggable" in bl) || ("ondragstart" in bl && "ondrop" in bl)
|
|
|
|
}
|
|
|
|
|
|
|
|
function ah() {
|
|
|
|
var bl = "localStorage";
|
|
|
|
try {
|
|
|
|
localStorage.setItem(bl, bl);
|
|
|
|
localStorage.removeItem(bl);
|
|
|
|
return true
|
|
|
|
} catch (bm) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function aL() {
|
|
|
|
return "content" in ba.createElement("template")
|
|
|
|
}
|
|
|
|
|
|
|
|
function aX() {
|
|
|
|
return "createShadowRoot" in ba.createElement("a")
|
|
|
|
}
|
|
|
|
|
|
|
|
function aS() {
|
|
|
|
return "registerElement" in ba
|
|
|
|
}
|
|
|
|
|
|
|
|
function O() {
|
|
|
|
return "import" in ba.createElement("link")
|
|
|
|
}
|
|
|
|
|
|
|
|
function T() {
|
|
|
|
return "getItems" in ba
|
|
|
|
}
|
|
|
|
|
|
|
|
function aq() {
|
|
|
|
return "EventSource" in window
|
|
|
|
}
|
|
|
|
|
|
|
|
function a7(bn, bo) {
|
|
|
|
var bl = {
|
|
|
|
lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",
|
|
|
|
lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",
|
|
|
|
alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",
|
|
|
|
animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"
|
|
|
|
};
|
|
|
|
var bm = new Image();
|
|
|
|
bm.onload = function() {
|
|
|
|
var bp = (bm.width > 0) && (bm.height > 0);
|
|
|
|
bo(bn, bp)
|
|
|
|
};
|
|
|
|
bm.onerror = function() {
|
|
|
|
bo(bn, false)
|
|
|
|
};
|
|
|
|
bm.src = "data:image/webp;base64," + bl[bn]
|
|
|
|
}
|
|
|
|
|
|
|
|
function bi(bm, bl) {
|
|
|
|
ag.f["WebP-" + bm] = bl;
|
|
|
|
return bl
|
|
|
|
}
|
|
|
|
|
|
|
|
function aY() {
|
|
|
|
return "openDatabase" in aa
|
|
|
|
}
|
|
|
|
|
|
|
|
function a3() {
|
|
|
|
return "performance" in aa && "timing" in aa.performance
|
|
|
|
}
|
|
|
|
|
|
|
|
function be() {
|
|
|
|
return "performance" in aa && "mark" in aa.performance
|
|
|
|
}
|
|
|
|
|
|
|
|
function aB() {
|
|
|
|
return !!(Array.prototype && Array.prototype.every && Array.prototype.filter && Array.prototype.forEach &&
|
|
|
|
Array.prototype.indexOf && Array.prototype.lastIndexOf && Array.prototype.map && Array.prototype.some &&
|
|
|
|
Array.prototype.reduce && Array.prototype.reduceRight && Array.isArray)
|
|
|
|
}
|
|
|
|
|
|
|
|
function ad() {
|
|
|
|
return "Promise" in aa && "cast" in aa.Promise && "resolve" in aa.Promise && "reject" in aa.Promise && "all" in
|
|
|
|
aa.Promise && "race" in aa.Promise && (function() {
|
|
|
|
var bl;
|
|
|
|
new aa.Promise(function(bm) {
|
|
|
|
bl = bm
|
|
|
|
});
|
|
|
|
return typeof bl === "function"
|
|
|
|
}())
|
|
|
|
}
|
|
|
|
|
|
|
|
function ao() {
|
|
|
|
var bl = !!(aa.ProgressEvent);
|
|
|
|
var bm = !!(aa.FormData);
|
|
|
|
var bn = aa.XMLHttpRequest && "withCredentials" in new XMLHttpRequest;
|
|
|
|
return bl && bm && bn
|
|
|
|
}
|
|
|
|
|
|
|
|
function aN() {
|
|
|
|
return "geolocation" in navigator
|
|
|
|
}
|
|
|
|
|
|
|
|
function ay() {
|
|
|
|
var bm = aC("canvas");
|
|
|
|
var bl = "probablySupportsContext" in bm ? "probablySupportsContext" : "supportsContext";
|
|
|
|
if (bl in bm) {
|
|
|
|
return bm[bl]("webgl") || bm[bl]("experimental-webgl")
|
|
|
|
}
|
|
|
|
return "WebGLRenderingContext" in aa
|
|
|
|
}
|
|
|
|
|
|
|
|
function aI() {
|
|
|
|
return !!ba.createElementNS && !!ba.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect
|
|
|
|
}
|
|
|
|
|
|
|
|
function a5() {
|
|
|
|
return !!aa.Worker
|
|
|
|
}
|
|
|
|
|
|
|
|
function a1() {
|
|
|
|
return "WebSocket" in aa && aa.WebSocket.CLOSING === 2
|
|
|
|
}
|
|
|
|
|
|
|
|
function aQ() {
|
|
|
|
var bl = ba.createElement("video");
|
|
|
|
return !!bl.canPlayType
|
|
|
|
}
|
|
|
|
|
|
|
|
function am() {
|
|
|
|
var bl = ba.createElement("audio");
|
|
|
|
return !!bl.canPlayType
|
|
|
|
}
|
|
|
|
|
|
|
|
function aW() {
|
|
|
|
return !!(aa.history && "pushState" in aa.history)
|
|
|
|
}
|
|
|
|
|
|
|
|
function aH() {
|
|
|
|
return !!(aa.File && aa.FileReader)
|
|
|
|
}
|
|
|
|
|
|
|
|
function aK() {
|
|
|
|
return "postMessage" in window
|
|
|
|
}
|
|
|
|
|
|
|
|
function aP() {
|
|
|
|
return !!aa.webkitNotifications || ("Notification" in aa && "permission" in aa.Notification &&
|
|
|
|
"requestPermission" in aa.Notification)
|
|
|
|
}
|
|
|
|
|
|
|
|
function aD() {
|
|
|
|
var bn = ["webkit", "moz", "o", "ms"];
|
|
|
|
var bm = aa.requestAnimationFrame;
|
|
|
|
for (var bl = 0; bl < bn.length && !bm; ++bl) {
|
|
|
|
bm = aa[bn[bl] + "RequestAnimationFrame"]
|
|
|
|
}
|
|
|
|
return !!bm
|
|
|
|
}
|
|
|
|
|
|
|
|
function aR() {
|
|
|
|
return "JSON" in aa && "parse" in JSON && "stringify" in JSON
|
|
|
|
}
|
|
|
|
|
|
|
|
function a6() {
|
|
|
|
return !!(ax("exitFullscreen", ba, false) || ax("cancelFullScreen", ba, false))
|
|
|
|
}
|
|
|
|
|
|
|
|
function ak() {
|
|
|
|
return !!ax("Intl", aa)
|
|
|
|
}
|
|
|
|
|
|
|
|
function a0() {
|
|
|
|
return aj("flexBasis", "1px", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function a2() {
|
|
|
|
return !!aj("perspective", "1px", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function au() {
|
|
|
|
return aj("shapeOutside", "content-box", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function bk() {
|
|
|
|
var bl = aC("div");
|
|
|
|
bl.style.cssText = ar.join("filter:blur(2px); ");
|
|
|
|
return !!bl.style.length && ((ba.documentMode === undefined || ba.documentMode > 9))
|
|
|
|
}
|
|
|
|
|
|
|
|
function Z() {
|
|
|
|
return "XMLHttpRequest" in aa && "withCredentials" in new XMLHttpRequest()
|
|
|
|
}
|
|
|
|
|
|
|
|
function W() {
|
|
|
|
return aC("progress").max !== undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
function aU() {
|
|
|
|
return aC("meter").max !== undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
function bc() {
|
|
|
|
return "sendBeacon" in navigator
|
|
|
|
}
|
|
|
|
|
|
|
|
function a9() {
|
|
|
|
return aj("borderRadius", "0px", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function P() {
|
|
|
|
return aj("boxShadow", "1px 1px", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function S() {
|
|
|
|
var bm = aC("div");
|
|
|
|
var bl = bm.style;
|
|
|
|
bl.cssText = ar.join("opacity:.55;");
|
|
|
|
return (/^0.55$/).test(bl.opacity)
|
|
|
|
}
|
|
|
|
|
|
|
|
function bb() {
|
|
|
|
return aO(["textShadow"], undefined, "1px 1px")
|
|
|
|
}
|
|
|
|
|
|
|
|
function af() {
|
|
|
|
return aj("animationName", "a", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function aw() {
|
|
|
|
return aj("transition", "all", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
function bg() {
|
|
|
|
return navigator.userAgent.indexOf("Android 2.") === -1 && aj("transform", "scale(1)", true)
|
|
|
|
}
|
|
|
|
var ag = {
|
|
|
|
f: {},
|
|
|
|
t: function(bl, bn, bm) {
|
|
|
|
this.f[bl] = bn.apply(this, [].slice.call(arguments, 2))
|
|
|
|
},
|
|
|
|
c: function(bm, bl) {
|
|
|
|
bm.apply(this, [].slice.call(arguments, 1))
|
|
|
|
},
|
|
|
|
runAllTest: function() {
|
|
|
|
var bl = this;
|
|
|
|
bl.t("bdrs", a9);
|
|
|
|
bl.t("bxsd", P);
|
|
|
|
bl.t("opat", S);
|
|
|
|
bl.t("txsd", bb);
|
|
|
|
bl.t("anim", af);
|
|
|
|
bl.t("trsi", aw);
|
|
|
|
bl.t("trfm", bg);
|
|
|
|
bl.t("flex", a0);
|
|
|
|
bl.t("3dtr", a2);
|
|
|
|
bl.t("shpe", au);
|
|
|
|
bl.t("fltr", bk);
|
|
|
|
bl.t("cavs", a4);
|
|
|
|
bl.t("dgdp", aV);
|
|
|
|
bl.t("locs", ah);
|
|
|
|
bl.t("wctem", aL);
|
|
|
|
bl.t("wcsdd", aX);
|
|
|
|
bl.t("wccse", aS);
|
|
|
|
bl.t("wchti", O);
|
|
|
|
bl.c(a7, "lossy", bi);
|
|
|
|
bl.c(a7, "lossless", bi);
|
|
|
|
bl.c(a7, "alpha", bi);
|
|
|
|
bl.c(a7, "animation", bi);
|
|
|
|
bl.t("wsql", aY);
|
|
|
|
bl.t("natm", a3);
|
|
|
|
bl.t("ustm", be);
|
|
|
|
bl.t("arra", aB);
|
|
|
|
bl.t("prms", ad);
|
|
|
|
bl.t("xhr2", ao);
|
|
|
|
bl.t("wbgl", ay);
|
|
|
|
bl.t("geol", aN);
|
|
|
|
bl.t("svg", aI);
|
|
|
|
bl.t("work", a5);
|
|
|
|
bl.t("wbsk", a1);
|
|
|
|
bl.t("vido", aQ);
|
|
|
|
bl.t("audo", am);
|
|
|
|
bl.t("hsty", aW);
|
|
|
|
bl.t("file", aH);
|
|
|
|
bl.t("psmg", aK);
|
|
|
|
bl.t("wknf", aP);
|
|
|
|
bl.t("rqaf", aD);
|
|
|
|
bl.t("json", aR);
|
|
|
|
bl.t("flsc", a6);
|
|
|
|
bl.t("i18n", ak);
|
|
|
|
bl.t("cors", Z);
|
|
|
|
bl.t("prog", W);
|
|
|
|
bl.t("metr", aU);
|
|
|
|
bl.t("becn", bc);
|
|
|
|
bl.t("mcrd", T);
|
|
|
|
bl.t("esrc", aq)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var R = bj.alog.tracker("feature");
|
|
|
|
R.on("commit", function() {
|
|
|
|
ag.runAllTest();
|
|
|
|
var bl = setInterval(function() {
|
|
|
|
if ("WebP-lossy" in ag.f && "WebP-lossless" in ag.f && "WebP-alpha" in ag.f && "WebP-animation" in ag.f) {
|
|
|
|
for (var bm in ag.f) {
|
|
|
|
ag.f[bm] = ag.f[bm] ? "y" : "n"
|
|
|
|
}
|
|
|
|
R.send("feature", ag.f);
|
|
|
|
clearInterval(bl)
|
|
|
|
}
|
|
|
|
}, 500)
|
|
|
|
});
|
|
|
|
bj.alog("feature.create", {
|
|
|
|
dv: 4,
|
|
|
|
postUrl: az,
|
|
|
|
page: aZ ? aZ : aJ,
|
|
|
|
p: ab
|
|
|
|
});
|
|
|
|
bj.alog("feature.fire", "commit")
|
|
|
|
}
|
|
|
|
}(N, L, M)
|
|
|
|
}(window, document, u);
|
|
|
|
u._alog = u.alog || function() {};
|
|
|
|
u.alog("cus.fire", "count", "z_loadscriptcount");
|
|
|
|
if (location.protocol === "https:") {
|
|
|
|
u.alog("cus.fire", "count", "z_httpscount")
|
|
|
|
}
|
|
|
|
|
|
|
|
function s(L, M) {
|
|
|
|
for (var N in M) {
|
|
|
|
L[N] = M[N]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function c(L) {
|
|
|
|
this.map = L;
|
|
|
|
this.tileLayers = [];
|
|
|
|
this.bufferNumber = 30;
|
|
|
|
this.realBufferNumber = 0;
|
|
|
|
this.curViewTiles = {};
|
|
|
|
this.bufferTiles = {};
|
|
|
|
this.layersContainer = this.createLayersContainer();
|
|
|
|
this.initialize()
|
|
|
|
}
|
|
|
|
J.extend(c.prototype, {
|
|
|
|
createLayersContainer: function() {
|
|
|
|
var L = document.createElement("div");
|
|
|
|
L.style.cssText = "position:absolute;left:0;top:0;z-index:0;";
|
|
|
|
this.map.platform.appendChild(L);
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
initialize: function() {
|
|
|
|
var L = this;
|
|
|
|
var M = this.map;
|
|
|
|
M.addEventListener("onload", function() {
|
|
|
|
L.loadBaseTileLayer()
|
|
|
|
});
|
|
|
|
M.addEventListener("oncenterzoomend", function() {
|
|
|
|
L.reDrawCurViewTiles()
|
|
|
|
});
|
|
|
|
M.addEventListener("addtilelayer", function(N) {
|
|
|
|
L.addTileLayer(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("removetilelayer", function(N) {
|
|
|
|
L.removeTileLayer(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("moving", function(N) {
|
|
|
|
L.reDrawCurViewTiles()
|
|
|
|
});
|
|
|
|
M.addEventListener("zoomstart", function(P) {
|
|
|
|
if (P.evtSrc === "zoomTo") {
|
|
|
|
if (this._zoomMapByAnimation) {
|
|
|
|
var O = new j(this.width / 2, this.height / 2);
|
|
|
|
var N = this.zoomLevel;
|
|
|
|
this._zoomMapByAnimation(this, O, N)
|
|
|
|
} else {
|
|
|
|
L.reDrawCurViewTiles()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
M.addEventListener("zoomend", function(N) {
|
|
|
|
L.reDrawCurViewTiles()
|
|
|
|
});
|
|
|
|
M.addEventListener("resize", function(N) {
|
|
|
|
L.reDrawCurViewTiles()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
loadBaseTileLayer: function() {
|
|
|
|
var M = this.map;
|
|
|
|
if (!M.loaded) {
|
|
|
|
var N = new l();
|
|
|
|
var L = M.config.mapStyle ? e : H;
|
|
|
|
J.extend(N, L);
|
|
|
|
M.addTileLayer(N);
|
|
|
|
M.loaded = true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
addTileLayer: function(P) {
|
|
|
|
var O = this.map;
|
|
|
|
var M = P.target;
|
|
|
|
for (var N = 0, L = this.tileLayers.length; N < L; N++) {
|
|
|
|
if (this.tileLayers[N] === M) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.tileLayers.push(M);
|
|
|
|
M.initialize(O, this.layersContainer);
|
|
|
|
this.reDrawCurViewTiles()
|
|
|
|
},
|
|
|
|
removeTileLayer: function(S) {
|
|
|
|
var R = this;
|
|
|
|
var N = S.target;
|
|
|
|
var L = R.curViewTiles;
|
|
|
|
var P = R.bufferTiles;
|
|
|
|
for (var Q in P) {
|
|
|
|
var M = Q.split("-")[1];
|
|
|
|
if (M == N.guid) {
|
|
|
|
delete P[Q]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (var Q in L) {
|
|
|
|
var M = Q.split("-")[1];
|
|
|
|
if (M == N.guid) {
|
|
|
|
delete L[Q]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
N.remove();
|
|
|
|
for (var O = this.tileLayers.length - 1; O >= 0; O--) {
|
|
|
|
if (this.tileLayers[O] === N) {
|
|
|
|
this.tileLayers.splice(O, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
R.reDrawCurViewTiles()
|
|
|
|
},
|
|
|
|
getTileName: function(L, M) {
|
|
|
|
return "TILE-" + M.guid + "-" + L[0] + "-" + L[1] + "-" + L[2]
|
|
|
|
},
|
|
|
|
reDrawCurViewTiles: function() {
|
|
|
|
var V = this.tileLayers.length;
|
|
|
|
if (V <= 0) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var an = this.map;
|
|
|
|
var M = an.getZoom();
|
|
|
|
var ad = an.centerPoint;
|
|
|
|
var U = an.getZoomUnits(M);
|
|
|
|
var O = an.getTileUnits(M);
|
|
|
|
var W = Math.ceil(ad.lat / O);
|
|
|
|
var R = Math.ceil(ad.lng / O);
|
|
|
|
var Z = an.config.tileSize;
|
|
|
|
var P = [W, R, (ad.lat - W * O) / O * Z, (ad.lng - R * O) / O * Z];
|
|
|
|
var ak = an.width;
|
|
|
|
var ab = an.height;
|
|
|
|
var ai = P[0] - Math.ceil((ab / 2 - P[2]) / Z);
|
|
|
|
var N = P[1] - Math.ceil((ak / 2 - P[3]) / Z);
|
|
|
|
var af = P[0] + Math.ceil((ab / 2 + P[2]) / Z);
|
|
|
|
var Y = P[1] + Math.ceil((ak / 2 + P[3]) / Z);
|
|
|
|
var X = this.tileLayers;
|
|
|
|
var aa = this.curViewTiles;
|
|
|
|
var L = [];
|
|
|
|
for (var ae = 0, aj = X.length; ae < aj; ae++) {
|
|
|
|
var ap = X[ae];
|
|
|
|
o.css3TransformDom(ap.tilesDiv, Math.round(-an.offsetX + ak / 2), Math.round(-an.offsetY + ab / 2));
|
|
|
|
for (var am in aa) {
|
|
|
|
var ao = aa[am];
|
|
|
|
var al = ao.info;
|
|
|
|
if (al[2] !== M || (al[2] === M && (ai > al[0] || af <= al[0] || N > al[1] || Y <= al[1]))) {
|
|
|
|
this.hideTile(ao)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
L.length = 0;
|
|
|
|
for (var ah = ai; ah < af; ah++) {
|
|
|
|
for (var ag = N; ag < Y; ag++) {
|
|
|
|
L.push([ah, ag])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
L.sort((function(aq) {
|
|
|
|
return function(ar, at) {
|
|
|
|
return ((0.4 * Math.abs(ar[1] - aq[1]) + 0.6 * Math.abs(ar[0] - aq[0])) - (0.4 * Math.abs(at[1] - aq[1]) +
|
|
|
|
0.6 * Math.abs(at[0] - aq[0])))
|
|
|
|
}
|
|
|
|
})([P[0] - 1, P[1] - 1]));
|
|
|
|
var T = -ad.lng / U;
|
|
|
|
var S = ad.lat / U;
|
|
|
|
var Q = [Math.round(S), Math.round(T)];
|
|
|
|
for (var ah = 0, ac = L.length; ah < ac; ah++) {
|
|
|
|
this.showTile([L[ah][0], L[ah][1], M], Q, ap, Z)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showTile: function(Q, P, T, V) {
|
|
|
|
var N = this.getTileName(Q, T);
|
|
|
|
var O = (Q[1] * V) + P[1];
|
|
|
|
var M = (-1 - Q[0]) * V + P[0];
|
|
|
|
var U = this.curViewTiles[N];
|
|
|
|
if (U && U.img) {
|
|
|
|
o.css3TransformDom(U.img, O, M);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
U = this.bufferTiles[N];
|
|
|
|
if (U && U.img) {
|
|
|
|
T.tilesDiv.insertBefore(U.img, T.tilesDiv.lastChild);
|
|
|
|
this.curViewTiles[N] = U;
|
|
|
|
o.css3TransformDom(U.img, O, M);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var R = new j(Q[1], Q[0]);
|
|
|
|
var L = T.getTilesUrl(R, Q[2]);
|
|
|
|
var S = [O, M];
|
|
|
|
U = new b(this, L, S, Q, T, V);
|
|
|
|
this.curViewTiles[N] = U
|
|
|
|
},
|
|
|
|
hideTile: function(M) {
|
|
|
|
var L = M.img;
|
|
|
|
if (L) {
|
|
|
|
if (o.isInDocument(L)) {
|
|
|
|
L.parentNode.removeChild(L)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete this.curViewTiles[M.name];
|
|
|
|
if (!M.loaded) {
|
|
|
|
L = null;
|
|
|
|
M.img = null;
|
|
|
|
M.mgr = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function l(L) {
|
|
|
|
this.opts = L || {};
|
|
|
|
this.baseLayer = this.opts.baseLayer || false;
|
|
|
|
this.zIndex = this.opts.zIndex || 0;
|
|
|
|
this.guid = l._guid++
|
|
|
|
}
|
|
|
|
l._guid = 0;
|
|
|
|
J.lang.inherits(l, J.lang.Class, "TileLayer");
|
|
|
|
J.extend(l.prototype, {
|
|
|
|
initialize: function(N, L) {
|
|
|
|
if (this.baseLayer) {
|
|
|
|
this.zIndex = -1
|
|
|
|
}
|
|
|
|
this.map = N;
|
|
|
|
if (!this.tilesDiv) {
|
|
|
|
var O = o.create("div");
|
|
|
|
var M = O.style;
|
|
|
|
M.cssText = "position:absolute;left:0;top:0;z-index:" + this.zIndex;
|
|
|
|
L.appendChild(O);
|
|
|
|
this.tilesDiv = O
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remove: function() {
|
|
|
|
if (this.tilesDiv && this.tilesDiv.parentNode) {
|
|
|
|
this.tilesDiv.innerHTML = "";
|
|
|
|
this.tilesDiv.parentNode.removeChild(this.tilesDiv)
|
|
|
|
}
|
|
|
|
delete this.tilesDiv
|
|
|
|
},
|
|
|
|
getTilesUrl: function(M, N) {
|
|
|
|
var L = "";
|
|
|
|
if (this.opts.tileUrlTemplate) {
|
|
|
|
L = this.opts.tileUrlTemplate.replace(/\{X\}/, M.x);
|
|
|
|
L = L.replace(/\{Y\}/, M.y);
|
|
|
|
L = L.replace(/\{Z\}/, N)
|
|
|
|
}
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
getTileVersion: function(M) {
|
|
|
|
var N = window.TILE_VERSION;
|
|
|
|
var L = "20170730";
|
|
|
|
if (N && N.ditu) {
|
|
|
|
var O = N.ditu;
|
|
|
|
if (O[M] && O[M]["updateDate"]) {
|
|
|
|
L = O[M]["updateDate"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return L
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function b(R, L, N, M, O, T) {
|
|
|
|
this.mgr = R;
|
|
|
|
this.position = N;
|
|
|
|
this.name = R.getTileName(M, O);
|
|
|
|
this.info = M;
|
|
|
|
var S = o.create("img");
|
|
|
|
o.setUnSelectable(S);
|
|
|
|
S.galleryImg = false;
|
|
|
|
var Q = S.style;
|
|
|
|
Q.cssText = "position:absolute;width:" + T + "px;height:" + T + "px;left:0;top:0;";
|
|
|
|
o.css3TransformDom(S, N[0], N[1]);
|
|
|
|
this.img = S;
|
|
|
|
this.src = L;
|
|
|
|
this.errorImgSrc = u.apiUrlCdn + "/images/blank.gif";
|
|
|
|
var P = this;
|
|
|
|
P.img.onload = function() {
|
|
|
|
P.loaded = true;
|
|
|
|
if (!P.mgr) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var V = P.mgr;
|
|
|
|
var U = V.bufferTiles;
|
|
|
|
if (!U[P.name]) {
|
|
|
|
V.realBufferNumber++;
|
|
|
|
U[P.name] = P
|
|
|
|
}
|
|
|
|
if (P.img && !o.isInDocument(P.img) && O.tilesDiv) {
|
|
|
|
O.tilesDiv.appendChild(P.img)
|
|
|
|
}
|
|
|
|
var X = V.realBufferNumber - V.bufferNumber;
|
|
|
|
for (var Y in U) {
|
|
|
|
if (X <= 0) {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if (!V.curViewTiles[Y]) {
|
|
|
|
var W = U[Y].img;
|
|
|
|
if (W && W.parentNode) {
|
|
|
|
W.parentNode.removeChild(W)
|
|
|
|
}
|
|
|
|
W = null;
|
|
|
|
U[Y].img = null;
|
|
|
|
U[Y].mgr = null;
|
|
|
|
delete U[Y];
|
|
|
|
V.realBufferNumber--;
|
|
|
|
X--
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
P.img.onerror = function() {
|
|
|
|
var V = P.img;
|
|
|
|
var W = V ? V.getAttribute("errorCount") : true;
|
|
|
|
if (V && (!W || W && W < 5)) {
|
|
|
|
W = W || 0;
|
|
|
|
W++;
|
|
|
|
V.src = L;
|
|
|
|
V.setAttribute("errorCount", W)
|
|
|
|
} else {
|
|
|
|
if (!P.mgr) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var U = P.mgr;
|
|
|
|
P.img.src = P.errorImgSrc;
|
|
|
|
if (P.img && !o.isInDocument(P.img)) {
|
|
|
|
O.tilesDiv.appendChild(P.img)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
P.img.src = L
|
|
|
|
}
|
|
|
|
var H = new l({
|
|
|
|
baseLayer: true
|
|
|
|
});
|
|
|
|
H.getTilesUrl = function(N, P) {
|
|
|
|
var S = N.x;
|
|
|
|
var O = N.y;
|
|
|
|
var Q = u.url.domain["TILE_ONLINE_URLS"];
|
|
|
|
var R = "x=" + S + "&y=" + O + "&z=" + P + "&styles=pl&scaler=2";
|
|
|
|
var M = u.url.proto + Q[Math.abs(S + O) % Q.length] + "/tile/?qt=vtile&" + R;
|
|
|
|
var L = this.getTileVersion("normal");
|
|
|
|
M += "&udt=" + L;
|
|
|
|
return M.replace(/-(\d+)/gi, "M$1")
|
|
|
|
};
|
|
|
|
var e = new l({
|
|
|
|
baseLayer: true
|
|
|
|
});
|
|
|
|
e.getTilesUrl = function(O, T) {
|
|
|
|
var M = this.map;
|
|
|
|
var U = O.x;
|
|
|
|
var P = O.y;
|
|
|
|
var S = u.url.domain["main_domain_cdn"]["baidu"];
|
|
|
|
var Q = "x=" + U + "&y=" + P + "&z=" + T + "&scale=2";
|
|
|
|
var N = u.url.proto + S[Math.abs(U + P) % S.length] + "/customimage/tile/?" + Q;
|
|
|
|
var R = this.getTileVersion("normal");
|
|
|
|
N += "&udt=" + R;
|
|
|
|
var L = this.getStyleParam();
|
|
|
|
N += L;
|
|
|
|
return N.replace("{x}", U).replace("{y}", P).replace("{z}", T)
|
|
|
|
};
|
|
|
|
e.getStyleParam = function() {
|
|
|
|
var M = this.map.config.mapStyle;
|
|
|
|
var N = "&";
|
|
|
|
if (M.style) {
|
|
|
|
N = N + "customid=" + M.style
|
|
|
|
} else {
|
|
|
|
if (M.styleJson) {
|
|
|
|
var L = this.styleJson2styleString(M.styleJson);
|
|
|
|
N = N + "styles=" + encodeURIComponent(L)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
e.styleJson2styleString = function(L) {
|
|
|
|
var Q = {
|
|
|
|
featureType: "t",
|
|
|
|
elementType: "e",
|
|
|
|
visibility: "v",
|
|
|
|
color: "c",
|
|
|
|
lightness: "l",
|
|
|
|
saturation: "s",
|
|
|
|
weight: "w",
|
|
|
|
zoom: "z",
|
|
|
|
hue: "h"
|
|
|
|
};
|
|
|
|
var S = {
|
|
|
|
all: "all",
|
|
|
|
geometry: "g",
|
|
|
|
"geometry.fill": "g.f",
|
|
|
|
"geometry.stroke": "g.s",
|
|
|
|
labels: "l",
|
|
|
|
"labels.text.fill": "l.t.f",
|
|
|
|
"labels.text.stroke": "l.t.s",
|
|
|
|
"lables.text": "l.t",
|
|
|
|
"labels.icon": "l.i"
|
|
|
|
};
|
|
|
|
var T = [];
|
|
|
|
for (var M = 0, R; R = L[M]; M++) {
|
|
|
|
var O = R.stylers;
|
|
|
|
delete R.stylers;
|
|
|
|
J.extend(R, O);
|
|
|
|
var N = [];
|
|
|
|
for (var P in Q) {
|
|
|
|
if (R[P]) {
|
|
|
|
if (P === "elementType") {
|
|
|
|
N.push(Q[P] + ":" + S[R[P]])
|
|
|
|
} else {
|
|
|
|
N.push(Q[P] + ":" + R[P])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (N.length > 2) {
|
|
|
|
T.push(N.join("|"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return T.join(",")
|
|
|
|
};
|
|
|
|
|
|
|
|
function a() {
|
|
|
|
this.map = null;
|
|
|
|
this._overlays = {};
|
|
|
|
this._customOverlays = []
|
|
|
|
}
|
|
|
|
J.extend(a.prototype, {
|
|
|
|
draw: function(L) {
|
|
|
|
for (var M in this._overlays) {
|
|
|
|
this._overlays[M].draw(L)
|
|
|
|
}
|
|
|
|
J.array.each(this._customOverlays, function(N) {
|
|
|
|
N.draw(L)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
u.register(function(M) {
|
|
|
|
M.overlayDiv = document.createElement("div");
|
|
|
|
M.overlayDiv.style.cssText = "position:absolute;z-index:100;left:0;top:0;width:0;height:0;";
|
|
|
|
M._panes.markerPane = document.createElement("div");
|
|
|
|
M._panes.markerPane.style.cssText = "position:absolute;z-index:100;left:0;top:0;width: 0;height: 0;";
|
|
|
|
M.overlayDiv.appendChild(M._panes.markerPane);
|
|
|
|
M.platform.appendChild(M.overlayDiv);
|
|
|
|
var L = new a();
|
|
|
|
L.map = M;
|
|
|
|
M._overlays = L._overlays;
|
|
|
|
M._customOverlays = L._customOverlays;
|
|
|
|
M.addEventListener("load", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("moveend", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("zooming", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("zoomend", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("oncenterzoomend", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("resize", function(N) {
|
|
|
|
L.draw(N)
|
|
|
|
});
|
|
|
|
M.addEventListener("addoverlay", function(R) {
|
|
|
|
var O = R.target;
|
|
|
|
if (O instanceof I) {
|
|
|
|
if (!L._overlays[O.guid]) {
|
|
|
|
L._overlays[O.guid] = O
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var Q = false;
|
|
|
|
for (var P = 0, N = L._customOverlays.length; P < N; P++) {
|
|
|
|
if (L._customOverlays[P] === O) {
|
|
|
|
Q = true;
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!Q) {
|
|
|
|
L._customOverlays.push(O)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
M.addEventListener("removeoverlay", function(Q) {
|
|
|
|
var O = Q.target;
|
|
|
|
if (O instanceof I) {
|
|
|
|
delete L._overlays[O.guid]
|
|
|
|
} else {
|
|
|
|
for (var P = 0, N = L._customOverlays.length; P < N; P++) {
|
|
|
|
if (L._customOverlays[P] === O) {
|
|
|
|
L._customOverlays.splice(P, 1);
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
M.addEventListener("clearoverlays", function(Q) {
|
|
|
|
for (var P in L._overlays) {
|
|
|
|
if (L._overlays[P]._config.enableMassClear) {
|
|
|
|
L._overlays[P].remove();
|
|
|
|
delete L._overlays[P]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (var N = L._customOverlays.length, O = N - 1; O >= 0; O--) {
|
|
|
|
if (L._customOverlays[O].enableMassClear !== false) {
|
|
|
|
L._customOverlays[O].remove();
|
|
|
|
L._customOverlays[O] = null;
|
|
|
|
L._customOverlays.splice(O, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
function E() {
|
|
|
|
this._type = "overlay"
|
|
|
|
}
|
|
|
|
J.lang.inherits(E, J.lang.Class, "Overlay");
|
|
|
|
E.getZIndex = function(L) {
|
|
|
|
L = L * 1;
|
|
|
|
if (!L) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return (L * -100000) << 1
|
|
|
|
};
|
|
|
|
J.extend(E.prototype, {
|
|
|
|
_i: function(L) {
|
|
|
|
if (!this.domElement && J.lang.isFunction(this.initialize)) {
|
|
|
|
this.domElement = this.initialize(L);
|
|
|
|
if (this.domElement) {
|
|
|
|
this.domElement.style.WebkitUserSelect = "none"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.draw()
|
|
|
|
},
|
|
|
|
initialize: function(L) {
|
|
|
|
throw "initialize方法未实现"
|
|
|
|
},
|
|
|
|
draw: function() {
|
|
|
|
throw "draw方法未实现"
|
|
|
|
},
|
|
|
|
remove: function() {
|
|
|
|
if (this.domElement && this.domElement.parentNode) {
|
|
|
|
this.domElement.parentNode.removeChild(this.domElement)
|
|
|
|
}
|
|
|
|
this.domElement = null;
|
|
|
|
this.dispatchEvent(new F("onremove"))
|
|
|
|
},
|
|
|
|
hide: function() {
|
|
|
|
if (this.domElement) {
|
|
|
|
J.dom.hide(this.domElement)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
show: function() {
|
|
|
|
if (this.domElement) {
|
|
|
|
J.dom.show(this.domElement)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isVisible: function() {
|
|
|
|
if (!this.domElement) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (this.domElement.style.display == "none" || this.domElement.style.visibility == "hidden") {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function I() {
|
|
|
|
J.lang.Class.call(this);
|
|
|
|
E.call(this);
|
|
|
|
this.map = null;
|
|
|
|
this._visible = true
|
|
|
|
}
|
|
|
|
J.lang.inherits(I, E, "OverlayInternal");
|
|
|
|
J.extend(I.prototype, {
|
|
|
|
initialize: function(L) {
|
|
|
|
this.map = L;
|
|
|
|
J.lang.Class.call(this, this.guid);
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
getMap: function() {
|
|
|
|
return this.map
|
|
|
|
},
|
|
|
|
draw: function() {},
|
|
|
|
remove: function() {
|
|
|
|
this.map = null;
|
|
|
|
J.lang.decontrol(this.guid);
|
|
|
|
E.prototype.remove.call(this)
|
|
|
|
},
|
|
|
|
hide: function() {
|
|
|
|
if (this._visible == false) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this._visible = false
|
|
|
|
},
|
|
|
|
show: function() {
|
|
|
|
if (this._visible == true) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this._visible = true
|
|
|
|
},
|
|
|
|
isVisible: function() {
|
|
|
|
if (!this.domElement) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return !!this._visible
|
|
|
|
},
|
|
|
|
getContainer: function() {
|
|
|
|
return this.domElement
|
|
|
|
},
|
|
|
|
setConfig: function(M) {
|
|
|
|
M = M || {};
|
|
|
|
for (var L in M) {
|
|
|
|
this._config[L] = M[L]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setZIndex: function(L) {
|
|
|
|
this.zIndex = L
|
|
|
|
},
|
|
|
|
enableMassClear: function() {
|
|
|
|
this._config.enableMassClear = true
|
|
|
|
},
|
|
|
|
disableMassClear: function() {
|
|
|
|
this._config.enableMassClear = false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function h(M, N, Q) {
|
|
|
|
var P = this.dpr = 2;
|
|
|
|
if (!M || !N) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
Q = Q || {};
|
|
|
|
N.width = N.width / P;
|
|
|
|
N.height = N.height / P;
|
|
|
|
if (Q.anchor && Q.anchor instanceof d) {
|
|
|
|
Q.anchor.width = Q.anchor.width / P;
|
|
|
|
Q.anchor.height = Q.anchor.height / P
|
|
|
|
}
|
|
|
|
if (Q.imageOffset && Q.imageOffset instanceof d) {
|
|
|
|
Q.imageOffset.width = Math.floor(Q.imageOffset.width / P);
|
|
|
|
Q.imageOffset.height = Math.floor(Q.imageOffset.height / P)
|
|
|
|
}
|
|
|
|
if (Q.backGroundImageSize && Q.backGroundImageSize instanceof d) {
|
|
|
|
Q.backGroundImageSize.width = Math.floor(Q.backGroundImageSize.width / P);
|
|
|
|
Q.backGroundImageSize.height = Math.floor(Q.backGroundImageSize.height / P)
|
|
|
|
}
|
|
|
|
this.size = N;
|
|
|
|
this.imageUrl = M;
|
|
|
|
var L = new d(Math.floor(N.width / 2), N.height);
|
|
|
|
var O = new d(N.width, N.height);
|
|
|
|
var R = {
|
|
|
|
anchor: L,
|
|
|
|
imageOffset: new d(0, 0),
|
|
|
|
backGroundImageSize: O
|
|
|
|
};
|
|
|
|
J.extend(R, Q);
|
|
|
|
this.anchor = R.anchor;
|
|
|
|
this.imageOffset = R.imageOffset;
|
|
|
|
this.backGroundImageSize = R.backGroundImageSize
|
|
|
|
}
|
|
|
|
J.extend(h.prototype, {
|
|
|
|
setImageUrl: function(L) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.imageUrl = L
|
|
|
|
},
|
|
|
|
setSize: function(L) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.size = new d(L.width / this.dpr, L.height / this.dpr)
|
|
|
|
},
|
|
|
|
setAnchor: function(L) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.anchor = new d(L.width / this.dpr, L.height / this.dpr)
|
|
|
|
},
|
|
|
|
setImageOffset: function(L) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.imageOffset = new d(L.width / this.dpr, L.height / this.dpr)
|
|
|
|
},
|
|
|
|
getHTML: function() {
|
|
|
|
var L = '<img style="position:absolute;padding:0;margin:0;border:0;left:' + this.imageOffset.width + "px;top:" +
|
|
|
|
this.imageOffset.height + "px;width:" + this.backGroundImageSize.width + "px;height:" + this.backGroundImageSize
|
|
|
|
.height + 'px;"src="' + this.imageUrl + '"/>';
|
|
|
|
return L
|
|
|
|
},
|
|
|
|
setBackGroundImageSize: function(L) {
|
|
|
|
if (!L) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.backGroundImageSize = new d(L.width / this.dpr, L.height / this.dpr)
|
|
|
|
},
|
|
|
|
toString: function() {
|
|
|
|
return "Icon"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var D = new h(u.apiUrlCdn + "/images/hd_red_marker.png", new d(47, 50));
|
|
|
|
|
|
|
|
function z(L, M) {
|
|
|
|
I.call(this);
|
|
|
|
M = M || {};
|
|
|
|
this.point = L;
|
|
|
|
this.map = null;
|
|
|
|
this._config = {
|
|
|
|
offset: new d(0, 0),
|
|
|
|
icon: D,
|
|
|
|
baseZIndex: 0,
|
|
|
|
clickable: true,
|
|
|
|
isTop: false,
|
|
|
|
enableMassClear: true
|
|
|
|
};
|
|
|
|
this.setConfig(M);
|
|
|
|
if (o.isDefined(M.enableClicking)) {
|
|
|
|
this._config.clickable = M.enableClicking
|
|
|
|
}
|
|
|
|
this._loadAsyncCode()
|
|
|
|
}
|
|
|
|
J.lang.inherits(z, I, "Marker");
|
|
|
|
J.extend(z.prototype, {
|
|
|
|
_loadAsyncCode: function() {
|
|
|
|
var L = this;
|
|
|
|
p.load("marker", function() {
|
|
|
|
L._loadAsyncCodeCbk()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
setIcon: function(L) {
|
|
|
|
if (L instanceof h) {
|
|
|
|
this._config.icon = L
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getIcon: function() {
|
|
|
|
return this._config.icon
|
|
|
|
},
|
|
|
|
getPosition: function() {
|
|
|
|
return this.point
|
|
|
|
},
|
|
|
|
setPosition: function(L) {
|
|
|
|
if (L instanceof w) {
|
|
|
|
this.point = new w(L.lng, L.lat)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setTop: function(M, L) {
|
|
|
|
this._config.isTop = !!M;
|
|
|
|
if (M) {
|
|
|
|
this._addi = L || 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setOffset: function(L) {
|
|
|
|
if (L instanceof d) {
|
|
|
|
this._config.offset = L
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getOffset: function() {
|
|
|
|
return this._config.offset
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function x() {
|
|
|
|
this._map = null;
|
|
|
|
this._container;
|
|
|
|
this._type = "control";
|
|
|
|
this._visible = true
|
|
|
|
}
|
|
|
|
J.lang.inherits(x, J.lang.Class, "Control");
|
|
|
|
J.extend(x.prototype, {
|
|
|
|
initialize: function(L) {
|
|
|
|
this._map = L;
|
|
|
|
if (this._container) {
|
|
|
|
L.container.appendChild(this._container);
|
|
|
|
return this._container
|
|
|
|
}
|
|
|
|
return
|
|
|
|
},
|
|
|
|
_i: function(L) {
|
|
|
|
if (!this._container && this.initialize && J.lang.isFunction(this.initialize)) {
|
|
|
|
this._container = this.initialize(L)
|
|
|
|
}
|
|
|
|
this._opts = this._opts || {};
|
|
|
|
this._setStyle();
|
|
|
|
this._setPosition();
|
|
|
|
if (this._container) {
|
|
|
|
this._container._jsobj = this
|
|
|
|
}
|
|
|
|
},
|
|
|
|
_setStyle: function() {
|
|
|
|
var N = this._container;
|
|
|
|
if (N) {
|
|
|
|
var L = N.style;
|
|
|
|
var M = this._container.style.zIndex || 10;
|
|
|
|
L.position = "absolute";
|
|
|
|
L.zIndex = M
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remove: function() {
|
|
|
|
this._map = null;
|
|
|
|
if (!this._container) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this._container.parentNode && this._container.parentNode.removeChild(this._container);
|
|
|
|
this._container._jsobj = null;
|
|
|
|
this._container = null
|
|
|
|
},
|
|
|
|
_render: function() {
|
|
|
|
this._container = o.beforeEndHTML(this._map.container, "<div></div>");
|
|
|
|
if (this._visible == false) {
|
|
|
|
J.dom.hide(this._container)
|
|
|
|
}
|
|
|
|
return this._container
|
|
|
|
},
|
|
|
|
_setPosition: function() {
|
|
|
|
this.setAnchor(this._opts.anchor)
|
|
|
|
},
|
|
|
|
setAnchor: function(N) {
|
|
|
|
if (this.anchorFixed || !J.lang.isNumber(N) || isNaN(N) || N < BMAP_ANCHOR_TOP_LEFT || N >
|
|
|
|
BMAP_ANCHOR_BOTTOM_RIGHT) {
|
|
|
|
N = this.defaultAnchor
|
|
|
|
}
|
|
|
|
this._opts = this._opts || {};
|
|
|
|
this._opts.offset = this._opts.offset || this.defaultOffset;
|
|
|
|
var M = this._opts.anchor;
|
|
|
|
this._opts.anchor = N;
|
|
|
|
if (!this._container) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var P = this._container;
|
|
|
|
var L = this._opts.offset.width;
|
|
|
|
var O = this._opts.offset.height;
|
|
|
|
switch (N) {
|
|
|
|
case BMAP_ANCHOR_TOP_LEFT:
|
|
|
|
P.style.top = O + "px";
|
|
|
|
P.style.left = L + "px";
|
|
|
|
break;
|
|
|
|
case BMAP_ANCHOR_TOP_RIGHT:
|
|
|
|
P.style.top = O + "px";
|
|
|
|
P.style.right = L + "px";
|
|
|
|
break;
|
|
|
|
case BMAP_ANCHOR_BOTTOM_LEFT:
|
|
|
|
P.style.bottom = O + "px";
|
|
|
|
P.style.left = L + "px";
|
|
|
|
break;
|
|
|
|
case BMAP_ANCHOR_BOTTOM_RIGHT:
|
|
|
|
P.style.bottom = O + "px";
|
|
|
|
P.style.right = L + "px";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getAnchor: function() {
|
|
|
|
return this._opts.anchor
|
|
|
|
},
|
|
|
|
setOffset: function(L) {
|
|
|
|
if (!(L instanceof d)) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this._opts = this._opts || {};
|
|
|
|
this._opts.offset = new d(L.width, L.height);
|
|
|
|
if (!this._container) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.setAnchor(this._opts.anchor)
|
|
|
|
},
|
|
|
|
getOffset: function() {
|
|
|
|
return this._opts.offset
|
|
|
|
},
|
|
|
|
getDom: function() {
|
|
|
|
return this._container
|
|
|
|
},
|
|
|
|
show: function() {
|
|
|
|
this._visible = true;
|
|
|
|
if (this._container) {
|
|
|
|
J.dom.show(this._container)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hide: function() {
|
|
|
|
this._visible = false;
|
|
|
|
if (this._container) {
|
|
|
|
J.dom.hide(this._container)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isVisible: function() {
|
|
|
|
if (!this._container && !this._map) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return !!this._visible
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window.BMAP_ANCHOR_TOP_LEFT = 0;
|
|
|
|
window.BMAP_ANCHOR_TOP_RIGHT = 1;
|
|
|
|
window.BMAP_ANCHOR_BOTTOM_LEFT = 2;
|
|
|
|
window.BMAP_ANCHOR_BOTTOM_RIGHT = 3;
|
|
|
|
|
|
|
|
function y(L) {
|
|
|
|
x.call(this);
|
|
|
|
L = L || {};
|
|
|
|
this._opts = {};
|
|
|
|
this._opts = J.object.extend(J.object.extend(this._opts, {
|
|
|
|
color: "black",
|
|
|
|
unit: "metric"
|
|
|
|
}), L);
|
|
|
|
this.defaultAnchor = BMAP_ANCHOR_BOTTOM_LEFT;
|
|
|
|
this.defaultOffset = new d(20, 10);
|
|
|
|
this.setAnchor(L.anchor);
|
|
|
|
this._units = {
|
|
|
|
metric: {
|
|
|
|
name: "metric",
|
|
|
|
conv: 1,
|
|
|
|
incon: 1000,
|
|
|
|
u1: "米",
|
|
|
|
u2: "公里"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (!this._units[this._opts.unit]) {
|
|
|
|
this._opts.unit = "metric"
|
|
|
|
}
|
|
|
|
this._scaleText = null;
|
|
|
|
this._numberArray = {};
|
|
|
|
this._loadAsyncCode()
|
|
|
|
}
|
|
|
|
J.lang.inherits(y, x, "ScaleControl");
|
|
|
|
J.object.extend(y.prototype, {
|
|
|
|
_loadAsyncCode: function() {
|
|
|
|
var L = this;
|
|
|
|
p.load("control", function() {
|
|
|
|
L._loadAsyncCodeCbk()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initialize: function(L) {
|
|
|
|
this._map = L;
|
|
|
|
return this._container
|
|
|
|
},
|
|
|
|
setColor: function(L) {
|
|
|
|
this._opts.color = L + ""
|
|
|
|
},
|
|
|
|
getColor: function() {
|
|
|
|
return this._opts.color
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function C(L) {
|
|
|
|
x.call(this);
|
|
|
|
L = L || {};
|
|
|
|
this._opts = {};
|
|
|
|
this._opts = J.object.extend(this._opts, L);
|
|
|
|
this.defaultAnchor = BMAP_ANCHOR_BOTTOM_RIGHT;
|
|
|
|
this.defaultOffset = new u.Size(8, 14);
|
|
|
|
this.setAnchor(L.anchor)
|
|
|
|
}
|
|
|
|
J.lang.inherits(C, x, "ZoomControl");
|
|
|
|
J.object.extend(C.prototype, {
|
|
|
|
initialize: function(M) {
|
|
|
|
this._map = M;
|
|
|
|
var O = this._container = document.createElement("div");
|
|
|
|
O.style.cssText = "box-shadow:1px 1px 2px rgba(0,0,0,.4);background:rgba(255,255,255,.8);border-radius: 3px;";
|
|
|
|
var L = this._zoomIn = document.createElement("div");
|
|
|
|
L.style.cssText = "width:36px;height:42px;text-align:center;line-height:42px;font-family:arial;color:#000;";
|
|
|
|
L.innerHTML =
|
|
|
|
'<div style="font-size:24px;border-bottom:solid 1px #ccc;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events: none;">+</div>';
|
|
|
|
var N = this._zoomOut = document.createElement("div");
|
|
|
|
N.style.cssText = "width:36px;height:42px;text-align:center;line-height:42px;font-family:arial;color:#000;";
|
|
|
|
N.innerHTML =
|
|
|
|
'<div style="font-size:40px;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;">-</div>';
|
|
|
|
O.appendChild(L);
|
|
|
|
O.appendChild(N);
|
|
|
|
M.getContainer().appendChild(O);
|
|
|
|
this.bindEvt();
|
|
|
|
return O
|
|
|
|
},
|
|
|
|
bindEvt: function() {
|
|
|
|
var L = this;
|
|
|
|
var M = L._map;
|
|
|
|
L._zoomIn.onclick = function() {
|
|
|
|
M.zoomIn();
|
|
|
|
L.zoomChangeHandler()
|
|
|
|
};
|
|
|
|
L._zoomOut.onclick = function() {
|
|
|
|
M.zoomOut();
|
|
|
|
L.zoomChangeHandler()
|
|
|
|
};
|
|
|
|
L._zoomIn.ontouchstart = function() {
|
|
|
|
this.style.background = "rgba(94,169,221,.8)"
|
|
|
|
};
|
|
|
|
L._zoomIn.ontouchend = function() {
|
|
|
|
this.style.background = ""
|
|
|
|
};
|
|
|
|
L._zoomOut.ontouchstart = function() {
|
|
|
|
this.style.background = "rgba(94,169,221,.8)"
|
|
|
|
};
|
|
|
|
L._zoomOut.ontouchend = function() {
|
|
|
|
this.style.background = ""
|
|
|
|
};
|
|
|
|
L.zoomChangeHandler = function() {
|
|
|
|
if (M.getZoom() >= M.config.maxZoom) {
|
|
|
|
L._zoomIn.style.background = "rgba(205,205,205,.8)"
|
|
|
|
} else {
|
|
|
|
L._zoomIn.style.background = ""
|
|
|
|
}
|
|
|
|
if (M.getZoom() <= M.config.minZoom) {
|
|
|
|
L._zoomOut.style.background = "rgba(205,205,205,.8)"
|
|
|
|
} else {
|
|
|
|
L._zoomOut.style.background = ""
|
|
|
|
}
|
|
|
|
};
|
|
|
|
M.addEventListener("zoomend", L.zoomChangeHandler);
|
|
|
|
M.addEventListener("centerzoomend", L.zoomChangeHandler);
|
|
|
|
M.addEventListener("load", L.zoomChangeHandler)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function k(L) {
|
|
|
|
this["defaultAnchor"] = BMAP_ANCHOR_BOTTOM_LEFT;
|
|
|
|
this["defaultOffset"] = new d(1, 1);
|
|
|
|
this._cZIndex = 30;
|
|
|
|
this.IMG_URL = u.apiUrlCdn + "images/copyright_logo_hd.png"
|
|
|
|
}
|
|
|
|
k.prototype = new x();
|
|
|
|
k.prototype.initialize = function(M) {
|
|
|
|
this._map = M;
|
|
|
|
var N = o.create("div");
|
|
|
|
var L = o.create("a", {
|
|
|
|
title: "到百度地图查看此区域",
|
|
|
|
target: "_blank",
|
|
|
|
href: "http://map.baidu.com/?sr=1"
|
|
|
|
});
|
|
|
|
L.style.outline = "none";
|
|
|
|
N.style.height = "25px";
|
|
|
|
L.href = "http://map.baidu.com/?sr=1";
|
|
|
|
L.innerHTML = "<img style='border:none;width:68px;height:25px' src='" + this.IMG_URL + "' />";
|
|
|
|
N.appendChild(L);
|
|
|
|
M.getContainer().appendChild(N);
|
|
|
|
return N
|
|
|
|
};
|
|
|
|
var K = new h(u.apiUrlCdn + "/images/hd_red_marker.png", new d(47, 50));
|
|
|
|
|
|
|
|
function q(L, M) {
|
|
|
|
J.lang.Class.call(this);
|
|
|
|
M = M || {};
|
|
|
|
this.point = L;
|
|
|
|
this._opts = {
|
|
|
|
icon: K,
|
|
|
|
data: "",
|
|
|
|
margin: 0
|
|
|
|
};
|
|
|
|
this._opts = J.object.extend(this._opts, M)
|
|
|
|
}
|
|
|
|
J.lang.inherits(q, J.lang.Class, "MassFeature");
|
|
|
|
J.extend(q.prototype, {
|
|
|
|
getData: function() {
|
|
|
|
return this._opts.data
|
|
|
|
},
|
|
|
|
getIcon: function() {
|
|
|
|
return this._opts.icon
|
|
|
|
},
|
|
|
|
getPosition: function() {
|
|
|
|
return this.point
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function t(L) {
|
|
|
|
this._map = L;
|
|
|
|
this._asyncCodeLoaded = false;
|
|
|
|
this._massFeatures = [];
|
|
|
|
this._IconCache = {};
|
|
|
|
this._needLoadImgNumber = 0
|
|
|
|
}
|
|
|
|
u.register(function(M) {
|
|
|
|
var L = new t(M);
|
|
|
|
L.initialize()
|
|
|
|
});
|
|
|
|
J.extend(t.prototype, {
|
|
|
|
initialize: function() {
|
|
|
|
var M = this._map;
|
|
|
|
var L = this;
|
|
|
|
M.addEventListener("addmassfeatures", function(Q) {
|
|
|
|
var N = Q.massFeatures;
|
|
|
|
for (var S = 0, P = N.length; S < P; S++) {
|
|
|
|
var R = N[S];
|
|
|
|
var O = R.guid;
|
|
|
|
if (!L._massFeatures[O]) {
|
|
|
|
L._massFeatures[O] = 1;
|
|
|
|
L._massFeatures.push(R)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
L._loadAsyncCode(function() {
|
|
|
|
L.drawMassFeatures(true)
|
|
|
|
})
|
|
|
|
});
|
|
|
|
M.addEventListener("removemassfeatures", function(Q) {
|
|
|
|
var N = Q.massFeatures;
|
|
|
|
for (var S = 0, P = N.length; S < P; S++) {
|
|
|
|
for (var R = L._massFeatures.length - 1; R >= 0; R--) {
|
|
|
|
if (N[S].guid === L._massFeatures[R].guid) {
|
|
|
|
var O = L._massFeatures[R].guid;
|
|
|
|
L._massFeatures.splice(R, 1);
|
|
|
|
delete L._massFeatures[O];
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
L._loadAsyncCode(function() {
|
|
|
|
L.drawMassFeatures()
|
|
|
|
})
|
|
|
|
});
|
|
|
|
M.addEventListener("clearmassfeatures", function(N) {
|
|
|
|
L._massFeatures.length = 0;
|
|
|
|
for (var O in L._massFeatures) {
|
|
|
|
delete L._massFeatures[O]
|
|
|
|
}
|
|
|
|
L._loadAsyncCode(function() {
|
|
|
|
L.drawMassFeatures()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
_loadAsyncCode: function(L) {
|
|
|
|
var M = this;
|
|
|
|
p.load("massfeatures", function() {
|
|
|
|
if (!M._asyncCodeLoaded) {
|
|
|
|
M._loadAsyncCodeCbk()
|
|
|
|
}
|
|
|
|
L && L()
|
|
|
|
}, true)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
u.verify();
|
|
|
|
})();
|
|
|
|
})();
|