Commit c6bdda51 authored by Akikonata's avatar Akikonata

fixed bug

parent 9b8dddbf
var baidu = baidu || {};
baidu.frontia = {}, function(e) {
baidu.frontia.version = "1.0.0", baidu.frontia.serviceHost = {PCS: "https://c.pcs.baidu.com",Frontia: "https://frontia.baidu.com",PBLog: "http://frontialog.smrapp.baidu.com",Social: "https://openapi.baidu.com"}, baidu.frontia.currentAccount = null, baidu.frontia.apiKey = null, baidu.frontia._CURRENT_USER_KEY = "currentUser", "undefined" != typeof localStorage && (baidu.frontia.localStorage = localStorage), baidu.frontia.DomainManager = {getSocialDomain: function() {
return baidu.frontia.serviceHost.Social
},getPCSDomain: function() {
return baidu.frontia.serviceHost.PCS
},getFrontiaDomain: function() {
return baidu.frontia.serviceHost.Frontia
},getPBLogDomain: function() {
return baidu.frontia.serviceHost.PBLog
}}, baidu.frontia.Base = Object.defineProperty(function() {
}, "extend", {value: function(e, t) {
var r = e && e.hasOwnProperty("constructor") ? e.constructor : this, n = function() {
r.apply(this, arguments)
};
if (n.prototype = function(e, t) {
return Object.getOwnPropertyNames(t).forEach(function(r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r))
}), e
}(Object.create(this.prototype), e || {}), t)
for (var a in t)
t.hasOwnProperty(a) && (n[a] = t[a]);
return Object.defineProperty(n, "extend", Object.getOwnPropertyDescriptor(this, "extend")), n
}}), baidu.frontia.Object = baidu.frontia.Base.extend({acl: null,constructor: function(t) {
if (t && !(t instanceof e.ACL))
throw new Error("[construct ]: acl is invalid");
this.acl = t || null
},setAcl: function(t) {
if (t && !(t instanceof e.ACL))
throw new Error("[setAcl ]: acl is invalid");
this.acl = t || null
},getACL: function() {
return this.acl
},_getACLInfo: function() {
var t = null;
return this.acl instanceof e.ACL && (t = this.acl.toJSON()), t
}}), baidu.frontia.setCurrentAccount = function(t) {
if (!(t instanceof e.User || t instanceof e.Role))
throw new Error("[setCurrentAccount]: account is invalid");
var r = t.toJSON();
baidu.frontia.localStorage.setItem(baidu.frontia._getLocalStorageKey(baidu.frontia._CURRENT_USER_KEY), JSON.stringify(r)), baidu.frontia.currentAccount = t
}, baidu.frontia.logOutCurrentAccount = function() {
baidu.frontia.currentAccount = null, baidu.frontia.localStorage.removeItem(baidu.frontia._getLocalStorageKey(baidu.frontia._CURRENT_USER_KEY))
}, baidu.frontia.getCurrentAccount = function() {
if (baidu.frontia.currentAccount)
return baidu.frontia.currentAccount;
var e = baidu.frontia.localStorage.getItem(baidu.frontia._getLocalStorageKey(baidu.frontia._CURRENT_USER_KEY));
if (!e)
return null;
var t = JSON.parse(e);
return "user" === t.type ? new baidu.frontia.User({socialId: t.socialId,accessToken: t.accessToken,name: t.name,mediaType: t.mediaType,expiresIn: t.expiresIn}) : new baidu.frontia.Role(t.roleId)
}, baidu.frontia.init = function(e) {
if (!e)
throw new Error("[init]: apiKey is invaild");
baidu.frontia.apiKey = e
}, baidu.frontia.getApiKey = function() {
return baidu.frontia.apiKey
}, baidu.frontia._getLocalStorageKey = function(e) {
if (!baidu.frontia.apiKey)
throw "Should call baidu.frontia.init before using baidu.frontia";
if (e || (e = ""), "string" != typeof e)
throw "userKey must be a string when getting localStorage key";
return "baidu.frontia/" + baidu.frontia.apiKey + "/" + e
}
}(baidu.frontia), "undefined" != typeof module && module.exports && (module.exports = baidu), baidu.frontia.error = baidu.frontia.error || {}, function() {
baidu.frontia.error = function(e, t) {
t = t || "error", this.code = e.error_code || e.Code, this.message = e.error_msg || e.Message, this.message += " [" + t + "]"
}, baidu.frontia.ERR_MSG = {NO_AK: {error_code: -1,error_msg: "No AK found, please config AK by calling BaiduFrontia.init(yourak) at first"},INVALID_AK: {error_code: -1,error_msg: "Invalid AK"},INVALID_PARAMS: {error_code: -1,error_msg: "Invalid params"},INVALID_RES_TYPE: {error_code: -1,error_msg: "Invalid params: response_type"},INVALID_MEDIA_TYPE: {error_code: -1,error_msg: "Invalid params: media_type"}}
}(baidu.frontia), function() {
"use strict";
function e(e, t) {
var r = e.split("."), n = g;
!(r[0] in n) && n.execScript && n.execScript("var " + r[0]);
for (var a; r.length && (a = r.shift()); )
r.length || t === h ? n = n[a] ? n[a] : n[a] = {} : n[a] = t
}
function t(e, t) {
if (this.index = "number" == typeof t ? t : 0, this.f = 0, this.buffer = e instanceof (m ? Uint8Array : Array) ? e : new (m ? Uint8Array : Array)(32768), 2 * this.buffer.length <= this.index)
throw Error("invalid index");
this.buffer.length <= this.index && r(this)
}
function r(e) {
var t, r = e.buffer, n = r.length, a = new (m ? Uint8Array : Array)(n << 1);
if (m)
a.set(r);
else
for (t = 0; n > t; ++t)
a[t] = r[t];
return e.buffer = a
}
function n(e, t, r) {
var n, a = "number" == typeof t ? t : t = 0, o = "number" == typeof r ? r : e.length;
for (n = -1, a = 7 & o; a--; ++t)
n = n >>> 8 ^ S[255 & (n ^ e[t])];
for (a = o >> 3; a--; t += 8)
n = n >>> 8 ^ S[255 & (n ^ e[t])], n = n >>> 8 ^ S[255 & (n ^ e[t + 1])], n = n >>> 8 ^ S[255 & (n ^ e[t + 2])], n = n >>> 8 ^ S[255 & (n ^ e[t + 3])], n = n >>> 8 ^ S[255 & (n ^ e[t + 4])], n = n >>> 8 ^ S[255 & (n ^ e[t + 5])], n = n >>> 8 ^ S[255 & (n ^ e[t + 6])], n = n >>> 8 ^ S[255 & (n ^ e[t + 7])];
return (4294967295 ^ n) >>> 0
}
function a(e) {
this.buffer = new (m ? Uint16Array : Array)(2 * e), this.length = 0
}
function o(e, t) {
this.h = j, this.j = 0, this.input = m && e instanceof Array ? new Uint8Array(e) : e, this.c = 0, t && (t.lazy && (this.j = t.lazy), "number" == typeof t.compressionType && (this.h = t.compressionType), t.outputBuffer && (this.a = m && t.outputBuffer instanceof Array ? new Uint8Array(t.outputBuffer) : t.outputBuffer), "number" == typeof t.outputIndex && (this.c = t.outputIndex)), this.a || (this.a = new (m ? Uint8Array : Array)(32768))
}
function i(e, t) {
this.length = e, this.k = t
}
function s(e, t) {
function r(e, t) {
var r, n = e.k, a = [], o = 0;
r = O[e.length], a[o++] = 65535 & r, a[o++] = 255 & r >> 16, a[o++] = r >> 24;
var i;
switch (d) {
case 1 === n:
i = [0, n - 1, 0];
break;
case 2 === n:
i = [1, n - 2, 0];
break;
case 3 === n:
i = [2, n - 3, 0];
break;
case 4 === n:
i = [3, n - 4, 0];
break;
case 6 >= n:
i = [4, n - 5, 1];
break;
case 8 >= n:
i = [5, n - 7, 1];
break;
case 12 >= n:
i = [6, n - 9, 2];
break;
case 16 >= n:
i = [7, n - 13, 2];
break;
case 24 >= n:
i = [8, n - 17, 3];
break;
case 32 >= n:
i = [9, n - 25, 3];
break;
case 48 >= n:
i = [10, n - 33, 4];
break;
case 64 >= n:
i = [11, n - 49, 4];
break;
case 96 >= n:
i = [12, n - 65, 5];
break;
case 128 >= n:
i = [13, n - 97, 5];
break;
case 192 >= n:
i = [14, n - 129, 6];
break;
case 256 >= n:
i = [15, n - 193, 6];
break;
case 384 >= n:
i = [16, n - 257, 7];
break;
case 512 >= n:
i = [17, n - 385, 7];
break;
case 768 >= n:
i = [18, n - 513, 8];
break;
case 1024 >= n:
i = [19, n - 769, 8];
break;
case 1536 >= n:
i = [20, n - 1025, 9];
break;
case 2048 >= n:
i = [21, n - 1537, 9];
break;
case 3072 >= n:
i = [22, n - 2049, 10];
break;
case 4096 >= n:
i = [23, n - 3073, 10];
break;
case 6144 >= n:
i = [24, n - 4097, 11];
break;
case 8192 >= n:
i = [25, n - 6145, 11];
break;
case 12288 >= n:
i = [26, n - 8193, 12];
break;
case 16384 >= n:
i = [27, n - 12289, 12];
break;
case 24576 >= n:
i = [28, n - 16385, 13];
break;
case 32768 >= n:
i = [29, n - 24577, 13];
break;
default:
throw "invalid distance"
}
r = i, a[o++] = r[0], a[o++] = r[1], a[o++] = r[2];
var s, c;
for (s = 0, c = a.length; c > s; ++s)
y[_++] = a[s];
v[a[0]]++, b[a[3]]++, A = e.length + t - 1, l = null
}
var n, a, o, i, s, u, f, l, p, g = {}, y = m ? new Uint16Array(2 * t.length) : [], _ = 0, A = 0, v = new (m ? Uint32Array : Array)(286), b = new (m ? Uint32Array : Array)(30), w = e.j;
if (!m) {
for (o = 0; 285 >= o; )
v[o++] = 0;
for (o = 0; 29 >= o; )
b[o++] = 0
}
for (v[256] = 1, n = 0, a = t.length; a > n; ++n) {
for (o = s = 0, i = 3; i > o && n + o !== a; ++o)
s = s << 8 | t[n + o];
if (g[s] === h && (g[s] = []), u = g[s], !(0 < A--)) {
for (; 0 < u.length && 32768 < n - u[0]; )
u.shift();
if (n + 3 >= a) {
for (l && r(l, -1), o = 0, i = a - n; i > o; ++o)
p = t[n + o], y[_++] = p, ++v[p];
break
}
0 < u.length ? (f = c(t, n, u), l ? l.length < f.length ? (p = t[n - 1], y[_++] = p, ++v[p], r(f, 0)) : r(l, -1) : f.length < w ? l = f : r(f, 0)) : l ? r(l, -1) : (p = t[n], y[_++] = p, ++v[p])
}
u.push(n)
}
return y[_++] = 256, v[256]++, e.n = v, e.m = b, m ? y.subarray(0, _) : y
}
function c(e, t, r) {
var n, a, o, s, c, u, f = 0, l = e.length;
s = 0, u = r.length;
e: for (; u > s; s++) {
if (n = r[u - s - 1], o = 3, f > 3) {
for (c = f; c > 3; c--)
if (e[n + c - 1] !== e[t + c - 1])
continue e;
o = f
}
for (; 258 > o && l > t + o && e[n + o] === e[t + o]; )
++o;
if (o > f && (a = n, f = o), 258 === o)
break
}
return new i(f, t - a)
}
function u(e, t) {
var r, n, o, i, s, c = e.length, u = new a(572), l = new (m ? Uint8Array : Array)(c);
if (!m)
for (i = 0; c > i; i++)
l[i] = 0;
for (i = 0; c > i; ++i)
0 < e[i] && u.push(i, e[i]);
if (r = Array(u.length / 2), n = new (m ? Uint32Array : Array)(u.length / 2), 1 === r.length)
return l[u.pop().index] = 1, l;
for (i = 0, s = u.length / 2; s > i; ++i)
r[i] = u.pop(), n[i] = r[i].value;
for (o = f(n, n.length, t), i = 0, s = r.length; s > i; ++i)
l[r[i].index] = o[i];
return l
}
function f(e, t, r) {
function n(e) {
var r = h[e][d[e]];
r === t ? (n(e + 1), n(e + 1)) : --l[r], ++d[e]
}
var a, o, i, s, c, u = new (m ? Uint16Array : Array)(r), f = new (m ? Uint8Array : Array)(r), l = new (m ? Uint8Array : Array)(t), p = Array(r), h = Array(r), d = Array(r), g = (1 << r) - t, y = 1 << r - 1;
for (u[r - 1] = t, o = 0; r > o; ++o)
y > g ? f[o] = 0 : (f[o] = 1, g -= y), g <<= 1, u[r - 2 - o] = (0 | u[r - 1 - o] / 2) + t;
for (u[0] = f[0], p[0] = Array(u[0]), h[0] = Array(u[0]), o = 1; r > o; ++o)
u[o] > 2 * u[o - 1] + f[o] && (u[o] = 2 * u[o - 1] + f[o]), p[o] = Array(u[o]), h[o] = Array(u[o]);
for (a = 0; t > a; ++a)
l[a] = r;
for (i = 0; i < u[r - 1]; ++i)
p[r - 1][i] = e[i], h[r - 1][i] = i;
for (a = 0; r > a; ++a)
d[a] = 0;
for (1 === f[r - 1] && (--l[0], ++d[r - 1]), o = r - 2; o >= 0; --o) {
for (s = a = 0, c = d[o + 1], i = 0; i < u[o]; i++)
s = p[o + 1][c] + p[o + 1][c + 1], s > e[a] ? (p[o][i] = s, h[o][i] = t, c += 2) : (p[o][i] = e[a], h[o][i] = a, ++a);
d[o] = 0, 1 === f[o] && n(o)
}
return l
}
function l(e) {
var t, r, n, a, o = new (m ? Uint16Array : Array)(e.length), i = [], s = [], c = 0;
for (t = 0, r = e.length; r > t; t++)
i[e[t]] = (0 | i[e[t]]) + 1;
for (t = 1, r = 16; r >= t; t++)
s[t] = c, c += 0 | i[t], c <<= 1;
for (t = 0, r = e.length; r > t; t++)
for (c = s[e[t]], s[e[t]] += 1, n = o[t] = 0, a = e[t]; a > n; n++)
o[t] = o[t] << 1 | 1 & c, c >>>= 1;
return o
}
function p(e, t) {
this.input = e, this.c = this.i = 0, this.d = {}, t && (t.flags && (this.d = t.flags), "string" == typeof t.filename && (this.filename = t.filename), "string" == typeof t.comment && (this.l = t.comment), t.deflateOptions && (this.e = t.deflateOptions)), this.e || (this.e = {})
}
var h = void 0, d = !0, g = this, m = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array;
t.prototype.b = function(e, t, n) {
var a, o = this.buffer, i = this.index, s = this.f, c = o[i];
if (n && t > 1 && (e = t > 8 ? (w[255 & e] << 24 | w[255 & e >>> 8] << 16 | w[255 & e >>> 16] << 8 | w[255 & e >>> 24]) >> 32 - t : w[e] >> 8 - t), 8 > t + s)
c = c << t | e, s += t;
else
for (a = 0; t > a; ++a)
c = c << 1 | 1 & e >> t - a - 1, 8 === ++s && (s = 0, o[i++] = w[c], c = 0, i === o.length && (o = r(this)));
o[i] = c, this.buffer = o, this.f = s, this.index = i
}, t.prototype.finish = function() {
var e, t = this.buffer, r = this.index;
return 0 < this.f && (t[r] <<= 8 - this.f, t[r] = w[t[r]], r++), m ? e = t.subarray(0, r) : (t.length = r, e = t), e
};
var y, _ = new (m ? Uint8Array : Array)(256);
for (y = 0; 256 > y; ++y) {
for (var A = y, v = A, b = 7, A = A >>> 1; A; A >>>= 1)
v <<= 1, v |= 1 & A, --b;
_[y] = (255 & v << b) >>> 0
}
var w = _, T = [0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117], S = m ? new Uint32Array(T) : T;
a.prototype.getParent = function(e) {
return 2 * (0 | (e - 2) / 4)
}, a.prototype.push = function(e, t) {
var r, n, a, o = this.buffer;
for (r = this.length, o[this.length++] = t, o[this.length++] = e; r > 0 && (n = this.getParent(r), o[r] > o[n]); )
a = o[r], o[r] = o[n], o[n] = a, a = o[r + 1], o[r + 1] = o[n + 1], o[n + 1] = a, r = n;
return this.length
}, a.prototype.pop = function() {
var e, t, r, n, a, o = this.buffer;
for (t = o[0], e = o[1], this.length -= 2, o[0] = o[this.length], o[1] = o[this.length + 1], a = 0; (n = 2 * a + 2, !(n >= this.length)) && (n + 2 < this.length && o[n + 2] > o[n] && (n += 2), o[n] > o[a]); )
r = o[a], o[a] = o[n], o[n] = r, r = o[a + 1], o[a + 1] = o[n + 1], o[n + 1] = r, a = n;
return {index: e,value: t,length: this.length}
};
var k, j = 2, I = [];
for (k = 0; 288 > k; k++)
switch (d) {
case 143 >= k:
I.push([k + 48, 8]);
break;
case 255 >= k:
I.push([k - 144 + 400, 9]);
break;
case 279 >= k:
I.push([k - 256 + 0, 7]);
break;
case 287 >= k:
I.push([k - 280 + 192, 8]);
break;
default:
throw "invalid literal: " + k
}
o.prototype.g = function() {
var e, r, n, a, o = this.input;
switch (this.h) {
case 0:
for (n = 0, a = o.length; a > n; ) {
r = m ? o.subarray(n, n + 65535) : o.slice(n, n + 65535), n += r.length;
var i = r, c = n === a, f = h, p = h, g = h, y = h, _ = h, A = this.a, v = this.c;
if (m) {
for (A = new Uint8Array(this.a.buffer); A.length <= v + i.length + 5; )
A = new Uint8Array(A.length << 1);
A.set(this.a)
}
if (f = c ? 1 : 0, A[v++] = 0 | f, p = i.length, g = 65535 & ~p + 65536, A[v++] = 255 & p, A[v++] = 255 & p >>> 8, A[v++] = 255 & g, A[v++] = 255 & g >>> 8, m)
A.set(i, v), v += i.length, A = A.subarray(0, v);
else {
for (y = 0, _ = i.length; _ > y; ++y)
A[v++] = i[y];
A.length = v
}
this.c = v, this.a = A
}
break;
case 1:
var b = new t(m ? new Uint8Array(this.a.buffer) : this.a, this.c);
b.b(1, 1, d), b.b(1, 2, d);
var w, T, S, k = s(this, o);
for (w = 0, T = k.length; T > w; w++)
if (S = k[w], t.prototype.b.apply(b, I[S]), S > 256)
b.b(k[++w], k[++w], d), b.b(k[++w], 5), b.b(k[++w], k[++w], d);
else if (256 === S)
break;
this.a = b.finish(), this.c = this.a.length;
break;
case j:
var x, O, R, D, N, P, E, C, U, L, M, q, F, K, J, B = new t(m ? new Uint8Array(this.a.buffer) : this.a, this.c), z = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], V = Array(19);
for (x = j, B.b(1, 1, d), B.b(x, 2, d), O = s(this, o), P = u(this.n, 15), E = l(P), C = u(this.m, 7), U = l(C), R = 286; R > 257 && 0 === P[R - 1]; R--)
;
for (D = 30; D > 1 && 0 === C[D - 1]; D--)
;
var H, G, Q, Y, $, X, Z = R, W = D, et = new (m ? Uint32Array : Array)(Z + W), tt = new (m ? Uint32Array : Array)(316), rt = new (m ? Uint8Array : Array)(19);
for (H = G = 0; Z > H; H++)
et[G++] = P[H];
for (H = 0; W > H; H++)
et[G++] = C[H];
if (!m)
for (H = 0, Y = rt.length; Y > H; ++H)
rt[H] = 0;
for (H = $ = 0, Y = et.length; Y > H; H += G) {
for (G = 1; Y > H + G && et[H + G] === et[H]; ++G)
;
if (Q = G, 0 === et[H])
if (3 > Q)
for (; 0 < Q--; )
tt[$++] = 0, rt[0]++;
else
for (; Q > 0; )
X = 138 > Q ? Q : 138, X > Q - 3 && Q > X && (X = Q - 3), 10 >= X ? (tt[$++] = 17, tt[$++] = X - 3, rt[17]++) : (tt[$++] = 18, tt[$++] = X - 11, rt[18]++), Q -= X;
else if (tt[$++] = et[H], rt[et[H]]++, Q--, 3 > Q)
for (; 0 < Q--; )
tt[$++] = et[H], rt[et[H]]++;
else
for (; Q > 0; )
X = 6 > Q ? Q : 6, X > Q - 3 && Q > X && (X = Q - 3), tt[$++] = 16, tt[$++] = X - 3, rt[16]++, Q -= X
}
for (e = m ? tt.subarray(0, $) : tt.slice(0, $), L = u(rt, 7), K = 0; 19 > K; K++)
V[K] = L[z[K]];
for (N = 19; N > 4 && 0 === V[N - 1]; N--)
;
for (M = l(L), B.b(R - 257, 5, d), B.b(D - 1, 5, d), B.b(N - 4, 4, d), K = 0; N > K; K++)
B.b(V[K], 3, d);
for (K = 0, J = e.length; J > K; K++)
if (q = e[K], B.b(M[q], L[q], d), q >= 16) {
switch (K++, q) {
case 16:
F = 2;
break;
case 17:
F = 3;
break;
case 18:
F = 7;
break;
default:
throw "invalid code: " + q
}
B.b(e[K], F, d)
}
var nt, at, ot, it, st, ct, ut, ft, lt = [E, P], pt = [U, C];
for (st = lt[0], ct = lt[1], ut = pt[0], ft = pt[1], nt = 0, at = O.length; at > nt; ++nt)
if (ot = O[nt], B.b(st[ot], ct[ot], d), ot > 256)
B.b(O[++nt], O[++nt], d), it = O[++nt], B.b(ut[it], ft[it], d), B.b(O[++nt], O[++nt], d);
else if (256 === ot)
break;
this.a = B.finish(), this.c = this.a.length;
break;
default:
throw "invalid compression type"
}
return this.a
};
var x = function() {
function e(e) {
switch (d) {
case 3 === e:
return [257, e - 3, 0];
case 4 === e:
return [258, e - 4, 0];
case 5 === e:
return [259, e - 5, 0];
case 6 === e:
return [260, e - 6, 0];
case 7 === e:
return [261, e - 7, 0];
case 8 === e:
return [262, e - 8, 0];
case 9 === e:
return [263, e - 9, 0];
case 10 === e:
return [264, e - 10, 0];
case 12 >= e:
return [265, e - 11, 1];
case 14 >= e:
return [266, e - 13, 1];
case 16 >= e:
return [267, e - 15, 1];
case 18 >= e:
return [268, e - 17, 1];
case 22 >= e:
return [269, e - 19, 2];
case 26 >= e:
return [270, e - 23, 2];
case 30 >= e:
return [271, e - 27, 2];
case 34 >= e:
return [272, e - 31, 2];
case 42 >= e:
return [273, e - 35, 3];
case 50 >= e:
return [274, e - 43, 3];
case 58 >= e:
return [275, e - 51, 3];
case 66 >= e:
return [276, e - 59, 3];
case 82 >= e:
return [277, e - 67, 4];
case 98 >= e:
return [278, e - 83, 4];
case 114 >= e:
return [279, e - 99, 4];
case 130 >= e:
return [280, e - 115, 4];
case 162 >= e:
return [281, e - 131, 5];
case 194 >= e:
return [282, e - 163, 5];
case 226 >= e:
return [283, e - 195, 5];
case 257 >= e:
return [284, e - 227, 5];
case 258 === e:
return [285, e - 258, 0];
default:
throw "invalid length: " + e
}
}
var t, r, n = [];
for (t = 3; 258 >= t; t++)
r = e(t), n[t] = r[2] << 24 | r[1] << 16 | r[0];
return n
}(), O = m ? new Uint32Array(x) : x;
p.prototype.g = function() {
var e, t, r, a, i, s, c, u, f = new (m ? Uint8Array : Array)(32768), l = 0, p = this.input, d = this.i, g = this.filename, y = this.l;
if (f[l++] = 31, f[l++] = 139, f[l++] = 8, e = 0, this.d.fname && (e |= N), this.d.fcomment && (e |= P), this.d.fhcrc && (e |= D), f[l++] = e, t = 0 | (Date.now ? Date.now() : +new Date) / 1e3, f[l++] = 255 & t, f[l++] = 255 & t >>> 8, f[l++] = 255 & t >>> 16, f[l++] = 255 & t >>> 24, f[l++] = 0, f[l++] = R, this.d.fname !== h) {
for (c = 0, u = g.length; u > c; ++c)
s = g.charCodeAt(c), s > 255 && (f[l++] = 255 & s >>> 8), f[l++] = 255 & s;
f[l++] = 0
}
if (this.d.comment) {
for (c = 0, u = y.length; u > c; ++c)
s = y.charCodeAt(c), s > 255 && (f[l++] = 255 & s >>> 8), f[l++] = 255 & s;
f[l++] = 0
}
return this.d.fhcrc && (r = 65535 & n(f, 0, l), f[l++] = 255 & r, f[l++] = 255 & r >>> 8), this.e.outputBuffer = f, this.e.outputIndex = l, i = new o(p, this.e), f = i.g(), l = i.c, m && (l + 8 > f.buffer.byteLength ? (this.a = new Uint8Array(l + 8), this.a.set(new Uint8Array(f.buffer)), f = this.a) : f = new Uint8Array(f.buffer)), a = n(p, h, h), f[l++] = 255 & a, f[l++] = 255 & a >>> 8, f[l++] = 255 & a >>> 16, f[l++] = 255 & a >>> 24, u = p.length, f[l++] = 255 & u, f[l++] = 255 & u >>> 8, f[l++] = 255 & u >>> 16, f[l++] = 255 & u >>> 24, this.i = d, m && l < f.length && (this.a = f = f.subarray(0, l)), f
};
var R = 255, D = 2, N = 8, P = 16;
e("Zlib.Gzip", p), e("Zlib.Gzip.prototype.compress", p.prototype.g)
}.call(this), baidu.frontia.util = {}, function(namespace_) {
var now = +new Date, util = {};
util.guid = function() {
return "baidu_frontia_" + now++
}, util.mix = function(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
if (r)
for (var n in r)
r.hasOwnProperty(n) && (e[n] = r[n])
}
return e
}, util.noop = function() {
}, util.parseJSON = function(text) {
return window.JSON && "function" == typeof JSON.parse ? JSON.parse(text) : eval("(" + text + ")")
};
var whitespace = /(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+$)/g;
util.trim = function(e) {
return e.replace(whitespace, "")
}, util.encodeHTML = function(e) {
return e += "", e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;")
}, util.serializeURL = function(e) {
if (!e)
return "";
var t = "";
for (var r in e)
if (e.hasOwnProperty(r)) {
var n = e[r];
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(n)
}
return t.slice(1)
}, function(e) {
"use strict";
if (!e.Base64) {
var t, r = "2.1.2";
"undefined" != typeof module && module.exports && (t = require("buffer").Buffer);
var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = function(e) {
for (var t = {}, r = 0, n = e.length; n > r; r++)
t[e.charAt(r)] = r;
return t
}(n), o = String.fromCharCode, i = function(e) {
if (e.length < 2) {
var t = e.charCodeAt(0);
return 128 > t ? e : 2048 > t ? o(192 | t >>> 6) + o(128 | 63 & t) : o(224 | 15 & t >>> 12) + o(128 | 63 & t >>> 6) + o(128 | 63 & t)
}
var t = 65536 + 1024 * (e.charCodeAt(0) - 55296) + (e.charCodeAt(1) - 56320);
return o(240 | 7 & t >>> 18) + o(128 | 63 & t >>> 12) + o(128 | 63 & t >>> 6) + o(128 | 63 & t)
}, s = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, c = function(e) {
return e.replace(s, i)
}, u = function(e) {
var t = [0, 2, 1][e.length % 3], r = e.charCodeAt(0) << 16 | (e.length > 1 ? e.charCodeAt(1) : 0) << 8 | (e.length > 2 ? e.charCodeAt(2) : 0), a = [n.charAt(r >>> 18), n.charAt(63 & r >>> 12), t >= 2 ? "=" : n.charAt(63 & r >>> 6), t >= 1 ? "=" : n.charAt(63 & r)];
return a.join("")
}, f = e.btoa || function(e) {
return e.replace(/[\s\S]{1,3}/g, u)
}, l = t ? function(e) {
return new t(e).toString("base64")
} : function(e) {
return f(c(e))
}, p = function(e, t) {
return t ? l(e).replace(/[+\/]/g, function(e) {
return "+" == e ? "-" : "_"
}).replace(/=/g, "") : l(e)
}, h = function(e) {
return p(e, !0)
}, d = new RegExp(["[À-ß][€-¿]", "[à-ï][€-¿]{2}", "[ð-÷][€-¿]{3}"].join("|"), "g"), g = function(e) {
switch (e.length) {
case 4:
var t = (7 & e.charCodeAt(0)) << 18 | (63 & e.charCodeAt(1)) << 12 | (63 & e.charCodeAt(2)) << 6 | 63 & e.charCodeAt(3), r = t - 65536;
return o((r >>> 10) + 55296) + o((1023 & r) + 56320);
case 3:
return o((15 & e.charCodeAt(0)) << 12 | (63 & e.charCodeAt(1)) << 6 | 63 & e.charCodeAt(2));
default:
return o((31 & e.charCodeAt(0)) << 6 | 63 & e.charCodeAt(1))
}
}, m = function(e) {
return e.replace(d, g)
}, y = function(e) {
var t = e.length, r = t % 4, n = (t > 0 ? a[e.charAt(0)] << 18 : 0) | (t > 1 ? a[e.charAt(1)] << 12 : 0) | (t > 2 ? a[e.charAt(2)] << 6 : 0) | (t > 3 ? a[e.charAt(3)] : 0), i = [o(n >>> 16), o(255 & n >>> 8), o(255 & n)];
return i.length -= [0, 0, 2, 1][r], i.join("")
}, _ = e.atob || function(e) {
return e.replace(/[\s\S]{1,4}/g, y)
}, A = t ? function(e) {
return new t(e, "base64").toString()
} : function(e) {
return m(_(e))
}, v = function(e) {
return A(e.replace(/[-_]/g, function(e) {
return "-" == e ? "+" : "/"
}).replace(/[^A-Za-z0-9\+\/]/g, ""))
};
e.mix(e, {VERSION: r,atob: _,btoa: f,fromBase64: v,toBase64: p,utob: c,encode: p,encodeURI: h,btou: m,decode: v})
}
}(util), util.isBoolean = function(e) {
return e === !0 || e === !1 || "[object Boolean]" == toString.call(e)
}, namespace_.util = util
}(baidu.frontia), baidu.frontia.ajax = {}, function(e) {
function t(e, t) {
var r = a.serializeURL(t);
if (r) {
var n = e.indexOf("?") >= 0 ? "&" : "?";
return e + n + r
}
return e
}
function r(e, t) {
null == t && (t = "");
var a = n.hooks.serializeData.getKey, o = e ? encodeURIComponent(e) : "", i = Object.prototype.toString.call(t);
switch (i) {
case "[object Array]":
for (var s = [], c = 0; c < t.length; c++) {
var u = t[c];
s[c] = r("", u)
}
return o ? o + "=" + s.join(",") : s.join(",");
case "[object Object]":
var f = [];
for (var l in t) {
var p = a(l, e), h = r(p, t[l]);
f.push(h)
}
return f.join("&");
default:
return o ? o + "=" + encodeURIComponent(t) : encodeURIComponent(t)
}
}
var n = {}, a = e.util;
n.hooks = {}, n.hooks.serializeData = function(e) {
return r("", e)
}, n.hooks.serializeData.getKey = function(e, t) {
return t ? t + "." + e : e
}, n.request = function(e) {
var r = {method: "POST",data: {},cache: !0,callback: function() {
},onerror: function() {
}};
e = a.mix(r, e);
var o, i = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
i.onreadystatechange = function() {
if (4 === i.readyState) {
clearTimeout(o);
var t = i.status;
if (0 === t ? t = 200 : 1223 === t && (t = 204), 200 > t || t >= 300 && 304 !== t)
return e.onerror(i), void 0;
var r = i.responseText;
if ("json" === e.dataType)
try {
r = a.parseJSON(r)
} catch (n) {
return e.onerror(i, n), void 0
}
e.callback(r)
}
};
var s = e.method.toUpperCase(), c = {};
"GET" === s && a.mix(c, e.data), e.cache === !1 && (c._ = +new Date);
var u = t(e.url, c);
if (i.open(s, u, !0), e.header) {
var f;
for (f in e.header)
e.header.hasOwnProperty(f) && i.setRequestHeader(f, e.header[f])
}
if ("GET" === s)
i.send();
else {
var l = e.contentType || "application/x-www-form-urlencoded";
i.setRequestHeader("Content-type", l);
var p = n.hooks.serializeData(e.data);
i.send(p), i.send(e.data)
}
return e.timeout > 0 && (o = setTimeout(function() {
i.status = 408, e.onerror(i)
}, e.timeout)), i
}, n.get = function(e, t, r) {
var o = {method: "GET",url: e,data: t,cache: !1};
return r = a.mix(o, r), n.request(r)
}, n.getJSON = function(e, t, r) {
var o = {method: "GET",url: e,data: t,dataType: "json",cache: cache || !1};
return r = a.mix(o, r), n.request(r)
}, n.request1 = function(e) {
var r = {method: "POST",data: {},cache: !0,callback: function() {
},onerror: function() {
}};
e = a.mix(r, e);
var o, i = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
i.onreadystatechange = function() {
if (4 === i.readyState) {
clearTimeout(o);
var t = i.status;
if (0 === t ? t = 200 : 1223 === t && (t = 204), 200 > t || t >= 300 && 304 !== t)
return e.onerror(i), void 0;
var r = i.responseText;
if ("json" === e.dataType && r)
try {
r = a.parseJSON(r)
} catch (n) {
return e.onerror(i, n), void 0
}
e.callback(r)
}
};
var s = e.method.toUpperCase(), c = {};
"GET" === s && a.mix(c, e.data), e.cache === !1 && (c._ = +new Date);
var u = t(e.url, c);
if (i.open(s, u, !0), e.header) {
var f;
for (f in e.header)
e.header.hasOwnProperty(f) && i.setRequestHeader(f, e.header[f])
}
if ("GET" === s)
i.send();
else if (e.contentLength && i.setRequestHeader("Content-Length", e.contentLength), "multipart/form-data" === e.contentType)
i.send(e.data);
else if ("application/json" === e.contentType)
i.setRequestHeader("Content-type", e.contentType), i.send(e.data);
else if ("application/octet-stream" === e.contentType)
i.setRequestHeader("Content-type", e.contentType), i.send(e.data);
else {
var l = e.contentType || "application/x-www-form-urlencoded";
i.setRequestHeader("Content-type", l);
var p = n.hooks.serializeData(e.data);
i.send(p)
}
return e.timeout > 0 && (o = setTimeout(function() {
i.status = 408, e.onerror(i)
}, e.timeout)), i
}, n.post = function(e, t, r, o) {
var i = {method: "POST",url: e,data: t,dataType: r || "json"};
return o = a.mix(i, o), n.request1(o)
}, n.put = function(e, t, r, o) {
var i = {method: "PUT",url: e,data: t,dataType: r || "json"};
return o = a.mix(i, o), n.request1(o)
}, e.ajax = n
}(baidu.frontia), baidu.frontia.jsonp = {}, function(e) {
e.jsonp = function() {
function e(e, t) {
var r = document.createElement("script"), n = !1;
r.src = e, r.async = !0;
var o = t || s.error;
"function" == typeof o && (r.onerror = function(t) {
o({url: e,event: t})
}), r.onload = r.onreadystatechange = function() {
n || this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState || (n = !0, r.onload = r.onreadystatechange = null, r && r.parentNode && r.parentNode.removeChild(r))
}, a || (a = document.getElementsByTagName("head")[0]), a.appendChild(r)
}
function t(e) {
return encodeURIComponent(e)
}
function r(r, n, a, c, u) {
var f, l = -1 === (r || "").indexOf("?") ? "?" : "&";
u = u || s.callbackName || "callback";
var p = "baidu_frontia_" + u + "_json" + ++o;
n = n || {};
for (f in n)
n.hasOwnProperty(f) && (l += t(f) + "=" + t(n[f]) + "&");
return i[p] = function(e) {
a(e);
try {
delete i[p]
} catch (t) {
}
i[p] = null
}, e(r + l + u + "=" + p, c), p
}
function n(e) {
s = e
}
var a, o = 0, i = this, s = {};
return {get: r,init: n}
}()
}(baidu.frontia), baidu.frontia.Account = baidu.frontia.Account || {}, baidu.frontia.User = baidu.frontia.User || {}, baidu.frontia.Role = baidu.frontia.Role || {}, baidu.frontia.ACL = baidu.frontia.ACL || {}, function(e) {
function t(t) {
var r = e.util.toBase64("Application:" + t);
return "Basic " + r
}
function r(t) {
var r = {application_info: [{app_frontia_version: e.version,app_appid: e.getApiKey(),user_id: e.getCurrentAccount().getId() || "",frontia_action: [{action_name: "",timestamp: null,restimestamp: null,err_code: "",err_msg: ""}]}]};
r.application_info[0].frontia_action[0] = t;
var n = {}, a = new Zlib.Gzip(new Uint8Array(JSON.stringify(r).split("").map(function(e) {
return e.charCodeAt(0)
}))), o = a.compress();
n.stats = btoa(String.fromCharCode.apply(null, o));
var i = e.ajax;
i.post(c, JSON.stringify(n), "json", {contentType: "application/json"})
}
function n() {
var e = Math.floor((new Date).getTime() / 1e3);
return e
}
var a = e.error, o = e.ERR_MSG, i = e.DomainManager.getFrontiaDomain() + "/role", s = e.DomainManager.getFrontiaDomain() + "/user", c = e.DomainManager.getPBLogDomain() + "/pushlog";
e.Account = e.Object.extend({accountId: null,accountType: null,accountName: null,constructor: function(e, t, r) {
if (!e || "string" != typeof e && "number" != typeof e)
throw new a(o.INVALID_PARAMS, "[construct Role/User]: accountId is invalid, the typeof accountId is string or number");
this.accountType = t, this.accountId = e, this.accountName = r
},getId: function() {
return this.accountId
},getType: function() {
return this.accountType
},getName: function() {
return this.accountName
}}), e.User = e.Account.extend({accessToken: null,expirationIn: null,mediaType: null,constructor: function(t) {
t = t || {}, this.accessToken = t.accessToken, this.expiresIn = t.expiresIn, this.mediaType = t.mediaType, e.Account.prototype.constructor.call(this, t.socialId, "user", t.name)
},getAccessToken: function() {
return this.accessToken
},getExpiresIn: function() {
return this.expiresIn
},getMediaType: function() {
return this.mediaType
},getDetailInfo: function(t) {
t = t || {}, t.error || (t.error = function() {
}), t.success || (t.success = function() {
}), e.User.find({userId: this.accountId}, {error: function(e) {
t.error(e)
},success: function(e) {
0 === e.count ? t.error(new a({Code: "1701",Message: "user not exists"})) : t.success(e.result[0])
}})
},toJSON: function() {
return {socialId: this.getId(),name: this.getName(),type: this.getType(),mediaType: this.getMediaType(),expiresIn: this.getExpiresIn(),accessToken: this.getAccessToken()}
}});
var u = {options: {error: function() {
},success: function() {
}},_configure: function(e) {
e = e || {}, e.error && (this.options.error = e.error), e.success && (this.options.success = e.success)
},_checkParams: function(t, r) {
var n = this;
return t.every(function(t) {
return "string" !== t.type || t.value && "string" == typeof t.value ? "role" !== t.type || t.value && t.value instanceof e.Role ? "array" !== t.type || t.value && "Array" === Object.prototype.toString.call(t.value).slice(8, -1) ? !0 : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: targets is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: role is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: target is invalid")), !1)
})
},find: function(o, i) {
var c = {};
c.action_name = "User.list", c.timestamp = n();
var u = this;
if (1 === arguments.length)
var i = o;
i || (i = {}), u._configure(i);
var f = {};
o.mediaType && (f.media_type = o.mediaType), o.sex && (f.sex = o.sex), o.userId && (f.user_id = o.userId), o.userName && (f.username = o.userName);
var l = u._attachAccount({method: "list",criteria: f}), p = u._createAjaxOpt(c, {header: {authorization: t(e.getApiKey())},contentType: "application/json"});
p.callback = function(t) {
if (t.error_code) {
var o = new a(t);
u.options.error(o), c.err_code = o.code, c.err_msg = o.message
} else {
var i = [];
t.response_params.users.forEach(function(t) {
var r = new e.User({socialId: t.user_id,mediaType: t.media_type,name: t.username});
r.extra = t;
i.push(r);
}), u.options.success({result: i,count: t.response_params.count}), c.err_code = 0
}
c.restimestamp = n(), r(c)
};
var h = e.ajax;
h.post(s, JSON.stringify(l), "json", p)
},_attachAccount: function(t) {
var r = null;
return e.currentAccount && e.currentAccount instanceof e.Role && e.currentAccount.getId() ? (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getId()) : e.currentAccount && e.currentAccount instanceof e.User && e.currentAccount.getAccessToken() && (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getAccessToken()), t
},_createAjaxOpt: function(t, o) {
var i = this, s = {callback: function(e) {
if (e.error_code) {
var o = new a(e);
i.options.error(o), t.err_code = o.code, t.err_msg = o.message
} else
i.options.success(e), t.err_code = 0;
t.restimestamp = n(), r(t)
},onerror: function(o, s) {
try {
var c = e.util.parseJSON(o.responseText)
} catch (u) {
return i.options.error(u, o), void 0
}
var s = new a(c);
i.options.error(new a(c), o), t.err_code = s.code, t.err_msg = s.message, t.restimestamp = n(), r(t)
}};
return e.util.mix(s, o)
}};
e.util.mix(e.User, u), e.Role = e.Account.extend({roleList: {},constructor: function(t, r) {
var n = this;
n.roleList = {}, Array.isArray(r) && r.forEach(function(t) {
if (!(t instanceof e.User || t instanceof e.Role))
throw new a(o.INVALID_PARAMS, "[construct Role]: account is invalid");
n.roleList[t.getId()] = t
}), e.Account.prototype.constructor.call(this, t, "role", t)
},add: function(t) {
if (!(t instanceof e.User || t instanceof e.Role))
throw new a(o.INVALID_PARAMS, "[add Role]: account is invalid");
this.roleList[t.getId()] = t
},"delete": function(e) {
delete this.roleList[e]
},getInfo: function() {
var e = [];
for (var t in this.roleList)
this.roleList.hasOwnProperty(t) && e.push(this.roleList[t].getType() + ":" + this.roleList[t].getId());
return e
},toJSON: function() {
return {roleId: this.getId(),name: this.getName(),memberList: this.getInfo()}
}});
var f = {options: {error: function() {
},success: function() {
}},_configure: function(e) {
e = e || {}, e.error && (this.options.error = e.error), e.success && (this.options.success = e.success)
},_checkParams: function(t, r) {
var n = this;
return t.every(function(t) {
return "string" !== t.type || t.value && "string" == typeof t.value ? "role" !== t.type || t.value && t.value instanceof e.Role ? "array" !== t.type || t.value && "Array" === Object.prototype.toString.call(t.value).slice(8, -1) ? !0 : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: targets is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: role is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: target is invalid")), !1)
})
},remove: function(r, a) {
var o = {};
o.action_name = "Role.remove", o.timestamp = n();
var s = this;
if (a = a || {}, s._configure(a), s._checkParams([{value: r,type: "string"}], "Role remove")) {
var c = s._attachAccount({method: "remove",role_id: r}), u = s._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), f = e.ajax;
f.post(i, JSON.stringify(c), "json", u)
}
},get: function(r, a) {
var o = {};
o.action_name = "Role.get", o.timestamp = n();
var s = this;
if (a = a || {}, s._configure(a), s._checkParams([{value: r,type: "string"}], "Role get")) {
var c = s._attachAccount({method: "describe",role_id: r}), u = s._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), f = e.ajax;
f.post(i, JSON.stringify(c), "json", u)
}
},save: function(r, a) {
var o = {};
o.action_name = "Role.save", o.timestamp = n();
var s = this;
if (a = a || {}, s._configure(a), s._checkParams([{value: r,type: "role"}], "Role save")) {
var c = r.getInfo(), u = s._attachAccount({method: "create",role_id: r.getId(),child: c}), f = r.getACL();
f && (u._acl = f.toJSON());
var l = s._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), p = e.ajax;
p.post(i, JSON.stringify(u), "json", l)
}
},update: function(r, s) {
var c = {};
c.action_name = "Role.update", c.timestamp = n();
var u = this, f = null;
if (s = s || {}, u._configure(s), u._checkParams([{value: r,type: "string"}], "Role update")) {
var l = u._attachAccount({method: "modify",role_id: r});
if (s.acl && s.acl instanceof e.ACL && (l._acl = s.acl.toJSON()), f = "add" === s.update_type ? "push_child" : "del" === s.update_type ? "pull_child" : "set" === s.update_type ? "set_child" : null) {
var p = [];
s.accounts.forEach(function(t) {
if (!(t instanceof e.User || t instanceof e.Role))
throw new a(o.INVALID_PARAMS, "[update Role]: account is invalid");
p.push(t.getType() + ":" + t.getId())
}), l[f] = p
}
var h = u._createAjaxOpt(c, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), d = e.ajax;
d.post(i, JSON.stringify(l), "json", h)
}
},list: function(o) {
var s = {};
s.action_name = "Role.list", s.timestamp = n();
var c = this;
o = o || {}, c._configure(o);
var u = c._attachAccount({method: "list"}), f = c._createAjaxOpt(s, {header: {authorization: t(e.getApiKey())},contentType: "application/json"});
f.callback = function(t) {
if (t.error_code) {
var o = new a(t);
c.options.error(o), s.err_code = o.code, s.err_msg = o.message
} else {
var i = [];
t.response_params.roles.forEach(function(t) {
var r = new e.ACL;
t._acl && (r._setPermission(t._acl), delete t._acl);
var n = new e.Role(t.role_id);
t.child.forEach(function(t) {
var r = t.split(":");
"user" === r[0] ? n.add(new e.User({socialId: r[1]})) : n.add(new e.Role(r[1]))
}), i.push(n)
}), c.options.success({result: i,count: t.response_params.count}), s.err_code = 0
}
s.restimestamp = n(), r(s)
};
var l = e.ajax;
l.post(i, JSON.stringify(u), "json", f)
},_attachAccount: function(t) {
var r = null;
return e.currentAccount && e.currentAccount instanceof e.Role && e.currentAccount.getId() ? (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getId()) : e.currentAccount && e.currentAccount instanceof e.User && e.currentAccount.getAccessToken() && (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getAccessToken()), t
},_createAjaxOpt: function(t, o) {
var i = this, s = {callback: function(e) {
if (e.error_code) {
var o = new a(e);
i.options.error(o), t.err_code = o.code, t.err_msg = o.message
} else
i.options.success(e), t.err_code = 0;
t.restimestamp = n(), r(t)
},onerror: function(o, s) {
try {
var c = e.util.parseJSON(o.responseText)
} catch (u) {
return i.options.error(u, o), void 0
}
var s = new a(c);
i.options.error(s, o), t.err_code = s.code, t.err_msg = s.message, t.restimestamp = n(), r(t)
}};
return e.util.mix(s, o)
}};
e.util.mix(e.Role, f), e.ACL = e.Base.extend({permissions: null,constructor: function() {
this.permissions = {}
},_setAccess: function(t, r, n) {
if (!(r instanceof e.User || r instanceof e.Role))
throw new a(o.INVALID_PARAMS, "[setAccess]: account is invalid");
if (!e.util.isBoolean(n))
throw new a(o.INVALID_PARAMS, "[setAccess]: allowed is invalid");
var i = [r.getType(), ":", r.getId()].join("");
this.permissions[i] = this.permissions[i] || {}, this.permissions[i][t] = n
},_isAccess: function(t, r) {
if (!(r instanceof e.User || r instanceof e.Role))
throw new a(o.INVALID_PARAMS, "[isAccess]: account is invalid");
if (this.permissions["role:*"] && this.permissions["role:*"][t])
return !0;
var n = [r.getType(), ":", r.getId()].join(""), i = this.permissions[n];
return i ? i[t] : !1
},_setPermission: function(e) {
this.permissions = {};
for (var t in e)
if (e.hasOwnProperty(t))
switch (e[t]) {
case 1:
this.permissions[t] = this.permissions[t] || {}, this.permissions[t].write = !0;
break;
case 2:
this.permissions[t] = this.permissions[t] || {}, this.permissions[t].read = !0;
break;
case 3:
this.permissions[t] = this.permissions[t] || {}, this.permissions[t].write = !0, this.permissions[t].read = !0
}
},setReadAccess: function(e, t) {
this._setAccess("read", e, t)
},setPublicReadAccess: function(t) {
var r = new e.Role("*");
this._setAccess("read", r, t)
},setWriteAccess: function(e, t) {
this._setAccess("write", e, t)
},setPublicWriteAccess: function(t) {
var r = new e.Role("*");
this._setAccess("write", r, t)
},isReadAccess: function(e) {
this._isAccess("read", e)
},isWriteAccess: function(e) {
this._isAccess("write", e)
},toJSON: function() {
var e = {};
for (var t in this.permissions)
if (this.permissions.hasOwnProperty(t)) {
var r = this.permissions[t];
e[t] = (r.read ? 2 : 0) + (r.write ? 1 : 0)
}
return e
}})
}(baidu.frontia), baidu.frontia.social = baidu.frontia.social || {}, function(e) {
function t(e) {
return encodeURIComponent(e + "")
}
function r(e, r, n, a, o, i, s, c) {
var u = f + "?" + "response_type=" + r + "&" + "client_id=" + e + "&" + "media_type=" + n + "&" + "redirect_uri=" + t(a);
return o && (u += "&state=" + o), i && (u += "&display=" + i), s && (u += "&client_type=" + s), c && (u += "&scope=" + c), u + "&secure=1"
}
function n(t) {
var n = e.getApiKey(), a = r(n, t.response_type, t.media_type, t.redirect_uri, t.state, t.display, t.client_type, t.scope);
return a
}
function a() {
function e() {
var e = {};
if (t) {
var r = t.indexOf("#");
if (-1 !== r) {
var n = t.slice(r + 1);
if (n) {
var a = n.split("&");
a.forEach(function(t) {
var r = t.split("=");
e[r[0]] = r[1]
})
}
}
}
return e
}
var t = location.hash, r = e();
return {access_token: r.access_token,expires_in: r.expires_in,media_type: r.media_type}
}
function o(t) {
var r = null;
return e.currentAccount && e.currentAccount instanceof e.Role && e.currentAccount.getId() ? (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getId()) : e.currentAccount && e.currentAccount instanceof e.User && e.currentAccount.getAccessToken() && (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getAccessToken()), t
}
function i(t) {
var r = e.util.toBase64("Application:" + t);
return "Basic " + r
}
function s(t) {
var r = {application_info: [{app_frontia_version: e.version,app_appid: e.getApiKey(),user_id: e.getCurrentAccount().getId() || "",frontia_action: [{action_name: "",timestamp: null,restimestamp: null,err_code: "",err_msg: ""}]}]};
r.application_info[0].frontia_action[0] = t;
var n = {}, a = new Zlib.Gzip(new Uint8Array(JSON.stringify(r).split("").map(function(e) {
return e.charCodeAt(0)
}))), o = a.compress();
n.stats = btoa(String.fromCharCode.apply(null, o));
var i = e.ajax;
i.post(p, JSON.stringify(n), "json", {contentType: "application/json"})
}
function c() {
var e = Math.floor((new Date).getTime() / 1e3);
return e
}
var u = e.error, f = e.DomainManager.getSocialDomain() + "/social/oauth/2.0/authorize", l = e.DomainManager.getSocialDomain() + "/social/api/2.0/user/info", p = e.DomainManager.getPBLogDomain() + "/pushlog", h = e.DomainManager.getFrontiaDomain() + "/user", d = {TOKEN: "token",CODE: "code"}, g = {setLoginCallback: function(t) {
var r = a();
if (!e.getCurrentAccount() && r.access_token && t) {
var n = {};
n.action_name = "social.login", n.timestamp = c(), t.success || (t.success = function() {
}), t.error || (t.error = function() {
}), e.jsonp.get(l, {access_token: r.access_token}, function(a) {
if (a.error_code) {
var f = new u(a);
t.error(f), n.err_code = f.code, n.err_msg = f.message
} else {
var l = new e.User({socialId: a.social_uid,name: a.username,accessToken: r.access_token,expiresIn: r.expires_in,mediaType: r.media_type});
e.setCurrentAccount(l);
var p = o({method: "register"}), d = {header: {authorization: i(e.getApiKey())},contentType: "application/json"}, g = e.ajax;
g.post(h, JSON.stringify(p), "json", d), t.success(l), n.err_code = 0
}
n.restimestamp = c(), s(n)
}, function() {
})
}
},login: function(t) {
if (e.logOutCurrentAccount(), !t)
throw new baidu.frontia.error(baidu.frontia.ERR_MSG.INVALID_PARAMS);
if (t.error = t.error || function() {
}, !t.response_type)
throw new baidu.frontia.error(baidu.frontia.ERR_MSG.INVALID_PARAMS);
if (!t.media_type)
throw new baidu.frontia.error(baidu.frontia.ERR_MSG.INVALID_PARAMS);
if (t.response_type != d.TOKEN)
throw new baidu.frontia.error(baidu.frontia.ERR_MSG.INVALID_PARAMS);
var r = n(t);
location.href = r
}};
e.social = g
}(baidu.frontia), baidu.frontia.storage = baidu.frontia.storage || {}, function(e) {
function t(t) {
var r = e.util.toBase64("Application:" + t);
return "Basic " + r
}
function r(t) {
var r = {application_info: [{app_frontia_version: e.version,app_appid: e.getApiKey(),user_id: e.getCurrentAccount().getId() || "",frontia_action: [{action_name: "",timestamp: null,restimestamp: null,err_code: "",err_msg: ""}]}]};
r.application_info[0].frontia_action[0] = t;
var n = {}, a = new Zlib.Gzip(new Uint8Array(JSON.stringify(r).split("").map(function(e) {
return e.charCodeAt(0)
}))), o = a.compress();
n.stats = btoa(String.fromCharCode.apply(null, o));
var i = e.ajax;
i.post(c, JSON.stringify(n), "json", {contentType: "application/json"})
}
function n() {
var e = Math.floor((new Date).getTime() / 1e3);
return e
}
var a = e.error, o = e.ERR_MSG, i = e.DomainManager.getFrontiaDomain() + "/bss/document", s = e.DomainManager.getFrontiaDomain() + "/bcs/object", c = e.DomainManager.getPBLogDomain() + "/pushlog";
e.File = e.Object.extend({constructor: function(t, r, n) {
if (t && !(t instanceof File))
throw new a(o.INVALID_PARAMS, "[baidu.frontia.File.constructor]: file is invalid");
this.file = t, this.target = r, this.detail = null, e.Object.prototype.constructor.call(this, n)
},getFileInfo: function() {
return this.detail
},_getFile: function() {
return this.file
},_getTarget: function() {
return this.target
},_setFileInfo: function(e) {
this.detail = e
}}), e.Data = e.Object.extend({constructor: function(t, r) {
this.obj = t || {}, e.Object.prototype.constructor.call(this, r)
},getData: function() {
return this.obj
}});
var u = {options: {error: function() {
},success: function() {
}},_configure: function(e) {
e = e || {}, e.error && (this.options.error = e.error), e.success && (this.options.success = e.success)
},_checkParams: function(t, r) {
var n = this;
return t.every(function(t) {
return "file" !== t.type || t.value && t.value instanceof e.File ? "string" !== t.type || t.value && "string" == typeof t.value ? "array" !== t.type || t.value && "Array" === Object.prototype.toString.call(t.value).slice(8, -1) ? "query" !== t.type || t.value && t.value instanceof u.Query ? "data" !== t.type || t.value && t.value instanceof e.Data ? !0 : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: data is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: query is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: targets is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: target is invalid")), !1) : (n.options.error(new a(o.INVALID_PARAMS, "[" + r + "]: file is null or not typeof File of baidu.frontia")), !1)
})
},uploadFile: function(o, i) {
var c = {};
c.action_name = "storage.uploadFile", c.timestamp = n();
var u = this;
if (i = i || {}, u._configure(i), u._checkParams([{value: o,type: "file"}], "storage.uploadFile")) {
var f = {file: o._getFile(),acl: o._getACLInfo(),target: o._getTarget()}, l = u._attachAccount({method: "getuploadurl"}), p = e.ajax;
p.post(s, JSON.stringify(l), "json", {header: {authorization: t(e.getApiKey())},contentType: "application/json",callback: function(o) {
if (o.error_code)
u.options.error(new a(o));
else {
var i = o.response_params.url + "&dumpheader=1", l = new FileReader;
l.onload = function() {
var o = l.result;
p.put(i, o, "json", {contentType: "application/octet-stream",callback: function(r) {
if (0 !== r.Error.Code)
u.options.error(new a(r.Error));
else {
var n = u._createAjaxOpt(c, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), o = u._attachAccount({method: "create",md5s: [r.Header["Content-MD5"]],object: f.target,_acl: f.acl});
p.post(s, JSON.stringify(o), "json", n)
}
},onerror: function(e, t) {
try {
var o = JSON.parse(e.responseText)
} catch (i) {
return u.options.error(i, e), void 0
}
var t = new a(o.Error);
u.options.error(t, e), c.err_code = t.code, c.err_msg = t.message, c.restimestamp = n(), r(c)
}})
}, l.readAsArrayBuffer(f.file)
}
},onerror: function(e, t) {
try {
var o = JSON.parse(e.responseText)
} catch (i) {
return u.options.error(i, e), void 0
}
var t = new a(o);
u.options.error(t, e), c.err_code = t.code, c.err_msg = t.message, c.restimestamp = n(), r(c)
}})
}
},getFileUrl: function(r, a) {
var o = {};
o.action_name = "storage.getFileUrl", o.timestamp = n();
var i = this;
if (a = a || {}, i._configure(a), i._checkParams([{value: r,type: "string"}], "storage.getFileUrl")) {
var c = i._attachAccount({method: "getdownloadurl",object: r}), u = i._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), f = e.ajax;
f.post(s, JSON.stringify(c), "json", u)
}
},deleteFile: function(r, a) {
var o = {};
o.action_name = "storage.deleteFile", o.timestamp = n();
var i = this;
if (a = a || {}, i._configure(a), i._checkParams([{value: r,type: "string"}], "storage.deleteFile")) {
var c = i._attachAccount({method: "delete",object: r}), u = i._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), f = e.ajax;
f.post(s, JSON.stringify(c), "json", u)
}
},listFile: function(o, i) {
var c = {};
c.action_name = "storage.listFile", c.timestamp = n();
var u = this;
if (i = i || {}, u._configure(i), u._checkParams([{value: o,type: "string"}], "storage.listFile")) {
var f = u._attachAccount({method: "list",object: o}), l = u._createAjaxOpt(c, {header: {authorization: t(e.getApiKey())},contentType: "application/json"});
l.callback = function(t) {
if (t.error_code) {
var o = new a(t);
u.options.error(o), c.err_code = o.code, c.err_msg = o.message
} else {
var i = [];
t.response_params.object_list.forEach(function(t) {
var r = new e.ACL;
t._acl && (r._setPermission(t._acl), delete t._acl);
var n = new e.File(null, null, r);
n._setFileInfo(t), i.push(n)
}), u.options.success({result: i,count: t.response_params.object_total}), c.err_code = 0
}
c.restimestamp = n(), r(c)
};
var p = e.ajax;
p.post(s, JSON.stringify(f), "json", l)
}
},insertData: function(r, a) {
var o = {};
if (o.action_name = "storage.insertData", o.timestamp = n(), a = a || {}, this._configure(a), this._checkParams([{value: r,type: "data"}], "storage.insertData")) {
var s = r.getData(), c = r._getACLInfo();
c && (s._acl = c);
var u = this._attachAccount({method: "insert",documents: s}), f = this._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), l = e.ajax;
l.post(i, JSON.stringify(u), "json", f)
}
},deleteData: function(r, a) {
var o = {};
if (o.action_name = "storage.deleteData", o.timestamp = n(), a = a || {}, this._configure(a), this._checkParams([{value: r,type: "query"}], "storage.deleteData")) {
var s = this._attachAccount({method: "remove",criteria: r.query}), c = this._createAjaxOpt(o, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), u = e.ajax;
u.post(i, JSON.stringify(s), "json", c)
}
},updateData: function(r, a, o) {
var s = {};
if (s.action_name = "storage.updateData", s.timestamp = n(), o = o || {}, this._configure(o), this._checkParams([{value: r,type: "query"}, {value: a,type: "data"}], "storage.updateData")) {
var c = a.getData(), u = a._getACLInfo();
if (u)
if (c.hasOwnProperty("$set"))
c.$set._acl = u;
else {
var f = 0;
for (var l in c)
if (c.hasOwnProperty(l) && "$" === l[0]) {
f = 1, c.$set = {}, c.$set._acl = u;
break
}
0 === f && (c._acl = u)
}
var p = this._attachAccount({method: "update",criteria: r.query,document: c}), h = this._createAjaxOpt(s, {header: {authorization: t(e.getApiKey())},contentType: "application/json"}), d = e.ajax;
d.post(i, JSON.stringify(p), "json", h)
}
},findData: function(o, s) {
var c = {};
c.action_name = "storage.findData", c.timestamp = n();
var u = this;
if (s = s || {}, this._configure(s), this._checkParams([{value: o,type: "query"}], "storage.findData")) {
var f = this._attachAccount({method: "query",criteria: o.query}), l = this._createAjaxOpt(c, {header: {authorization: t(e.getApiKey())},contentType: "application/json"});
l.callback = function(t) {
if (t.error_code) {
var o = new a(t);
u.options.error(o), c.err_code = o.code, c.err_msg = o.message
} else {
var i = [];
t.response_params.documents.forEach(function(t) {
var r = new e.ACL;
t._acl && (r._setPermission(t._acl), delete t._acl);
var n = new e.Data(t, r);
i.push(n)
}), u.options.success({result: i,count: t.response_params.count}), c.err_code = 0
}
c.restimestamp = n(), r(c)
};
var p = e.ajax;
p.post(i, JSON.stringify(f), "json", l)
}
},_attachAccount: function(t) {
var r = null;
return e.currentAccount && e.currentAccount instanceof e.Role && e.currentAccount.getId() ? (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getId()) : e.currentAccount && e.currentAccount instanceof e.User && e.currentAccount.getAccessToken() && (r = "requester", t[r] = e.currentAccount.getType() + ":" + e.currentAccount.getAccessToken()), t
},_createAjaxOpt: function(t, o) {
var i = this, s = {callback: function(e) {
if (e.error_code) {
var o = new a(e);
i.options.error(o), t.err_code = o.code, t.err_msg = o.message
} else
i.options.success(e), t.err_code = 0;
t.restimestamp = n(), r(t)
},onerror: function(o, s) {
try {
var c = e.util.parseJSON(o.responseText)
} catch (u) {
return i.options.error(u, o), void 0
}
var s = new a(c);
i.options.error(s, o), t.err_code = s.code, t.err_msg = s.message, t.restimestamp = n(), r(t)
}};
return e.util.mix(s, o)
}};
u.Query = e.Base.extend({currentKey: null,query: null,constructor: function() {
},_set: function(e, t) {
this.query = this.query || {}, this.query[e] instanceof Object || (this.query[e] = {});
for (var r in t)
t.hasOwnProperty(r) && (this.query[e][r] = t[r])
},_build: function(e, t) {
if (null === this.currentKey)
throw new a("Query key must not be null");
switch (e) {
case u.Query.EQUAL:
this.query = this.query || {}, this.query[this.currentKey] = t;
break;
case u.Query.LESSTHAN:
this._set(this.currentKey, {$lt: t});
break;
case u.Query.LESSTHANEQUAL:
this._set(this.currentKey, {$lte: t});
break;
case u.Query.GREATERTHAN:
this._set(this.currentKey, {$gt: t});
break;
case u.Query.GREATERTHANEQUAL:
this._set(this.currentKey, {$gte: t});
break;
default:
throw new a("Query " + e + " is not supported")
}
},equal: function(e) {
return this._build(u.Query.EQUAL, e), this
},lessThan: function(e) {
return this._build(u.Query.LESSTHAN, e), this
},lessThanEqual: function(e) {
return this._build(u.Query.LESSTHANEQUAL, e), this
},greaterThan: function(e) {
return this._build(u.Query.GREATERTHAN, e), this
},greaterThanEqual: function(e) {
return this._build(u.Query.GREATERTHANEQUAL, e), this
},on: function(e) {
return this.currentKey = e, this
}}, {EQUAL: 1,LESSTHAN: 2,LESSTHANEQUAL: 3,GREATERTHAN: 4,GREATERTHANEQUAL: 5}), e.storage = u
}(baidu.frontia), baidu.frontia.personalStorage = baidu.frontia.personalStorage || {}, function(e) {
function t(e, t, r) {
var n, a = {}, o = null, i = null;
t = t || {}, "string" == typeof e ? (o = "/" === e.slice(0, 1) ? e : "/".concat(e), a.path = o) : e && (i = {list: []}, e.forEach(function(e) {
o = "/" === e.slice(0, 1) ? e : "/".concat(e), i.list.push({path: o})
}), i = JSON.stringify(i));
for (n in t)
t.hasOwnProperty(n) && -1 === r.indexOf(n) && (a[n] = t[n]);
return {query: a,body: i}
}
function r(t, r) {
var n = [s, t, e.util.serializeURL(r)].join("");
return n
}
function n(t) {
var r = {application_info: [{app_frontia_version: e.version,app_appid: e.getApiKey(),user_id: e.getCurrentAccount().getId() || "",frontia_action: [{action_name: "",timestamp: null,restimestamp: null,err_code: "",err_msg: ""}]}]};
r.application_info[0].frontia_action[0] = t;
var n = {}, a = new Zlib.Gzip(new Uint8Array(JSON.stringify(r).split("").map(function(e) {
return e.charCodeAt(0)
}))), o = a.compress();
n.stats = btoa(String.fromCharCode.apply(null, o));
var i = e.ajax;
i.post(c, JSON.stringify(n), "json", {contentType: "application/json"})
}
function a() {
var e = Math.floor((new Date).getTime() / 1e3);
return e
}
var o = baidu.frontia.error, i = baidu.frontia.ERR_MSG, s = e.DomainManager.getPCSDomain() + "/rest/2.0/pcs/", c = e.DomainManager.getPBLogDomain() + "/pushlog";
e.apiKey;
var u = {};
u = {options: {error: function() {
},success: function() {
}},_configure: function(e) {
e = e || {}, e.error && (this.options.error = e.error), e.success && (this.options.success = e.success)
},_checkParams: function(e, t) {
var r = this;
return e.every(function(e) {
return "file" !== e.type || e.value && e.value instanceof File ? "string" !== e.type || e.value && "string" == typeof e.value ? "array" !== e.type || e.value && "Array" === Object.prototype.toString.call(e.value).slice(8, -1) ? !0 : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: targets is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: target is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: file is null or not typeof File of DOM")), !1)
})
},_createAjaxOpt: function(t, r) {
var i = this, s = {callback: function(e) {
if (e.error_code) {
var r = new o(e);
i.options.error(r), t.err_code = r.code, t.err_msg = r.message
} else
i.options.success(e), t.err_code = 0;
t.restimestamp = a(), n(t)
},onerror: function(r, s) {
try {
var c = e.util.parseJSON(r.responseText)
} catch (u) {
return i.options.error(u, r), void 0
}
var s = new o(c);
i.options.error(s, r), t.err_code = s.code, t.err_msg = s.message, t.restimestamp = a(), n(t)
}};
return e.util.mix(s, r)
},uploadFile: function(n, o, i) {
var s = {};
s.action_name = "personalStorage.uploadFile", s.timestamp = a();
var c = this;
if (i = i || {}, c._configure(i), c._checkParams([{value: n,type: "file"}, {value: o,type: "string"}], "personalStorage.uploadFile")) {
i.method = "upload";
var u = e.getCurrentAccount();
u && (accessToken = u.getAccessToken()), i.access_token = accessToken;
var f = t(o, i, ["success", "error"]), l = r("file?", f.query), p = c._createAjaxOpt(s, {contentType: "multipart/form-data"}), h = e.ajax, d = new FormData;
d.append("baidu_frontia_file", n), h.post(l, d, "json", p)
}
},uploadTextFile: function(text, target, options) {
var s = {};
s.action_name = "personalStorage.uploadFile", s.timestamp = a();
var c = this;
if (options = options || {}, c._configure(options), c._checkParams([{value: text,type: "string"}, {value: target,type: "string"}], "personalStorage.uploadFile")) {
options.method = "upload";
var u = e.getCurrentAccount();
u && (accessToken = u.getAccessToken()), options.access_token = accessToken;
var f = t(target, options, ["success", "error"]), l = r("file?", f.query), p = c._createAjaxOpt(s, {contentType: "multipart/form-data"}), h = e.ajax, d = new FormData;
var blob = new Blob([text], {type: 'text/plain'});
d.append("baidu_frontia_file", blob), h.post(l, d, "json", p);
}
},getFileUrl: function(i, s) {
var c = {};
c.action_name = "personalStorage.getFileUrl", c.timestamp = a();
var u = this;
if (s = s || {}, u._configure(s), u._checkParams([{value: i,type: "string"}], "personalStorage.getFileUrl")) {
var f = e.getCurrentAccount();
f && (accessToken = f.getAccessToken()), s.access_token = accessToken, s.method = "download";
var l = t(i, s, ["success", "error"]), p = r("file?", l.query);
s.method = "meta", l = t(i, s, ["success", "error"]);
var h = r("file?", l.query), d = {callback: function(e) {
if (e.error_code) {
var t = new o(e);
u.options.error(t), c.err_code = t.code, c.err_msg = t.message
} else
u.options.success(p), c.err_code = 0;
c.restimestamp = a(), n(c)
},onerror: function(t, r) {
try {
var i = e.util.parseJSON(t.responseText)
} catch (s) {
return u.options.error(s, t), void 0
}
var r = new o(i);
u.options.error(r, t), c.err_code = r.code, c.err_msg = r.message, c.restimestamp = a(), n(c)
},dataType: "json"}, g = e.ajax;
g.get(h, {}, d)
}
},deleteFile: function(n, o) {
var i = {};
i.action_name = "personalStorage.deleteFile", i.timestamp = a();
var s = this;
if (o = o || {}, s._configure(o), s._checkParams([{value: n,type: "array"}], "personalStorage.deleteFile")) {
o.method = "delete";
var c = e.getCurrentAccount();
c && (accessToken = c.getAccessToken()), o.access_token = accessToken;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i), p = e.ajax;
p.post(f, {param: u.body}, "json", l)
}
},listFile: function(n, o) {
var i = {};
i.action_name = "personalStorage.listFile", i.timestamp = a();
var s = this;
if (o = o || {}, s._configure(o), s._checkParams([{value: n,type: "string"}], "personalStorage.listFile")) {
o.method = "list";
var c = e.getCurrentAccount();
c && (accessToken = c.getAccessToken()), o.access_token = accessToken;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i, {dataType: "json"}), p = e.ajax;
p.get(f, {}, l)
}
},listStreamFile: function(n) {
var o = {};
o.action_name = "personalStorage.listStreamFile", o.timestamp = a();
var i = this;
n = n || {}, i._configure(n), n.method = "list";
var s = e.getCurrentAccount();
s && (accessToken = s.getAccessToken()), n.access_token = accessToken;
var c = t(null, n, ["success", "error"]);
n.filter_path && (c.query.filter_path = n.filter_path);
var u = r("stream?", c.query), f = i._createAjaxOpt(o, {dataType: "json"}), l = e.ajax;
l.get(u, {}, f)
},makeDir: function(n, o) {
var i = {};
i.action_name = "personalStorage.makeDir", i.timestamp = a();
var s = this;
if (o = o || {}, s._configure(o), s._checkParams([{value: n,type: "string"}], "personalStorage.makeDir")) {
o.method = "mkdir";
var c = e.getCurrentAccount();
c && (accessToken = c.getAccessToken()), o.access_token = accessToken;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt({dataType: "json"}), p = e.ajax;
p.post(f, {}, "json", l)
}
},getQuota: function(n) {
var o = {};
o.action_name = "personalStorage.getQuota", o.timestamp = a();
var i = this;
if (n = n || {}, i._configure(n), i._checkParams([], "psersonalStorage.getQuota")) {
n.method = "info";
var s = e.getCurrentAccount();
s && (accessToken = s.getAccessToken()), n.access_token = accessToken;
var c = t(null, n, ["success", "error"]), u = r("quota?", c.query), f = i._createAjaxOpt(o, {dataType: "json"}), l = e.ajax;
l.get(u, {}, f)
}
}}, u.constant = {ONDUP_OVERWRITE: "overwrite",ONDUP_NEWCOPY: "newcopy",BY_NAME: "name",BY_TIME: "time",BY_SIZE: "size",ORDER_ASC: "asc",ORDER_DESC: "desc",TYPE_STREAM_VIDEO: "video",TYPE_STREAM_AUDIO: "audio",TYPE_STREAM_IMAGE: "image",TYPE_STREAM_DOC: "doc"}, e.personalStorage = u
}(baidu.frontia), baidu.frontia.store = baidu.frontia.store || {}, function(e) {
function t(t) {
var r = e.util.toBase64("Application:" + t);
return "Basic " + r
}
function r() {
var e = Math.floor((new Date).getTime() / 1e3);
return e
}
var n = e.error;
e.ERR_MSG;
var a = e.DomainManager.getFrontiaDomain() + "/push";
e.DomainManager.getPBLogDomain() + "/pushlog";
var o = {options: {error: function() {
},success: function() {
}},_configure: function(e) {
e = e || {}, e.error && (this.options.error = e.error), e.success && (this.options.success = e.success)
},send: function(n, o) {
var i = {};
i.action_name = "Push.list", i.timestamp = r();
var s = this;
o = o || {}, s._configure(o);
var c = a, u = {method: "pushmsg",messages: n.messages,msg_keys: n.msg_keys};
for (var f in o)
o.hasOwnProperty(f) && "success" !== f && "error" !== f && (u[f] = o[f]);
var l = s._createAjaxOpt({header: {authorization: t(e.getApiKey())},contentType: "application/json"}), p = e.ajax;
p.post(c, JSON.stringify(u), "json", l)
},_createAjaxOpt: function(t) {
var r = this, a = {callback: function(e) {
e.error_code ? r.options.error(new n(e)) : e && e.error_code ? r.options.error(new n(e)) : r.options.success(e)
},onerror: function(t) {
try {
var a = e.util.parseJSON(t.responseText)
} catch (o) {
return r.options.error(o, t), void 0
}
r.options.error(new n(a), t)
}};
return e.util.mix(a, t)
}};
e.Push = o
}(baidu.frontia);
( function () {
function getKMBasePath( docUrl, confUrl ) {
return getBasePath( docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath() );
}
function getConfigFilePath() {
var configPath = document.getElementsByTagName( 'script' );
return configPath[ configPath.length - 1 ].src;
}
function getBasePath( docUrl, confUrl ) {
var basePath = confUrl;
if ( /^(\/|\\\\)/.test( confUrl ) ) {
basePath = /^.+?\w(\/|\\\\)/.exec( docUrl )[ 0 ] + confUrl.replace( /^(\/|\\\\)/, '' );
} else if ( !/^[a-z]+:/i.test( confUrl ) ) {
docUrl = docUrl.split( "#" )[ 0 ].split( "?" )[ 0 ].replace( /[^\\\/]+$/, '' );
basePath = docUrl + "" + confUrl;
}
return optimizationPath( basePath );
}
function optimizationPath( path ) {
var protocol = /^[a-z]+:\/\//.exec( path )[ 0 ],
tmp = null,
res = [];
path = path.replace( protocol, "" ).split( "?" )[ 0 ].split( "#" )[ 0 ];
path = path.replace( /\\/g, '/' ).split( /\// );
path[ path.length - 1 ] = "";
while ( path.length ) {
if ( ( tmp = path.shift() ) === ".." ) {
res.pop();
} else if ( tmp !== "." ) {
res.push( tmp );
}
}
return protocol + res.join( "/" );
}
window.KITYMINDER_CONFIG = {
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | switchlayout'
]
//设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图
//回退相关选项
//,maxUndoCount:20 //最大可回退的次数,默认20
//语言默认是zh-cn
//,lang:'zh-cn'
//设置km整体的z-index大小
//,zIndex : 1000
};
} )()
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
.kmui-modal-header .kmui-title{
font-size: 14px;
}
.kmui-dialog-markers-body {
padding-bottom: 5px
}
.icon-list{
margin: 0;
padding: 0
}
.icon-list li{
padding: 5px 10px;
margin: 0;
list-style: none;
cursor: pointer;
color: #333
}
.icon-list li:hover,.icon-list li.active{
background: #cfe0f7
}
.icon-list li span.icon{
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 10px;
}
\ No newline at end of file
( function () {
var utils = KM.utils;
KM.registerWidget( 'markers', {
tpl: "<ul class='icon-list'>" +
"<li value='1' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) 0 0'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -20px 0'></span><span><%= priority %>2</span></li>" +
"<li value='3' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -40px 0'></span><span><%= priority %>3</span></li>" +
"<li value='4' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -60px 0'></span><span><%= priority %>4</span></li>" +
"<li value='5' type='priority'><span class='icon' style='background:url(../dialogs/icons/iconpriority.png) -80px 0'></span><span><%= priority %>5</span></li>" +
"</ul>" +
"<ul class='icon-list'>" +
"<li value='1' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) 0 0'></span><span><%= progress.notdone %></span></li>" +
"<li value='2' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -20px 0'></span><span><%= progress.quarterdone %></span></li>" +
"<li value='3' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -40px 0'></span><span><%= progress.halfdone %></span></li>" +
"<li value='4' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -60px 0'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon' style='background:url(../dialogs/icons/iconprogress.png) -80px 0'></span><span><%= progress.done %></span></li>" +
"</ul>",
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.markers' );
if ( lang ) {
var html = $.parseTmpl( this.tpl, lang );
}
this.root().html( html );
},
initEvent: function ( km, $w ) {
$w.on( "click", "li", function () {
var $this = $( this );
$this.siblings().removeClass( "active" );
$this.toggleClass( "active" );
var val = $this.val();
if ( !$this.hasClass( "active" ) ) {
val = null;
}
var type = $this.attr( "type" );
km.execCommand( type, val );
} );
km.on( 'interactchange', function ( e ) {
var valPri = this.queryCommandValue( "priority" );
var valPro = this.queryCommandValue( "progress" );
$w.find( "li[type='priority']" ).removeClass( "active" );
$w.find( "li[type='priority'][value='" + valPri + "']" ).addClass( "active" );
$w.find( "li[type='progress']" ).removeClass( "active" );
$w.find( "li[type='progress'][value='" + valPro + "']" ).addClass( "active" );
} );
},
buttons: {
'ok': {
exec: function ( km, $w ) {
var href = $( '#kmui-link-Jhref' ).val().replace( /^\s+|\s+$/g, '' );
if ( href ) {
km.execCommand( 'link', {
'href': href,
'target': $( "#kmui-link-Jtarget:checked" ).length ? "_blank" : '_self',
'title': $( "#kmui-link-Jtitle" ).val().replace( /^\s+|\s+$/g, '' ),
'_href': href
} );
}
}
},
'cancel': {}
},
width: 200,
} )
} )();
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social.js" charset="utf-8"></script>
<script src="kitygraph.all.min.js" charset="utf-8"></script>
<script src="configure.js" charset="utf-8"></script>
<script src="dev.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="social.css">
<style>
.km_receiver{
width:0;
height:0;
}
.km-minderNode{
cursor:default;
}
.kmui-container {
height: 100%;
}
html, body, div {
margin: 0;
padding: 0;
}
html, body, div.kmui-editor-body {
height: 100%;
-moz-user-select: none;
}
</style>
</head>
<body >
<div id="kityminder" style="height:100%;width:100%" onselectstart="return false">
</div>
<div id="social"></div>
</body>
<script>
window.km = KM.getKityMinder('kityminder');
</script>
</html>
\ No newline at end of file
/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};o.fn=o.prototype={jquery:n,constructor:o,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=o.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return o.each(this,a,b)},map:function(a){return this.pushStack(o.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},o.extend=o.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||o.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(o.isPlainObject(d)||(e=o.isArray(d)))?(e?(e=!1,f=c&&o.isArray(c)?c:[]):f=c&&o.isPlainObject(c)?c:{},g[b]=o.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},o.extend({expando:"jQuery"+(n+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===o.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==o.type(a)||a.nodeType||o.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=o.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?o.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),o.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||o.guid++,f):void 0},now:Date.now,support:l}),o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=o.type(a);return"function"===c||o.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);o.find=t,o.expr=t.selectors,o.expr[":"]=o.expr.pseudos,o.unique=t.uniqueSort,o.text=t.getText,o.isXMLDoc=t.isXML,o.contains=t.contains;var u=o.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(o.isFunction(b))return o.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return o.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return o.filter(b,a,c);b=o.filter(b,a)}return o.grep(a,function(a){return g.call(b,a)>=0!==c})}o.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?o.find.matchesSelector(d,a)?[d]:[]:o.find.matches(a,o.grep(b,function(a){return 1===a.nodeType}))},o.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(o(a).filter(function(){for(b=0;c>b;b++)if(o.contains(e[b],this))return!0}));for(b=0;c>b;b++)o.find(a,e[b],d);return d=this.pushStack(c>1?o.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?o(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=o.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof o?b[0]:b,o.merge(this,o.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),v.test(c[1])&&o.isPlainObject(b))for(c in b)o.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=m.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):o.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(o):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),o.makeArray(a,this))};A.prototype=o.fn,y=o(m);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};o.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&o(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),o.fn.extend({has:function(a){var b=o(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(o.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?o(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&o.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?o.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(o(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(o.unique(o.merge(this.get(),o(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}o.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return o.dir(a,"parentNode")},parentsUntil:function(a,b,c){return o.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return o.dir(a,"nextSibling")},prevAll:function(a){return o.dir(a,"previousSibling")},nextUntil:function(a,b,c){return o.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return o.dir(a,"previousSibling",c)},siblings:function(a){return o.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return o.sibling(a.firstChild)},contents:function(a){return a.contentDocument||o.merge([],a.childNodes)}},function(a,b){o.fn[a]=function(c,d){var e=o.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=o.filter(d,e)),this.length>1&&(C[a]||o.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return o.each(a.match(E)||[],function(a,c){b[c]=!0}),b}o.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):o.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){o.each(b,function(b,c){var d=o.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&o.each(arguments,function(a,b){var c;while((c=o.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?o.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},o.extend({Deferred:function(a){var b=[["resolve","done",o.Callbacks("once memory"),"resolved"],["reject","fail",o.Callbacks("once memory"),"rejected"],["notify","progress",o.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return o.Deferred(function(c){o.each(b,function(b,f){var g=o.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&o.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?o.extend(a,d):d}},e={};return d.pipe=d.then,o.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&o.isFunction(a.promise)?e:0,g=1===f?a:o.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&o.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;o.fn.ready=function(a){return o.ready.promise().done(a),this},o.extend({isReady:!1,readyWait:1,holdReady:function(a){a?o.readyWait++:o.ready(!0)},ready:function(a){(a===!0?--o.readyWait:o.isReady)||(o.isReady=!0,a!==!0&&--o.readyWait>0||(H.resolveWith(m,[o]),o.fn.trigger&&o(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),o.ready()}o.ready.promise=function(b){return H||(H=o.Deferred(),"complete"===m.readyState?setTimeout(o.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},o.ready.promise();var J=o.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===o.type(c)){e=!0;for(h in c)o.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,o.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(o(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};o.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=o.expando+Math.random()}K.uid=1,K.accepts=o.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,o.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(o.isEmptyObject(f))o.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,o.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{o.isArray(b)?d=b.concat(b.map(o.camelCase)):(e=o.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!o.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?o.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}o.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),o.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;
while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),o.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||o.isArray(c)?d=L.access(a,b,o.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=o.queue(a,b),d=c.length,e=c.shift(),f=o._queueHooks(a,b),g=function(){o.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:o.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),o.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?o.queue(this[0],a):void 0===b?this:this.each(function(){var c=o.queue(this,a,b);o._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&o.dequeue(this,a)})},dequeue:function(a){return this.each(function(){o.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=o.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===o.css(a,"display")||!o.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=m.createDocumentFragment(),b=a.appendChild(m.createElement("div"));b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";l.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return m.activeElement}catch(a){}}o.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=o.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof o!==U&&o.event.triggered!==b.type?o.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n&&(l=o.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=o.event.special[n]||{},k=o.extend({type:n,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&o.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),o.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n){l=o.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||o.removeEvent(a,n,r.handle),delete i[n])}else for(n in i)o.event.remove(a,n+b[j],c,d,!0);o.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,p=[d||m],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||m,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+o.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[o.expando]?b:new o.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:o.makeArray(c,[b]),n=o.event.special[q]||{},e||!n.trigger||n.trigger.apply(d,c)!==!1)){if(!e&&!n.noBubble&&!o.isWindow(d)){for(i=n.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||m)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:n.bindType||q,l=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),l&&l.apply(g,c),l=k&&g[k],l&&l.apply&&o.acceptData(g)&&(b.result=l.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||n._default&&n._default.apply(p.pop(),c)!==!1||!o.acceptData(d)||k&&o.isFunction(d[q])&&!o.isWindow(d)&&(h=d[k],h&&(d[k]=null),o.event.triggered=q,d[q](),o.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=o.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=o.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=o.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((o.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?o(e,this).index(i)>=0:o.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||m,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[o.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new o.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=m),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&o.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return o.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=o.extend(new o.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?o.event.trigger(e,null,b):o.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},o.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},o.Event=function(a,b){return this instanceof o.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.getPreventDefault&&a.getPreventDefault()?Z:$):this.type=a,b&&o.extend(this,b),this.timeStamp=a&&a.timeStamp||o.now(),void(this[o.expando]=!0)):new o.Event(a,b)},o.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z,this.stopPropagation()}},o.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){o.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!o.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.focusinBubbles||o.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){o.event.simulate(b,a.target,o.event.fix(a),!0)};o.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),o.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return o().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=o.guid++)),this.each(function(){o.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,o(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){o.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){o.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?o.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return o.nodeName(a,"table")&&o.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)o.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=o.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&o.nodeName(a,b)?o.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}o.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=o.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||o.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===o.type(e))o.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;o.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===o.inArray(e,d))&&(i=o.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=o.event.special,i=0;void 0!==(c=a[i]);i++){if(o.acceptData(c)&&(f=c[L.expando],f&&(b=L.cache[f]))){if(d=Object.keys(b.events||{}),d.length)for(g=0;void 0!==(e=d[g]);g++)h[e]?o.event.remove(c,e):o.removeEvent(c,e,b.handle);L.cache[f]&&delete L.cache[f]}delete M.cache[c[M.expando]]}}}),o.fn.extend({text:function(a){return J(this,function(a){return void 0===a?o.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?o.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||o.cleanData(ob(c)),c.parentNode&&(b&&o.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(o.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return o.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(o.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,o.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,n=k-1,p=a[0],q=o.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=o.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=o.map(ob(c,"script"),kb),g=f.length;k>j;j++)h=c,j!==n&&(h=o.clone(h,!0,!0),g&&o.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,o.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&o.contains(i,h)&&(h.src?o._evalUrl&&o._evalUrl(h.src):o.globalEval(h.textContent.replace(hb,"")))}return this}}),o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){o.fn[a]=function(a){for(var c,d=[],e=o(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),o(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d=o(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:o.css(d[0],"display");return d.detach(),e}function tb(a){var b=m,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||o("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||o.contains(a.ownerDocument,a)||(g=o.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",e=m.documentElement,f=m.createElement("div"),g=m.createElement("div");g.style.backgroundClip="content-box",g.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===g.style.backgroundClip,f.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",f.appendChild(g);function h(){g.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",e.appendChild(f);var d=a.getComputedStyle(g,null);b="1%"!==d.top,c="4px"===d.width,e.removeChild(f)}a.getComputedStyle&&o.extend(l,{pixelPosition:function(){return h(),b},boxSizingReliable:function(){return null==c&&h(),c},reliableMarginRight:function(){var b,c=g.appendChild(m.createElement("div"));return c.style.cssText=g.style.cssText=d,c.style.marginRight=c.style.width="0",g.style.width="1px",e.appendChild(f),b=!parseFloat(a.getComputedStyle(c,null).marginRight),e.removeChild(f),g.innerHTML="",b}})}(),o.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:0,fontWeight:400},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=o.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=o.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=o.css(a,"border"+R[f]+"Width",!0,e))):(g+=o.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=o.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===o.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):f[g]||(e=S(d),(c&&"none"!==c||!e)&&L.set(d,"olddisplay",e?c:o.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}o.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=o.camelCase(b),i=a.style;return b=o.cssProps[h]||(o.cssProps[h]=Fb(i,h)),g=o.cssHooks[b]||o.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(o.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||o.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]="",i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=o.camelCase(b);return b=o.cssProps[h]||(o.cssProps[h]=Fb(a.style,h)),g=o.cssHooks[b]||o.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||o.isNumeric(f)?f||0:e):e}}),o.each(["height","width"],function(a,b){o.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&zb.test(o.css(a,"display"))?o.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===o.css(a,"boxSizing",!1,e),e):0)}}}),o.cssHooks.marginRight=yb(l.reliableMarginRight,function(a,b){return b?o.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),o.each({margin:"",padding:"",border:"Width"},function(a,b){o.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(o.cssHooks[a+b].set=Gb)}),o.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(o.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=o.css(a,b[g],!1,d);return f}return void 0!==c?o.style(a,b,c):o.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?o(this).show():o(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}o.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(o.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?o.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=o.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){o.fx.step[a.prop]?o.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[o.cssProps[a.prop]]||o.cssHooks[a.prop])?o.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},o.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},o.fx=Kb.prototype.init,o.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(o.cssNumber[a]?"":"px"),g=(o.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(o.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,o.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=o.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k=this,l={},m=a.style,n=a.nodeType&&S(a),p=L.get(a,"fxshow");c.queue||(h=o._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,k.always(function(){k.always(function(){h.unqueued--,o.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],j=o.css(a,"display"),"none"===j&&(j=tb(a.nodeName)),"inline"===j&&"none"===o.css(a,"float")&&(m.display="inline-block")),c.overflow&&(m.overflow="hidden",k.always(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(n?"hide":"show")){if("show"!==e||!p||void 0===p[d])continue;n=!0}l[d]=p&&p[d]||o.style(a,d)}if(!o.isEmptyObject(l)){p?"hidden"in p&&(n=p.hidden):p=L.access(a,"fxshow",{}),f&&(p.hidden=!n),n?o(a).show():k.done(function(){o(a).hide()}),k.done(function(){var b;L.remove(a,"fxshow");for(b in l)o.style(a,b,l[b])});for(d in l)g=Ub(n?p[d]:0,d,k),d in p||(p[d]=g.start,n&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=o.camelCase(c),e=b[d],f=a[c],o.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=o.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=o.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:o.extend({},b),opts:o.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=o.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return o.map(k,Ub,j),o.isFunction(j.opts.start)&&j.opts.start.call(a,j),o.fx.timer(o.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}o.Animation=o.extend(Xb,{tweener:function(a,b){o.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),o.speed=function(a,b,c){var d=a&&"object"==typeof a?o.extend({},a):{complete:c||!c&&b||o.isFunction(a)&&a,duration:a,easing:c&&b||b&&!o.isFunction(b)&&b};return d.duration=o.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in o.fx.speeds?o.fx.speeds[d.duration]:o.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){o.isFunction(d.old)&&d.old.call(this),d.queue&&o.dequeue(this,d.queue)},d},o.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=o.isEmptyObject(a),f=o.speed(b,c,d),g=function(){var b=Xb(this,o.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=o.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&o.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=o.timers,g=d?d.length:0;for(c.finish=!0,o.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),o.each(["toggle","show","hide"],function(a,b){var c=o.fn[b];o.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),o.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){o.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),o.timers=[],o.fx.tick=function(){var a,b=0,c=o.timers;for(Lb=o.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||o.fx.stop(),Lb=void 0},o.fx.timer=function(a){o.timers.push(a),a()?o.fx.start():o.timers.pop()},o.fx.interval=13,o.fx.start=function(){Mb||(Mb=setInterval(o.fx.tick,o.fx.interval))},o.fx.stop=function(){clearInterval(Mb),Mb=null},o.fx.speeds={slow:600,fast:200,_default:400},o.fn.delay=function(a,b){return a=o.fx?o.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=m.createElement("input"),b=m.createElement("select"),c=b.appendChild(m.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=m.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var Yb,Zb,$b=o.expr.attrHandle;o.fn.extend({attr:function(a,b){return J(this,o.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){o.removeAttr(this,a)})}}),o.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?o.prop(a,b,c):(1===f&&o.isXMLDoc(a)||(b=b.toLowerCase(),d=o.attrHooks[b]||(o.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=o.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void o.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=o.propFix[c]||c,o.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&o.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?o.removeAttr(a,c):a.setAttribute(c,c),c}},o.each(o.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||o.find.attr;$b[b]=function(a,b,d){var e,f;
return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;o.fn.extend({prop:function(a,b){return J(this,o.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[o.propFix[a]||a]})}}),o.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!o.isXMLDoc(a),f&&(b=o.propFix[b]||b,e=o.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),l.optSelected||(o.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),o.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){o.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;o.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=o.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(o.isFunction(a))return this.each(function(b){o(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?o.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(o.isFunction(a)?function(c){o(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=o(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;o.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=o.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,o(this).val()):a,null==e?e="":"number"==typeof e?e+="":o.isArray(e)&&(e=o.map(e,function(a){return null==a?"":a+""})),b=o.valHooks[this.type]||o.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=o.valHooks[e.type]||o.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),o.extend({valHooks:{select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&o.nodeName(c.parentNode,"optgroup"))){if(b=o(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=o.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=o.inArray(o(d).val(),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),o.each(["radio","checkbox"],function(){o.valHooks[this]={set:function(a,b){return o.isArray(b)?a.checked=o.inArray(o(a).val(),b)>=0:void 0}},l.checkOn||(o.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),o.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){o.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),o.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=o.now(),dc=/\?/;o.parseJSON=function(a){return JSON.parse(a+"")},o.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&o.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=m.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(o.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,o.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=o.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&o.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}o.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":o.parseJSON,"text xml":o.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,o.ajaxSettings),b):tc(o.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=o.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?o(l):o.event,n=o.Deferred(),p=o.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(n.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=o.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=o.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===o.active++&&o.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(o.lastModified[d]&&v.setRequestHeader("If-Modified-Since",o.lastModified[d]),o.etag[d]&&v.setRequestHeader("If-None-Match",o.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(o.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(o.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?n.resolveWith(l,[r,x,v]):n.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--o.active||o.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return o.get(a,b,c,"json")},getScript:function(a,b){return o.get(a,void 0,b,"script")}}),o.each(["get","post"],function(a,b){o[b]=function(a,c,d,e){return o.isFunction(c)&&(e=e||d,d=c,c=void 0),o.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),o.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){o.fn[b]=function(a){return this.on(b,a)}}),o._evalUrl=function(a){return o.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},o.fn.extend({wrapAll:function(a){var b;return o.isFunction(a)?this.each(function(b){o(this).wrapAll(a.call(this,b))}):(this[0]&&(b=o(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(o.isFunction(a)?function(b){o(this).wrapInner(a.call(this,b))}:function(){var b=o(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=o.isFunction(a);return this.each(function(c){o(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){o.nodeName(this,"body")||o(this).replaceWith(this.childNodes)}).end()}}),o.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},o.expr.filters.visible=function(a){return!o.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(o.isArray(b))o.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==o.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}o.param=function(a,b){var c,d=[],e=function(a,b){b=o.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=o.ajaxSettings&&o.ajaxSettings.traditional),o.isArray(a)||a.jquery&&!o.isPlainObject(a))o.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},o.fn.extend({serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=o.prop(this,"elements");return a?o.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!o(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=o(this).val();return null==c?null:o.isArray(c)?o.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),o.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=o.ajaxSettings.xhr();a.ActiveXObject&&o(a).on("unload",function(){for(var a in Dc)Dc[a]()}),l.cors=!!Fc&&"withCredentials"in Fc,l.ajax=Fc=!!Fc,o.ajaxTransport(function(a){var b;return l.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort"),f.send(a.hasContent&&a.data||null)},abort:function(){b&&b()}}:void 0}),o.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return o.globalEval(a),a}}}),o.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),o.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=o("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),m.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;o.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||o.expando+"_"+cc++;return this[a]=!0,a}}),o.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=o.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||o.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&o.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),o.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||m;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=o.buildFragment([a],b,e),e&&e.length&&o(e).remove(),o.merge([],d.childNodes))};var Ic=o.fn.load;o.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h),a=a.slice(0,h)),o.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&o.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?o("<div>").append(o.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},o.expr.filters.animated=function(a){return o.grep(o.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return o.isWindow(a)?a:9===a.nodeType&&a.defaultView}o.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=o.css(a,"position"),l=o(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=o.css(a,"top"),i=o.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),o.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},o.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){o.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,o.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===o.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),o.nodeName(a[0],"html")||(d=a.offset()),d.top+=o.css(a[0],"borderTopWidth",!0),d.left+=o.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-o.css(c,"marginTop",!0),left:b.left-d.left-o.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!o.nodeName(a,"html")&&"static"===o.css(a,"position"))a=a.offsetParent;return a||Jc})}}),o.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;o.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),o.each(["top","left"],function(a,b){o.cssHooks[b]=yb(l.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?o(a).position()[b]+"px":c):void 0})}),o.each({Height:"height",Width:"width"},function(a,b){o.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){o.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return o.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?o.css(b,c,g):o.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),o.fn.size=function(){return this.length},o.fn.andSelf=o.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return o});var Lc=a.jQuery,Mc=a.$;return o.noConflict=function(b){return a.$===o&&(a.$=Mc),b&&a.jQuery===o&&(a.jQuery=Lc),o},typeof b===U&&(a.jQuery=a.$=o),o});
/*!
* ====================================================
* kitygraph - v1.0.0 - 2014-02-23
* https://github.com/kitygraph/kity
* GitHub: https://github.com/kitygraph/kity.git
* Copyright (c) 2014 Baidu UEditor Group; Licensed MIT
* ====================================================
*/
!function(){function define(a,b,c){if(_modules[a]={exports:{},value:null,factory:null},2===arguments.length&&(c=b),"[object Object]"===_modules.toString.call(c))_modules[a].value=c;else{if("function"!=typeof c)throw new Error("define函数未定义的行为");_modules[a].factory=c}}function require(a){var b=_modules[a],c=null;return b?b.value?b.value:(c=b.factory.call(null,require,b.exports,b),c&&(b.exports=c),b.value=b.exports,b.value):null}function use(a){return require(a)}var _modules={};define("animate/animator",["animate/timeline","graphic/color","graphic/matrix","graphic/eventhandler","core/class","animate/easing","core/config","graphic/shape","graphic/svg","core/utils","graphic/styled","graphic/data","graphic/pen"],function(a){function b(a){var b=parseFloat(a,10);return/ms/.test(a)?b:/s/.test(a)?1e3*b:/min/.test(a)?60*b*1e3:b}var c=a("animate/timeline"),d=a("animate/easing"),e=a("core/class").createClass("Animator",{constructor:function(a,b,c){if(1==arguments.length){var d=arguments[0];this.beginVal=d.beginValue,this.finishVal=d.finishValue,this.setter=d.setter}else this.beginVal=a,this.finishVal=b,this.setter=c},start:function(a,c,d,e,f){4===arguments.length&&"function"==typeof e&&(f=e,e=0);var g=this.create(a,c,d,f);return e=b(e),e>0?setTimeout(function(){g.play()},e):g.play(),g},create:function(a,f,g,h){var i;return f=f&&b(f)||e.DEFAULT_DURATION,g=g||e.DEFAULT_EASING,"string"==typeof g&&(g=d[g]),i=new c(this,a,f,g),"function"==typeof h&&i.on("finish",h),i},reverse:function(){return new e(this.finishVal,this.beginVal,this.setter)}});e.DEFAULT_DURATION=300,e.DEFAULT_EASING="linear";var f=a("graphic/shape");return a("core/class").extendClass(f,{animate:function(a,b,c,d,e){function f(){g.shift(),g.length&&setTimeout(g[0].t.play.bind(g[0].t),g[0].d)}var g=this._KityAnimateQueue=this._KityAnimateQueue||[],h=a.create(this,b,c,e);return h.on("finish",f),g.push({t:h,d:d}),1==g.length&&setTimeout(h.play.bind(h),d),this},stop:function(){var a=this._KityAnimateQueue;if(a)for(;a.length;)a.shift().stop()}}),e}),define("animate/easing",[],function(){var a={linear:function(a,b,c,d){return c*(a/d)+b},swing:function(b,c,d,e){return a.easeOutQuad(b,c,d,e)},ease:function(b,c,d,e){return a.easeInOutCubic(b,c,d,e)},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeInQuart:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOutQuart:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOutQuart:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOutQuint:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOutQuint:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOutSine:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOutSine:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},easeInExpo:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOutExpo:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOutExpo:function(a,b,c,d){return 0==a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOutCirc:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOutCirc:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(1==(a/=d))return b+c;if(f||(f=.3*d),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f))+b},easeOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(1==(a/=d))return b+c;if(f||(f=.3*d),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return g*Math.pow(2,-10*a)*Math.sin(2*(a*d-e)*Math.PI/f)+c+b},easeInOutElastic:function(a,b,c,d){var e=1.70158,f=0,g=c;if(0==a)return b;if(2==(a/=d/2))return b+c;if(f||(f=.3*d*1.5),g<Math.abs(c)){g=c;var e=f/4}else var e=f/(2*Math.PI)*Math.asin(c/g);return 1>a?-.5*g*Math.pow(2,10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)+b:g*Math.pow(2,-10*(a-=1))*Math.sin(2*(a*d-e)*Math.PI/f)*.5+c+b},easeInBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOutBack:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},easeInBounce:function(b,c,d,e){return d-a.easeOutBounce(e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOutBounce:function(b,c,d,e){return e/2>b?.5*a.easeInBounce(2*b,0,d,e)+c:.5*a.easeOutBounce(2*b-e,0,d,e)+.5*d+c}};return a}),define("animate/opacityanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/vector","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("OpacityAnimator",{base:b,constructor:function(a){this.callBase({beginValue:function(a){return a.getOpacity()},finishValue:a,setter:function(a,b){a.setOpacity(b)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxOpacity:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fadeTo:function(){return this.fxOpacity.apply(this,arguments)},fadeIn:function(){return this.fxOpacity.apply(this,[1].concat([].slice.call(arguments)))},fadeOut:function(){return this.fxOpacity.apply(this,[0].concat([].slice.call(arguments)))}}),c}),define("animate/rotateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/vector","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("RotateAnimator",{base:b,constructor:function(a,b,c){this.callBase({beginValue:0,finishValue:a,setter:function(a,d,e){var f=e.getDelta();a.rotate(f,b,c)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxRotate:function(a,b,d,e,f){return this.animate(new c(a),b,d,e,f)},fxRotateAnchor:function(a,b,d,e,f,g,h){return this.animate(new c(a,b,d),e,f,g,h)}}),c}),define("animate/scaleanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/vector","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("ScaleAnimator",{base:b,constructor:function(a,b){this.callBase({beginValue:0,finishValue:1,setter:function(c,d,e){var f=e.getDelta(),g=Math.pow(a,f),h=Math.pow(b,f);c.scale(h,g)}})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxScale:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("animate/timeline",["graphic/color","core/utils","graphic/standardcolor","core/class","graphic/matrix","graphic/vector","graphic/eventhandler","graphic/shapeevent","core/config"],function(a){function b(a){~o.indexOf(a)||o.push(a),1===o.length&&(p=d())}function c(a){var b=o.indexOf(a);-1!==b&&o.splice(b,1),0===o.length&&m(p)}function d(){var a=n;for(n=[];a.length;)a.shift()();o.length>0&&(p=l(d))}function e(a,b,c){if(!1===isNaN(parseFloat(a)))return c(a,b);var d={};for(var f in a)a.hasOwnProperty(f)&&(d[f]=e(a[f],b[f],c));return d}function f(a,b){return e(a,b,function(a,b){return b-a})}function g(a,b,c){return e(a,b,function(a,b){return a+(b-a)*c})}function h(a,b,c){this.timeline=a,this.target=a.target,this.type=b;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])}var i=a("graphic/color"),j=a("graphic/matrix"),k=a("graphic/eventhandler"),l=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return setTimeout(a,16)},m=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(a){return clearTimeout(a)},n=[],o=[],p=0,q=0,r=a("core/class").createClass("Timeline",{mixins:[k],constructor:function(a,b,c,d){this.callMixin(),this.time=0,this.duration=c,this.target=b,this.easing=d,this.status="ready",this.animator=a,this.beginVal=a.beginVal,this.finishVal=a.finishVal,this.setter=a.setter,this.id=q++},guessValueType:function(){var a=this.beginVal;return parseFloat(a)?(this.valueType="number",void 0):"string"==typeof a||a instanceof i?(this.valueType="color",void 0):a.x&&a.y?(this.valueType="point",void 0):(a instanceof j&&(this.valueType="matrix"),void 0)},nextFrame:function(){if("playing"==this.status){{var a=+new Date,b=this.lastFrameTS||0,c=a-b;this.target,this.setter}c>200&&(c=1e3/60),this.time+=c,this.setValue(this.getValue()),this.lastFrameTS=a,this.time>=this.duration&&this.timeUp(),n.push(this.nextFrame.bind(this))}},getPlayTime:function(){return this.rollbacking?this.duration-this.time:this.time},getTimeProportion:function(){return this.getPlayTime()/this.duration},getValueProportion:function(){return this.easing(this.getPlayTime(),0,1,this.duration)},getValue:function(){var a,b=this.beginVal,c=this.finishVal,d=this.getValueProportion();switch(this.valueType){case"color":return b=b.getValues(),c=c.getValues(),a=g(b,c,d),i.createRGBA(a.r,a.g,a.b,a.a);case"matrix":return b=b.getMatrix(),c=c.getMatrix(),a=g(b,c,d),new j(a);default:return g(b,c,d)}},getDelta:function(){return this.lastValue=this.lastValue||this.beginVal,f(this.lastValue,this.currentValue)},setValue:function(a){this.currentValue=a,this.setter.call(this.target,this.target,a,this),this.lastValue=a},play:function(){var a=(this.context,this.status);switch(this.status="playing",a){case"ready":this.beginVal="function"==typeof this.beginVal?this.beginVal.call(this.target,this.target):this.beginVal,this.finishVal="function"==typeof this.finishVal?this.finishVal.call(this.target,this.target):this.finishVal,this.time=0,this.guessValueType(),this.nextFrame();break;case"finished":case"stoped":this.time=0,this.nextFrame();break;case"paused":this.lastFrameTS=0,this.nextFrame()}return this.fire("play",new h(this,"play",{lastStatus:a})),b(this.id),this},pause:function(){return this.status="paused",this.fire("pause",new h(this,"pause")),c(this.id),this},stop:function(){return this.status="stoped",this.setValue(this.finishVal),this.rollbacking=!1,this.fire("stop",new h(this,"stop")),c(this.id),this},reset:function(){this.setValue(this.beginVal)},timeUp:function(){this.repeatOption?(this.time=0,this.rollback?this.rollbacking?(this.decreaseRepeat(),this.rollbacking=!1):(this.rollbacking=!0,this.fire("rollback",new h(this,"rollback"))):this.decreaseRepeat(),this.repeatOption?this.fire("repeat",new h(this,"repeat")):this.finish()):this.finish()},finish:function(){this.setValue(this.finishVal),this.status="finished",this.fire("finish",new h(this,"finish")),c(this.id)},decreaseRepeat:function(){this.repeatOption!==!0&&this.repeatOption--},repeat:function(a,b){return this.repeatOption=a,this.rollback=b,this}});return r}),define("animate/translateanimator",["animate/animator","animate/timeline","animate/easing","core/class","graphic/shape","graphic/matrix","core/utils","graphic/vector","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/pen"],function(a){var b=a("animate/animator"),c=(a("graphic/matrix"),a("core/class").createClass("TranslateAnimator",{base:b,constructor:function(a,b){this.callBase({x:0,y:0},{x:a,y:b},function(a,b,c){var d=c.getDelta();a.translate(d.x,d.y)})}})),d=a("graphic/shape");return a("core/class").extendClass(d,{fxTranslate:function(a,b,d,e,f,g){return this.animate(new c(a,b),d,e,f,g)}}),c}),define("core/class",["core/config"],function(require,exports){function Class(){}function getCallerClass(a){a.constructor}function checkBaseConstructorCall(a,b){var c=a.toString();if(!/this\.callBase/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function checkMixinConstructorCall(a,b){var c=a.toString();if(!/this\.callMixin/.test(c))throw new Error(b+" : 类构造函数没有调用父类的构造函数!为了安全,请调用父类的构造函数")}function inherit(constructor,BaseClass,classname){var KityClass=eval("(function "+classname+"( __inherit__flag ) {if( __inherit__flag != KITY_INHERIT_FLAG ) {KityClass.__KityConstructor.apply(this, arguments);}this.__KityClassName = KityClass.__KityClassName;})");KityClass.__KityConstructor=constructor,KityClass.prototype=new BaseClass(KITY_INHERIT_FLAG);for(var methodName in BaseClass.prototype)BaseClass.prototype.hasOwnProperty(methodName)&&0!==methodName.indexOf("__Kity")&&(KityClass.prototype[methodName]=BaseClass.prototype[methodName]);return KityClass.prototype.constructor=KityClass,KityClass}function mixin(a,b){if(!1==b instanceof Array)return a;var c,d,e,f=b.length;for(a.__KityMixins={constructor:[]},c=0;f>c;c++){d=b[c].prototype;for(e in d)!1!==d.hasOwnProperty(e)&&0!==e.indexOf("__Kity")&&("constructor"===e?a.__KityMixins.constructor.push(d[e]):a.prototype[e]=a.__KityMixins[e]=d[e])}return a}function extend(a,b){b.__KityClassName&&(b=b.prototype);for(var c in b)if(b.hasOwnProperty(c)&&c.indexOf("__Kity")&&"constructor"!=c){var d=a.prototype[c]=b[c];d.__KityMethodClass=a,d.__KityMethodName=c}return a}Function.prototype.bind=Function.prototype.bind||function(a){var b=Array.prototype.slice.call(arguments,1);return this.apply(a,b)};var config=require("core/config");if(config.debug){var origin=Object.prototype.toString;Object.prototype.toString=function(){return this.__KityClassName||origin.call(this)}}Class.__KityClassName="Class",Class.prototype.base=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityBaseClass.prototype[a];return c.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callBase=function(){var a=arguments.callee.caller,b=a.__KityMethodClass.__KityBaseClass.prototype[a.__KityMethodName];return b.apply(this,arguments)},Class.prototype.mixin=function(a){var b=arguments.callee.caller,c=b.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[a];return d.apply(this,Array.prototype.slice.call(arguments,1))},Class.prototype.callMixin=function(){var a=arguments.callee.caller,b=a.__KityMethodName,c=a.__KityMethodClass.__KityMixins;if(!c)return this;var d=c[b];if("constructor"==b){for(var e=0,f=d.length;f>e;e++)d[e].call(this);return this}return d.apply(this,arguments)},Class.prototype.pipe=function(a){return"function"==typeof a&&a.call(this,this),this},Class.prototype.getType=function(){return this.__KityClassName};var KITY_INHERIT_FLAG="__KITY_INHERIT_FLAG_"+ +new Date;exports.createClass=function(a,b){var c,d,e;return 1===arguments.length&&(b=arguments[0],a="AnonymousClass"),e=b.base||Class,b.hasOwnProperty("constructor")?(c=b.constructor,e!=Class&&checkBaseConstructorCall(c,a)):c=function(){this.callBase.apply(this,arguments),this.callMixin.apply(this,arguments)},d=inherit(c,e,a),d=mixin(d,b.mixins),d.__KityClassName=c.__KityClassName=a,d.__KityBaseClass=c.__KityBaseClass=e,d.__KityMethodName=c.__KityMethodName="constructor",d.__KityMethodClass=c.__KityMethodClass=d,delete b.mixins,delete b.constructor,delete b.base,d=extend(d,b)},exports.extendClass=extend}),define("core/config",[],function(){return{debug:!0,version:"1.0.0"}}),define("core/utils",[],function(){var a={each:function(a,b,c){if(null!==a)if(a.length===+a.length){for(var d=0,e=a.length;e>d;d++)if(b.call(c,a[d],d,a)===!1)return!1}else for(var f in a)if(a.hasOwnProperty(f)&&b.call(c,a[f],f,a)===!1)return!1},extend:function(a){for(var b=arguments,c=this.isBoolean(b[b.length-1])?b[b.length-1]:!1,d=this.isBoolean(b[b.length-1])?b.length-1:b.length,e=1;d>e;e++){var f=b[e];for(var g in f)c&&a.hasOwnProperty(g)||(a[g]=f[g])}return a},clone:function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},getValue:function(a,b){return void 0!==a?a:b}};return a.each(["String","Function","Array","Number","RegExp","Object","Boolean"],function(b){a["is"+b]=function(a){return Object.prototype.toString.apply(a)=="[object "+b+"]"}}),a}),define("filter/effect/colormatrixeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("ColorMatrixEffect",{base:b,constructor:function(a,e){this.callBase(b.NAME_COLOR_MATRIX),this.set("type",c.getValue(a,d.TYPE_MATRIX)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}});return c.extend(d,{TYPE_MATRIX:"matrix",TYPE_SATURATE:"saturate",TYPE_HUE_ROTATE:"hueRotate",TYPE_LUMINANCE_TO_ALPHA:"luminanceToAlpha",MATRIX_ORIGINAL:"10000010000010000010".split("").join(" "),MATRIX_EMPTY:"00000000000000000000".split("").join(" ")}),d}),define("filter/effect/compositeeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("CompositeEffect",{base:b,constructor:function(a,e,f){this.callBase(b.NAME_COMPOSITE),this.set("operator",c.getValue(a,d.OPERATOR_OVER)),e&&this.set("in",e),f&&this.set("in2",f)}});return c.extend(d,{OPERATOR_OVER:"over",OPERATOR_IN:"in",OPERATOR_OUT:"out",OPERATOR_ATOP:"atop",OPERATOR_XOR:"xor",OPERATOR_ARITHMETIC:"arithmetic"}),d}),define("filter/effect/convolvematrixeffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils"),d=a("core/class").createClass("ConvolveMatrixEffect",{base:b,constructor:function(a,e){this.callBase(b.NAME_CONVOLVE_MATRIX),this.set("edgeMode",c.getValue(a,d.MODE_DUPLICATE)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}});return c.extend(d,{MODE_DUPLICATE:"duplicate",MODE_WRAP:"wrap",MODE_NONE:"none"}),d}),define("filter/effect/effect",["graphic/svg","core/class","core/config","core/utils"],function(a){var b=a("graphic/svg"),c=a("core/class").createClass("Effect",{constructor:function(a){this.node=b.createNode(a)},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node},toString:function(){return this.node.getAttribute("result")||""}});return a("core/utils").extend(c,{NAME_GAUSSIAN_BLUR:"feGaussianBlur",NAME_OFFSET:"feOffset",NAME_COMPOSITE:"feComposite",NAME_COLOR_MATRIX:"feColorMatrix",NAME_CONVOLVE_MATRIX:"feConvolveMatrix",INPUT_SOURCE_GRAPHIC:"SourceGraphic",INPUT_SOURCE_ALPHA:"SourceAlpha",INPUT_BACKGROUND_IMAGE:"BackgroundImage",INPUT_BACKGROUND_ALPHA:"BackgroundAlpha",INPUT_FILL_PAINT:"FillPaint",INPUT_STROKE_PAINT:"StrokePaint"}),c}),define("filter/effect/gaussianblureffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils");return a("core/class").createClass("GaussianblurEffect",{base:b,constructor:function(a,d){this.callBase(b.NAME_GAUSSIAN_BLUR),this.set("stdDeviation",c.getValue(a,1)),this.set("in",c.getValue(d,b.INPUT_SOURCE_GRAPHIC))}})}),define("filter/effect/offseteffect",["filter/effect/effect","graphic/svg","core/class","core/utils","core/config"],function(a){var b=a("filter/effect/effect"),c=a("core/utils");return a("core/class").createClass("OffsetEffect",{base:b,constructor:function(a,d,e){this.callBase(b.NAME_OFFSET),this.set("dx",c.getValue(a,0)),this.set("dy",c.getValue(d,0)),this.set("in",c.getValue(e,b.INPUT_SOURCE_GRAPHIC))}})}),define("filter/effectcontainer",["core/class","core/config","graphic/container"],function(a){return a("core/class").createClass("EffectContainer",{base:a("graphic/container"),addEffect:function(){return this.addItem.apply(this,arguments)},prependEffect:function(){return this.prependItem.apply(this,arguments)},appendEffect:function(){return this.appendItem.apply(this,arguments)},removeEffect:function(){return this.removeItem.apply(this,arguments)},addEffects:function(){return this.addItems.apply(this,arguments)},setEffects:function(){return this.setItems.apply(this,arguments)},getEffect:function(){return this.getItem.apply(this,arguments)},getEffects:function(){return this.getItems.apply(this,arguments)},getFirstEffect:function(){return this.getFirstItem.apply(this,arguments)},getLastEffect:function(){return this.getLastItem.apply(this,arguments)},itemAddedHandler:function(a,b){var c=this.getEffects().length,d=this.getItem(b+1);return c===b+1?(this.node.appendChild(a.getNode()),void 0):(this.node.insertBefore(a.getNode(),d.getNode()),void 0)}})}),define("filter/filter",["graphic/svg","core/class","core/config","filter/effectcontainer","graphic/container","graphic/shape","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){var b=a("graphic/svg"),c=a("core/class"),d=c.createClass("Filter",{mixins:[a("filter/effectcontainer")],constructor:function(a,c,d,e){this.node=b.createNode("filter"),void 0!==a&&this.set("x",a),void 0!==c&&this.set("y",c),void 0!==d&&this.set("width",d),void 0!==e&&this.set("height",e)},getId:function(){return this.id},setId:function(a){return this.node.id=a,this},set:function(a,b){return this.node.setAttribute(a,b),this},get:function(a){return this.node.getAttribute(a)},getNode:function(){return this.node}}),e=a("graphic/shape");return c.extendClass(e,{applyFilter:function(a){var b=a.get("id");return b&&this.node.setAttribute("filter","url(#"+b+")"),this}}),d}),define("filter/gaussianblurfilter",["filter/effect/gaussianblureffect","filter/effect/effect","core/utils","core/class","core/config","filter/filter","graphic/svg","filter/effectcontainer","graphic/shape"],function(a){var b=a("filter/effect/gaussianblureffect");return a("core/class").createClass("GaussianblurFilter",{base:a("filter/filter"),constructor:function(a){this.callBase(),this.addEffect(new b(a))}})}),define("filter/projectionfilter",["filter/effect/gaussianblureffect","filter/effect/effect","core/utils","core/class","graphic/svg","filter/effect/colormatrixeffect","graphic/color","graphic/standardcolor","filter/effect/compositeeffect","filter/effect/offseteffect","core/config","filter/filter","filter/effectcontainer","graphic/shape"],function(a){var b=a("filter/effect/gaussianblureffect"),c=a("filter/effect/effect"),d=a("filter/effect/colormatrixeffect"),e=a("graphic/color"),f=a("core/utils"),g=a("filter/effect/compositeeffect"),h=a("filter/effect/offseteffect");return a("core/class").createClass("ProjectionFilter",{base:a("filter/filter"),constructor:function(a,e,f){this.callBase(),this.gaussianblurEffect=new b(a,c.INPUT_SOURCE_ALPHA),this.gaussianblurEffect.set("result","gaussianblur"),this.addEffect(this.gaussianblurEffect),this.offsetEffect=new h(e,f,this.gaussianblurEffect),this.offsetEffect.set("result","offsetBlur"),this.addEffect(this.offsetEffect),this.colorMatrixEffect=new d(d.TYPE_MATRIX,this.offsetEffect),this.colorMatrixEffect.set("values",d.MATRIX_ORIGINAL),this.colorMatrixEffect.set("result","colorOffsetBlur"),this.addEffect(this.colorMatrixEffect),this.compositeEffect=new g(g.OPERATOR_OVER,c.INPUT_SOURCE_GRAPHIC,this.colorMatrixEffect),this.addEffect(this.compositeEffect)},setColor:function(a){var b=null,c=[];if(f.isString(a)&&(a=e.parse(a)),!a)return this;b=d.MATRIX_EMPTY.split(" "),c.push(a.get("r")),c.push(a.get("g")),c.push(a.get("b"));for(var g=0,h=c.length;h>g;g++)b[5*g+3]=c[g]/255;return b[18]=a.get("a"),this.colorMatrixEffect.set("values",b.join(" ")),this},setOpacity:function(a){var b=this.colorMatrixEffect.get("values").split(" ");return b[18]=a,this.colorMatrixEffect.set("values",b.join(" ")),this},setOffset:function(a,b){this.setOffsetX(a),this.setOffsetY(b)},setOffsetX:function(a){this.offsetEffect.set("dx",a)},setOffsetY:function(a){this.offsetEffect.set("dy",a)},setDeviation:function(a){this.gaussianblurEffect.set("stdDeviation",a)}})}),define("graphic/bezier",["core/class","core/config","graphic/pointcontainer","graphic/container","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){return a("core/class").createClass("Bezier",{mixins:[a("graphic/pointcontainer")],base:a("graphic/path"),constructor:function(a){this.callBase(),a=a||[],this.changeable=!0,this.setBezierPoints(a)},getBezierPoints:function(){return this.getPoints()},setBezierPoints:function(a){return this.setPoints(a)},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=null,b=this.getBezierPoints();if(!(b.length<2)){a=this.getDrawer(),a.clear();var c=b[0].getVertex(),d=null,e=null;a.moveTo(c.x,c.y);for(var f=1,g=b.length;g>f;f++)c=b[f].getVertex(),e=b[f].getBackward(),d=b[f-1].getForward(),a.bezierTo(d.x,d.y,e.x,e.y,c.x,c.y);return this}}})}),define("graphic/bezierpoint",["graphic/shapepoint","core/class","graphic/point","graphic/vector","core/config"],function(a){var b=a("graphic/shapepoint"),c=a("graphic/vector"),d=a("core/class").createClass("BezierPoint",{constructor:function(a,c,d){this.vertex=new b(a,c),this.forward=new b(a,c),this.backward=new b(a,c),this.setSmooth(void 0===d||d),this.setSymReflaction(!0)},clone:function(){var a=new d,b=null;return b=this.getVertex(),a.setVertex(b.x,b.y),b=this.getForward(),a.setForward(b.x,b.y),b=this.getBackward(),a.setBackward(b.x,b.y),a.setSmooth(a.isSmooth()),a},setVertex:function(a,b){return this.vertex.setPoint(a,b),this.update(),this},moveTo:function(a,b){var c=this.forward.getPoint(),d=this.backward.getPoint(),e=this.vertex.getPoint(),f={left:a-e.x,top:b-e.y};this.forward.setPoint(c.x+f.left,c.y+f.top),this.backward.setPoint(d.x+f.left,d.y+f.top),this.vertex.setPoint(a,b),this.update()},setForward:function(a,b){return this.forward.setPoint(a,b),this.smooth&&this.updateAnother(this.forward,this.backward),this.update(),this},setBackward:function(a,b){return this.backward.setPoint(a,b),this.smooth&&this.updateAnother(this.backward,this.forward),this.update(),this},setSymReflaction:function(a){this.symReflaction=a},isSymReflaction:function(){return this.symReflaction},updateAnother:function(a,b){var d=this.getVertex(),e=c.fromPoints(a.getPoint(),d),f=c.fromPoints(d,b.getPoint());f=c.normalize(e,this.isSymReflaction()?e.length():f.length()),b.setPoint(d.x+f.x,d.y+f.y)},setSmooth:function(a){return this.smooth=!!a,this},getVertex:function(){return this.vertex.getPoint()},getForward:function(){return this.forward.getPoint()},getBackward:function(){return this.backward.getPoint()},isSmooth:function(){return this.smooth},update:function(){return this.container?(this.container.update&&this.container.update(this),void 0):this}});return d}),define("graphic/circle",["core/class","core/config","graphic/ellipse","core/utils","graphic/path"],function(a){return a("core/class").createClass("Circle",{base:a("graphic/ellipse"),constructor:function(a,b,c){this.callBase(a,a,b,c)},getRadius:function(){return this.getRadiusX()},setRadius:function(a){return this.callBase(a,a)}})}),define("graphic/clip",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Clip",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("clipPath")},clip:function(a){return a.getNode().setAttribute("clip-path","url(#"+this.getId()+")"),this}});return b.extendClass(c,{clipWith:function(a){return a.clip(this),this}}),d}),define("graphic/color",["core/utils","graphic/standardcolor","core/class","core/config"],function(a){var b=a("core/utils"),c=a("graphic/standardcolor"),d={},e=a("core/class").createClass("Color",{constructor:function(){var a=null;"string"==typeof arguments[0]?(a=d.parseToValue(arguments[0]),null===a&&(a={r:0,g:0,b:0,h:0,s:0,l:0,a:1})):(a={r:0|arguments[0],g:0|arguments[1],b:0|arguments[2],a:parseFloat(arguments[3])||1},a=d.overflowFormat(a),a=b.extend(a,d.rgbValueToHslValue(a))),this._color=a},set:function(a,c){if(!e._MAX_VALUE[a])throw new Error("Color set(): Illegal parameter");return"a"!==a&&(c=Math.floor(c)),"h"==a&&(c=(c+360)%360),this._color[a]=Math.max(e._MIN_VALUE[a],Math.min(e._MAX_VALUE[a],c)),-1!=="rgb".indexOf(a)?this._color=b.extend(this._color,d.rgbValueToHslValue(this._color)):-1!=="hsl".indexOf(a)&&(this._color=b.extend(this._color,d.hslValueToRGBValue(this._color))),this},inc:function(a,b){return b=this.get(a)+b,"h"==a?b=(b+360)%360:(b=Math.min(e._MAX_VALUE[a],b),b=Math.max(e._MIN_VALUE[a],b)),this.clone().set(a,b)},dec:function(a,b){return this.inc(a,-b)},clone:function(){return new e(this.toRGBA())},get:function(a){return e._MAX_VALUE[a]?this._color[a]:null},getValues:function(){return b.clone(this._color)},toRGB:function(){return d.toString(this._color,"rgb")},toRGBA:function(){return d.toString(this._color,"rgba")},toHEX:function(){return d.toString(this._color,"hex")},toHSL:function(){return d.toString(this._color,"hsl")},toHSLA:function(){return d.toString(this._color,"hsla")},toString:function(){return 1===this._color.a?this.toRGB():this.toRGBA()}});return b.extend(e,{_MAX_VALUE:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},_MIN_VALUE:{r:0,g:0,b:0,h:0,s:0,l:0,a:0},R:"r",G:"g",B:"b",H:"h",S:"s",L:"l",A:"a",parse:function(a){var b=d.parseToValue(a);return null===b?new e:new e(b.r,b.g,b.b,b.a)},createHSL:function(a,b,c){return e.createHSLA(a,b,c,1)},createHSLA:function(a,b,c,d){var f=null;return b+="%",c+="%",f=["hsla("+a,b,c,d+")"],e.parse(f.join(", "))},createRGB:function(a,b,c){return e.createRGBA(a,b,c,1)},createRGBA:function(a,b,c,d){return new e(a,b,c,d)}}),b.extend(d,{parseToValue:function(a){var b={};if(a=c.EXTEND_STANDARD[a]||c.COLOR_STANDARD[a]||a,/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a))b=d.hexToValue(a);else if(/^(rgba?)/i.test(a))b=d.rgbaToValue(a);else{if(!/^(hsla?)/i.test(a))return null;b=d.hslaToValue(a)}return d.overflowFormat(b)},hexToValue:function(a){var c={},e=["r","g","b"];return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?(a=RegExp.$1.split(""),b.each(e,function(b,e){c[b]=3===a.length?d.toNumber(a[e]+a[e]):d.toNumber(a[2*e]+a[2*e+1])}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=1,c):null},rgbaToValue:function(a){var c={},e=!1,f=["r","g","b"];return/^(rgba?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^rgba?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),b.each(f,function(b,d){c[b]=0|a[d]}),c=b.extend(c,d.rgbValueToHslValue(c)),c.a=e?parseFloat(a[3]):1,c):null},hslaToValue:function(a){var c={},e=!1;return/^(hsla?)/i.test(a)?(e=4===RegExp.$1.length,a=a.replace(/^hsla?/i,"").replace(/\s+/g,"").replace(/[^0-9,.]/g,"").split(","),c.h=0|a[0],c.s=0|a[1],c.l=0|a[2],c=b.extend(c,d.hslValueToRGBValue(c)),c=d.hslValueToRGBValue(c),c.a=e?parseFloat(a[3]):1,c):null},hslValueToRGBValue:function(a){function c(a,b,c){return 0>c?c+=1:c>1&&(c-=1),1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+(b-a)*(2/3-c)*6:a}var d=null,e=null,f={};return a=b.extend({},a),a.h=a.h/360,a.s=a.s/100,a.l=a.l/100,0===a.s?f.r=f.g=f.b=a.l:(d=a.l<.5?a.l*(1+a.s):a.l+a.s-a.l*a.s,e=2*a.l-d,f.r=c(e,d,a.h+1/3),f.g=c(e,d,a.h),f.b=c(e,d,a.h-1/3)),f.r=Math.min(Math.round(255*f.r),255),f.g=Math.min(Math.round(255*f.g),255),f.b=Math.min(Math.round(255*f.b),255),f},rgbValueToHslValue:function(a){var c=null,d=null,e={};return a=b.extend({},a),a.r=a.r/255,a.g=a.g/255,a.b=a.b/255,c=Math.max(a.r,a.g,a.b),d=Math.min(a.r,a.g,a.b),c===d?e.h=0:c===a.r?e.h=a.g>=a.b?60*(a.g-a.b)/(c-d):60*(a.g-a.b)/(c-d)+360:c===a.g?e.h=60*(a.b-a.r)/(c-d)+120:c===a.b&&(e.h=60*(a.r-a.g)/(c-d)+240),e.l=(c+d)/2,e.s=0===e.l||c===d?0:e.l>0&&e.l<=.5?(c-d)/(c+d):(c-d)/(2-c-d),e.h=Math.round(e.h),e.s=Math.round(100*e.s),e.l=Math.round(100*e.l),e
},toString:function(a,c){var e=[];return a=b.extend({},a),-1!==c.indexOf("hsl")&&(a.s+="%",a.l+="%"),"hex"!==c?(b.each(c.split(""),function(b){e.push(a[b])}),(c+"("+e.join(", ")+")").toLowerCase()):(e.push(d.toHexValue(+a.r)),e.push(d.toHexValue(+a.g)),e.push(d.toHexValue(+a.b)),("#"+e.join("")).toLowerCase())},toNumber:function(a){return 0|Number("0x"+a)},toHexValue:function(a){var b=a.toString(16);return 1===b.length?"0"+b:b},overflowFormat:function(a){var c=b.extend({},a),d="rgba";return b.each(d.split(""),function(a){c.hasOwnProperty(a)&&(c[a]=Math.min(e._MAX_VALUE[a],c[a]),c[a]=Math.max(e._MIN_VALUE[a],c[a]))}),c}}),e}),define("graphic/container",["core/class","core/config"],function(a){function b(){return this.container.removeItem(this),this}return a("core/class").createClass("Container",{getItems:function(){return this.items||(this.items=[])},getItem:function(a){return this.getItems()[a]},getFirstItem:function(){return this.getItem(0)},getLastItem:function(){return this.getItem(this.getItems().length-1)},indexOf:function(a){return this.getItems().indexOf(a)},eachItem:function(a){var b,c=this.getItems(),d=c.length;for(b=0;d>b;b++)a.call(this,b,c[b]);return this},addItem:function(a,c,d){var e=this.getItems(),f=e.length;return~e.indexOf(a)?this:(c>=0&&f>c||(c=f),e.splice(c,0,a),"object"==typeof a&&(a.container=this,a.remove=b),this.handleAdd(a,c),d||this.onContainerChanged("add",[a]),this)},addItems:function(a){for(var b=0,c=a.length;c>b;b++)this.addItem(a[b],-1,!0);return this.onContainerChanged("add",a),this},setItems:function(a){return this.clear().addItems(a)},appendItem:function(a){return this.addItem(a)},prependItem:function(a){return this.addItem(a,0)},removeItem:function(a,b){if("number"!=typeof a)return this.removeItem(this.indexOf(a));var c=this.getItems(),d=(c.length,c[a]);return void 0===d?this:(c.splice(a,1),d.container&&delete d.container,d.remove&&delete d.remove,this.handleRemove(d,a),b||this.onContainerChanged("remove",[d]),this)},clear:function(){for(var a,b=[];a=this.getFirstItem();)b.push(a),this.removeItem(0,!0);return this.onContainerChanged("remove",b),this},onContainerChanged:function(){},handleAdd:function(){},handleRemove:function(){}})}),define("graphic/curve",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg","graphic/pointcontainer","graphic/container"],function(a){var b=a("core/utils"),c={getCurvePanLines:function(a,b){var d=c.getCenterPoints(a),e=c.getPanLine(a.length,d);return c.getMovedPanLines(a,e,b)},getCenterPoints:function(a){for(var b={},c=null,d=0,e=0,f=a.length;f>d;d++)e=d===f-1?0:d+1,c=d+","+e,b[c]={x:(a[d].getX()+a[e].getX())/2,y:(a[d].getY()+a[e].getY())/2};return b},getPanLine:function(a,b){for(var c,d={},e=null,f=0;a>f;f++){var g=null,h=null;c=(f+1)%a,e=c,g=b[f+","+c],f=c,c=(f+1)%a,h=b[f+","+c],d[e]={points:[{x:g.x,y:g.y},{x:h.x,y:h.y}],center:{x:(g.x+h.x)/2,y:(g.y+h.y)/2}},f=(e+a-1)%a}return d},getMovedPanLines:function(a,c,d){var e={};return b.each(a,function(a,f){var g=c[f],h=g.center,i={x:h.x-a.getX(),y:h.y-a.getY()},j=e[f]={points:[],center:{x:a.getX(),y:a.getY()}};b.each(g.points,function(a){var b={x:a.x-i.x,y:a.y-i.y},c=j.center,e=b.x-c.x,f=b.y-c.y;b.x=c.x+d*e,b.y=c.y+d*f,j.points.push(b)})}),e}};return a("core/class").createClass("Curve",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.setPoints(a||[]),this.closeState=!!b,this.changeable=!0,this.smoothFactor=1,this.update()},onContainerChanged:function(){this.changeable&&this.update()},setSmoothFactor:function(a){return this.smoothFactor=0>a?0:a,this.update(),this},getSmoothFactor:function(){return this.smoothFactor},update:function(){var a=this.getPoints(),b=null,d=this.getDrawer(),e=null,f=null,g=null;if(d.clear(),0===a.length)return this;if(d.moveTo(a[0].getX(),a[0].getY()),1===a.length)return this;if(2===a.length)return d.lineTo(a[1].getX(),a[1].getY()),this;b=c.getCurvePanLines(a,this.getSmoothFactor());for(var h=1,i=a.length;i>h;h++)e=b[h].center,f=this.closeState||h!=i-1?b[h].points[0]:b[h].center,g=this.closeState||1!=h?b[h-1].points[1]:b[h-1].center,d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y);return this.closeState&&(e=b[0].center,f=b[0].points[0],g=b[a.length-1].points[1],d.bezierTo(g.x,g.y,f.x,f.y,e.x,e.y)),this},close:function(){return this.closeState=!0,this.update()},open:function(){return this.closeState=!1,this.update()},isClose:function(){return!!this.closeState}})}),define("graphic/data",["core/class","core/config"],function(a){return a("core/class").createClass("Data",{constructor:function(){this._data={}},setData:function(a,b){return this._data[a]=b,this},getData:function(a){return this._data[a]},removeData:function(a){return delete this._data[a],this}})}),define("graphic/defbrush",["graphic/svg","core/class","core/config"],function(a){var b=a("graphic/svg");return a("core/class").createClass("GradientBrush",{constructor:function(a){this.callBase(),this.node=b.createNode(a)},fill:function(a){var b=a.node;return b.setAttribute("fill","url(#"+this.node.id+")"),this}})}),define("graphic/ellipse",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg"],function(a){a("core/utils");return a("core/class").createClass("Ellipse",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.rx=a||0,this.ry=b||0,this.cx=c||0,this.cy=d||0,this.update()},update:function(){var a=this.rx,b=this.ry;x1=this.cx+a,x2=this.cx-a,y=this.cy;var c=this.getDrawer();return c.clear(),c.moveTo(x1,y),c.arcTo(a,b,0,1,1,x2,y),c.arcTo(a,b,0,1,1,x1,y),this},getRadius:function(){return{x:this.rx,y:this.ry}},getRadiusX:function(){return this.rx},getRadiusY:function(){return this.ry},getCenter:function(){return{x:this.cx,y:this.cy}},getCenterX:function(){return this.cx},getCenterY:function(){return this.cy},setRadius:function(a,b){return this.rx=a,this.ry=b,this.update()},setRadiusX:function(a){return this.rx=a,this.update()},setRadiusY:function(a){return this.ry=a,this.update()},setCenter:function(a,b){return this.cx=a,this.cy=b,this.update()},setCenterX:function(a){return this.cx=a,this.update()},setCenterY:function(a){return this.cy=a,this.update()}})}),define("graphic/eventhandler",["core/utils","graphic/shapeevent","graphic/matrix","core/class","core/config"],function(a){function b(a,b,c){return c=!!c,i.isString(a)&&(a=a.match(/\S+/g)),i.each(a,function(a){d.call(this,this.node,a,b,c)},this),this}function c(a,b){var c=null,d=this._EVNET_UID,e=void 0===b;try{c=l[d][a]}catch(g){return}return e||(e=!0,i.each(c,function(a,d){a===b?delete c[d]:e=!1})),e&&(f(this.node,a,k[d][a]),delete l[d][a],delete k[d][a]),this}function d(a,b,c,d){var f=this._EVNET_UID,g=this;k[f]||(k[f]={}),k[f][b]||(k[f][b]=function(a){a=new j(a||window.event),i.each(l[f][b],function(c){var e;return c&&(e=c.call(g,a),d&&g.off(b,c)),e},g)}),l[f]||(l[f]={}),l[f][b]?l[f][b].push(c):(l[f][b]=[c],a&&e(a,b,k[f][b]))}function e(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function f(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent(b,c)}function g(a,b,c){var d=new CustomEvent(b,{bubbles:!0,cancelable:!0});d.__kity_param=c,a.dispatchEvent(d)}function h(a,b,c){var d=null,e=null;try{if(e=k[a._EVNET_UID][b],!e)return}catch(f){return}d=i.extend({type:b,target:a},c||{}),e.call(a,d)}!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}window.CustomEvent=window.CustomEvent||a}();var i=a("core/utils"),j=a("graphic/shapeevent"),k={},l={},m=0;return a("core/class").createClass("EventHandler",{constructor:function(){this._EVNET_UID=++m},addEventListener:function(a,c){return b.call(this,a,c,!1)},addOnceEventListener:function(a,c){return b.call(this,a,c,!0)},removeEventListener:function(a,b){return c.call(this,a,b)},on:function(){return this.addEventListener.apply(this,arguments)},once:function(){return this.addOnceEventListener.apply(this,arguments)},off:function(){return this.removeEventListener.apply(this,arguments)},fire:function(){return this.trigger.apply(this,arguments)},trigger:function(a,b){return this.node?g(this.node,a,b):h(this,a,b),this}})}),define("graphic/gradientbrush",["graphic/svg","graphic/defbrush","core/class","graphic/color","core/utils","graphic/standardcolor","core/config"],function(a){var b=a("graphic/svg"),c=a("graphic/defbrush"),d=a("graphic/color");return a("core/class").createClass("GradientBrush",{base:c,constructor:function(a){this.callBase(a),this.stops=[]},addStop:function(a,c,e){var f=b.createNode("stop");return c instanceof d||(c=d.parse(c)),void 0===e&&(e=c.get("a")),f.setAttribute("offset",a),f.setAttribute("stop-color",c.toRGB()),1>e&&f.setAttribute("stop-opacity",e),this.node.appendChild(f),this}})}),define("graphic/group",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","core/config","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){var b=a("graphic/shapecontainer");return a("core/class").createClass("Group",{mixins:[b],base:a("graphic/shape"),constructor:function(){this.callBase("g")}})}),define("graphic/image",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){return a("core/class").createClass("Image",{base:a("graphic/shape"),constructor:function(a,b,c,d,e){this.callBase("image"),this.url=a,this.width=b||0,this.height=c||0,this.x=d||0,this.y=e||0,this.update()},update:function(){return this.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.url),this.node.setAttribute("x",this.x),this.node.setAttribute("y",this.y),this.node.setAttribute("width",this.width),this.node.setAttribute("height",this.height),this},setUrl:function(a){return this.url=""===a?null:a,this.update()},getUrl:function(){return this.url},setWidth:function(a){return this.width=a,this.update()},getWidth:function(){return this.width},setHeight:function(a){return this.height=a,this.update()},getHeight:function(){return this.height},setX:function(a){return this.x=a,this.update()},getX:function(){return this.x},setY:function(a){return this.y=a,this.update()},getY:function(){return this.y}})}),define("graphic/line",["core/class","core/config","graphic/path","core/utils","graphic/shape","graphic/svg"],function(a){return a("core/class").createClass("Line",{base:a("graphic/path"),constructor:function(a,b,c,d){this.callBase(),this.point1={x:a||0,y:b||0},this.point2={x:c||0,y:d||0},this.update()},setPoint1:function(a,b){return this.point1.x=a,this.point1.y=b,this.update()},setPoint2:function(a,b){return this.point2.x=a,this.point2.y=b,this.update()},getPoint1:function(){return{x:this.point1.x,y:this.point1.y}},getPoint2:function(){return{x:this.point2.x,y:this.point2.y}},update:function(){var a=this.getDrawer();return a.clear(),a.moveTo(this.point1.x,this.point1.y),a.lineTo(this.point2.x,this.point2.y),this}})}),define("graphic/lineargradientbrush",["graphic/svg","graphic/gradientbrush","graphic/defbrush","graphic/color","core/class","core/config"],function(a){var b="LinearGradientBrush",c=(a("graphic/svg"),a("graphic/gradientbrush"));return a("core/class").createClass(b,{base:c,constructor:function(a){this.callBase("linearGradient"),this.setStartPosition(0,0),this.setEndPosition(1,0),"function"==typeof a&&a.call(this,this)},setStartPosition:function(a,b){return this.node.setAttribute("x1",a),this.node.setAttribute("y1",b),this},setEndPosition:function(a,b){return this.node.setAttribute("x2",a),this.node.setAttribute("y2",b),this},getStartPosition:function(){return{x:+this.node.getAttribute("x1"),y:+this.node.getAttribute("y1")}},getEndPosition:function(){return{x:+this.node.getAttribute("x2"),y:+this.node.getAttribute("y2")}}})}),define("graphic/mask",["core/class","core/config","graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","graphic/shapecontainer","graphic/container"],function(a){var b=a("core/class"),c=a("graphic/shape"),d=b.createClass("Mask",{base:c,mixins:[a("graphic/shapecontainer")],constructor:function(){this.callBase("mask")},mask:function(a){return a.getNode().setAttribute("mask","url(#"+this.getId()+")"),this}});return b.extendClass(c,{maskWith:function(a){return a.mask(this),this}}),d}),define("graphic/matrix",["core/utils","graphic/vector","core/class","core/config"],function(a){function b(a,b){return{a:b.a*a.a+b.c*a.b,b:b.b*a.a+b.d*a.b,c:b.a*a.c+b.c*a.d,d:b.b*a.c+b.d*a.d,e:b.a*a.e+b.c*a.f+b.e,f:b.b*a.e+b.d*a.f+b.f}}function c(a){return a*Math.PI/180}var d=a("core/utils"),e=/matrix\((.+)\)/i,f=a("graphic/vector"),g=a("core/class").createClass("Matrix",{constructor:function(){arguments.length?this.setMatrix.apply(this,arguments):this.setMatrix(1,0,0,1,0,0)},translate:function(a,c){return this.m=b(this.m,{a:1,c:0,e:a,b:0,d:1,f:c}),this},rotate:function(a){var d=c(a),e=Math.sin(d),f=Math.cos(d);return this.m=b(this.m,{a:f,c:-e,e:0,b:e,d:f,f:0}),this},scale:function(a,c){return void 0===c&&(c=a),this.m=b(this.m,{a:a,c:0,e:0,b:0,d:c,f:0}),this},skew:function(a,d){void 0===d&&(d=a);var e=Math.tan(c(a)),f=Math.tan(c(d));return this.m=b(this.m,{a:1,c:e,e:0,b:f,d:1,f:0}),this},setMatrix:function(a,b,c,e,f,g){return this.m=1===arguments.length?d.clone(arguments[0]):{a:a,b:b,c:c,d:e,e:f,f:g},this},getMatrix:function(){return d.clone(this.m)},mergeMatrix:function(a){return new g(b(this.m,a.m))},merge:function(a){return this.mergeMatrix(a)},toString:function(){var a=this.m;return"matrix("+[a.a,a.b,a.c,a.d,a.e,a.f].join(", ")+")"},transformPoint:function(a,b){return g.transformPoint(a,b,this.m)},transformBox:function(a){return g.transformBox(a,this.m)}});return g.parse=function(a){var b,c=parseFloat;if(b=e.exec(a)){var d=b[1].split(",");return new g({a:c(d[0]),b:c(d[1]),c:c(d[2]),d:c(d[3]),e:c(d[4]),f:c(d[5])})}return new g},g.transformPoint=function(a,b,c){return new f(c.a*a+c.c*b+c.e,c.b*a+c.d*b+c.f)},g.transformBox=function(a,b){for(var c,d,e=Number.MAX_VALUE,f=-Number.MAX_VALUE,h=Number.MAX_VALUE,i=-Number.MAX_VALUE,j=[[a.x,a.y],[a.x+a.width,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height]],k=[];c=j.pop();)d=g.transformPoint(c[0],c[1],b),k.push(d),e=Math.min(e,d.x),f=Math.max(f,d.x),h=Math.min(h,d.y),i=Math.max(i,d.y);return{x:e,y:h,width:f-e,height:i-h,closurePoints:k,left:e,right:f,top:h,bottom:i}},g}),define("graphic/palette",["graphic/standardcolor","graphic/color","core/utils","core/class","core/config"],function(a){var b=a("graphic/standardcolor"),c=a("graphic/color"),d=a("core/utils"),e=a("core/class").createClass("Palette",{constructor:function(){this.color={}},get:function(a){var d=this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||"";return d?new c(d):null},getColorValue:function(a){return this.color[a]||b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},add:function(a,b){return this.color[a]="string"==typeof b?new c(b).toRGBA():b.toRGBA(),b},remove:function(a){return this.color.hasOwnProperty(a)?(delete this.color[a],!0):!1}});return d.extend(e,{getColor:function(a){var d=b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a];return d?new c(d):null},getColorValue:function(a){return b.EXTEND_STANDARD[a]||b.COLOR_STANDARD[a]||""},addColor:function(a,d){return b.EXTEND_STANDARD[a]="string"==typeof d?new c(d).toRGBA():d.toRGBA(),d},removeColor:function(a){return b.EXTEND_STANDARD.hasOwnProperty(a)?(delete b.EXTEND_STANDARD[a],!0):!1}}),e}),define("graphic/paper",["core/class","core/config","core/utils","graphic/svg","graphic/container","graphic/shapecontainer","graphic/shape","graphic/viewbox","graphic/eventhandler","graphic/shapeevent","graphic/styled","graphic/matrix","graphic/vector","graphic/data","graphic/pen"],function(a){var b=a("core/class"),c=a("core/utils"),d=a("graphic/svg"),e=a("graphic/container"),f=a("graphic/shapecontainer"),g=a("graphic/viewbox"),h=a("graphic/eventhandler"),i=a("graphic/styled"),j=a("graphic/matrix"),k=b.createClass("Paper",{mixins:[f,h,i,g],constructor:function(a){this.callBase(),this.node=this.createSVGNode(),this.node.paper=this,this.node.appendChild(this.resourceNode=d.createNode("defs")),this.node.appendChild(this.shapeNode=d.createNode("g")),this.resources=new e,this.setWidth("100%").setHeight("100%"),a&&this.renderTo(a),this.callMixin()},renderTo:function(a){c.isString(a)&&(a=document.getElementById(a)),this.container=a,a.appendChild(this.node)},createSVGNode:function(){var a=d.createNode("svg");return a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a},getNode:function(){return this.node},getContainer:function(){return this.container},getWidth:function(){return+this.node.getAttribute("width")},setWidth:function(a){return this.node.setAttribute("width",a),this},getHeight:function(){return+this.node.getAttribute("height")},setHeight:function(a){return this.node.setAttribute("height",a),this},setViewPort:function(a,b,c){var d,e;1==arguments.length&&(d=arguments[0],a=d.center.x,b=d.center.y,c=d.zoom),c=c||1,e=this.getViewBox();var f=new j,g=e.x+e.width/2-a,h=e.y+e.height/2-b;return f.translate(-a,-b),f.scale(c),f.translate(a,b),f.translate(g,h),this.shapeNode.setAttribute("transform",f),this.viewport={center:{x:a,y:b},offset:{x:g,y:h},zoom:c},this},getViewPort:function(){if(!this.viewport){var a=this.getViewBox();this.viewport={zoom:1,center:{x:a.x+a.width/2,y:a.y+a.height/2},offset:{x:0,y:0}}}return this.viewport},addResource:function(a){return this.resources.appendItem(a),a.node&&this.resourceNode.appendChild(a.node),this},removeResource:function(a){return a.remove&&a.remove(),a.node&&this.resourceNode.removeChild(a.node),this},getPaper:function(){return this}}),l=a("graphic/shape");return b.extendClass(l,{getPaper:function(){for(var a=this.container;a&&a instanceof k==!1;)a=a.container;return a}}),k}),define("graphic/path",["core/utils","core/class","core/config","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){var b=(a("core/utils"),a("core/class").createClass),c=a("graphic/shape"),d=a("graphic/svg"),e=a("core/config"),f=b("PathDrawer",{constructor:function(a){this.path=a,this.__clear=!1},appendData:function(a){var b=this.path.getPathData();return this.__clear&&(b="",this.__clear=!1),b?this.path.setPathData(b+" "+a.join(" ")):this.path.setPathData(a.join(" ")),this},moveTo:function(a,b){return this.appendData(["M",a,b])},moveBy:function(a,b){return this.appendData(["m",a,b])},lineTo:function(a,b){return this.appendData(["L",a,b])},lineBy:function(a,b){return this.appendData(["l",a,b])},arcTo:function(a,b,c,d,e,f,g){return this.appendData(["A",a,b,c,d,e,f,g])},arcBy:function(a,b,c,d,e,f,g){return this.appendData(["a",a,b,c,d,e,f,g])},carcTo:function(a,b,c,d,e){return this.arcTo(a,a,0,d||0,e||0,b,c)},carcBy:function(a,b,c,d,e){return this.arcBy(a,a,0,d||0,e||0,b,c)},bezierTo:function(a,b,c,d,e,f){return this.appendData(["C",a,b,c,d,e,f])},bezierBy:function(a,b,c,d,e,f){return this.appendData(["c",a,b,c,d,e,f])},close:function(){return this.appendData(["z"])},clear:function(){return this.__clear=!0,this.path.setPathData("M 0 0"),this}});return b("Path",{base:c,constructor:function(a){this.callBase("path"),a&&this.setPathData(a),this.node.setAttribute("fill",d.defaults.fill),this.node.setAttribute("stroke",d.defaults.stroke)},setPathData:function(a){if(a){this.pathdata=a;var b=this;return e.debug?(b.node.setAttribute("d",a),this.trigger("shapeupdate",{type:"pathdata"})):(clearTimeout(this.lazyDumpId),this.lazyDumpId=setTimeout(function(){b.node.setAttribute("d",a),this.trigger("shapeupdate",{type:"pathdata"})})),this}},getPathData:function(){return this.pathdata||""},getDrawer:function(){return new f(this)},isClosed:function(){var a=this.getPathData();return!!~a.indexOf("z")||!!~a.indexOf("Z")}})}),define("graphic/patternbrush",["graphic/defbrush","graphic/svg","core/class","graphic/shapecontainer","graphic/container","core/utils","graphic/shape","core/config"],function(a){{var b=a("graphic/defbrush"),c=a("graphic/shapecontainer");a("graphic/svg")}return a("core/class").createClass("PatternBrush",{base:b,mixins:[c],constructor:function(){this.callBase("pattern"),this.node.setAttribute("patternUnits","userSpaceOnUse")},setX:function(a){return this.x=a,this.node.setAttribute("x",a),this},setY:function(a){return this.y=a,this.node.setAttribute("y",a),this},setWidth:function(a){return this.width=a,this.node.setAttribute("width",a),this},setHeight:function(a){return this.height=a,this.node.setAttribute("height",a),this},getWidth:function(){return this.width},getHeight:function(){return this.height}})}),define("graphic/pen",["graphic/color","core/utils","graphic/standardcolor","core/class","core/config"],function(a){var b=a("graphic/color");return a("core/class").createClass("Pen",{constructor:function(a,c){this.color=a instanceof b?a:new b(a),this.width=c||1,this.linecap=null,this.linejoin=null,this.dashArray=null,this.opacity=this.color.get("a")},getColor:function(){return this.color},setColor:function(a){return"string"==typeof a&&(a=new b(a)),this.color=a,this.opacity=this.color.get("a"),this},getWidth:function(){return this.width},setWidth:function(a){return this.width=a,this},getOpacity:function(){return this.opacity},setOpacity:function(a){this.opacity=a},getLineCap:function(){return this.linecap},setLineCap:function(a){return this.linecap=a,this},getLineJoin:function(){return this.linejoin},setLineJoin:function(a){return this.linejoin=a,this},getDashArray:function(){return this.dashArray},setDashArray:function(a){return this.dashArray=a,this},stroke:function(a){var b=a.node;b.setAttribute("stroke",this.getColor()),b.setAttribute("stroke-width",this.getWidth()),this.getOpacity()<1&&b.setAttribute("stroke-opacity",this.getOpacity()),this.getLineCap()&&b.setAttribute("stroke-linecap",this.getLineCap()),this.getLineJoin()&&b.setAttribute("stroke-linejoin",this.getLineJoin()),this.getDashArray()&&b.setAttribute("stroke-dasharray",this.getDashArray())}})}),define("graphic/point",["core/class","core/config"],function(a){return a("core/class").createClass("Point",{constructor:function(a,b){this.px=a||0,this.py=b||0},setPoint:function(a,b){return this.px=a,this.py=b,this},getPoint:function(){return{x:this.px,y:this.py}},setX:function(a){return this.px=a,this},getX:function(){return this.px},setY:function(a){return this.py=a,this},getY:function(){return this.py}})}),define("graphic/pointcontainer",["core/class","core/config","graphic/container"],function(a){return a("core/class").createClass("PointContainer",{base:a("graphic/container"),constructor:function(){this.callBase()},addPoint:function(){return this.addItem.apply(this,arguments)},prependPoint:function(){return this.prependItem.apply(this,arguments)},appendPoint:function(){return this.appendItem.apply(this,arguments)},removePoint:function(){return this.removeItem.apply(this,arguments)},addPoints:function(){return this.addItems.apply(this,arguments)},setPoints:function(){return this.setItems.apply(this,arguments)},getPoint:function(){return this.getItem.apply(this,arguments)},getPoints:function(){return this.getItems.apply(this,arguments)},getFirstPoint:function(){return this.getFirstItem.apply(this,arguments)},getLastPoint:function(){return this.getLastItem.apply(this,arguments)}})}),define("graphic/poly",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg","graphic/pointcontainer","graphic/container"],function(a){a("core/utils");return a("core/class").createClass("Poly",{base:a("graphic/path"),mixins:[a("graphic/pointcontainer")],constructor:function(a,b){this.callBase(),this.closeable=!!b,this.setPoints(a||[]),this.changeable=!0,this.update()},onContainerChanged:function(){this.changeable&&this.update()},update:function(){var a=this.getDrawer(),b=this.getPoints();if(a.clear(),!b.length)return this;a.moveTo(b[0].getX(),b[0].getY());for(var c,d=1,e=b.length;e>d;d++)c=b[d],a.lineTo(c.getX(),c.getY());return this.closeable&&b.length>2&&a.close(),this}})}),define("graphic/polygon",["core/class","core/config","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polygon",{base:a("graphic/poly"),constructor:function(a){this.callBase(a,!0)}})}),define("graphic/polyline",["core/class","core/config","graphic/poly","core/utils","graphic/path","graphic/pointcontainer"],function(a){return a("core/class").createClass("Polyline",{base:a("graphic/poly"),constructor:function(a){this.callBase(a)}})}),define("graphic/radialgradientbrush",["graphic/gradientbrush","graphic/svg","graphic/defbrush","graphic/color","core/class","core/config"],function(a){var b=a("graphic/gradientbrush");return a("core/class").createClass("RadialGradientBrush",{base:b,constructor:function(a){this.callBase("radialGradient"),this.setCenter(.5,.5),this.setFocal(.5,.5),this.setRadius(.5),"function"==typeof a&&a.call(this,this)},setCenter:function(a,b){return this.node.setAttribute("cx",a),this.node.setAttribute("cy",b),this},getCenter:function(){return{x:+this.node.getAttribute("cx"),y:+this.node.getAttribute("cy")}},setFocal:function(a,b){return this.node.setAttribute("fx",a),this.node.setAttribute("fy",b),this},getFocal:function(){return{x:+this.node.getAttribute("fx"),y:+this.node.getAttribute("fy")}},setRadius:function(a){return this.node.setAttribute("r",a),this},getRadius:function(){return+this.node.getAttribute("r")}})}),define("graphic/rect",["core/utils","core/class","core/config","graphic/path","graphic/shape","graphic/svg"],function(a){var b={},c=a("core/utils");return c.extend(b,{formatRadius:function(a,b,c){var d=Math.floor(Math.min(a/2,b/2));return Math.min(d,c)},getPathData:function(a,b,c,d,e){var f=null;return 0===e?f=["M "+a+","+b," h "+c," v "+d," h "+-c," Z"]:(c-=2*e,d-=2*e,f=["M "+(a+e)+","+b," h "+c," a "+e+" "+e+" 0 0 1 "+e+" "+e," v "+d," a "+e+" "+e+" 0 0 1 "+-e+" "+e," h "+-c," a "+e+" "+e+" 0 0 1 "+-e+" "+-e," v "+-d," a "+e+" "+e+" 0 0 1 "+e+" "+-e," Z"]),f.join("")}}),a("core/class").createClass("Rect",{base:a("graphic/path"),constructor:function(a,c,d,e,f){this.callBase(),this.x=d||0,this.y=e||0,this.width=a||0,this.height=c||0,this.radius=b.formatRadius(this.width,this.height,f||0),this.update()},update:function(){var a=b.getPathData(this.x,this.y,this.width,this.height,this.radius);return this.setPathData(a),this},setWidth:function(a){return this.width=a,this.update()},setHeight:function(a){return this.height=a,this.update()},setSize:function(a,b){return this.width=a,this.height=b,this.update()},getRadius:function(){return this.radius},setRadius:function(a){return this.radius=a,this.update()},getPosition:function(){return{x:this.x,y:this.y}},setPosition:function(a,b){return this.x=a,this.y=b,this.update()},getWidth:function(){return this.width},getHeight:function(){return this.height},getPositionX:function(){return this.x},getPositionY:function(){return this.y},setPositionX:function(a){return this.x=a,this.update()},setPositionY:function(a){return this.y=a,this.update()}})}),define("graphic/shape",["graphic/svg","core/utils","graphic/eventhandler","graphic/shapeevent","core/class","graphic/styled","graphic/data","graphic/matrix","graphic/vector","graphic/pen","graphic/color","core/config"],function(a){{var b=a("graphic/svg"),c=a("core/utils"),d=a("graphic/eventhandler"),e=a("graphic/styled"),f=a("graphic/data"),g=a("graphic/matrix");a("graphic/pen")}return a("core/class").createClass("Shape",{mixins:[d,e,f],constructor:function(a){this.node=b.createNode(a),this.node.shape=this,this.callMixin()},getId:function(){return this.node.id},setId:function(a){return this.node.id=a,this},getNode:function(){return this.node},getBoundaryBox:function(){var a;try{a=this.node.getBBox()}catch(b){a={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}return a},getRenderBox:function(a){function b(a,b){for(var c=b.container;c&&c!=a;)c=c.container;return!!c}void 0===a?a=this:"top"===a?a=this.getPaper()||this:b(a,this)||(a=this);for(var c=this.getBoundaryBox(),d=this,e=d.getTransform();d!=a;)d=d.container,d.getTransform&&(e=e.merge(d.getTransform()));return e.transformBox(c)},getWidth:function(){return this.getRenderBox().width},getHeight:function(){return this.getRenderBox().height},getSize:function(){var a=this.getRenderBox();return delete a.x,delete a.y,a},setOpacity:function(a){return this.node.setAttribute("opacity",a),this},getOpacity:function(){var a=this.node.getAttribute("opacity");return a?+a:1},getTransform:function(){return g.parse(this.node.getAttribute("transform"))},setTransform:function(a){return this.node.setAttribute("transform",a),this.trigger("shapeupdate",{type:"transform"}),this},resetTransform:function(){return this.node.removeAttribute("transform"),this.trigger("shapeupdate",{type:"transform"}),this},mergeTransform:function(a){return this.setTransform(this.getTransform().mergeMatrix(a))},getAnchor:function(){if(this.anchor&&void 0!==this.anchor.x)return this.anchor;var a=a||"center",b=this.getRenderBox(),c={x:b.x+b.width/2,y:b.y+b.height/2};return~a.indexOf("left")&&(c.x=b.x),~a.indexOf("right")&&(c.x=b.x+b.width),~a.indexOf("top")&&(c.y=b.y),~a.indexOf("bottom")&&(c.y=b.y+b.height),c},setAnchor:function(a,b){return this.anchor=1===arguments.length?a:{x:a,y:b},this},resetAnchor:function(){return delete this.anchor,this},translate:function(a,b){return void 0===b&&(b=0),this.mergeTransform((new g).translate(a,b))},rotate:function(a){var b=this.getAnchor();return this.mergeTransform((new g).translate(-b.x,-b.y).rotate(a).translate(b.x,b.y))},scale:function(a,b){var c=this.getAnchor();return void 0===b&&(b=a),this.mergeTransform((new g).translate(-c.x,-c.y).scale(a,b).translate(c.x,c.y))},skew:function(a,b){var c=this.getAnchor();return void 0===b&&(b=a),this.mergeTransform((new g).translate(-c.x,-c.y).skew(a,b).translate(c.x,c.y))},stroke:function(a,b){return a&&a.stroke?a.stroke(this):(this.node.setAttribute("stroke",a),b&&this.node.setAttribute("stroke-width",b)),this},fill:function(a){return a&&a.fill?a.fill(this):this.node.setAttribute("fill",a),this},setAttr:function(a,b){var d=this;c.isObject(a)&&c.each(a,function(a,b){d.setAttr(b,a)}),void 0===b||null===b||""===b?this.node.removeAttribute(a):this.node.setAttribute(a,b)},getAttr:function(a){return this.node.getAttribute(a)}})}),define("graphic/shapecontainer",["graphic/container","core/class","core/utils","core/config","graphic/shape","graphic/svg","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){var b=a("graphic/container"),c=a("core/utils"),d=a("core/class").createClass("ShapeContainer",{base:b,isShapeContainer:!0,handleAdd:function(a,b){var c=this.getShapeNode();c.insertBefore(a.node,c.childNodes[b]||null),a.trigger("add",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeadd",this)},handleRemove:function(a){var b=this.getShapeNode();b.removeChild(a.node),a.trigger("remove",{container:this}),a.notifyTreeModification&&a.notifyTreeModification("treeremove",this)},notifyTreeModification:function(a,b){this.eachItem(function(c,e){e instanceof d&&e.notifyTreeModification(a,b),e.trigger(a,{container:b})})},getShape:function(a){return this.getItem(a)},addShape:function(a,b){return this.addItem(a,b)},appendShape:function(a){return this.addShape(a)},prependShape:function(a){return this.addShape(a,0)},replaceShape:function(a,b){var c=this.indexOf(b);if(-1!==c)return this.removeShape(c),this.addShape(a,c),this},addShapeBefore:function(a,b){var c=this.indexOf(b);return this.addShape(a,c)},addShapeAfter:function(a,b){var c=this.indexOf(b);return this.addShape(a,-1===c?void 0:c+1)},addShapes:function(a){return this.addItems(a)},removeShape:function(a){return this.removeItem(a)
},getShapes:function(){return this.getItems()},getShapesByType:function(a){function b(e){a.toLowerCase()==e.getType().toLowerCase()&&d.push(e),e.isShapeContainer&&c.each(e.getShapes(),function(a){b(a)})}var d=[];return b(this),d},getShapeById:function(a){return this.getShapeNode().getElementById(a).shape},arrangeShape:function(a,b){return this.removeShape(a).addShape(a,b)},getShapeNode:function(){return this.shapeNode||this.node}}),e=a("graphic/shape");return a("core/class").extendClass(e,{bringTo:function(a){return this.container.arrangeShape(this,a),this},bringFront:function(){return this.bringTo(this.container.indexOf(this)+1)},bringBack:function(){return this.bringTo(this.container.indexOf(this)-1)},bringTop:function(){return this.container.removeShape(this).addShape(this),this},bringRear:function(){return this.bringTo(0)},bringRefer:function(a,b){return a.container&&(this.remove&&this.remove(),a.container.addShape(this,a.container.indexOf(a)+(b||0))),this},bringAbove:function(a){return this.bringRefer(a)},bringBelow:function(a){return this.bringRefer(a,1)},replaceBy:function(a){return this.container&&(a.bringAbove(this),this.remove()),this}}),d}),define("graphic/shapeevent",["graphic/matrix","core/utils","graphic/vector","core/class","core/config"],function(a){var b=a("graphic/matrix"),c=a("core/utils");return a("core/class").createClass("ShapeEvent",{constructor:function(a){var b=null;c.isObject(a.target)?c.extend(this,a):(this.type=a.type,b=a.target,b.correspondingUseElement&&(b=b.correspondingUseElement),this.originEvent=a,this.targetShape=b.shape||b.paper,a.__kity_param&&c.extend(this,a.__kity_param))},preventDefault:function(){var a=this.originEvent;return a?a.preventDefault?(a.preventDefault(),a.cancelable):(a.returnValue=!1,!0):!0},getPosition:function(a){if(!this.originEvent)return null;var c=this.originEvent.touches?this.originEvent.touches[a||0]:this.originEvent,d=c.clientX,e=c.clientY,f=this.targetShape.getPaper(),g=b.transformPoint(d,e,f.node.getScreenCTM().inverse()),h=f.getViewPort();return{x:g.x/h.zoom-h.offset.x,y:g.y/h.zoom-h.offset.y}},stopPropagation:function(){var a=this.originEvent;return a?(a.stopPropagation?a.stopPropagation():a.cancelBubble=!1,void 0):!0}})}),define("graphic/shapepoint",["core/class","core/config","graphic/point"],function(a){return a("core/class").createClass("ShapePoint",{base:a("graphic/point"),constructor:function(a,b){this.callBase(a,b)},setX:function(a){return this.callBase(a),this.update(),this},setY:function(a){return this.callBase(a),this.update(),this},setPoint:function(a,b){return this.callBase(a,b),this.update(),this},update:function(){return this.container&&this.container.update&&this.container.update(),this}})}),define("graphic/standardcolor",[],{COLOR_STANDARD:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00"},EXTEND_STANDARD:{}}),define("graphic/styled",["core/class","core/config"],function(a){return a("core/class").createClass("Styled",{addClass:function(a){return this.node.classList.add(a),this},removeClass:function(a){return this.node.classList.remove(a),this},hasClass:function(a){return this.node.classList.contains(a)},setStyle:function(a){if(2==arguments.length)return this.node.style[arguments[0]]=arguments[1],this;for(var b in a)a.hasOwnProperty(b)&&(this.node.style[b]=a[b]);return this}})}),define("graphic/svg",[],function(){var a=document,b=0,c={createNode:function(d){var e=a.createElementNS(c.ns,d);return e.id="kity_"+d+"_"+b++,e},defaults:{stroke:"none",fill:"none"},xlink:"http://www.w3.org/1999/xlink",ns:"http://www.w3.org/2000/svg"};return c}),define("graphic/text",["graphic/textcontent","graphic/shape","core/class","graphic/shapecontainer","graphic/container","core/utils","graphic/svg","core/config"],function(a){var b=a("graphic/textcontent"),c=a("graphic/shapecontainer"),d=a("graphic/svg");return a("core/class").createClass("Text",{base:b,mixins:[c],constructor:function(a){this.callBase("text"),void 0!==a&&this.setContent(a)},setX:function(a){return this.node.setAttribute("x",a),this},setPosition:function(a,b){return this.setX(a).setY(b)},setY:function(a){return this.node.setAttribute("y",a),this},getX:function(){return+this.node.getAttribute("x")},getY:function(){return+this.node.getAttribute("y")},setTextAnchor:function(a){return"center"==a&&(a="middle"),this.node.setAttribute("text-anchor",a),this.shapeNode!=this.node&&this.shapeNode.setAttribute("startOffset",{start:"0",middle:"50%",end:"100%"}[a]),this},getTextAnchor:function(){return this.node.getAttribute("text-anchor")||"start"},addSpan:function(a){return this.addShape(a),this},setPath:function(a){var b=this.shapeNode;if(this.shapeNode==this.node){for(b=this.shapeNode=d.createNode("textPath");this.node.firstChild;)this.shapeNode.appendChild(this.node.firstChild);this.node.appendChild(b)}return b.setAttributeNS(d.xlink,"xlink:href","#"+a.node.id),this.setAnchor(this.getAnchor()),this}})}),define("graphic/textcontent",["graphic/shape","graphic/svg","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen","core/class","core/config"],function(a){var b=a("graphic/shape");return a("core/class").createClass("TextContent",{base:b,constructor:function(a){this.callBase(a),this.shapeNode=this.shapeNode||this.node},clearContent:function(){for(;this.shapeNode.firstChild;)this.shapeNode.removeChild(this.shapeNode.firstChild);return this},setContent:function(a){return this.shapeNode.textContent=a,this},getContent:function(){return this.shapeNode.textContent},appendContent:function(a){return this.shapeNode.textContent+=a,this},setSize:function(a){return this.fontsize=a,this.node.setAttribute("font-size",a),this},getSize:function(){return this.fontsize},getExtentOfChar:function(a){return this.node.getExtentOfChar(a)},getRotationOfChar:function(a){return this.node.getRotationOfChar(a)},getCharNumAtPosition:function(a,b){return this.node.getCharNumAtPosition(this.node.viewportElement.createSVGPoint(a,b))}})}),define("graphic/textspan",["graphic/textcontent","graphic/shape","core/class","graphic/styled","core/config"],function(a){var b=a("graphic/textcontent"),c=a("graphic/styled");return a("core/class").createClass("TextSpan",{base:b,mixins:[c],constructor:function(a){this.callBase("tspan"),this.setContent(a)}})}),define("graphic/use",["graphic/svg","core/class","core/config","graphic/shape","core/utils","graphic/eventhandler","graphic/styled","graphic/data","graphic/matrix","graphic/pen"],function(a){var b=a("graphic/svg"),c=a("core/class"),d=c.createClass("Use",{base:a("graphic/shape"),constructor:function(a){var c=null;this.callBase("use"),c=a.getId(),c&&this.node.setAttributeNS(b.xlink,"xlink:href","#"+c),"none"===a.node.getAttribute("fill")&&a.node.removeAttribute("fill"),"none"===a.node.getAttribute("stroke")&&a.node.removeAttribute("stroke")}}),e=a("graphic/shape");return c.extendClass(e,{use:function(){return new d(this)}}),d}),define("graphic/vector",["core/class","core/config"],function(a){var b=a("core/class").createClass("Vector",{constructor:function(a,b){this.x=a||0,this.y=b||0},length:function(){return Math.sqrt(b.square(this))}});return b.add=function(a,c){return new b(a.x+c.x,a.y+c.y)},b.square=function(a){return a.x*a.x+a.y*a.y},b.normalize=function(a,c){void 0===c&&(c=1);var d=c/a.length();return new b(a.x*d,a.y*d)},b.verticalVector=function(a){return new b(a.y,-a.x)},b.verticalNormalize=function(a){return b.normalize(b.verticalVector(a))},b.multipy=function(a,c){return new b(a.x*c,a.y*c)},b.reverse=function(a){return b.multipy(a,-1)},b.dot=function(a,b){return a.x*b.x+a.y*b.y},b.minus=function(a,c){return new b(a.x-c.x,a.y-c.y)},b.projection=function(a,c){var d=b.dot(a,c)/b.square(c);return b.multipy(c,d)},b.fromPoints=function(a,c){return new b(c.x-a.x,c.y-a.y)},b.fromPolar=function(a,c,d){return d!==!0&&(c=c*Math.PI/180),new b(a*Math.cos(c),a*Math.sin(c))},b}),define("graphic/view",["graphic/shapecontainer","graphic/container","core/utils","core/class","graphic/shape","graphic/viewbox","core/config","graphic/view"],function(a){var b=a("graphic/shapecontainer"),c=a("graphic/viewbox");return a("core/class").createClass("View",{mixins:[b,c],base:a("graphic/view"),constructor:function(){this.callBase("view")}})}),define("graphic/viewbox",["core/class","core/config"],function(a){return a("core/class").createClass("ViewBox",{getViewBox:function(){var a=this.node.getAttribute("viewBox");return null===a?{x:0,y:0,width:this.node.clientWidth,height:this.node.clientHeight}:(a=a.split(" "),{x:+a[0],y:+a[1],width:+a[2],height:+a[3]})},setViewBox:function(a,b,c,d){return this.node.setAttribute("viewBox",[a,b,c,d].join(" ")),this}})}),function(a){define("kity.start",function(b){var c=a.kity=b("core/class");b("core/utils").extend(c,{Utils:b("core/utils"),Bezier:b("graphic/bezier"),BezierPoint:b("graphic/bezierpoint"),Circle:b("graphic/circle"),Clip:b("graphic/clip"),Color:b("graphic/color"),Curve:b("graphic/curve"),Ellipse:b("graphic/ellipse"),GradientBrush:b("graphic/gradientbrush"),Group:b("graphic/group"),Image:b("graphic/image"),Line:b("graphic/line"),LinearGradientBrush:b("graphic/lineargradientbrush"),Mask:b("graphic/mask"),Matrix:b("graphic/matrix"),Palette:b("graphic/palette"),Paper:b("graphic/paper"),Path:b("graphic/path"),PatternBrush:b("graphic/patternbrush"),Pen:b("graphic/pen"),Point:b("graphic/point"),Polygon:b("graphic/polygon"),Polyline:b("graphic/polyline"),RadialGradientBrush:b("graphic/radialgradientbrush"),Rect:b("graphic/rect"),Shape:b("graphic/shape"),ShapePoint:b("graphic/shapepoint"),Text:b("graphic/text"),TextSpan:b("graphic/textspan"),Use:b("graphic/use"),Vector:b("graphic/vector"),Animator:b("animate/animator"),Easing:b("animate/easing"),OpacityAnimator:b("animate/opacityanimator"),RotateAnimator:b("animate/rotateanimator"),ScaleAnimator:b("animate/scaleanimator"),Timeline:b("animate/timeline"),TranslateAnimator:b("animate/translateanimator"),Filter:b("filter/filter"),GaussianblurFilter:b("filter/gaussianblurfilter"),ProjectionFilter:b("filter/projectionfilter"),ColorMatrixEffect:b("filter/effect/colormatrixeffect"),CompositeEffect:b("filter/effect/compositeeffect"),ConvolveMatrixEffect:b("filter/effect/convolvematrixeffect"),Effect:b("filter/effect/effect"),GaussianblurEffect:b("filter/effect/gaussianblureffect"),OffsetEffect:b("filter/effect/offseteffect")})});try{use("kity.start")}catch(b){}}(this)}();
\ No newline at end of file
KityMinder.LANG[ 'zh-cn' ] = {
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': {
'undo': '撤销',
'redo': '重做',
'bold': '加粗',
'italic': '斜体',
'forecolor': '字体颜色',
'fontfamily': '字体',
'fontsize': '字号',
'layoutstyle': '主题',
'node': '节点操作',
'saveto': '导出',
'hand': '允许拖拽',
'zoom-in': '放大',
'zoom-out': '缩小',
'markers': '添加标签',
'switchlayout': '切换主题'
},
'popupcolor': {
'clearColor': '清空颜色',
'standardColor': '标准颜色',
'themeColor': '主题颜色'
},
'dialogs': {
'markers': {
'static': {
'lang_input_text': '文本内容:',
'lang_input_url': '链接地址:',
'lang_input_title': '标题:',
'lang_input_target': '是否在新窗口打开:'
},
'priority': '优先级',
'progress': {
'notdone': "未完成",
'quarterdone': '完成1/4',
'halfdone': '完成1/2',
'threequartersdone': '完成3/4',
'done': '已完成'
}
}
},
'node': {
'appendsiblingnode': '插入兄弟节点',
'appendchildnode': '插入孩子节点',
'removenode': '删除节点'
}
};
\ No newline at end of file
{
"main": "index.html",
"name": "kityminder",
"description": "kityminder",
"version": "1.0.0.0 ",
"keywords": [ "kity", "kityminder", "minder" ],
"window": {
"icon": "minder.png",
"toolbar": false,
"width": 800,
"height": 600,
"frame": true
}
}
\ No newline at end of file
#social {
position: absolute;
right: 10px;
top: 10px;
line-height: 20px;
text-align: right;
overflow: hidden;
}
#social button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
padding: 0 15px;
height: 35px;
font-size: 13px;
line-height: 35px;
text-align: center;
border-radius: 5px;
color: #ffffff;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;
background: #0099f2;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0099f2), color-stop(0%, #4096ee), color-stop(100%, #0076dd));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* W3C */
}
#social button:hover {
background: #009fff;
}
#social button[disabled] {
background: #AAA;
}
#social button.baidu-cloud {
padding-left: 35px;
position: relative;
}
#social button.baidu-cloud:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
#social button.share {
padding-left: 35px;
position: relative;
}
#social button.share:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
#social button img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
#social button.user-file {
padding-right: 28px;
position: relative;
}
#social button.user-file:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
}
.user-file-menu {
margin-top: 20px;
margin-left: 1px;
}
$.extend( $.fn, {
disabled: function ( value ) {
if ( value === undefined ) return !!this.attr( 'disabled' );
if ( value ) {
this.attr( 'disabled', 'disabled' );
} else {
this.removeAttr( 'disabled' );
}
return this;
},
loading: function ( text ) {
if ( text ) {
if ( !this.disabled() ) {
this.disabled( true );
this.attr( 'origin-text', this.text() );
}
this.text( text );
} else {
this.text( this.attr( 'origin-text' ) );
this.removeAttr( 'origin-text' );
this.disabled( false );
}
return this;
},
text: ( function () {
var originFn = $.fn.text;
return function () {
var textSpan = this.children( 'span.text' );
if ( textSpan.length ) {
return originFn.apply( textSpan, arguments );
} else {
return originFn.apply( this, arguments );
}
};
} )()
} );
$( function () {
var $panel = $( '#social' );
var $login_btn, $save_btn, $share_btn, $user_btn, $user_menu;
var baseUrl = ( function () {
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0; i < scripts.length; i++ ) {
var index = scripts[ i ].src.indexOf( 'social.js' );
if ( ~index ) {
return scripts[ i ].src.substr( 0, index );
}
}
} )();
$login_btn = $( '<button>登录</button>' ).addClass( 'login' ).click( login );
$user_btn = $( '<button><span class="text"></span></button>' ).addClass( 'user-file' );
$user_menu = $.kmuidropmenu( {
data: [ {
label: '新建脑图',
click: newFile
}, {
label: '到网盘管理文件...',
click: function () {
window.open( 'http://pan.baidu.com/disk/home#dir/path=/apps/kityminder' );
}
}, {
divider: true
} ]
} ).addClass( 'user-file-menu' ).appendTo( 'body' ).kmui();
$user_menu.attachTo( $user_btn );
$save_btn = $( '<button>保存</button>' ).click( saveThisFile ).addClass( 'baidu-cloud' );
$share_btn = $( '<button>分享</button>' ).click( shareThisFile ).addClass( 'share' );
var AK, thisMapFilename, currentUser, share_id = uuid(),
isShareLink;
AK = 'wiE55BGOG8BkGnpPs6UNtPbb';
baidu.frontia.init( AK );
baidu.frontia.social.setLoginCallback( {
success: setCurrentUser,
error: function ( error ) {
console.log( error );
}
} );
function login() {
var options = {
response_type: 'token',
media_type: 'baidu',
redirect_uri: baseUrl + 'index.html',
client_type: 'web'
};
baidu.frontia.social.login( options );
}
function setCurrentUser( user ) {
currentUser = user;
$user_btn.text( user.getName() + ' 的脑图' );
$user_btn.appendTo( $panel );
$save_btn.appendTo( $panel );
$share_btn.appendTo( $panel );
$login_btn.detach();
loadRecent();
loadAvator();
window.location.hash = '';
}
function loadAvator() {
currentUser.getDetailInfo( {
success: function ( user ) {
var $img = $( '<img />' ).attr( {
'src': user.extra.tinyurl,
'width': 16,
'height': 16
} );
$img.prependTo( $user_btn );
}
} );
}
function loadRecent() {
var sto = baidu.frontia.personalStorage;
$user_btn.loading( '加载最近脑图...' );
sto.listFile( 'apps/kityminder/', {
by: 'time',
success: function ( result ) {
if ( result.list.length ) {
if ( !isShareLink ) {
loadPersonal( result.list[ 0 ].path );
} else {
$user_btn.loading( false );
}
addToRecentMenu( result.list );
}
}
} );
}
function addToRecentMenu( list ) {
list.splice(8);
list.forEach( function ( file ) {
$user_menu.appendItem( {
item: {
label: getFileName( file.path ),
value: file.path
},
click: openFile
} );
} );
}
function getFileName( path ) {
var filename = path.substr( path.lastIndexOf( '/' ) + 1 );
return filename.substr( 0, filename.lastIndexOf( '.' ) );
}
function openFile( e ) {
var path = $( this ).data( 'value' );
loadPersonal( path );
}
function loadPersonal( path ) {
var sto = baidu.frontia.personalStorage;
thisMapFilename = path;
$user_btn.loading( '加载“' + getFileName( path ) + '”...' );
sto.getFileUrl( path, {
success: function ( url ) {
$.ajax( {
cache: false,
url: url,
dataType: 'text',
success: function ( result ) {
window.km.importData( result, 'json' );
$user_btn.loading( false ).text( getFileName( path ) );
}
} );
}
} );
}
function getMapFileName() {
return '/apps/kityminder/' + window.km.getMinderTitle() + '.km';
}
function newFile() {
thisMapFilename = null;
window.km.importData( '新建脑图', 'plain' );
$user_btn.text( '<新建脑图>' );
}
function saveThisFile() {
var data = window.km.exportData( 'json' );
save( data, thisMapFilename || getMapFileName(), function ( success, info ) {
if ( success ) {
$save_btn.text( '保存成功!' );
setTimeout( function () {
$save_btn.loading( false );
}, 3000 );
if ( !thisMapFilename ) {
thisMapFilename = info.path;
addToRecentMenu( [ info ] );
$user_btn.text( getFileName( thisMapFilename ) );
}
}
console.log( info );
} );
$save_btn.loading( '正在保存...' );
}
function save( file, filename, callback ) {
var sto = baidu.frontia.personalStorage;
var options = {
ondup: thisMapFilename ? sto.constant.ONDUP_OVERWRITE : sto.constant.ONDUP_NEWCOPY,
success: function ( result ) {
callback( true, result );
},
error: function ( error ) {
callback( false, error );
}
};
sto.uploadTextFile( file, filename, options );
}
function uuid() {
return ( ( +new Date() * 10000 ) + ( Math.random() * 9999 ) ).toString( 36 );
}
function shareThisFile() {
if ( $share_btn.disabled() ) {
return;
}
var data = window.km.exportData( 'json' );
$share_btn.loading( '正在分享...' );
var shareUrl = baseUrl + 'index.html?share_id=' + share_id;
share( data, share_id, function ( success ) {
if ( success ) {
var $popup = $( '<div></div>' ).addClass( 'popup' ).appendTo( 'body' );
$popup.css( {
'position': 'absolute',
'right': 10,
'top': $share_btn.offset().top + $share_btn.height() + 10,
'width': 250,
'padding': 10,
'background': 'white',
'border-radius': '5px',
'box-shadow': '1px 2px 4px rgba(0, 0, 0, .3)'
} );
$popup.append( '<p style="margin: 5px 0; font-size: 12px;">分享成功,请复制URL:</p>' );
var $input = $( '<input type="text" style="width: 250px;" value="' + shareUrl + '"></input>' ).appendTo( $popup );
$input[ 0 ].select();
$popup.mousedown( function ( e ) {
e.stopPropagation();
} );
$( 'body' ).on( 'mousedown', function ( e ) {
$popup.fadeOut( 'fast', function () {
$popup.remove();
} );
$share_btn.loading( false );
$( 'body' ).off( 'mousedown', arguments.callee );
} );
}
} );
}
function share( text, shareId, callback ) {
var data = new baidu.frontia.Data( {
shareMinder: {
id: shareId,
data: text
}
} );
var handles = {
success: function ( result ) {
callback( true );
},
error: function ( e ) {
callback( false );
}
};
baidu.frontia.storage.insertData( data, handles );
}
function loadShare() {
var pattern = /share_id=(\w+)([&#]|$)/;
var match = pattern.exec( window.location.href );
if ( !match ) return;
var shareId = match[ 1 ];
var query = new baidu.frontia.storage.Query();
query.on( 'shareMinder.id' ).equal( shareId );
$share_btn.loading( '正在加载分享内容...' );
baidu.frontia.storage.findData( query, {
success: function ( ret ) {
window.km.importData( ret.result[ 0 ].obj.shareMinder.data, 'json' );
$share_btn.loading( false );
},
error: function ( e ) {
console.log( e );
}
} );
isShareLink = true;
}
loadShare();
currentUser = baidu.frontia.getCurrentAccount();
if ( currentUser ) {
setCurrentUser( currentUser );
} else {
$login_btn.appendTo( $panel );
}
} );
\ No newline at end of file
#social {
position: absolute;
right: 10px;
top: 10px;
line-height: 20px;
text-align: right;
overflow: hidden;
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
padding: 0 15px;
height: 35px;
font-size: 13px;
line-height: 35px;
text-align: center;
border-radius: 5px;
color: #ffffff;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
&:hover {
background: #009fff;
}
&[disabled] {
background: #AAA;
}
&.baidu-cloud {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
}
&.share {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
}
img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
&.user-file {
padding-right: 28px;
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
}
}
}
}
.user-file-menu {
margin-top: 20px;
margin-left: 1px;
}
\ No newline at end of file
utils.extend( KityMinder, function () {
var _kityminderUI = {},
_kityminderToolbarUI = {},
_activeWidget = null,
_widgetData = {},
_widgetCallBack = {};
return {
registerUI: function ( uiname, fn ) {
utils.each( uiname.split( /\s+/ ), function ( i, name ) {
_kityminderUI[ name ] = fn;
} )
},
registerToolbarUI: function ( uiname, fn ) {
utils.each( uiname.split( /\s+/ ), function ( i, name ) {
_kityminderToolbarUI[ name ] = fn;
} )
},
loadUI: function ( km ) {
utils.each( _kityminderUI, function ( i, fn ) {
fn.call( km )
} )
},
_createUI: function ( id ) {
var $cont = $( '<div class="kmui-container"></div>' ),
$toolbar = $.kmuitoolbar(),
$kmbody = $( '<div class="kmui-editor-body"></div>' ),
$statusbar = $( '<div class="kmui-statusbar"></div>' );
$cont.append( $toolbar ).append( $kmbody ).append( $statusbar );
$( utils.isString( id ) ? '#' + id : id ).append( $cont );
return {
'$container': $cont,
'$toolbar': $toolbar,
'$body': $kmbody,
'$statusbar': $statusbar
};
},
_createToolbar: function ( $toolbar, km ) {
var toolbars = km.getOptions( 'toolbars' );
if ( toolbars && toolbars.length ) {
var btns = [];
$.each( toolbars, function ( i, uiNames ) {
$.each( uiNames.split( /\s+/ ), function ( index, name ) {
if ( name == '|' ) {
$.kmuiseparator && btns.push( $.kmuiseparator() );
} else {
if ( _kityminderToolbarUI[ name ] ) {
var ui = _kityminderToolbarUI[ name ].call( km, name );
ui && btns.push( ui );
}
}
} );
btns.length && $toolbar.kmui().appendToBtnmenu( btns );
} );
}
$toolbar.append( $( '<div class="kmui-dialog-container"></div>' ) );
},
_createStatusbar: function ( $statusbar, km ) {
},
getKityMinder: function ( id, options ) {
var containers = this._createUI( id );
var km = this.getMinder( containers.$body.get( 0 ), options );
this._createToolbar( containers.$toolbar, km );
this._createStatusbar( containers.$statusbar, km );
km.$container = containers.$container;
this.loadUI( km );
return km.fire( 'interactchange' );
},
registerWidget: function ( name, pro, cb ) {
_widgetData[ name ] = $.extend2( pro, {
$root: '',
_preventDefault: false,
root: function ( $el ) {
return this.$root || ( this.$root = $el );
},
preventDefault: function () {
this._preventDefault = true;
},
clear: false
} );
if ( cb ) {
_widgetCallBack[ name ] = cb;
}
},
getWidgetData: function ( name ) {
return _widgetData[ name ]
},
setWidgetBody: function ( name, $widget, km ) {
if ( !km._widgetData ) {
utils.extend( km, {
_widgetData: {},
getWidgetData: function ( name ) {
return this._widgetData[ name ];
},
getWidgetCallback: function ( widgetName ) {
var me = this;
return function () {
return _widgetCallBack[ widgetName ].apply( me, [ me, $widget ].concat( utils.argsToArray( arguments, 0 ) ) )
}
}
} )
}
var pro = _widgetData[ name ];
if ( !pro ) {
return null;
}
pro = km._widgetData[ name ];
if ( !pro ) {
pro = _widgetData[ name ];
pro = km._widgetData[ name ] = $.type( pro ) == 'function' ? pro : utils.clone( pro );
}
pro.root( $widget.kmui().getBodyContainer() );
pro.initContent( km, $widget );
if ( !pro._preventDefault ) {
pro.initEvent( km, $widget );
}
pro.width && $widget.width( pro.width );
},
setActiveWidget: function ( $widget ) {
_activeWidget = $widget;
}
}
}() );
\ No newline at end of file
KM.registerToolbarUI( 'bold italic redo undo',
function ( name ) {
var me = this;
var $btn = $.kmuibutton( {
icon: name,
click: function () {
me.execCommand( name );
},
title: this.getLang( 'tooltips' )[ name ] || ''
} );
this.on( 'interactchange', function () {
var state = this.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 );
} );
return $btn;
}
);
\ No newline at end of file
KM.registerToolbarUI( 'fontfamily fontsize', function ( name ) {
var me = this,
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
title: label,
comboboxName: name,
items: me.getOptions( name ) || [],
itemStyles: [],
value: [],
autowidthitem: []
},
$combox = null,
comboboxWidget = null;
if ( options.items.length == 0 ) {
return null;
}
switch ( name ) {
case 'fontfamily':
options = transForFontfamily( options );
break;
case 'fontsize':
options = transForFontsize( options );
break;
}
//实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( name, res.value );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
} );
//状态反射
this.on( 'interactchange', function () {
var state = this.queryCommandState( name ),
value = this.queryCommandValue( name );
//设置按钮状态
comboboxWidget.button().kmui().disabled( state == -1 ).active( state == 1 );
if ( value ) {
//设置label
value = value.replace( /['"]/g, '' ).toLowerCase().split( /['|"]?\s*,\s*[\1]?/ );
comboboxWidget.selectItemByLabel( value );
}
} );
return comboboxWidget.button().addClass( 'kmui-combobox' );
//字体参数转换
function transForFontfamily( options ) {
var temp = null,
tempItems = [];
for ( var i = 0, len = options.items.length; i < len; i++ ) {
temp = options.items[ i ].val;
tempItems.push( temp.split( /\s*,\s*/ )[ 0 ] );
options.itemStyles.push( 'font-family: ' + temp );
options.value.push( temp );
options.autowidthitem.push( $.wordCountAdaptive( tempItems[ i ] ) );
}
options.items = tempItems;
return options;
}
//字体大小参数转换
function transForFontsize( options ) {
var temp = null,
tempItems = [];
options.itemStyles = [];
options.value = [];
for ( var i = 0, len = options.items.length; i < len; i++ ) {
temp = options.items[ i ];
tempItems.push( temp );
options.itemStyles.push( 'font-size: ' + temp + 'px; height:' + (temp+2) + 'px; line-height: ' + (temp + 2) + 'px' );
}
options.value = options.items;
options.items = tempItems;
options.autoRecord = false;
return options;
}
} );
KM.registerToolbarUI( 'forecolor', function ( name ) {
function getCurrentColor() {
return $colorLabel.css( 'background-color' );
}
var me = this,
$colorPickerWidget = null,
$colorLabel = null,
$btn = null;
this.on( 'interactchange', function () {
var state = this.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 );
} );
$btn = $.kmuicolorsplitbutton( {
icon: name,
caret: true,
name: name,
title: this.getLang( 'tooltips' )[ name ] || '',
click: function () {
var color = kity.Color.parse(getCurrentColor()).toHEX();
if(!color == '#000000'){
me.execCommand( name, color );
}
}
} );
$colorLabel = $btn.kmui().colorLabel();
$colorPickerWidget = $.kmuicolorpicker( {
name: name,
lang_clearColor: me.getLang( 'popupcolor' )[ 'clearColor' ] || '',
lang_themeColor: me.getLang( 'popupcolor' )[ 'themeColor' ] || '',
lang_standardColor: me.getLang( 'popupcolor' )[ 'standardColor' ] || ''
} ).on( 'pickcolor', function ( evt, color ) {
window.setTimeout( function () {
$colorLabel.css( "backgroundColor", color );
me.execCommand( name, color );
}, 0 );
} ).on( 'show', function () {
KM.setActiveWidget( $colorPickerWidget.kmui().root() );
} ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
$btn.kmui().on( 'arrowclick', function () {
if ( !$colorPickerWidget.parent().length ) {
me.$container.find( '.kmui-dialog-container' ).append( $colorPickerWidget );
}
$colorPickerWidget.kmui().show( $btn, {
caretDir: "down",
offsetTop: -5,
offsetLeft: 8,
caretLeft: 11,
caretTop: -8
} );
} ).register( 'click', $btn, function () {
$colorPickerWidget.kmui().hide()
} );
return $btn;
} );
\ No newline at end of file
KM.registerUI( 'contextmenu', function () {
var me = this;
function getItemByLabel(label){
var result;
utils.each(me.getContextmenu(),function(i,item){
if(item.label == label){
result = item;
return false;
}
});
return result;
}
var $menu = $.kmuidropmenu({
click:function(e,v,l){
var item = getItemByLabel(l);
if(item.exec){
item.exec.apply(km)
}else{
me.execCommand(item.cmdName);
}
this.hide();
}
});
me.$container.append($menu);
me.on('contextmenu',function(e){
var items = me.getContextmenu();
var data = [];
utils.each(items,function(i,item){
if(item.divider){
data.push(item)
return;
}
if(me.queryCommandState(item.cmdName)!=-1){
data.push({
label:item.label,
value:item.cmdName
})
}
});
if(data.length){
var item = data[data.length-1];
if(item.divider){
data.pop();
}
$menu.kmui().setData({
data:data
}).position(e.getPosition()).show();
e.preventDefault()
}
});
me.on('click',function(){
$menu.kmui().hide();
});
me.on('beforemousedown',function(e){
var isRightMB;
if ("which" in e.originEvent) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB = e.originEvent.which == 3;
else if ("button" in e.originEvent) // IE, Opera
isRightMB = e.originEvent.button == 2;
if(isRightMB){
e.stopPropagationImmediately();
}
})
} );
KM.registerToolbarUI( 'markers', function ( name ) {
var me = this,
currentRange, $dialog,
opt = {
width: 200,
title: this.getLang( 'tooltips' )[ name ] || '',
url: me.getOptions( 'KITYMINDER_HOME_URL' ) + 'dialogs/' + name + '/' + name + '.js',
};
var $btn = $.kmuibutton( {
icon: name,
title: this.getLang( 'tooltips' )[ name ] || ''
} );
//加载模版数据
utils.loadFile( document, {
src: opt.url,
tag: "script",
type: "text/javascript",
defer: "defer"
}, function () {
$dialog = $.kmuimodal( opt );
$dialog.attr( 'id', 'kmui-dialog-' + name ).addClass( 'kmui-dialog-' + name )
.find( '.kmui-modal-body' ).addClass( 'kmui-dialog-' + name + '-body' );
$dialog.kmui().on( 'beforeshow', function () {
var $root = this.root(),
win = null,
offset = null;
if ( !$root.parent()[ 0 ] ) {
me.$container.find( '.kmui-dialog-container' ).append( $root );
}
KM.setWidgetBody( name, $dialog, me );
} ).attachTo( $btn )
} );
me.on( 'interactchange', function () {
var state = this.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 )
} );
return $btn;
} );
\ No newline at end of file
KM.registerToolbarUI( 'switchlayout', function ( name ) {
var me = this,
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
title: label,
comboboxName: name,
items: me.getLayoutStyleItems() || [],
itemStyles: [],
value: me.getLayoutStyleItems(),
autowidthitem: [],
enabledRecord:false
},
$combox = null;
if ( options.items.length == 0 ) {
return null;
}
//实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( name, res.value );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
} );
//状态反射
me.on( 'interactchange', function () {
var state = this.queryCommandState( name ),
value = this.queryCommandValue( name );
//设置按钮状态
comboboxWidget.button().kmui().disabled( state == -1 ).active( state == 1 );
if ( value ) {
//设置label
value = value.replace( /['"]/g, '' ).toLowerCase().split( /['|"]?\s*,\s*[\1]?/ );
comboboxWidget.selectItemByLabel( value );
}
} );
var data = [];
utils.each(me.getLayoutStyleItems(),function(i,v){
data.push({
label:me.getLang( 'tooltips.' + name ) + ' ' + v,
cmdName:'switchlayout',
exec:function(){
me.execCommand('switchlayout',v);
}
})
});
data.push({
divider:1
});
me.addContextmenu(data);
return comboboxWidget.button().addClass( 'kmui-combobox' );
} );
\ No newline at end of file
KM.registerToolbarUI( 'node', function ( name ) {
var shortcutKeys = {
"appendsiblingnode": "enter",
"appendchildnode": "tab",
"removenode": "del|backspace"
};
var me = this,
msg = me.getLang( 'node' ),
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
title: label,
comboboxName: name,
items: me.getOptions( name ) || [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false
},
$combox = null;
if ( options.items.length == 0 ) {
return null;
}
//实例化
$combox = $.kmuibuttoncombobox( transForInserttopic( options ) ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( res.value, new MinderNode( me.getLang().topic ) );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
var combox = $combox.kmui();
combox.traverseItems( function ( label, value ) {
if ( me.queryCommandState( value ) == -1 ) {
combox.disableItemByLabel( label )
} else {
combox.enableItemByLabel( label )
}
} )
} );
return comboboxWidget.button().addClass( 'kmui-combobox' );
function transForInserttopic( options ) {
var tempItems = [];
utils.each( options.items, function ( k, v ) {
options.value.push( v );
tempItems.push( ( msg[ k ] || k ) + '(' + shortcutKeys[ v ].toUpperCase() + ')' );
options.autowidthitem.push( $.wordCountAdaptive( tempItems[ tempItems.length - 1 ] ) );
} );
options.items = tempItems;
return options;
}
} );
\ No newline at end of file
KM.registerToolbarUI( 'saveto', function ( name ) {
var me = this,
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
title: label,
comboboxName: name,
items: [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false
},
$combox = null,
comboboxWidget = null;
var downloadLink = document.createElement( 'a' );
utils.each( KityMinder.getAllRegisteredProtocals(), function ( k ) {
var p = KityMinder.findProtocal( k );
var text = p.fileDescription + '(' + p.fileExtension + ')';
options.value.push( k );
options.items.push( text );
options.autowidthitem.push( $.wordCountAdaptive( text ), true );
} );
//实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
if ( res.value === "png" ) {
var svghtml = $( "#kityminder .kmui-editor-body" ).html();
var bgImg = $( "#kityminder .kmui-editor-body" ).css( "backgroundImage" ).replace( /"/g, "" ).replace( /url\(|\)$/ig, "" );
var renderBox = me.getRenderContainer().getRenderBox( "top" );
var renderContainer = me.getRenderContainer();
var transform = renderContainer.getTransform();
renderContainer.resetTransform();
var svg = $( svghtml ).attr( {
width: renderBox.width,
height: renderBox.height,
viewBox: null
} );
var div = $( "<div></div>" ).append( svg );
svghtml = div.html();
var canvas = $( '<canvas width="' + ( parseInt( renderBox.width ) + 40 ) + '" height="' + ( parseInt( renderBox.height ) + 40 ) + '"></canvas>' );
var ctx = canvas[ 0 ].getContext( "2d" );
var DOMURL = self.URL || self.webkitURL || self;
var img = new Image();
var svg = new Blob( [ svghtml ], {
type: "image/svg+xml;charset=utf-8"
} );
var url = DOMURL.createObjectURL( svg );
img.onload = function () {
var bgTexture = document.createElement( 'img' );
bgTexture.src = bgImg;
bgTexture.onload = function () {
var bgfill = ctx.createPattern( bgTexture, "repeat" );
ctx.fillStyle = bgfill;
ctx.fillRect( 0, 0, renderBox.width + 40, renderBox.height + 40 );
ctx.drawImage( img, -renderBox.x + 20, -renderBox.y + 20 );
DOMURL.revokeObjectURL( url );
var type = 'png';
var imgData = canvas[ 0 ].toDataURL( type );
var _fixType = function ( type ) {
type = type.toLowerCase().replace( /jpg/i, 'jpeg' );
var r = type.match( /png|jpeg|bmp|gif/ )[ 0 ];
return 'image/' + r;
};
imgData = imgData.replace( _fixType( type ), 'image/octet-stream' );
var saveFile = function ( data, filename ) {
var save_link = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'a' );
save_link.href = data;
save_link.download = filename;
var event = document.createEvent( 'MouseEvents' );
event.initMouseEvent( 'click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null );
save_link.dispatchEvent( event );
};
// 下载后的文件名
var filename = 'kityminder_' + ( new Date() ).getTime() + '.' + type;
// download
saveFile( imgData, filename );
renderContainer.setTransform( transform );
};
};
img.src = url;
return "png";
} else if ( res.value === "svg" ) {
var svghtml = $( "#kityminder .kmui-editor-body" ).html();
var saveFile = function ( data, filename ) {
var save_link = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'a' );
save_link.href = 'data:image/svg+xml; utf-8,' + encodeURI( svghtml );
save_link.download = filename;
var event = document.createEvent( 'MouseEvents' );
event.initMouseEvent( 'click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null );
save_link.dispatchEvent( event );
};
var filename = 'kityminder_' + ( new Date() ).getTime() + '.svg';
saveFile( svg, filename );
return "svg";
}
var data = me.exportData( res.value );
var p = KityMinder.findProtocal( res.value );
var a = downloadLink;
a.setAttribute( 'download', 'MyMind' + p.fileExtension );
a.setAttribute( 'href', 'data:text/plain; utf-8,' + encodeURI( data ) );
a.dispatchEvent( new MouseEvent( 'click' ) );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
} ).on( 'aftercomboboxselect', function () {
this.setLabelWithDefaultValue();
} );
return comboboxWidget.button().addClass( 'kmui-combobox' );
} );
\ No newline at end of file
KM.registerUI( 'tooltips',
function ( name ) {
var km = this;
//添加tooltip;
if($.kmuitooltip){
$("[data-original-title]",km.$container).each(function(i,n){
var tooltips = km.getLang('tooltips');
var tooltip = $(n).data('original-title');
utils.each(tooltips,function(v,k){
if(k == tooltip && km.getShortcutKey(v)){
$(n).attr('data-original-title',tooltip + ' (' + km.getShortcutKey(v).toUpperCase() + ')');
}
})
});
$.kmuitooltip('attachTo', $("[data-original-title]",km.$container)).css('z-index',km.getOptions('zIndex')+1);
}
km.$container.find('a').click(function(evt){
evt.preventDefault()
});
}
);
\ No newline at end of file
/**
* 宽度自适应工具函数
* @param word 单词内容
* @param hasSuffix 是否含有后缀
*/
$.wordCountAdaptive = function( word, hasSuffix ) {
var $tmpNode = $('<span>' ).html( word ).css( {
display: 'inline',
position: 'absolute',
top: -10000000,
left: -100000
} ).appendTo( document.body),
width = $tmpNode.width();
$tmpNode.remove();
$tmpNode = null;
if( width < 50 ) {
return word;
} else {
word = word.slice( 0, hasSuffix ? -4 : -1 );
if( !word.length ) {
return '...';
}
return $.wordCountAdaptive( word + '...', true );
}
};
\ No newline at end of file
KM.registerToolbarUI( 'hand zoom-in zoom-out',
function ( name ) {
var me = this;
var $btn = $.kmuibutton( {
icon: name,
click: function () {
me.execCommand( name );
},
title: this.getLang( 'tooltips.' )[ name ] || ''
} );
me.on('interactchange', function() {
var state = me.queryCommandState( name );
$btn.kmui().disabled( state == -1 ).active( state == 1 );
});
return $btn;
}
);
\ No newline at end of file
var Command = kity.createClass( "Command", {
constructor: function () {
this._isContentChange = true;
this._isSelectionChange = false;
},
execute: function ( minder, args ) {
},
setContentChanged: function ( val ) {
this._isContentChange = !! val;
},
isContentChanged: function () {
return this._isContentChange;
},
setSelectionChanged: function ( val ) {
this._isSelectionChange = !! val;
},
isSelectionChanged: function () {
return this._isContentChange;
},
queryState: function ( km ) {
return 0;
},
queryValue: function ( km ) {
return 0;
},
isNeedUndo: function () {
return true;
}
} );
\ No newline at end of file
var MinderEvent = kity.createClass( 'MindEvent', {
constructor: function ( type, params, canstop ) {
params = params || {};
if ( params.getType && params.getType() == 'ShapeEvent' ) {
this.kityEvent = params;
this.originEvent = params.originEvent;
this.getPosition = params.getPosition.bind( params );
} else if ( params.target && params.preventDefault ) {
this.originEvent = params;
} else {
kity.Utils.extend( this, params );
}
this.type = type;
this._canstop = canstop || false;
},
getTargetNode: function () {
var findShape = this.kityEvent && this.kityEvent.targetShape;
if ( !findShape ) return null;
while ( !findShape.minderNode && findShape.container ) {
findShape = findShape.container;
}
return findShape.minderNode || null;
},
stopPropagation: function () {
this._stoped = true;
},
stopPropagationImmediately: function () {
this._immediatelyStoped = true;
this._stoped = true;
},
shouldStopPropagation: function () {
return this._canstop && this._stoped;
},
shouldStopPropagationImmediately: function () {
return this._canstop && this._immediatelyStoped;
},
preventDefault:function(){
this.originEvent.preventDefault();
}
} );
\ No newline at end of file
var keymap = KityMinder.keymap = {
'Backspace' : 8,
'Tab' : 9,
'Enter' : 13,
'Shift':16,
'Control':17,
'Alt':18,
'CapsLock':20,
'Esc':27,
'Spacebar':32,
'PageUp':33,
'PageDown':34,
'End':35,
'Home':36,
'Left':37,
'Up':38,
'Right':39,
'Down':40,
'Insert':45,
'Del':46,
'NumLock':144,
'Cmd':91,
'=':187,
'-':189,
"b":66,
'i':73,
'z':90,
'y':89
};
\ No newline at end of file
var KityMinder = window.KM = window.KityMinder = function () {
var instanceMap = {}, instanceId = 0;
return {
version: '1.0.0',
createMinder: function ( renderTarget, options ) {
options = options || {};
options.renderTo = Utils.isString( renderTarget ) ? document.getElementById( renderTarget ) : renderTarget;
var minder = new Minder( options );
this.addMinder( options.renderTo, minder );
return minder;
},
addMinder: function ( target, minder ) {
var id;
if ( typeof ( target ) === 'string' ) {
id = target;
} else {
id = target.id || ( "KM_INSTANCE_" + instanceId++ );
}
instanceMap[ id ] = minder;
},
getMinder: function ( target, options ) {
var id;
if ( typeof ( target ) === 'string' ) {
id = target;
} else {
id = target.id || ( "KM_INSTANCE_" + instanceId++ );
}
return instanceMap[ id ] || this.createMinder( target, options );
},
//挂接多语言
LANG: {}
};
}();
\ No newline at end of file
kity.extendClass( Minder, {
_getCommand: function ( name ) {
return this._commands[ name.toLowerCase() ];
},
_queryCommand: function ( name, type, args ) {
var cmd = this._getCommand( name );
if ( cmd ) {
var queryCmd = cmd[ 'query' + type ];
if ( queryCmd )
return queryCmd.apply( cmd, [ this ].concat( args ) );
}
return 0;
},
queryCommandState: function ( name ) {
return this._queryCommand( name, "State", Utils.argsToArray( 1 ) );
},
queryCommandValue: function ( name ) {
return this._queryCommand( name, "Value", Utils.argsToArray( 1 ) );
},
execCommand: function ( name ) {
name = name.toLowerCase();
var cmdArgs = Utils.argsToArray( arguments, 1 ),
cmd, stoped, result, eventParams;
var me = this;
cmd = this._getCommand( name );
eventParams = {
command: cmd,
commandName: name.toLowerCase(),
commandArgs: cmdArgs
};
if ( !cmd ) {
return false;
}
if ( !this._hasEnterExecCommand && cmd.isNeedUndo() ) {
this._hasEnterExecCommand = true;
stoped = this._fire( new MinderEvent( 'beforeExecCommand', eventParams, true ) );
if ( !stoped ) {
//保存场景
this._fire( new MinderEvent( 'saveScene' ) );
this._fire( new MinderEvent( "preExecCommand", eventParams, false ) );
result = cmd.execute.apply( cmd, [ me ].concat( cmdArgs ) );
this._fire( new MinderEvent( 'execCommand', eventParams, false ) );
//保存场景
this._fire( new MinderEvent( 'saveScene' ) );
if ( cmd.isContentChanged() ) {
this._firePharse( new MinderEvent( 'contentchange' ) );
}
if ( cmd.isSelectionChanged() ) {
this._firePharse( new MinderEvent( 'selectionchange' ) );
}
this._firePharse( new MinderEvent( 'interactchange' ) );
}
this._hasEnterExecCommand = false;
} else {
result = cmd.execute.apply( cmd, [ me ].concat( cmdArgs ) );
}
return result === undefined ? null : result;
}
} );
\ No newline at end of file
Utils.extend( KityMinder, {
_protocals: {},
registerProtocal: function ( name, protocalDeal ) {
KityMinder._protocals[ name ] = protocalDeal();
},
findProtocal: function ( name ) {
return KityMinder._protocals[ name ] || null;
},
getSupportedProtocals: function () {
return Utils.keys( KityMinder._protocals ).sort(function(a, b) {
return KityMinder._protocals[b].recognizePriority - KityMinder._protocals[a].recognizePriority;
});
},
getAllRegisteredProtocals: function () {
return KityMinder._protocals;
}
} );
// 这里的 Json 是一个对象
function exportNode( node ) {
var exported = {};
exported.data = node.getData();
var childNodes = node.getChildren();
if ( childNodes.length ) {
exported.children = [];
for ( var i = 0; i < childNodes.length; i++ ) {
exported.children.push( exportNode( childNodes[ i ] ) );
}
}
return exported;
}
function importNode( node, json ) {
var data = json.data;
for ( var field in data ) {
node.setData( field, data[ field ] );
}
node.setText( data.text );
var childrenTreeData = json.children;
if ( !childrenTreeData ) return;
for ( var i = 0; i < childrenTreeData.length; i++ ) {
var childNode = new MinderNode();
importNode( childNode, childrenTreeData[ i ] );
node.appendChild( childNode );
}
return node;
}
// 导入导出
kity.extendClass( Minder, {
exportData: function ( protocalName ) {
var json, protocal;
json = exportNode( this.getRoot() );
protocal = KityMinder.findProtocal( protocalName );
if ( protocal ) {
return protocal.encode( json );
} else {
return json;
}
},
importData: function ( local, protocalName ) {
var json, protocal;
if ( protocalName ) {
protocal = KityMinder.findProtocal( protocalName );
} else {
KityMinder.getSupportedProtocals().every( function ( name ) {
var test = KityMinder.findProtocal( name );
if ( test.recognize && test.recognize( local ) ) {
protocal = test;
}
return !protocal;
} );
}
if ( !protocal ) {
throw new Error( "Unsupported protocal: " + protocalName );
}
var params = {
local: local,
protocalName: protocalName,
protocal: protocal
};
// 是否需要阻止导入
var stoped = this._fire( new MinderEvent( 'beforeimport', params, true ) );
if ( stoped ) return this;
json = params.json || ( params.json = protocal.decode( local ) );
this._fire( new MinderEvent( 'preimport', params, false ) );
// 删除当前所有节点
while ( this._root.getChildren().length ) {
this._root.removeChild( 0 );
}
importNode( this._root, json );
this._fire( new MinderEvent( 'import', params, false ) );
this._firePharse( {
type: 'contentchange'
} );
this._firePharse( {
type: 'interactchange'
} );
return this;
}
} );
\ No newline at end of file
//这里只放不是由模块产生的默认参数
KM.defaultOptions = {
zIndex : 1000,
lang:'zh-cn'
};
\ No newline at end of file
// 事件机制
kity.extendClass( Minder, {
_initEvents: function () {
this._eventCallbacks = {};
},
_bindEvents: function () {
this._bindPaperEvents();
this._bindKeyboardEvents();
},
_resetEvents: function () {
this._initEvents();
this._bindEvents();
},
// TODO: mousemove lazy bind
_bindPaperEvents: function () {
this._paper.on( 'click dblclick mousedown contextmenu mouseup mousemove mousewheel touchstart touchmove touchend', this._firePharse.bind( this ) );
if ( window ) {
window.addEventListener( 'resize', this._firePharse.bind( this ) );
}
},
_bindKeyboardEvents: function () {
if ( ( navigator.userAgent.indexOf( 'iPhone' ) == -1 ) && ( navigator.userAgent.indexOf( 'iPod' ) == -1 ) && ( navigator.userAgent.indexOf( 'iPad' ) == -1 ) ) {
//只能在这里做,要不无法触发
Utils.listen( document.body, 'keydown keyup keypress', this._firePharse.bind( this ) );
}
},
_firePharse: function ( e ) {
var beforeEvent, preEvent, executeEvent;
beforeEvent = new MinderEvent( 'before' + e.type, e, true );
if ( this._fire( beforeEvent ) ) {
return;
}
preEvent = new MinderEvent( 'pre' + e.type, e, false );
executeEvent = new MinderEvent( e.type, e, false );
this._fire( preEvent );
this._fire( executeEvent );
this._fire( new MinderEvent( 'after' + e.type, e, false ) );
if ( ~'mousedown mouseup keydown keyup'.indexOf( e.type ) ) {
this._interactChange( e );
}
},
_interactChange: function ( e ) {
var minder = this;
clearTimeout( this._interactTimeout );
this._interactTimeout = setTimeout( function () {
var stoped = minder._fire( new MinderEvent( 'beforeinteractchange' ) );
if ( stoped ) {
return;
}
minder._fire( new MinderEvent( 'preinteractchange' ) );
minder._fire( new MinderEvent( 'interactchange' ) );
}, 300 );
},
_listen: function ( type, callback ) {
var callbacks = this._eventCallbacks[ type ] || ( this._eventCallbacks[ type ] = [] );
callbacks.push( callback );
},
_fire: function ( e ) {
var callbacks = this._eventCallbacks[ e.type.toLowerCase() ];
if ( !callbacks ) {
return false;
}
for ( var i = 0; i < callbacks.length; i++ ) {
callbacks[ i ].call( this, e );
if ( e.shouldStopPropagationImmediately() ) {
break;
}
}
return e.shouldStopPropagation();
},
on: function ( name, callback ) {
var types = name.split( ' ' );
for ( var i = 0; i < types.length; i++ ) {
this._listen( types[ i ].toLowerCase(), callback );
}
return this;
},
off: function ( name, callback ) {
var types = name.split( ' ' );
var i, j, callbacks, removeIndex;
for ( i = 0; i < types.length; i++ ) {
callbacks = this._eventCallbacks[ types[ i ].toLowerCase() ];
if ( callbacks ) {
removeIndex = null;
for ( j = 0; j < callbacks.length; j++ ) {
if ( callbacks[ j ] == callback ) {
removeIndex = j;
}
}
if ( removeIndex !== null ) {
callbacks.splice( removeIndex, 1 );
}
}
}
},
fire: function ( type, params ) {
var e = new MinderEvent( type, params );
this._fire( e );
return this;
}
} );
\ No newline at end of file
var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
constructor: function ( options ) {
this._options = Utils.extend( window.KITYMINDER_CONFIG || {}, options );
this.setDefaultOptions( KM.defaultOptions );
this._initEvents();
this._initMinder();
this._initSelection();
this._initShortcutKey();
this._initContextmenu();
this._initModules();
this.fire( 'ready' );
},
getOptions: function ( key ) {
return this._options[ key ];
},
setDefaultOptions: function ( key, val ) {
var obj = {};
if ( Utils.isString( key ) ) {
obj[ key ] = val;
} else {
obj = key;
}
utils.extend( this._options, obj, true );
},
_initMinder: function () {
this._paper = new kity.Paper();
this._paper.getNode().setAttribute( 'contenteditable', true );
this._paper.getNode().ondragstart = function(e) {
e.preventDefault();
};
this._addRenderContainer();
this._root = new MinderNode( this.getLang().maintopic );
this._root.setType( "root" );
if ( this._options.renderTo ) {
this.renderTo( this._options.renderTo );
}
},
_addRenderContainer: function () {
this._rc = new kity.Group();
this._paper.addShape( this._rc );
},
renderTo: function ( target ) {
this._paper.renderTo( this._renderTarget = target );
this._bindEvents();
},
getRenderContainer: function () {
return this._rc;
},
getPaper: function () {
return this._paper;
},
getRenderTarget: function () {
return this._renderTarget;
},
_initShortcutKey: function () {
this._shortcutkeys = {};
this._bindshortcutKeys();
},
isTextEditStatus:function(){
return false;
},
addShortcutKeys: function ( cmd, keys ) {
var obj = {},km = this;
if ( keys ) {
obj[ cmd ] = keys
} else {
obj = cmd;
}
utils.each(obj,function(k,v){
km._shortcutkeys[k.toLowerCase()] = v;
});
},
getShortcutKey : function(cmdName){
return this._shortcutkeys[cmdName]
},
_bindshortcutKeys: function () {
var me = this,
shortcutkeys = this._shortcutkeys;
function checkkey(key,keyCode,e){
switch(key){
case 'ctrl':
case 'cmd':
if(e.ctrlKey || e.metaKey){
return true;
}
break;
case 'alt':
if(e.altKey){
return true
}
break;
case 'shift':
if(e.shiftKey){
return true;
}
}
if(keyCode == keymap[key]){
return true;
}
return false
}
me.on( 'keydown', function ( e ) {
var originEvent = e.originEvent;
var keyCode = originEvent.keyCode || originEvent.which;
for ( var i in shortcutkeys ) {
var keys = shortcutkeys[ i ].toLowerCase().split('+');
var current = 0;
utils.each(keys,function(i,k){
if(checkkey(k,keyCode,originEvent)){
current++;
}
});
//todo 暂时通过receiver判断
if(me.isTextEditStatus()){
return;
}
if(current == keys.length){
if ( me.queryCommandState( i ) != -1 )
me.execCommand( i );
originEvent.preventDefault();
break;
}
}
} );
},
_initContextmenu:function(){
this.contextmenus = [];
},
addContextmenu:function(item){
if(utils.isArray(item)){
this.contextmenus = this.contextmenus.concat(item);
}else{
this.contextmenus.push(item);
}
return this;
},
getContextmenu:function(){
return this.contextmenus;
}
} );
/**
* @include <minder.data.js>
* @include <minder.event.js>
* @include <minder.module.js>
* @include <minder.node.js>
* @include <minder.select.js>
*/
\ No newline at end of file
//添加多语言模块
kity.extendClass( Minder, {
getLang: function ( path ) {
var lang = KM.LANG[ this.getOptions( 'lang' ) ];
if ( !lang ) {
throw Error( "not import language file" );
}
path = ( path || "" ).split( "." );
for ( var i = 0, ci; ci = path[ i++ ]; ) {
lang = lang[ ci ];
if ( !lang ) break;
}
return lang;
}
} );
\ No newline at end of file
// 模块声明周期维护
kity.extendClass( Minder, {
_initModules: function () {
var modulesPool = KityMinder.getModules();
var modulesToLoad = this._options.modules || Utils.keys( modulesPool );
this._commands = {};
this._query = {};
this._modules = {};
var i, name, module, moduleDeals, dealCommands, dealEvents;
var me = this;
for ( i = 0; i < modulesToLoad.length; i++ ) {
name = modulesToLoad[ i ];
if ( !modulesPool[ name ] ) continue;
//执行模块初始化,抛出后续处理对象
moduleDeals = modulesPool[ name ].call( me );
this._modules[ name ] = moduleDeals;
if ( moduleDeals.init ) {
moduleDeals.init.call( me, this._options );
}
//command加入命令池子
dealCommands = moduleDeals.commands;
for ( var name in dealCommands ) {
this._commands[ name.toLowerCase() ] = new dealCommands[ name ];
}
//绑定事件
dealEvents = moduleDeals.events;
if ( dealEvents ) {
for ( var type in dealEvents ) {
me.on( type, dealEvents[ type ] );
}
}
if ( moduleDeals.defaultOptions ) {
this.setDefaultOptions( moduleDeals.defaultOptions );
}
//添加模块的快捷键
if ( moduleDeals.addShortcutKeys ) {
this.addShortcutKeys( moduleDeals.addShortcutKeys )
}
//添加邮件菜单
if(moduleDeals.contextmenu){
this.addContextmenu(moduleDeals.contextmenu)
}
}
},
_garbage: function () {
this.clearSelect();
while ( this._root.getChildren().length ) {
this._root.removeChild( 0 );
}
},
destroy: function () {
var modules = this._modules;
this._resetEvents();
this._garbage();
for ( var key in modules ) {
if ( !modules[ key ].destroy ) continue;
modules[ key ].destroy.call( this );
}
},
reset: function () {
var modules = this._modules;
this._garbage();
for ( var key in modules ) {
if ( !modules[ key ].reset ) continue;
modules[ key ].reset.call( this );
}
}
} );
\ No newline at end of file
kity.extendClass( Minder, {
getRoot: function () {
return this._root;
},
setRoot: function ( root ) {
this._root = root;
},
handelNodeInsert: function ( node ) {
var rc = this._rc;
node.traverse( function ( current ) {
rc.addShape( current.getRenderContainer() );
} );
},
handelNodeRemove: function ( node ) {
var rc = this._rc;
node.traverse( function ( current ) {
rc.removeShape( current.getRenderContainer() );
} );
},
renderNodes: function ( nodes ) {
var km = this;
if ( nodes instanceof Array ) {
if ( nodes.length === 0 ) return false;
for ( var i = 0; i < nodes.length; i++ ) {
km.renderNode( nodes[ i ] );
}
} else {
km.renderNode( nodes );
}
},
getMinderTitle: function() {
return this.getRoot().getText();
}
} );
\ No newline at end of file
// 选区管理
kity.extendClass( Minder, function () {
function highlightNode( km, node ) {
node.setTmpData( "highlight", true );
km.highlightNode( node );
}
function unhighlightNode( km, node ) {
node.setTmpData( "highlight", false );
km.highlightNode( node );
}
return {
_initSelection: function () {
this._selectedNodes = [];
},
getSelectedNodes: function () {
//不能克隆返回,会对当前选区操作,从而影响querycommand
return this._selectedNodes;
},
getSelectedNode: function () {
return this.getSelectedNodes()[ 0 ] || null;
},
removeAllSelectedNodes: function () {
var me = this;
Utils.each( this.getSelectedNodes(), function ( i, n ) {
unhighlightNode( me, n );
} );
this._selectedNodes = [];
return this.fire( 'selectionclear' );
},
removeSelectedNodes: function ( nodes ) {
var me = this;
Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) {
var index;
if ( ( index = me._selectedNodes.indexOf( n ) ) === -1 ) return;
me._selectedNodes.splice( index, 1 );
unhighlightNode( me, n );
} );
return this;
},
select: function ( nodes, isToggleSelect ) {
if ( isToggleSelect ) {
this.removeAllSelectedNodes();
}
var me = this;
Utils.each( Utils.isArray( nodes ) ? nodes : [ nodes ], function ( i, n ) {
if ( me._selectedNodes.indexOf( n ) !== -1 ) return;
me._selectedNodes.push( n );
highlightNode( me, n );
} );
return this;
},
isNodeSelected: function ( node ) {
return node.getTmpData( 'highlight' ) === true;
},
//当前选区中的节点在给定的节点范围内的保留选中状态,
//没在给定范围的取消选中,给定范围中的但没在当前选中范围的也做选中效果
toggleSelect: function ( node ) {
if ( Utils.isArray( node ) ) {
node.forEach( this.toggleSelect.bind( this ) );
} else {
if ( node.isSelected() ) this.removeSelectedNodes( node );
else this.select( node );
}
return this;
},
isSingleSelect: function () {
return this._selectedNodes.length == 1;
},
getSelectedAncestors: function() {
var nodes = this.getSelectedNodes().slice( 0 ),
ancestors = [],
judge;
// 根节点不参与计算
var rootIndex = nodes.indexOf( this.getRoot() );
if ( ~rootIndex ) {
nodes.splice( rootIndex, 1 );
}
// 判断 nodes 列表中是否存在 judge 的祖先
function hasAncestor( nodes, judge ) {
for ( var i = nodes.length - 1; i >= 0; --i ) {
if ( nodes[ i ].isAncestorOf( judge ) ) return true;
}
return false;
}
// 按照拓扑排序
nodes.sort( function ( node1, node2 ) {
return node1.getLevel() - node2.getLevel();
} );
// 因为是拓扑有序的,所以只需往上查找
while ( ( judge = nodes.pop() ) ) {
if ( !hasAncestor( nodes, judge ) ) {
ancestors.push( judge );
}
}
return ancestors;
}
};
}() );
\ No newline at end of file
//模块注册&暴露模块接口
( function () {
var _modules;
KityMinder.registerModule = function ( name, module ) {
//初始化模块列表
if ( !_modules ) {
_modules = {};
}
_modules[ name ] = module;
};
KityMinder.getModules = function () {
return _modules;
};
} )();
\ No newline at end of file
var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
constructor: function ( options ) {
this.parent = null;
this.children = [];
this.data = {};
this.tmpData = {};
if ( Utils.isString( options ) ) {
this.setData( 'text', options );
} else {
this.setData( options );
}
this._createShapeDom();
this.setData( "layout", {} );
},
_createShapeDom: function () {
this.rc = new kity.Group();
this.rc.addClass( 'km-minderNode' );
this.rc.minderNode = this;
this._createBgGroup();
this._createContGroup();
this._createIconShape();
this._createTextShape();
},
_createGroup: function ( type ) {
var g = new kity.Group();
g.setData( 'rctype', type );
this.rc.appendShape( g );
},
_createBgGroup: function () {
this._createGroup( 'bgrc' );
},
_createContGroup: function () {
this._createGroup( 'contrc' );
},
_createTextShape: function () {
var textShape = new kity.Text( this.getData( 'text' ) || '' );
textShape.setAttr( '_nodeTextShape', true );
this.getContRc().appendShape( textShape );
},
_createIconShape: function () {
var g = new kity.Group();
this.getContRc().appendShape( g );
this._iconRc = g;
},
getContRc: function () {
var groups = this.rc.getShapesByType( 'group' ),
result;
Utils.each( groups, function ( i, p ) {
if ( p.getData( 'rctype' ) == 'contrc' ) {
result = p;
return false;
}
} );
return result;
},
getBgRc: function () {
var groups = this.rc.getShapesByType( 'group' ),
result;
Utils.each( groups, function ( i, p ) {
if ( p.getData( 'rctype' ) == 'bgrc' ) {
result = p;
return false;
}
} );
return result;
},
getIconRc: function () {
return this._iconRc;
},
setPoint: function ( x, y ) {
if ( arguments.length < 2 ) {
this.setData( "point", x );
} else {
this.setData( 'point', {
x: x,
y: y
} );
}
},
getPoint: function () {
return this.getData( 'point' );
},
setType: function ( type ) {
this.setData( 'type', type );
},
getLevel: function () {
var level = 0,
parent = this.parent;
while ( parent ) {
level++;
parent = parent.parent;
}
return level;
},
getType: function ( type ) {
var cached = this.getData( 'type' );
if ( cached ) {
return cached;
}
var level = Math.min( this.getLevel(), 2 );
cached = [ 'root', 'main', 'sub' ][ level ];
this.setData( 'type', cached );
return cached;
},
setText: function ( text ) {
this.setData( 'text', text );
this.getTextShape().setContent( text );
},
getText: function () {
return this.getData( 'text' );
},
isRoot: function () {
return this.getParent() === null ? true : false;
},
getParent: function () {
return this.parent;
},
getDepth: function () {
var depth = 0,
p = this.parent;
while ( p ) {
p = p.parent;
depth++;
}
return depth;
},
getRoot: function () {
var root = this;
while ( root.parent ) {
root = root.parent;
}
return root;
},
isAncestorOf: function ( test ) {
var p = test.parent;
while ( p ) {
if ( p == this ) return true;
p = p.parent;
}
return false;
},
preTraverse: function ( fn ) {
var children = this.getChildren();
fn( this );
for ( var i = 0; i < children.length; i++ ) {
children[ i ].preTraverse( fn );
}
},
postTraverse: function ( fn ) {
var children = this.getChildren();
for ( var i = 0; i < children.length; i++ ) {
children[ i ].postTraverse( fn );
}
fn( this );
},
traverse: function ( fn ) {
return this.postTraverse( fn );
},
getChildren: function () {
return this.children;
},
getIndex: function () {
return this.parent ? this.parent.children.indexOf( this ) : -1;
},
insertChild: function ( node, index ) {
if ( index === undefined ) {
index = this.children.length;
}
if ( node.parent ) {
node.parent.removeChild( node );
}
node.parent = this;
node.root = parent.root;
this.children.splice( index, 0, node );
},
appendChild: function ( node ) {
return this.insertChild( node );
},
prependChild: function ( node ) {
return this.insertChild( node, 0 );
},
removeChild: function ( elem ) {
var index = elem,
removed;
if ( elem instanceof MinderNode ) {
index = this.children.indexOf( elem );
}
if ( index >= 0 ) {
removed = this.children.splice( index, 1 )[ 0 ];
removed.parent = null;
// this.handelRemove( removed );
}
},
// handelRemove: function ( node ) {
// var root = this.getRoot();
// if ( root.tnh ) {
// root.tnh.handelNodeRemove.call( root.tnh, node );
// }
// },
getChild: function ( index ) {
return this.children[ index ];
},
getFirstChild: function () {
return this.children[ 0 ];
},
getLastChild: function () {
return this.children[ this.children.length - 1 ];
},
getData: function ( name ) {
if ( name === undefined ) {
return this.data;
}
return this.data[ name ];
},
setData: function ( name, value ) {
if ( name === undefined ) {
this.data = {};
} else if ( utils.isObject( name ) ) {
Utils.extend( this.data, name );
} else {
if ( value === undefined ) {
this.data[ name ] = null;
delete this.data[ name ];
} else {
this.data[ name ] = value;
}
}
},
getRenderContainer: function () {
return this.rc;
},
getCommonAncestor: function ( node ) {
return Utils.getNodeCommonAncestor( this, node );
},
contains: function ( node ) {
if ( this === node ) {
return true;
}
if ( this === node.parent ) {
return true;
}
var isContain = false;
Utils.each( this.getChildren(), function ( i, n ) {
isContain = n.contains( node );
if ( isContain === true ) {
return false;
}
} );
return isContain;
},
clone: function () {
function cloneNode( parent, isClonedNode ) {
var _tmp = new KM.MinderNode( isClonedNode.getText() );
_tmp.data = Utils.clonePlainObject( isClonedNode.getData() );
_tmp.tmpData = Utils.clonePlainObject( isClonedNode.getTmpData() )
_tmp.parent = parent;
if ( parent ) {
parent.children.push( _tmp );
}
for ( var i = 0, ci;
( ci = isClonedNode.children[ i++ ] ); ) {
cloneNode( _tmp, ci );
}
return _tmp;
}
return function () {
return cloneNode( null, this );
};
}(),
equals: function ( node ) {
if ( node.children.length != this.children.length ) {
return false;
}
if ( utils.compareObject( node.getData(), this.getData() ) === false ) {
return false;
}
if ( utils.compareObject( node.getTmpData(), this.getTmpData() ) === false ) {
return false;
}
for ( var i = 0, ci;
( ci = this.children[ i ] ); i++ ) {
if ( ci.equals( node.children[ i ] ) === false ) {
return false;
}
}
return true;
},
getTextShape: function () {
var textShape;
utils.each( this.getContRc().getShapesByType( 'text' ), function ( i, t ) {
if ( t.getAttr( '_nodeTextShape' ) ) {
textShape = t;
return false;
}
} );
return textShape;
},
isSelected: function () {
return this.getTmpData( 'highlight' ) === true;
},
clearChildren: function () {
this.children = [];
},
isHighlight: function () {
return this.getTmpData( 'highlight' )
},
setTmpData: function ( a, v ) {
var me = this;
if ( utils.isObject( a ) ) {
utils.each( a, function ( val, key ) {
me.setTmpData( key, val )
} )
}
if ( v === undefined || v === null || v === '' ) {
delete this.tmpData[ a ];
} else {
this.tmpData[ a ] = v;
}
},
getTmpData: function ( a ) {
if ( a === undefined ) {
return this.tmpData;
}
return this.tmpData[ a ]
}
} );
\ No newline at end of file
var utils = Utils = KityMinder.Utils = {
extend: kity.Utils.extend.bind( kity.Utils ),
listen: function ( element, type, handler ) {
var types = utils.isArray( type ) ? type : utils.trim( type ).split( /\s+/ ),
k = types.length;
if ( k )
while ( k-- ) {
type = types[ k ];
if ( element.addEventListener ) {
element.addEventListener( type, handler, false );
} else {
if ( !handler._d ) {
handler._d = {
els: []
};
}
var key = type + handler.toString(),
index = utils.indexOf( handler._d.els, element );
if ( !handler._d[ key ] || index == -1 ) {
if ( index == -1 ) {
handler._d.els.push( element );
}
if ( !handler._d[ key ] ) {
handler._d[ key ] = function ( evt ) {
return handler.call( evt.srcElement, evt || window.event );
};
}
element.attachEvent( 'on' + type, handler._d[ key ] );
}
}
}
element = null;
},
trim: function ( str ) {
return str.replace( /(^[ \t\n\r]+)|([ \t\n\r]+$)/g, '' );
},
each: function ( obj, iterator, context ) {
if ( obj == null ) return;
if ( obj.length === +obj.length ) {
for ( var i = 0, l = obj.length; i < l; i++ ) {
if ( iterator.call( context, i, obj[ i ], obj ) === false )
return false;
}
} else {
for ( var key in obj ) {
if ( obj.hasOwnProperty( key ) ) {
if ( iterator.call( context, key, obj[ key ], obj ) === false )
return false;
}
}
}
},
addCssRule: function ( key, style, doc ) {
var head, node;
if ( style === undefined || style && style.nodeType && style.nodeType == 9 ) {
//获取样式
doc = style && style.nodeType && style.nodeType == 9 ? style : ( doc || document );
node = doc.getElementById( key );
return node ? node.innerHTML : undefined;
}
doc = doc || document;
node = doc.getElementById( key );
//清除样式
if ( style === '' ) {
if ( node ) {
node.parentNode.removeChild( node );
return true
}
return false;
}
//添加样式
if ( node ) {
node.innerHTML = style;
} else {
node = doc.createElement( 'style' );
node.id = key;
node.innerHTML = style;
doc.getElementsByTagName( 'head' )[ 0 ].appendChild( node );
}
},
keys: function ( plain ) {
var keys = [];
for ( var key in plain ) {
if ( plain.hasOwnProperty( key ) ) {
keys.push( key );
}
}
return keys;
},
proxy: function ( fn, context ) {
return function () {
return fn.apply( context, arguments );
};
},
indexOf: function ( array, item, start ) {
var index = -1;
start = this.isNumber( start ) ? start : 0;
this.each( array, function ( v, i ) {
if ( i >= start && v === item ) {
index = i;
return false;
}
} );
return index;
},
argsToArray: function ( args,index ) {
return Array.prototype.slice.call( args, index || 0 );
},
clonePlainObject:function (source, target) {
var tmp;
target = target || {};
for (var i in source) {
if (source.hasOwnProperty(i)) {
tmp = source[i];
if (utils.isObject(tmp) || utils.isArray(tmp)) {
target[i] = utils.isArray(tmp) ? [] : {};
utils.clonePlainObject(source[i], target[i])
} else {
target[i] = tmp;
}
}
}
return target;
},
compareObject:function(source,target){
var tmp;
if(this.isEmptyObject(source) !== this.isEmptyObject(target)){
return false
}
if(this.getObjectLength(source) != this.getObjectLength(target)){
return false;
}
for(var p in source){
if(source.hasOwnProperty(p)){
tmp = source[p];
if(target[p] === undefined){
return false;
}
if (this.isObject(tmp) || this.isArray(tmp)) {
if(this.isObject(target[p]) !== this.isObject(tmp)){
return false;
}
if(this.isArray(tmp) !== this.isArray(target[p])){
return false;
}
if(this.compareObject(tmp, target[p]) === false){
return false
}
} else {
if(tmp != target[p]){
return false
}
}
}
}
return true;
},
getObjectLength:function(obj){
if (this.isArray(obj) || this.isString(obj)) return obj.length;
var count = 0;
for (var key in obj) if (obj.hasOwnProperty(key)) count++;
return count;
},
isEmptyObject:function (obj) {
if (obj == null) return true;
if (this.isArray(obj) || this.isString(obj)) return obj.length === 0;
for (var key in obj) if (obj.hasOwnProperty(key)) return false;
return true;
},
getNodeCommonAncestor : function(nodeA,nodeB){
if ( nodeA === nodeB ) {
return nodeA.parent
}
if ( nodeA.contains( nodeB ) ) {
return this
}
if ( nodeB.contains( nodeA ) ) {
return nodeB
}
var parent = nodeA.parent;
while ( !parent.contains( nodeB ) ) {
parent = parent.parent;
}
return parent;
},
loadFile:function () {
var tmpList = [];
function getItem(doc, obj) {
try {
for (var i = 0, ci; ci = tmpList[i++];) {
if (ci.doc === doc && ci.url == (obj.src || obj.href)) {
return ci;
}
}
} catch (e) {
return null;
}
}
return function (doc, obj, fn) {
var item = getItem(doc, obj);
if (item) {
if (item.ready) {
fn && fn();
} else {
item.funs.push(fn)
}
return;
}
tmpList.push({
doc:doc,
url:obj.src || obj.href,
funs:[fn]
});
if (!doc.body) {
var html = [];
for (var p in obj) {
if (p == 'tag')continue;
html.push(p + '="' + obj[p] + '"')
}
doc.write('<' + obj.tag + ' ' + html.join(' ') + ' ></' + obj.tag + '>');
return;
}
if (obj.id && doc.getElementById(obj.id)) {
return;
}
var element = doc.createElement(obj.tag);
delete obj.tag;
for (var p in obj) {
element.setAttribute(p, obj[p]);
}
element.onload = element.onreadystatechange = function () {
if (!this.readyState || /loaded|complete/.test(this.readyState)) {
item = getItem(doc, obj);
if (item.funs.length > 0) {
item.ready = 1;
for (var fi; fi = item.funs.pop();) {
fi();
}
}
element.onload = element.onreadystatechange = null;
}
};
element.onerror = function () {
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file umeditor.config.js ')
};
doc.getElementsByTagName("head")[0].appendChild(element);
}
}(),
clone:function (source, target) {
var tmp;
target = target || {};
for (var i in source) {
if (source.hasOwnProperty(i)) {
tmp = source[i];
if (typeof tmp == 'object') {
target[i] = utils.isArray(tmp) ? [] : {};
utils.clone(source[i], target[i])
} else {
target[i] = tmp;
}
}
}
return target;
},
};
Utils.each( [ 'String', 'Function', 'Array', 'Number', 'RegExp', 'Object' ], function ( i, v ) {
KityMinder.Utils[ 'is' + v ] = function ( obj ) {
return Object.prototype.toString.apply( obj ) == '[object ' + v + ']';
}
} );
\ No newline at end of file
KityMinder.registerModule( "basestylemodule", function () {
var km = this;
return {
"commands": {
"bold": kity.createClass( "boldCommand", {
base: Command,
execute: function ( ) {
var nodes = km.getSelectedNodes();
if(this.queryState('bold') == 1){
utils.each(nodes,function(i,n){
n.setData('bold');
n.getTextShape().setAttr('font-weight');
km.updateLayout(n)
})
}else{
utils.each(nodes,function(i,n){
n.setData('bold',true);
n.getTextShape().setAttr('font-weight','bold');
km.updateLayout(n)
})
}
},
queryState: function ( ) {
var nodes = km.getSelectedNodes(),
result = 0;
if(nodes.length == 0){
return -1;
}
utils.each(nodes,function(i,n){
if(n.getData('bold')){
result = 1;
return false;
}
});
return result;
}
} ),
"italic": kity.createClass( "italicCommand", {
base: Command,
execute: function ( ) {
var nodes = km.getSelectedNodes();
if(this.queryState('italic') == 1){
utils.each(nodes,function(i,n){
n.setData('italic');
n.getTextShape().setAttr('font-style');
km.updateLayout(n)
})
}else{
utils.each(nodes,function(i,n){
n.setData('italic',true);
n.getTextShape().setAttr('font-style','italic');
km.updateLayout(n)
})
}
},
queryState: function ( ) {
var nodes = km.getSelectedNodes(),
result = 0;
if(nodes.length == 0){
return -1;
}
utils.each(nodes,function(i,n){
if(n.getData('italic')){
result = 1;
return false;
}
});
return result;
}
} )
},
addShortcutKeys: {
"bold": "ctrl+b", //bold
"italic": "ctrl+i" //italic
},
"events": {
"beforeRenderNode": function ( e ) {
//加粗
if(e.node.getData('bold')){
e.node.getTextShape().setAttr('font-weight','bold');
}
if(e.node.getData('italic')){
e.node.getTextShape().setAttr('font-style','italic');
}
}
}
};
} );
\ No newline at end of file
var GM = KityMinder.Geometry;
// 矩形的变形动画定义
var AreaAnimator = kity.createClass( "AreaAnimator", {
base: kity.Animator,
constructor: function ( startArea, endArea ) {
startArea.opacity = 0;
endArea.opacity = 0.8;
this.callBase( startArea, endArea, function ( target, value ) {
target.setPosition( value.x, value.y );
target.setSize( value.width, value.height );
target.setOpacity( value.opacity );
} );
}
} );
var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
base: Command,
execute: function ( minder, nodes, parent ) {
var node;
for ( var i = nodes.length - 1; i >= 0; i-- ) {
node = nodes[ i ];
if ( node.getParent() ) {
node.getParent().removeChild( node );
parent.appendChild( node );
}
}
minder.initStyle( minder.getRoot() );
minder.select( nodes, true );
}
} );
function boxMapper( node ) {
return node.getRenderContainer().getRenderBox( 'top' );
}
// 对拖动对象的一个替代盒子,控制整个拖放的逻辑,包括:
// 1. 从节点列表计算出拖动部分
// 2. 产生替代矩形包围拖动部分
// 3. 动画收缩替代矩形到固定大小,成为替代盒子
// 4. 控制替代盒子的移动
// 5. 计算可以 drop 的节点,产生 drop 交互提示
var DragBox = kity.createClass( "DragBox", {
base: kity.Group,
constructor: function ( minder ) {
this.callBase();
this._minder = minder;
this._draw();
},
// 绘制显示拖放范围的矩形和显示拖放信息的文本
_draw: function () {
this._rect = new kity.Rect()
.setRadius( 5 )
.fill( 'white' )
.stroke( '#3399ff', 1 );
this._text = new kity.Text()
.setSize( 14 )
.setTextAnchor( 'middle' )
.fill( 'black' )
.setStyle( 'cursor', 'default' );
this.addShapes( [ this._rect, this._text ] );
},
// 从选中的节点计算拖放源
// 并不是所有选中的节点都作为拖放源,如果选中节点中存在 A 和 B,
// 并且 A 是 B 的祖先,则 B 不作为拖放源
//
// 计算过程:
// 1. 将节点按照树高排序,排序后只可能是前面节点是后面节点的祖先
// 2. 从后往前枚举排序的结果,如果发现枚举目标之前存在其祖先,
// 则排除枚举目标作为拖放源,否则加入拖放源
_calcDragSources: function () {
this._dragSources = this._minder.getSelectedAncestors();
},
// 计算拖放目标可以释放的节点列表(释放意味着成为其子树),存在这条限制规则:
// - 不能拖放到拖放目标的子树上(允许拖放到自身,因为多选的情况下可以把其它节点加入)
//
// 1. 加入当前节点(初始为根节点)到允许列表
// 2. 对于当前节点的每一个子节点:
// (1) 如果是拖放目标的其中一个节点,忽略(整棵子树被剪枝)
// (2) 如果不是拖放目标之一,以当前子节点为当前节点,回到 1 计算
// 3. 返回允许列表
//
_calcDropTargets: function () {
function findAvailableParents( nodes, root ) {
var availables = [],
i;
availables.push( root );
root.getChildren().forEach( function ( test ) {
for ( i = 0; i < nodes.length; i++ ) {
if ( nodes[ i ] == test ) return;
}
availables = availables.concat( findAvailableParents( nodes, test ) );
} );
return availables;
}
this._dropTargets = findAvailableParents( this._dragSources, this._minder.getRoot() );
this._dropTargetBoxes = this._dropTargets.map( boxMapper );
},
// 进入拖放模式:
// 1. 计算拖放源和允许的拖放目标
// 2. 渲染拖放盒子
// 3. 启动收缩动画
// 4. 标记已启动
_enterDragMode: function () {
this._calcDragSources();
if ( !this._dragSources.length ) {
this._startPosition = null;
return false;
}
this._calcDropTargets();
this._drawForDragMode();
this._shrink();
this._dragMode = true;
return true;
},
_leaveDragMode: function () {
this.remove();
this._dragMode = false;
this._dropSucceedTarget = null;
},
_drawForDragMode: function () {
this._text.setContent( this._dragSources.length + ' items' );
this._text.setPosition( this._startPosition.x, this._startPosition.y + 5 );
this._minder.getPaper().addShape( this );
},
_shrink: function () {
// 合并所有拖放源图形的矩形即可
function calcSourceArea( boxArray ) {
var area = boxArray.pop();
while ( boxArray.length ) {
area = GM.mergeBox( area, boxArray.pop() );
}
return {
x: area.left,
y: area.top,
width: area.width,
height: area.height
};
}
// 从焦点发散出一个固定的矩形即可
function calcFocusArea( focusPoint ) {
var width = 80,
height = 30;
return {
x: focusPoint.x - width / 2,
y: focusPoint.y - height / 2,
width: width,
height: height
};
}
var sourceArea = calcSourceArea( this._dragSources.map( boxMapper ) );
var focusArea = calcFocusArea( this._startPosition );
var animator = new AreaAnimator( sourceArea, focusArea );
animator.start( this._rect, 400, 'easeOutQuint' );
},
// 此处可用线段树优化,但考虑到节点不多,必要性不到,就用暴力测试
_dropTest: function () {
var dragBox = this.getRenderBox(),
test;
this._dropSucceedTarget = null;
for ( var i = 0; i < this._dropTargetBoxes.length; i++ ) {
test = this._dropTargetBoxes[ i ];
if ( GM.isBoxIntersect( dragBox, test ) ) {
this._dropSucceedTarget = this._dropTargets[ i ];
return;
}
}
},
_updateDropHint: function () {
var target = this._dropSucceedTarget,
lastTarget = this._lastSucceedTarget;
if ( target && target == lastTarget ) return;
if ( lastTarget ) {
this._removeDropStyle( lastTarget );
}
if ( target ) {
this._addDropStyle( target );
}
this._lastSucceedTarget = target;
},
_removeDropStyle: function ( node ) {
node._layout.bgRect.stroke( 'none' );
this._rect.stroke( '#3399ff', 1 );
},
_addDropStyle: function ( node ) {
node._layout.bgRect.stroke( 'rgb(254, 219, 0)', 3 );
node.getRenderContainer().fxScale( 1.25, 1.25, 150, 'ease' ).fxScale( 0.8, 0.8, 150, 'ease' );
},
dragStart: function ( position ) {
// 只记录开始位置,不马上开启拖放模式
// 这个位置同时是拖放范围收缩时的焦点位置(中心)
this._startPosition = position;
},
dragMove: function ( position ) {
// 启动拖放模式需要最小的移动距离
var DRAG_MOVE_THRESHOLD = 10;
if ( !this._startPosition ) return;
this._dragPosition = position;
if ( !this._dragMode ) {
// 判断拖放模式是否该启动
if ( GM.getDistance( this._dragPosition, this._startPosition ) < DRAG_MOVE_THRESHOLD ) {
return;
}
if ( !this._enterDragMode() ) {
return;
}
}
var movement = kity.Vector.fromPoints( this._startPosition, this._dragPosition );
this.setTransform( new kity.Matrix().translate( movement.x, movement.y ) );
this._dropTest();
this._updateDropHint();
},
dragEnd: function () {
this._startPosition = null;
if ( !this._dragMode ) {
return;
}
if ( this._dropSucceedTarget ) {
this._minder.execCommand( 'movetoparent', this._dragSources, this._dropSucceedTarget );
}
this._leaveDragMode();
}
} );
KityMinder.registerModule( "DragTree", function () {
var dragStartPosition, dragBox, dragTargets, dropTargets, dragTargetBoxes, dropTarget;
return {
init: function () {
this._dragBox = new DragBox( this );
},
events: {
mousedown: function ( e ) {
// 单选中根节点也不触发拖拽
if ( e.getTargetNode() && e.getTargetNode() != this.getRoot() ) {
this._dragBox.dragStart( e.getPosition() );
}
},
mousemove: function ( e ) {
this._dragBox.dragMove( e.getPosition() );
},
mouseup: function ( e ) {
this._dragBox.dragEnd();
}
},
commands: {
'movetoparent': MoveToParentCommand
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "DropFile", function () {
function init() {
var container = this.getPaper().getContainer();
container.addEventListener( 'dragover', onDragOver );
container.addEventListener( 'drop', onDrop.bind( this ) );
}
function onDragOver( e ) {
e.preventDefault();
e.stopPropagation();
e.dataTransfer.dropEffect = 'copy';
}
function onDrop( e ) {
e.preventDefault();
e.stopPropagation();
var minder = this;
if ( e.dataTransfer.files ) {
var reader = new FileReader();
reader.onload = function ( e ) {
minder.importData( e.target.result );
};
reader.readAsText( e.dataTransfer.files[ 0 ] );
}
}
return {
events: {
ready: init
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "TextEditModule", function () {
var km = this;
var sel = new Minder.Selection();
var receiver = new Minder.Receiver(this);
var range = new Minder.Range();
this.receiver = receiver;
var mouseDownStatus = false;
var oneTime = 0;
var lastEvtPosition,dir = 1;
km.isTextEditStatus = function(){
return km.receiver.isTextEditStatus();
};
var selectionByClick = false;
return {
//插入光标
"init":function(){
this.getPaper().addShape(sel);
},
"events": {
'beforemousedown':function(e){
var isRightMB;
if ("which" in e.originEvent) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB = e.originEvent.which == 3;
else if ("button" in e.originEvent) // IE, Opera
isRightMB = e.originEvent.button == 2;
if(isRightMB){
e.stopPropagationImmediately();
return;
}
sel.setHide();
var node = e.getTargetNode();
if(!node){
var selectionShape = e.kityEvent.targetShape;
if(selectionShape && selectionShape.getType() == 'Selection'){
selectionByClick = true;
node = selectionShape.getData('relatedNode');
e.stopPropagationImmediately();
}
}
if(node){
var textShape = node.getTextShape();
textShape.setStyle('cursor','default');
if ( this.isSingleSelect() && node.isSelected()) {// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
sel.collapse();
node.getTextShape().setStyle('cursor','text');
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.setCurrentIndex(e.getPosition())
.updateSelection()
.setRange(range);
sel.setData('relatedNode',node);
mouseDownStatus = true;
lastEvtPosition = e.getPosition();
if(selectionByClick){
sel.setShow();
selectionByClick = false;
}
}
}
},
'mouseup':function(e){
if(mouseDownStatus){
if(!sel.collapsed ){
try{
receiver.updateRange(range)
}catch(e){
console.log(e)
}
}else
sel.setShow()
}
mouseDownStatus = false;
oneTime = 0;
},
'beforemousemove':function(e){
if(mouseDownStatus){
e.stopPropagationImmediately();
var offset = e.getPosition();
if(Math.abs(offset.y - lastEvtPosition.y) > 2 && Math.abs(lastEvtPosition.x - offset.x) < 1 ){
sel.setHide();
mouseDownStatus = false;
return;
}
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir);
receiver.updateSelectionByMousePosition(offset,dir)
.updateSelectionShow(dir);
lastEvtPosition = e.getPosition();
}
},
'dblclick':function(e){
var text = e.kityEvent.targetShape;
if ( text.getType().toLowerCase()== 'text') {
sel.setStartOffset(0);
sel.setEndOffset(text.getContent().length);
sel.setShow();
receiver.setContainerTxt(text.getContent()).updateSelectionShow(1)
.updateRange(range).setTextEditStatus(true)
}
},
'restoreScene':function(){
sel.setHide();
},
'stopTextEdit':function(){
sel.setHide();
receiver.clear().setTextEditStatus(false);
},
"resize": function ( e ) {
sel.setHide();
},
'execCommand':function(e){
var cmds = {
'appendchildnode':1,
'appendsiblingnode':1
};
if(cmds[e.commandName]){
var node = km.getSelectedNode();
var textShape = node.getTextShape();
textShape.setStyle('cursor','default');
node.getTextShape().setStyle('cursor','text');
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.getTextOffsetData()
.setIndex(0)
.updateSelection()
.setRange(range);
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
sel.setShow();
receiver.updateSelectionShow(1)
.updateRange(range);
return;
}
if(e.commandName == 'priority' || e.commandName == 'progress'){
receiver.setBaseOffset()
.getTextOffsetData();
if(sel.collapsed){
receiver.updateSelection();
}else{
receiver.updateSelectionShow(1)
}
return;
}
receiver.clear().setTextEditStatus(false);
},
'selectionclear':function(){
receiver.setTextEditStatus(false).clear()
}
}
};
} );
\ No newline at end of file
Minder.Range = kity.createClass('Range',{
constructor : function(){
this.nativeRange = document.createRange();
this.nativeSel = window.getSelection();
},
select:function(){
var start = this.nativeRange.startContainer;
if(start.nodeType == 1 && start.childNodes.length == 0){
var char = document.createTextNode('\u200b');
start.appendChild(char);
this.nativeRange.setStart(char,1);
this.nativeRange.collapse(true);
}
this.nativeSel.removeAllRanges();
this.nativeSel.addRange(this.nativeRange);
return this;
},
setStart:function(node,index){
try{
this.nativeRange.setStart(node,index);
}catch(e){
console.log(e)
}
return this;
},
setEnd:function(node,index){
this.nativeRange.setEnd(node,index);
return this;
},
getStart:function(){
var range = this.nativeSel.getRangeAt(0);
return {
startContainer:range.startContainer,
startOffset:range.startOffset
}
},
collapse:function(toStart){
this.nativeRange.collapse(toStart === true);
return this;
},
insertNode:function(node){
this.nativeRange.insertNode(node);
return this;
}
});
\ No newline at end of file
//接收者
Minder.Receiver = kity.createClass('Receiver',{
clear : function(){
this.container.innerHTML = '';
this.selection && this.selection.setHide();
this.index = 0;
return this;
},
setTextEditStatus : function(status){
this.textEditStatus = status || false;
return this;
},
isTextEditStatus:function(){
return this.textEditStatus;
},
constructor : function(km){
this.setKityMinder(km);
this.textEditStatus = false;
var _div = document.createElement('div');
_div.setAttribute('contenteditable',true);
_div.className = 'km_receiver';
this.container = document.body.insertBefore(_div,document.body.firstChild);
utils.addCssRule('km_receiver_css',' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}');//
this.km.on('beforekeyup', utils.proxy(this.keyboardEvents,this));
this.timer = null;
this.index = 0;
},
setRange : function(range,index){
this.index = index || this.index;
var text = this.container.firstChild;
this.range = range;
range.setStart(text || this.container, this.index).collapse(true);
var me = this;
setTimeout(function(){
me.container.focus();
range.select()
});
return this;
},
setTextShape:function(textShape){
if(!textShape){
textShape = new kity.Text();
}
this.textShape = textShape;
this.container.innerHTML = textShape.getContent();
return this;
},
setTextShapeSize:function(size){
this.textShape.setSize(size);
return this;
},
getTextShapeHeight:function(){
return this.textShape.getRenderBox().height;
},
appendTextShapeToPaper:function(paper){
paper.addShape(this.textShape);
return this;
},
setKityMinder:function(km){
this.km = km;
return this;
},
setMinderNode:function(node){
this.minderNode = node;
return this;
},
keyboardEvents : function(e){
clearTimeout(this.timer);
var me = this;
var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode;
switch(e.type){
case 'beforekeyup':
if(this.isTextEditStatus()){
switch(keyCode){
case keymap.Enter:
case keymap.Tab:
if(this.keydownNode === this.minderNode){
this.setTextEditStatus(false);
this.clear();
}
e.preventDefault();
return;
case keymap.Shift:
case keymap.Control:
case keymap.Alt:
case keymap.Cmd:
return;
}
var text = this.container.textContent.replace(/\u200b/g,'');
if(this.textShape.getOpacity() == 0){
this.textShape.setOpacity(1);
}
this.textShape.setContent(text);
this.setContainerStyle();
this.minderNode.setText(text);
if(text.length == 0){
this.textShape.setContent('a');
this.textShape.setOpacity(0);
}
this.km.updateLayout(this.minderNode);
this.setBaseOffset();
this.updateTextData();
this.updateIndex();
this.updateSelection();
this.timer = setTimeout(function(){
me.selection.setShow()
},500);
return true;
}
}
},
updateIndex:function(){
this.index = this.range.getStart().startOffset;
},
updateTextData : function(){
this.textShape.textData = this.getTextOffsetData();
},
setSelection : function(selection){
this.selection = selection;
return this;
},
updateSelection : function(){
this.selection.setShowHold();
this.selection.bringTop();
//更新模拟选区的范围
this.selection.setStartOffset(this.index).collapse(true);
if(this.index == this.textData.length){
if(this.index == 0){
this.selection.setPosition(this.getBaseOffset())
}else{
this.selection.setPosition({
x : this.textData[this.index-1].x + this.textData[this.index-1].width,
y : this.textData[this.index-1].y
})
}
}else{
this.selection.setPosition(this.textData[this.index])
}
return this;
},
getBaseOffset:function(){
return this.textShape.getRenderBox('top');
},
setBaseOffset :function(){
this.offset = this.textShape.getRenderBox('top');
return this;
},
setContainerStyle : function(){
var textShapeBox = this.textShape.getRenderBox();
this.container.style.cssText = ";left:" + this.offset.x
+ 'px;top:' + (this.offset.y+textShapeBox.height)
+ 'px;width:' + textShapeBox.width
+ 'px;height:' + textShapeBox.height + 'px;';
return this;
},
getTextOffsetData:function(){
var text = this.textShape.getContent();
this.textData = [];
for(var i= 0,l = text.length;i<l;i++){
var box = this.textShape.getExtentOfChar(i);
this.textData.push({
x:box.x + this.offset.x,
y:this.offset.y,
width:box.width,
height:box.height
})
}
return this;
},
setCurrentIndex:function(offset){
var me = this;
this.getTextOffsetData();
var hadChanged = false;
utils.each(this.textData,function(i,v){
//点击开始之前
if(i == 0 && offset.x <= v.x){
me.index = 0;
return false;
}
if(i == me.textData.length -1 && offset.x >= v.x){
me.index = me.textData.length;
return false;
}
if(offset.x >= v.x && offset.x <= v.x + v.width){
if(offset.x - v.x > v.width/2){
me.index = i + 1;
}else {
me.index = i
}
hadChanged = true;
return false;
}
});
return this;
},
setSelectionHeight:function(){
this.selection.setHeight(this.getTextShapeHeight());
return this;
},
updateSelectionByMousePosition:function(offset,dir){
var me = this;
utils.each(this.textData,function(i,v){
//点击开始之前
if(i == 0 && offset.x <= v.x){
me.selection.setStartOffset(0);
return false;
}
if(i == me.textData.length -1 && offset.x >= v.x){
me.selection.setEndOffset(me.textData.length);
return false;
}
if(offset.x >= v.x && offset.x <= v.x + v.width){
if(me.index == i){
if(i == 0){
me.selection.setStartOffset(i)
}
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else if(i > me.index){
me.selection.setStartOffset(me.index);
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else{
me.selection.setStartOffset(i + (dir == 1 ? 1 : 0));
me.selection.setEndOffset(me.index)
}
return false;
}
});
return this;
},
updateSelectionShow:function(){
var startOffset = this.textData[this.selection.startOffset],
endOffset = this.textData[this.selection.endOffset],
width = 0 ;
if(this.selection.collapsed){
this.selection.updateShow(startOffset||this.textData[this.textData.length-1],0);
return this;
}
if(!endOffset){
var lastOffset = this.textData[this.textData.length -1];
width = lastOffset.x - startOffset.x + lastOffset.width;
}else{
width = endOffset.x - startOffset.x;
}
this.selection.updateShow(startOffset,width);
return this;
},
updateRange:function(range){
var node = this.container.firstChild;
range.setStart(node,this.selection.startOffset);
range.setEnd(node,this.selection.endOffset);
range.select();
return this;
},
setIndex:function(index){
this.index = index;
return this
},
setContainerTxt:function(txt){
this.container.textContent = txt;
return this;
}
});
\ No newline at end of file
//模拟光标
Minder.Selection = kity.createClass( 'Selection', {
base: kity.Rect,
constructor: function ( height, color, width ) {
this.callBase();
this.height = height || 20;
this.stroke( color || 'rgb(27,171,255)', width || 1 );
this.width = 0;
this.fill('rgb(27,171,255)');
this.setHide();
this.timer = null;
this.collapsed = true;
this.startOffset = this.endOffset = 0;
this.setOpacity(0.5);
this.setStyle('cursor','text');
},
collapse : function(toEnd){
this.stroke( 'rgb(27,171,255)', 1 );
this.setOpacity(1);
this.width = 1;
this.collapsed = true;
if(toEnd){
this.startOffset = this.endOffset
}else{
this.endOffset = this.startOffset;
}
return this;
},
setStartOffset:function(offset){
this.startOffset = offset;
var tmpOffset = this.startOffset;
if(this.startOffset > this.endOffset){
this.startOffset = this.endOffset;
this.endOffset = tmpOffset;
}else if(this.startOffset == this.endOffset){
this.collapse();
return this;
}
this.collapsed = false;
this.stroke('none',0);
this.setOpacity(0.5);
return this;
},
setEndOffset:function(offset){
this.endOffset = offset;
var tmpOffset = this.endOffset;
if(this.endOffset < this.startOffset){
this.endOffset = this.startOffset;
this.startOffset = tmpOffset;
}else if(this.startOffset == this.endOffset){
this.collapse();
return this;
}
this.collapsed = false;
this.stroke('none',0);
this.setOpacity(0.5);
return this;
},
updateShow : function(offset,width){
if(width){
this.setShowHold();
}
this.setPosition(offset).setWidth(width);
return this;
},
setPosition: function ( offset ) {
try {
this.x = offset.x;
this.y = offset.y;
} catch ( e ) {
console.log(e)
}
return this.update();
},
setHeight: function ( height ) {
this.height = height;
},
setHide: function () {
clearInterval( this.timer );
this.setStyle( 'display', 'none' );
return this;
},
setShowHold: function () {
clearInterval( this.timer );
this.setStyle( 'display', '' );
return this;
},
setShow: function () {
clearInterval( this.timer );
var me = this,
state = '';
if(this.collapsed){
this.timer = setInterval( function () {
me.setStyle( 'display', state );
state = state ? '' : 'none';
}, 300 );
}else{
me.setStyle( 'display', '' );
}
return this;
},
setTextShape: function ( text ) {
if ( !text ) {
this.text = new kity.Text();
} else {
this.text = text;
}
return this
},
getTextShape: function () {
return this.text
},
setTxtContent: function ( text ) {
this.text.setContent( text )
},
updatePosition: function ( index ) {
}
} );
\ No newline at end of file
KityMinder.registerModule( "fontmodule", function () {
return {
defaultOptions: {
'fontfamily': [ {
name: 'songti',
val: '宋体,SimSun'
}, {
name: 'yahei',
val: '微软雅黑,Microsoft YaHei'
}, {
name: 'kaiti',
val: '楷体,楷体_GB2312, SimKai'
}, {
name: 'heiti',
val: '黑体, SimHei'
}, {
name: 'lishu',
val: '隶书, SimLi'
}, {
name: 'andaleMono',
val: 'andale mono'
}, {
name: 'arial',
val: 'arial, helvetica,sans-serif'
}, {
name: 'arialBlack',
val: 'arial black,avant garde'
}, {
name: 'comicSansMs',
val: 'comic sans ms'
}, {
name: 'impact',
val: 'impact,chicago'
}, {
name: 'timesNewRoman',
val: 'times new roman'
}, {
name: 'sans-serif',
val: 'sans-serif'
} ],
'fontsize': [ 10, 12, 16, 18, 24, 32, 48 ]
},
"commands": {
"forecolor": kity.createClass( "fontcolorCommand", {
base: Command,
execute: function ( km, color ) {
var nodes = km.getSelectedNodes();
utils.each( nodes, function ( i, n ) {
n.setData( 'fontcolor', color );
n.getTextShape().fill( color )
} )
},
queryState:function(km){
return km.getSelectedNodes().length == 0 ? -1 : 0
}
} ),
"fontfamily": kity.createClass( "fontfamilyCommand", {
base: Command,
execute: function ( km, family ) {
var nodes = km.getSelectedNodes();
utils.each( nodes, function ( i, n ) {
n.setData( 'fontfamily', family );
n.getTextShape().setAttr( 'font-family', family );
km.updateLayout( n )
} )
},
queryState:function(km){
return km.getSelectedNodes().length == 0 ? -1 : 0
}
} ),
"fontsize": kity.createClass( "fontsizeCommand", {
base: Command,
execute: function ( km, size ) {
var nodes = km.getSelectedNodes();
utils.each( nodes, function ( i, n ) {
n.setData( 'fontsize', size );
n.getTextShape().setSize( size );
km.updateLayout( n )
} )
},
queryState:function(km){
return km.getSelectedNodes().length == 0 ? -1 : 0
}
} )
},
"events": {
"beforeRenderNode": function ( e ) {
var val;
if ( val = e.node.getData( 'fontfamily' ) ) {
e.node.getTextShape().setAttr( 'font-family', val );
}
if ( val = e.node.getData( 'fontcolor' ) ) {
e.node.getTextShape().fill( val );
}
if ( val = e.node.getData( 'fontsize' ) ) {
e.node.getTextShape().setSize( val );
}
}
}
};
} );
\ No newline at end of file
KityMinder.Geometry = ( function () {
var g = {};
var min = Math.min,
max = Math.max,
abs = Math.abs;
var own = Object.prototype.hasOwnProperty;
g.isNumberInRange = function ( number, range ) {
return number > range[ 0 ] && number < range[ 1 ];
};
g.getDistance = function ( p1, p2 ) {
return kity.Vector.fromPoints( p1, p2 ).length();
};
function wrapBox( box ) {
box.width = box.right - box.left;
box.height = box.bottom - box.top;
box.x = box.left;
box.y = box.top;
return box;
}
g.getBox = function ( p1, p2 ) {
return wrapBox( {
left: min( p1.x, p2.x ),
right: max( p1.x, p2.x ),
top: min( p1.y, p2.y ),
bottom: max( p1.y, p2.y )
} );
};
g.mergeBox = function ( b1, b2 ) {
return wrapBox( {
left: min( b1.left, b2.left ),
right: max( b1.right, b2.right ),
top: min( b1.top, b2.top ),
bottom: max( b1.bottom, b2.bottom )
} );
};
g.getBoxRange = function ( box ) {
return {
x: [ box.left, box.right ],
y: [ box.top, box.bottom ]
};
};
g.getBoxVertex = function ( box ) {
return {
leftTop: {
x: box.left,
y: box.top
},
rightTop: {
x: box.right,
y: box.top
},
leftBottom: {
x: box.left,
y: box.bottom
},
rightBottom: {
x: box.right,
y: box.bottom
}
};
};
g.isPointInsideBox = function ( p, b ) {
var ranges = g.getBoxRange( b );
return g.isNumberInRange( p.x, ranges.x ) && g.isNumberInRange( p.y, ranges.y );
};
g.isBoxIntersect = function ( b1, b2 ) {
var minx = max(b1.left, b2.left),
miny = max(b1.top, b2.top),
maxx = min(b1.right, b2.right),
maxy = min(b1.bottom, b2.bottom);
return minx < maxx && miny < maxy;
};
g.snapToSharp = function ( unknown ) {
if ( utils.isNumber( unknown ) ) {
return ( unknown | 0 ) + 0.5;
}
if ( utils.isArray( unknown ) ) {
return unknown.map( g.snapToSharp );
}
[ 'x', 'y', 'left', 'top', 'right', 'bottom' ].forEach( function ( n ) {
if ( own.call( unknown, n ) ) {
unknown[ n ] = g.snapToSharp( unknown[ n ] );
}
} );
return unknown;
};
g.expandBox = function( box, sizeX, sizeY ) {
if(sizeY === undefined) {
sizeY = sizeX;
}
return wrapBox( {
left: box.left - sizeX,
top: box.top - sizeY,
right: box.right + sizeX,
bottom: box.bottom + sizeY
} );
};
return g;
} )();
\ No newline at end of file
var ViewDragger = kity.createClass( "ViewDragger", {
constructor: function ( minder ) {
this._minder = minder;
this._enabled = false;
this._offset = {
x: 0,
y: 0
};
this._bind();
},
isEnabled: function () {
return this._enabled;
},
setEnabled: function ( value ) {
var paper = this._minder.getPaper();
paper.setStyle( 'cursor', value ? 'pointer' : 'default' );
paper.setStyle( 'cursor', value ? '-webkit-grab' : 'default' );
this._enabled = value;
},
_bind: function () {
var dragger = this,
isRootDrag = false,
lastPosition = null,
currentPosition = null;
this._minder.on( 'beforemousedown', function ( e ) {
// 已经被用户打开拖放模式
if ( dragger.isEnabled() ) {
lastPosition = e.getPosition();
e.stopPropagation();
e.originEvent.preventDefault();
}
// 点击未选中的根节点临时开启
else if ( e.getTargetNode() == this.getRoot() &&
(!this.getRoot().isSelected() || !this.isSingleSelect())) {
lastPosition = e.getPosition();
dragger.setEnabled( true );
isRootDrag = true;
}
} )
.on( 'beforemousemove', function ( e ) {
if ( lastPosition ) {
currentPosition = e.getPosition();
// 当前偏移加上历史偏移
var offset = kity.Vector.fromPoints( lastPosition, currentPosition );
this.getRenderContainer().translate( offset.x, offset.y );
e.stopPropagation();
lastPosition = currentPosition;
}
} )
.on( 'mouseup', function ( e ) {
lastPosition = null;
// 临时拖动需要还原状态
if ( isRootDrag ) {
dragger.setEnabled( false );
isRootDrag = false;
}
} );
}
} );
KityMinder.registerModule( 'Hand', function () {
var ToggleHandCommand = kity.createClass( "ToggleHandCommand", {
base: Command,
execute: function ( minder ) {
minder._viewDragger.setEnabled( !minder._viewDragger.isEnabled() );
},
queryState: function ( minder ) {
return minder._viewDragger.isEnabled() ? 1 : 0;
}
} );
return {
init: function () {
this._viewDragger = new ViewDragger( this );
},
commands: {
'hand': ToggleHandCommand
},
events: {
keyup: function ( e ) {
if ( e.originEvent.keyCode == keymap.Spacebar && this.getSelectedNodes().length === 0 ) {
this.execCommand( 'hand' );
e.preventDefault();
}
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "HistoryModule", function () {
var km = this;
var Scene = kity.createClass( 'Scene', {
constructor: function ( root ) {
this.data = root.clone();
},
getData: function () {
return this.data;
},
cloneData: function () {
return this.getData().clone();
},
equals: function ( scene ) {
return this.getData().equals( scene.getData() )
}
} );
var HistoryManager = kity.createClass( 'HistoryManager', {
constructor: function ( km ) {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
this.km = km;
},
undo: function () {
if ( this.hasUndo ) {
if ( !this.list[ this.index - 1 ] && this.list.length == 1 ) {
this.reset();
return;
}
while ( this.list[ this.index ].equals( this.list[ this.index - 1 ] ) ) {
this.index--;
if ( this.index == 0 ) {
return this.restore( 0 );
}
}
this.restore( --this.index );
}
},
redo: function () {
if ( this.hasRedo ) {
while ( this.list[ this.index ].equals( this.list[ this.index + 1 ] ) ) {
this.index++;
if ( this.index == this.list.length - 1 ) {
return this.restore( this.index );
}
}
this.restore( ++this.index );
}
},
restore: function () {
var scene = this.list[ this.index ];
this.km.setRoot( scene.cloneData() );
this.km.removeAllSelectedNodes();
this.km.initStyle();
this.update();
this.km.fire('restoreScene');
this.km.fire('contentChange');
},
getScene: function () {
return new Scene( this.km.getRoot() )
},
saveScene: function () {
var currentScene = this.getScene();
var lastScene = this.list[ this.index ];
if ( lastScene && lastScene.equals( currentScene ) ) {
return
}
this.list = this.list.slice( 0, this.index + 1 );
this.list.push( currentScene );
//如果大于最大数量了,就把最前的剔除
if ( this.list.length > this.km.getOptions( 'maxUndoCount' ) ) {
this.list.shift();
}
this.index = this.list.length - 1;
//跟新undo/redo状态
this.update();
},
update: function () {
this.hasRedo = !! this.list[ this.index + 1 ];
this.hasUndo = !! this.list[ this.index - 1 ];
},
reset: function () {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
}
} );
//为km实例添加history管理
this.historyManager = new HistoryManager( this );
var keys = {
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,/*Command*/91:1,
37:1, 38:1, 39:1, 40:1
},
keycont = 0,
lastKeyCode,
saveSceneTimer;
return {
defaultOptions: {
maxUndoCount: 20,
maxInputCount:20
},
"commands": {
"undo": kity.createClass( "UndoCommand", {
base: Command,
execute: function ( km ) {
km.historyManager.undo()
},
queryState: function ( km ) {
return km.historyManager.hasUndo ? 0 : -1;
},
isNeedUndo: function () {
return false;
}
} ),
"redo": kity.createClass( "RedoCommand", {
base: Command,
execute: function ( km ) {
km.historyManager.redo()
},
queryState: function ( km ) {
return km.historyManager.hasRedo ? 0 : -1;
},
isNeedUndo: function () {
return false;
}
} )
},
addShortcutKeys: {
"Undo": "ctrl+z", //undo
"Redo": "ctrl+y" //redo
},
"events": {
"saveScene": function ( e ) {
this.historyManager.saveScene();
},
"renderNode":function(e){
var node = e.node;
if(node.isHighlight()){
km.select(node);
}
},
"keydown":function(e){
var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode || orgEvt.which;
if (!keys[keyCode] && !orgEvt.ctrlKey && !orgEvt.metaKey && !orgEvt.shiftKey && !orgEvt.altKey) {
if (km.historyManager.list.length == 0) {
km.historyManager.saveScene();
}
clearTimeout(saveSceneTimer);
saveSceneTimer = setTimeout(function(){
km.historyManager.saveScene();
},200);
lastKeyCode = keyCode;
keycont++;
if (keycont >= km.getOptions('maxInputCount') ) {
km.historyManager.saveScene()
}
}
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "IconModule", function () {
var renderPriorityIcon = function ( node, val ) {
var colors = [ "", "#A92E24", "#29A6BD", "#1E8D54", "#eb6100", "#876DDA" ];
var _bg = new kity.Rect().fill( colors[ val ] ).setRadius( 3 ).setWidth( 20 ).setHeight( 20 );
var _number = new kity.Text().setContent( val ).fill( "white" ).setSize( 12 );
var _rc = new kity.Group();
_rc.addShapes( [ _bg, _number ] );
node.getIconRc().addShape( _rc );
_number.setTransform( new kity.Matrix().translate( 6, 15 ) );
};
var renderProgressIcon = function ( node, val, left ) {
var _rc = new kity.Group();
var _bg = new kity.Circle().setRadius( 8 ).fill( "white" ).stroke( new kity.Pen( "#29A6BD", 2 ) );
var _percent, d;
if ( val < 5 ) {
_percent = new kity.Path();
d = _percent.getDrawer();
d.moveTo( 0, 0 ).lineTo( 6, 0 );
} else _percent = new kity.Group();
_rc.addShapes( [ _bg, _percent ] );
node.getIconRc().addShape( _rc );
_rc.setTransform( new kity.Matrix().translate( left, 10 ) );
_percent.setTransform( 10, 10 );
switch ( val ) {
case 1:
break;
case 2:
d.carcTo( 6, 0, -6 );
break;
case 3:
d.carcTo( 6, -6, 0 );
break;
case 4:
d.carcTo( 6, 0, 6, 1, 0 );
break;
case 5:
var check = new kity.Path();
_percent.addShapes( [ new kity.Circle().setRadius( 6 ).fill( "#29A6BD" ), check ] );
check.getDrawer().moveTo( -3, 0 ).lineTo( -1, 3 ).lineTo( 3, -2 );
check.stroke( new kity.Pen( "white", 2 ).setLineCap( "round" ) );
break;
}
if ( val < 5 ) d.close();
_percent.fill( "#29A6BD" );
};
var setPriorityCommand = kity.createClass( "SetPriorityCommand", ( function () {
return {
base: Command,
execute: function ( km, value ) {
var nodes = km.getSelectedNodes();
for ( var i = 0; i < nodes.length; i++ ) {
nodes[ i ].setData( "PriorityIcon", value );
km.updateLayout( nodes[ i ] );
}
},
queryValue: function ( km ) {
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "PriorityIcon" );
if ( val ) break;
}
return val;
}
};
} )() );
var setProgressCommand = kity.createClass( "SetProgressCommand", ( function () {
return {
base: Command,
execute: function ( km, value ) {
var nodes = km.getSelectedNodes();
for ( var i = 0; i < nodes.length; i++ ) {
nodes[ i ].setData( "ProgressIcon", value );
km.updateLayout( nodes[ i ] );
}
},
queryValue: function ( km ) {
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "ProgressIcon" );
if ( val ) break;
}
return val;
}
};
} )() );
return {
"commands": {
"priority": setPriorityCommand,
"progress": setProgressCommand
},
"events": {
"RenderNode": function ( e ) {
var node = e.node;
var iconRc = node.getIconRc();
var contRc = node.getContRc();
var PriorityIconVal = node.getData( "PriorityIcon" );
var ProgressIconVal = node.getData( "ProgressIcon" );
//依次排布图标、文字
iconRc.clear();
var PriorityIconWidth = 0;
if ( PriorityIconVal ) {
renderPriorityIcon( node, PriorityIconVal );
PriorityIconWidth = 22;
}
if ( ProgressIconVal ) {
renderProgressIcon( node, ProgressIconVal, PriorityIconWidth + 10 );
}
var iconWidth = iconRc.getWidth();
var textShape = node.getTextShape();
if ( iconWidth ) textShape.setTransform( new kity.Matrix().translate( iconWidth + 5, 0 ) );
else textShape.setTransform( new kity.Matrix().translate( 0, 0 ) );
iconRc.setTransform( new kity.Matrix().translate( 0, -( iconRc.getHeight() + textShape.getHeight() ) / 2 ) );
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "KeyboardModule", function () {
function buildPositionNetwork( root ) {
var pointIndexes = [],
p;
root.traverse( function ( node ) {
p = node.getData( 'point' );
pointIndexes.push( {
x: p.x,
y: p.y,
node: node
} );
} );
for ( var i = 0; i < pointIndexes.length; i++ ) {
findClosestPointsFor( pointIndexes, i );
}
}
function quadOf( p ) {
return p.x > 0 ?
( p.y > 0 ? 1 : 2 ) :
( p.y < 0 ? 3 : 4 );
}
function findClosestPointsFor( pointIndexes, iFind ) {
var find = pointIndexes[ iFind ];
var matrix = new kity.Matrix().translate( -find.x, -find.y ).rotate( 45 );
var most = {}, quad;
var current;
for ( var i = 0; i < pointIndexes.length; i++ ) {
if ( i == iFind ) continue;
current = matrix.transformPoint( pointIndexes[ i ].x, pointIndexes[ i ].y );
quad = quadOf( current );
if ( !most[ quad ] || current.length() < most[ quad ].point.length() ) {
most[ quad ] = {
point: current,
node: pointIndexes[ i ].node
};
}
}
find.node._nearestNodes = {
right: most[ 1 ] && most[ 1 ].node || null,
top: most[ 2 ] && most[ 2 ].node || null,
left: most[ 3 ] && most[ 3 ].node || null,
down: most[ 4 ] && most[ 4 ].node || null
};
}
function navigateTo( km, direction ) {
var referNode = km.getSelectedNode();
if ( !referNode ) {
km.select( km.getRoot() );
buildPositionNetwork( km.getRoot() );
return;
}
var nextNode = referNode._nearestNodes[ direction ];
if ( nextNode ) {
km.select( nextNode, true );
}
}
return {
"events": {
contentchange: function () {
buildPositionNetwork( this.getRoot() );
},
keydown: function ( e ) {
var keys = KityMinder.keymap;
if ( this.receiver.isTextEditStatus() ) {
switch ( e.originEvent.keyCode ) {
case keys.Enter:
case keys.Tab:
this.fire( 'stopTextEdit' );
e.preventDefault();
break;
case keys.Backspace:
case keys.Del:
case keys.Left:
case keys.Up:
case keys.Right:
case keys.Down:
break;
}
return;
}
var node = e.getTargetNode();
this.receiver.keydownNode = node;
switch ( e.originEvent.keyCode ) {
case keys.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( this.getLang().topic ) );
e.preventDefault();
break;
case keys.Tab:
this.execCommand( 'appendChildNode', new MinderNode( this.getLang().topic ) );
e.preventDefault();
break;
case keys.Backspace:
case keys.Del:
this.execCommand( 'removenode' );
e.preventDefault();
break;
case keys.Left:
navigateTo( this, 'left' );
e.preventDefault();
break;
case keys.Up:
navigateTo( this, 'top' );
e.preventDefault();
break;
case keys.Right:
navigateTo( this, 'right' );
e.preventDefault();
break;
case keys.Down:
navigateTo( this, 'down' );
e.preventDefault();
break;
}
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "LayoutBottom", function () {
var _target = this.getRenderTarget();
function getMinderSize() {
return {
width: _target.clientWidth,
height: _target.clientHeight
};
}
var minder = this;
//收缩-展开子树的节点
var ShIcon = kity.createClass( "DefaultshIcon", ( function () {
return {
constructor: function ( node ) {
this._show = false;
this._node = node;
var iconShape = this.shape = new kity.Group();
iconShape.class = "shicon";
iconShape.icon = this;
var rect = this._rect = new kity.Rect().fill( "white" ).stroke( "gray" ).setRadius( 2 ).setWidth( 10 ).setHeight( 10 );
var plus = this._plus = new kity.Path();
plus.getDrawer()
.moveTo( 2, 5 )
.lineTo( 8, 5 )
.moveTo( 5, 2 )
.lineTo( 5, 8 );
plus.stroke( "gray" );
var dec = this._dec = new kity.Path();
dec.getDrawer()
.moveTo( 2, 5 )
.lineTo( 8, 5 );
dec.stroke( "gray" );
if ( node.getType() === "main" ) minder.getRenderContainer().addShape( iconShape );
else {
node.getLayout().subgroup.addShape( iconShape );
}
iconShape.addShapes( [ rect, plus, dec ] );
this.update();
this.switchState();
},
switchState: function () {
if ( !this._show ) {
this._plus.setOpacity( 0 );
this._dec.setOpacity( 1 );
this._show = true;
} else {
this._plus.setOpacity( 1 );
this._dec.setOpacity( 0 );
this._show = false;
}
return this._show;
},
update: function () {
var node = this._node;
var Layout = node.getLayout();
var nodeShape = node.getRenderContainer();
var nodeType = node.getType();
var nodeX = nodeShape.getRenderBox().closurePoints[ 1 ].x + 5;
var nodeY = nodeShape.getRenderBox().closurePoints[ 0 ].y;
this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) );
},
remove: function () {
this.shape.remove();
}
};
} )() );
//样式的配置(包括颜色、字号等)
var nodeStyles = {
"root": {
color: '#430',
fill: '#e9df98',
fontSize: 24,
padding: [ 15.5, 25.5, 15.5, 25.5 ],
margin: [ 0, 0, 20, 0 ],
radius: 0,
highlight: 'rgb(254, 219, 0)'
},
"main": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
fill: '#A4c5c0',
color: "#333",
padding: [ 6.5, 20, 6.5, 20 ],
fontSize: 16,
margin: [ 20, 20, 10, 10 ],
radius: 0,
highlight: 'rgb(254, 219, 0)'
},
"sub": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
color: "#333",
fontSize: 12,
margin: [ 10, 10, 10, 30 ],
padding: [ 5, 10, 5.5, 10 ],
highlight: 'rgb(254, 219, 0)',
fill: 'rgb(231, 243, 255)'
}
};
//更新背景
var updateBg = function ( node ) {
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var Layout = node.getLayout();
switch ( node.getType() ) {
case "root":
case "main":
var bg = node.getBgRc().clear();
bg.addShape( Layout.bgShadow = new kity.Rect() );
bg.addShape( Layout.bgRect = new kity.Rect() );
Layout.bgRect.fill( nodeStyle.fill ).setRadius( nodeStyle.radius );
Layout.bgShadow.fill( 'black' ).setOpacity( 0.2 ).setRadius( nodeStyle.radius ).translate( 3, 5 );
break;
case "sub":
var bgRc = node.getBgRc().clear();
bgRc.addShape( Layout.bgRect = new kity.Rect() );
Layout.bgRect.fill( nodeStyle.fill );
break;
default:
break;
}
};
//初始化样式
var initLayout = function ( node ) {
var Layout = node.getLayout();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var txtShape = node.getTextShape();
txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 );
if ( nodeType === "main" ) {
var subgroup = Layout.subgroup = new kity.Group();
minder.getRenderContainer().addShape( subgroup );
}
};
//根据内容调整节点尺寸
var updateShapeByCont = function ( node ) {
var contRc = node.getContRc();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var _contRCWidth = contRc.getWidth();
var _contRCHeight = contRc.getHeight();
var Layout = node.getLayout();
switch ( nodeType ) {
case "root":
case "main":
var width = _contRCWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ],
height = _contRCHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.bgRect.setWidth( width ).setHeight( height );
Layout.bgShadow.setWidth( width ).setHeight( height );
break;
case "sub":
width = _contRCWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ];
height = _contRCHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.bgRect.setWidth( width ).setHeight( height );
break;
default:
break;
}
contRc.setTransform( new kity.Matrix().translate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + node.getTextShape().getHeight() ) );
};
var updateLayoutMain = function () {
var _root = minder.getRoot();
var mainnodes = _root.getChildren();
var countMainWidth = function ( node ) {
var nLayout = node.getLayout();
var selfwidth = node.getRenderContainer().getWidth() + nodeStyles.main.margin[ 1 ] + nodeStyles.main.margin[ 3 ];
var childwidth = nLayout.subgroup.getWidth() + nodeStyles.main.margin[ 1 ] + nodeStyles.sub.margin[ 3 ];
var branchwidth = nLayout.branchwidth = ( selfwidth > childwidth ? selfwidth : childwidth );
return branchwidth;
};
var rootLayout = _root.getLayout();
var rootbranchwidth = 0;
for ( var j = 0; j < mainnodes.length; j++ ) {
rootbranchwidth += countMainWidth( mainnodes[ j ] );
}
var sX = rootLayout.x - rootbranchwidth / 2;
for ( var k = 0; k < mainnodes.length; k++ ) {
var mLayout = mainnodes[ k ].getLayout();
mLayout.x = sX;
sX += mLayout.branchwidth;
}
return mainnodes;
};
var updateLayoutAll = function ( node, parent, action ) {
var effectSet = [];
var nodeType = node.getType();
var Layout = node.getLayout();
var _root = minder.getRoot();
var rootLayout = _root.getLayout();
if ( nodeType === "root" ) {
Layout.x = getMinderSize().width / 2;
Layout.y = 100;
Layout.align = "center";
effectSet.push( node );
var children = node.getChildren();
for ( var i = 0; i < children.length; i++ ) {
var childLayout = children[ i ].getLayout();
childLayout.y = Layout.y + node.getRenderContainer().getHeight() + nodeStyles.root.margin[ 2 ] + nodeStyles.main.margin[ 0 ];
}
effectSet = effectSet.concat( children );
} else if ( nodeType === "main" ) {
Layout.align = "left";
if ( action === "append" || action === "contract" ) {
Layout.y = rootLayout.y + _root.getRenderContainer().getHeight() + nodeStyles.root.margin[ 2 ] + nodeStyles.main.margin[ 0 ];
}
effectSet = updateLayoutMain();
} else {
Layout.align = "left";
var parentLayout = parent.getLayout();
if ( action === "append" ) {
if ( parent.getType() === "main" ) {
Layout.x = nodeStyles.sub.margin[ 3 ];
} else {
Layout.x = parentLayout.x + nodeStyles.sub.margin[ 3 ];
}
}
if ( action === "append" || action === "contract" ) {
Layout.branchheight = node.getRenderContainer().getHeight() + nodeStyles.sub.margin[ 0 ] + nodeStyles.sub.margin[ 2 ];
}
var prt = parent;
if ( action === "change" ) {
prt = node;
}
//自底向上更新branchheight
while ( prt.getType() !== "main" ) {
var c = prt.getChildren();
var prtLayout = prt.getLayout();
var branchHeight = prt.getRenderContainer().getHeight() + nodeStyles.sub.margin[ 0 ] + nodeStyles.sub.margin[ 2 ];
for ( var i1 = 0; i1 < c.length; i1++ ) {
branchHeight += c[ i1 ].getLayout().branchheight;
}
prtLayout.branchheight = branchHeight;
prt = prt.getParent();
}
//自顶向下更新y
var _buffer = [ prt ];
while ( _buffer.length !== 0 ) {
var childrenC = _buffer[ 0 ].getChildren();
_buffer = _buffer.concat( childrenC );
var _buffer0Layout = _buffer[ 0 ].getLayout();
var _buffer0Style = nodeStyles[ _buffer[ 0 ].getType() ];
var sY;
if ( _buffer[ 0 ].getType() === "main" ) sY = 0;
else sY = _buffer0Layout.y + _buffer[ 0 ].getRenderContainer().getHeight() + _buffer0Style.margin[ 2 ];
for ( var s = 0; s < childrenC.length; s++ ) {
var childLayoutC = childrenC[ s ].getLayout();
var childStyleC = nodeStyles[ childrenC[ s ].getType() ];
childLayoutC.y = sY + childStyleC.margin[ 0 ];
sY += childLayoutC.branchheight;
}
effectSet.push( _buffer[ 0 ] );
_buffer.shift();
}
}
return effectSet;
};
var translateNode = function ( node ) {
var Layout = node.getLayout();
var nodeShape = node.getRenderContainer();
var align = Layout.align;
var _rectHeight = nodeShape.getHeight();
var _rectWidth = nodeShape.getWidth();
switch ( align ) {
case "right":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth, Layout.y ) );
break;
case "center":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth / 2, Layout.y ) );
break;
default:
nodeShape.setTransform( new kity.Matrix().translate( Layout.x, Layout.y ) );
break;
}
if ( node.getType() === "main" ) {
Layout.subgroup.setTransform( new kity.Matrix().translate( Layout.x, Layout.y + node.getRenderContainer().getHeight() ) );
}
node.setPoint( Layout.x, Layout.y );
};
var updateConnectAndshIcon = function ( node ) {
var nodeType = node.getType();
var Layout = node.getLayout();
var nodeStyle = nodeStyles[ node.getType() ];
var connect;
var _root = minder.getRoot();
var _rootLayout = _root.getLayout();
//更新连线
if ( nodeType === "main" ) {
if ( !Layout.connect ) {
connect = Layout.connect = new kity.Path();
minder.getRenderContainer().addShape( connect );
}
connect = Layout.connect;
var sX = _rootLayout.x;
var sY = _rootLayout.y + _root.getRenderContainer().getHeight();
var transX = Layout.x + node.getRenderContainer().getWidth() / 2;
var transY = sY + nodeStyles.root.margin[ 2 ];
connect.getDrawer().clear()
.moveTo( sX, sY )
.lineTo( sX, transY )
.lineTo( transX, transY )
.lineTo( transX, Layout.y );
connect.stroke( nodeStyles.main.stroke );
} else if ( nodeType === "sub" ) {
var parent = node.getParent();
var parentLayout = parent.getLayout();
if ( !Layout.connect ) {
connect = Layout.connect = new kity.Path();
Layout.subgroup.addShape( connect );
}
connect = Layout.connect;
var ssX, ssY;
if ( parent.getType() === "main" ) {
ssX = 10;
ssY = 0;
} else {
ssX = parentLayout.x + 10;
ssY = parentLayout.y + parent.getRenderContainer().getHeight() + 10;
}
var transsY = Layout.y + node.getRenderContainer().getHeight() / 2;
connect.getDrawer().clear()
.moveTo( ssX, ssY )
.lineTo( ssX, transsY )
.lineTo( Layout.x, transsY );
connect.stroke( nodeStyles.sub.stroke );
}
//更新收放icon
if ( nodeType !== "root" && node.getChildren().length !== 0 ) {
if ( !Layout.shicon ) {
Layout.shicon = new ShIcon( node );
}
Layout.shicon.update();
}
};
var _style = {
highlightNode: function ( node ) {
var highlight = node.isHighlight();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var Layout = node.getLayout();
switch ( nodeType ) {
case "root":
case "main":
case "sub":
if ( highlight ) {
Layout.bgRect.fill( nodeStyle.highlight );
} else {
Layout.bgRect.fill( nodeStyle.fill );
}
break;
default:
break;
}
},
updateLayout: function ( node ) {
this._fire( new MinderEvent( "beforeRenderNode", {
node: node
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node );
var set = updateLayoutAll( node, node.getParent(), "change" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
if ( node.getType() === "sub" ) {
var set1 = updateLayoutMain();
for ( var j = 0; j < set1.length; j++ ) {
translateNode( set1[ j ] );
updateConnectAndshIcon( set1[ j ] );
}
}
},
initStyle: function () {
var _root = minder.getRoot();
minder.handelNodeInsert( _root );
//设置root的align
_root.getLayout().align = "center";
updateBg( _root );
initLayout( _root );
this._fire( new MinderEvent( "beforeRenderNode", {
node: _root
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: _root
}, false ) );
updateShapeByCont( _root );
updateLayoutAll( _root );
translateNode( _root );
var _buffer = [ _root ];
var _cleanbuffer = [];
//打散结构
while ( _buffer.length !== 0 ) {
var children = _buffer[ 0 ].getChildren();
_buffer = _buffer.concat( children );
for ( var i = 0; i < children.length; i++ ) {
children[ i ].getLayout().parent = _buffer[ 0 ];
}
_buffer[ 0 ].clearChildren();
if ( _buffer[ 0 ] !== _root ) _cleanbuffer.push( _buffer[ 0 ] );
_buffer.shift();
}
//重组结构
for ( var j = 0; j < _cleanbuffer.length; j++ ) {
this.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
}
},
appendChildNode: function ( parent, node, sibling ) {
node.clearLayout();
var parentLayout = parent.getLayout();
var expand = parent.getData( "expand" );
//设置分支类型
if ( parent.getType() === "root" ) {
node.setType( "main" );
node.setData( "expand", true );
minder.handelNodeInsert( node );
} else {
node.setType( "sub" );
//将节点加入到main分支的subgroup中
parentLayout.subgroup.addShape( node.getRenderContainer() );
node.getLayout().subgroup = parentLayout.subgroup;
}
if ( sibling ) {
parent.insertChild( node, sibling.getIndex() + 1 );
} else {
parent.appendChild( node );
}
//计算位置等流程
updateBg( node );
initLayout( node );
this._fire( new MinderEvent( "beforeRenderNode", {
node: node
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node );
var set = updateLayoutAll( node, parent, "append" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
if ( node.getType() === "sub" ) {
var set1 = updateLayoutMain();
for ( var j = 0; j < set1.length; j++ ) {
translateNode( set1[ j ] );
updateConnectAndshIcon( set1[ j ] );
}
}
},
appendSiblingNode: function ( sibling, node ) {
var parent = sibling.getParent();
this.appendChildNode( parent, node, sibling );
},
removeNode: function ( nodes ) {
while ( nodes.length !== 0 ) {
var parent = nodes[ 0 ].getParent();
if ( !parent ) {
nodes.splice( 0, 1 );
return false;
}
var nodeLayout = nodes[ 0 ].getLayout();
parent.removeChild( nodes[ 0 ] );
var set = updateLayoutAll( nodes[ 0 ], parent, "remove" );
for ( var j = 0; j < set.length; j++ ) {
translateNode( set[ j ] );
updateConnectAndshIcon( set[ j ] );
}
var set1 = updateLayoutMain();
for ( var k = 0; k < set1.length; k++ ) {
translateNode( set1[ k ] );
updateConnectAndshIcon( set1[ k ] );
}
var _buffer = [ nodes[ 0 ] ];
while ( _buffer.length !== 0 ) {
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
try {
_buffer[ 0 ].getRenderContainer().remove();
var Layout = _buffer[ 0 ].getLayout();
Layout.connect.remove();
Layout.shicon.remove();
} catch ( error ) {
console.log( "isRemoved" );
}
//检测当前节点是否在选中的数组中,如果在的话,从选中数组中去除
var idx = nodes.indexOf( _buffer[ 0 ] );
if ( idx !== -1 ) {
nodes.splice( idx, 1 );
}
_buffer.shift();
}
}
},
expandNode: function ( ico ) {
var isExpand, node;
if ( ico instanceof MinderNode ) {
node = ico;
isExpand = node.getLayout().shicon.switchState();
} else {
isExpand = ico.icon.switchState();
node = ico.icon._node;
}
node.setData( "expand", isExpand );
var _buffer = node.getChildren();
var _cleanbuffer = [];
while ( _buffer.length !== 0 ) {
var Layout = _buffer[ 0 ].getLayout();
if ( isExpand ) {
var parent = _buffer[ 0 ].getParent();
Layout.parent = parent;
_cleanbuffer.push( _buffer[ 0 ] );
Layout.connect = null;
Layout.shicon = null;
} else {
try {
_buffer[ 0 ].getRenderContainer().remove();
Layout.connect.remove();
if ( Layout.shicon ) Layout.shicon.remove();
} catch ( error ) {}
}
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift();
}
if ( isExpand ) {
node.clearChildren();
for ( var j = 0; j < _cleanbuffer.length; j++ ) {
_cleanbuffer[ j ].clearChildren();
minder.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
}
}
var set = [];
if ( !isExpand ) set = updateLayoutAll( node, node.getParent(), "contract" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
}
};
this.addLayoutStyle( "bottom", _style );
return {};
} );
\ No newline at end of file
KityMinder.registerModule( "LayoutDefault", function () {
var _target = this.getRenderTarget();
function getMinderSize() {
return {
width: _target.clientWidth,
height: _target.clientHeight
};
}
var minder = this;
//收缩-展开子树的节点
var ShIcon = kity.createClass( "DefaultshIcon", ( function () {
return {
constructor: function ( node ) {
this._show = false;
this._node = node;
var iconShape = this.shape = new kity.Group();
iconShape.class = "shicon";
iconShape.icon = this;
var circle = this._circle = new kity.Circle().fill( "white" ).stroke( "gray" ).setRadius( 5 );
var plus = this._plus = new kity.Path();
plus.getDrawer()
.moveTo( -3, 0 )
.lineTo( 3, 0 )
.moveTo( 0, -3 )
.lineTo( 0, 3 );
plus.stroke( "gray" );
var dec = this._dec = new kity.Path();
dec.getDrawer()
.moveTo( -3, 0 )
.lineTo( 3, 0 );
dec.stroke( "gray" );
minder.getRenderContainer().addShape( iconShape );
iconShape.addShapes( [ circle, plus, dec ] );
this.update();
this.switchState();
},
switchState: function () {
if ( !this._show ) {
this._plus.setOpacity( 0 );
this._dec.setOpacity( 1 );
this._show = true;
} else {
this._plus.setOpacity( 1 );
this._dec.setOpacity( 0 );
this._show = false;
}
return this._show;
},
update: function () {
var node = this._node;
var Layout = node.getLayout();
var nodeShape = node.getRenderContainer();
var nodeX, nodeY = ( node.getType() === "main" ? Layout.y : ( Layout.y + nodeShape.getHeight() / 2 - 5 ) );
if ( Layout.appendside === "left" ) {
nodeX = nodeShape.getRenderBox().closurePoints[ 1 ].x - 5;
} else {
nodeX = nodeShape.getRenderBox().closurePoints[ 0 ].x + 6;
if ( node.getType() === "main" ) nodeX -= 3;
}
this.shape.setTransform( new kity.Matrix().translate( nodeX, nodeY ) );
},
remove: function () {
this.shape.remove();
}
};
} )() );
//求并集
var uSet = function ( a, b ) {
for ( var i = 0; i < a.length; i++ ) {
var idx = b.indexOf( a[ i ] );
if ( idx !== -1 ) {
b.splice( idx, 1 );
}
}
return a.concat( b );
};
//样式的配置(包括颜色、字号等)
var nodeStyles = {
"root": {
color: '#430',
fill: '#e9df98',
fontSize: 24,
padding: [ 15.5, 25.5, 15.5, 25.5 ],
margin: [ 0, 0, 0, 0 ],
radius: 30,
highlight: 'rgb(254, 219, 0)'
},
"main": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
fill: '#A4c5c0',
color: "#333",
padding: [ 6.5, 20, 6.5, 20 ],
fontSize: 16,
margin: [ 0, 10, 30, 50 ],
radius: 10,
highlight: 'rgb(254, 219, 0)'
},
"sub": {
stroke: new kity.Pen( "white", 2 ).setLineCap( "round" ).setLineJoin( "round" ),
color: "white",
fontSize: 12,
margin: [ 0, 10, 20, 6 ],
padding: [ 5, 10, 5.5, 10 ],
highlight: 'rgb(254, 219, 0)'
}
};
//更新背景
var updateBg = function ( node ) {
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var Layout = node.getLayout();
switch ( node.getType() ) {
case "root":
case "main":
var bg = node.getBgRc().clear();
bg.addShape( Layout.bgShadow = new kity.Rect() );
bg.addShape( Layout.bgRect = new kity.Rect() );
Layout.bgRect.fill( nodeStyle.fill ).setRadius( nodeStyle.radius );
Layout.bgShadow.fill( 'black' ).setOpacity( 0.2 ).setRadius( nodeStyle.radius ).translate( 3, 5 );
break;
case "sub":
var underline = Layout.underline = new kity.Path();
var highlightshape = Layout.highlightshape = new kity.Rect().setRadius( 4 );
node.getBgRc().clear().addShapes( [ Layout.bgRect = new kity.Rect().setRadius( 4 ), highlightshape, underline ] );
break;
default:
break;
}
};
//初始化样式
var initLayout = function ( node ) {
var Layout = node.getLayout();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var txtShape = node.getTextShape();
txtShape.fill( nodeStyle.color ).setSize( nodeStyle.fontSize ).setY( -3 );
if ( nodeType === "root" ) {
Layout.leftList = [];
Layout.rightList = [];
Layout.leftHeight = 0;
Layout.rightHeight = 0;
}
};
//根据内容调整节点尺寸
var updateShapeByCont = function ( node ) {
var contRc = node.getContRc();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var _contRCWidth = contRc.getWidth();
var _contRCHeight = contRc.getHeight();
var Layout = node.getLayout();
switch ( nodeType ) {
case "root":
case "main":
var width = _contRCWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ],
height = _contRCHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.bgRect.setWidth( width ).setHeight( height );
Layout.bgShadow.setWidth( width ).setHeight( height );
break;
case "sub":
var _contWidth = contRc.getWidth();
var _contHeight = contRc.getHeight();
width = _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ];
height = _contHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ];
Layout.underline.getDrawer()
.clear()
.moveTo( 0, _contHeight + nodeStyle.padding[ 2 ] + nodeStyle.padding[ 0 ] )
.lineTo( _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ], _contHeight + nodeStyle.padding[ 2 ] + nodeStyle.padding[ 0 ] );
Layout.underline.stroke( nodeStyle.stroke );
Layout.highlightshape
.setWidth( _contWidth + nodeStyle.padding[ 1 ] + nodeStyle.padding[ 3 ] )
.setHeight( _contHeight + nodeStyle.padding[ 0 ] + nodeStyle.padding[ 2 ] );
Layout.bgRect.setWidth( width ).setHeight( height );
break;
default:
break;
}
contRc.setTransform( new kity.Matrix().translate( nodeStyle.padding[ 3 ], nodeStyle.padding[ 0 ] + node.getTextShape().getHeight() ) );
};
//计算节点在垂直方向的位置
var updateLayoutVertical = function ( node, parent, action ) {
var root = minder.getRoot();
var effectSet = [ node ];
if ( action === "remove" ) {
effectSet = [];
}
var Layout = node.getLayout();
var nodeShape = node.getRenderContainer();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var appendside = Layout.appendside;
var countBranchHeight = function ( node, side ) {
var nodeStyle = nodeStyles[ node.getType() ];
var selfHeight = node.getRenderContainer().getHeight() + nodeStyle.margin[ 0 ] + nodeStyle.margin[ 2 ];
var childHeight = ( function () {
var sum = 0;
var children;
if ( !side ) {
children = node.getChildren();
} else {
children = node.getLayout()[ side + "List" ];
}
for ( var i = 0; i < children.length; i++ ) {
var childLayout = children[ i ].getLayout();
if ( children[ i ].getRenderContainer().getHeight() !== 0 )
sum += childLayout.branchheight;
}
return sum;
} )();
if ( side ) {
return childHeight;
} else {
return ( selfHeight > childHeight ? selfHeight : childHeight );
}
};
if ( nodeType === "root" ) {
Layout.y = getMinderSize().height / 2;
effectSet.push( node );
} else {
if ( action === "append" || action === "contract" ) {
Layout.branchheight = node.getRenderContainer().getHeight() + nodeStyle.margin[ 0 ] + nodeStyle.margin[ 2 ];
} else if ( action === "change" ) {
Layout.branchheight = countBranchHeight( node );
}
var parentLayout = parent.getLayout();
var parentShape = parent.getRenderContainer();
var prt = node.getParent() || parent;
//自底向上更新祖先元素的branchheight值
while ( prt ) {
var prtLayout = prt.getLayout();
if ( prt.getType() === "root" ) {
prtLayout[ appendside + "Height" ] = countBranchHeight( prt, appendside );
} else {
prtLayout.branchheight = countBranchHeight( prt );
}
prt = prt.getParent();
}
//自顶向下更新受影响一侧的y值
var sideList = root.getLayout()[ appendside + "List" ];
var _buffer = [ root ];
while ( _buffer.length > 0 ) {
var _buffer0Layout = _buffer[ 0 ].getLayout();
var children = _buffer0Layout[ appendside + "List" ] || _buffer[ 0 ].getChildren();
_buffer = _buffer.concat( children );
var sY = _buffer0Layout.y - ( _buffer0Layout[ appendside + "Height" ] || _buffer0Layout.branchheight ) / 2;
for ( var i = 0; i < children.length; i++ ) {
var childLayout = children[ i ].getLayout();
childLayout.y = sY + childLayout.branchheight / 2;
sY += childLayout.branchheight;
}
if ( _buffer[ 0 ] !== root ) effectSet.push( _buffer[ 0 ] );
_buffer.shift();
}
}
return effectSet;
};
//计算节点在水平方向的位置
var updateLayoutHorizon = function ( node ) {
var nodeType = node.getType();
var parent = node.getParent();
var effectSet = [ node ];
var Layout = node.getLayout();
var _buffer = [ node ];
while ( _buffer.length !== 0 ) {
var prt = _buffer[ 0 ].getParent();
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
if ( !prt ) {
Layout.x = getMinderSize().width / 2;
_buffer.shift();
continue;
}
var parentLayout = prt.getLayout();
var parentWidth = prt.getRenderContainer().getWidth();
var parentStyle = nodeStyles[ prt.getType() ];
var childLayout = _buffer[ 0 ].getLayout();
var childStyle = nodeStyles[ _buffer[ 0 ].getType() ];
if ( parentLayout.align === "center" ) {
parentWidth = parentWidth / 2;
}
if ( childLayout.appendside === "left" ) {
childLayout.x = parentLayout.x - parentWidth - parentStyle.margin[ 1 ] - childStyle.margin[ 3 ];
} else {
childLayout.x = parentLayout.x + parentWidth + parentStyle.margin[ 1 ] + childStyle.margin[ 3 ];
}
effectSet.push( _buffer[ 0 ] );
_buffer.shift();
}
return effectSet;
};
var translateNode = function ( node ) {
var Layout = node.getLayout();
var nodeShape = node.getRenderContainer();
var align = Layout.align;
var _rectHeight = nodeShape.getHeight();
var _rectWidth = nodeShape.getWidth();
switch ( align ) {
case "right":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth, Layout.y - _rectHeight / 2 ) );
break;
case "center":
nodeShape.setTransform( new kity.Matrix().translate( Layout.x - _rectWidth / 2, Layout.y - _rectHeight / 2 ) );
break;
default:
nodeShape.setTransform( new kity.Matrix().translate( Layout.x, Layout.y - _rectHeight / 2 ) );
break;
}
node.setPoint( Layout.x, Layout.y );
};
var updateConnectAndshIcon = function ( node ) {
var nodeType = node.getType();
var Layout = node.getLayout();
var nodeStyle = nodeStyles[ node.getType() ];
var connect;
//更新连线
if ( nodeType === "main" ) {
if ( !Layout.connect ) {
connect = Layout.connect = new kity.Group();
var bezier = Layout.connect.bezier = new kity.Bezier();
var circle = Layout.connect.circle = new kity.Circle();
connect.addShapes( [ bezier, circle ] );
minder.getRenderContainer().addShape( connect );
minder.getRoot().getRenderContainer().bringTop();
}
var parent = minder.getRoot();
var rootX = parent.getLayout().x;
var rootY = parent.getLayout().y;
connect = Layout.connect;
var nodeShape = node.getRenderContainer();
var nodeClosurePoints = nodeShape.getRenderBox().closurePoints;
var sPos;
var endPos;
if ( Layout.appendside === "left" ) {
sPos = new kity.BezierPoint( rootX - 30, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 );
endPos = new kity.BezierPoint( nodeClosurePoints[ 2 ].x + 3, nodeClosurePoints[ 2 ].y + nodeShape.getHeight() / 2 );
} else {
sPos = new kity.BezierPoint( rootX + 30, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 );
endPos = new kity.BezierPoint( nodeClosurePoints[ 3 ].x - 3, nodeClosurePoints[ 3 ].y + nodeShape.getHeight() / 2 );
}
var sPosV = sPos.getVertex();
var endPosV = endPos.getVertex();
sPos.setVertex( rootX, rootY );
connect.bezier.setPoints( [ sPos, endPos ] ).stroke( nodeStyle.stroke );
connect.circle.setCenter( endPosV.x + ( Layout.appendside === "left" ? -0.5 : -1.5 ), endPosV.y ).fill( "white" ).setRadius( 4 );
} else if ( nodeType === "sub" ) {
if ( !Layout.connect ) {
connect = Layout.connect = new kity.Path();
minder.getRenderContainer().addShape( connect );
}
connect = Layout.connect;
var parentShape = node.getParent().getRenderContainer();
var parentBox = parentShape.getRenderBox();
var parentLayout = node.getParent().getLayout();
var parentStyle = nodeStyles[ node.getParent().getType() ];
var Shape = node.getRenderContainer();
var sX, sY = parentLayout.y;
var nodeX, nodeY = Shape.getRenderBox().closurePoints[ 1 ].y;
if ( Layout.appendside === "left" ) {
sX = parentBox.closurePoints[ 1 ].x - parentStyle.margin[ 1 ];
nodeX = Shape.getRenderBox().closurePoints[ 0 ].x;
connect.getDrawer()
.clear()
.moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - nodeStyle.margin[ 3 ] ) : ( nodeY + nodeStyle.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY, 0, 1 );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY );
connect.stroke( nodeStyle.stroke );
} else {
sX = parentBox.closurePoints[ 0 ].x + parentStyle.margin[ 1 ];
nodeX = Shape.getRenderBox().closurePoints[ 1 ].x + 1;
connect.getDrawer()
.clear()
.moveTo( sX, sY )
.lineTo( sX, nodeY > sY ? ( nodeY - nodeStyle.margin[ 3 ] ) : ( nodeY + nodeStyle.margin[ 3 ] ) );
if ( nodeY > sY ) connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY );
else connect.getDrawer().carcTo( nodeStyle.margin[ 3 ], nodeX, nodeY, 0, 1 );
connect.stroke( nodeStyle.stroke );
}
}
//更新收放icon
if ( nodeType !== "root" && node.getChildren().length !== 0 ) {
if ( !Layout.shicon ) {
Layout.shicon = new ShIcon( node );
}
Layout.shicon.update();
}
};
var _style = {
highlightNode: function ( node ) {
var highlight = node.isHighlight();
var nodeType = node.getType();
var nodeStyle = nodeStyles[ nodeType ];
var Layout = node.getLayout();
switch ( nodeType ) {
case "root":
case "main":
if ( highlight ) {
Layout.bgRect.fill( nodeStyle.highlight );
} else {
Layout.bgRect.fill( nodeStyle.fill );
}
break;
case "sub":
if ( highlight ) {
Layout.highlightshape.fill( nodeStyle.highlight ).setOpacity( 1 );
node.getTextShape().fill( 'black' );
} else {
Layout.highlightshape.setOpacity( 0 );
node.getTextShape().fill( 'white' );
}
break;
default:
break;
}
},
updateLayout: function ( node ) {
this._fire( new MinderEvent( "beforeRenderNode", {
node: node
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node );
var set1 = updateLayoutHorizon( node );
var set2 = updateLayoutVertical( node, node.getParent(), "change" );
var set = uSet( set1, set2 );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
},
initStyle: function () {
var _root = minder.getRoot();
var historyPoint = _root.getPoint();
if ( historyPoint ) historyPoint = JSON.parse( JSON.stringify( historyPoint ) );
minder.handelNodeInsert( _root );
//设置root的align
_root.getLayout().align = "center";
updateBg( _root );
initLayout( _root );
this._fire( new MinderEvent( "beforeRenderNode", {
node: _root
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: _root
}, false ) );
updateShapeByCont( _root );
updateLayoutHorizon( _root );
updateLayoutVertical( _root );
translateNode( _root );
var _buffer = [ _root ];
var _cleanbuffer = [];
//打散结构
while ( _buffer.length !== 0 ) {
var children = _buffer[ 0 ].getChildren();
_buffer = _buffer.concat( children );
for ( var i = 0; i < children.length; i++ ) {
children[ i ].getLayout().parent = _buffer[ 0 ];
}
_buffer[ 0 ].clearChildren();
if ( _buffer[ 0 ] !== _root ) _cleanbuffer.push( _buffer[ 0 ] );
_buffer.shift();
}
if ( historyPoint ) {
_root.setPoint( historyPoint );
}
//重组结构
for ( var j = 0; j < _cleanbuffer.length; j++ ) {
this.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
}
_root.setPoint( _root.getLayout().x, _root.getLayout().y );
},
appendChildNode: function ( parent, node, sibling ) {
minder.handelNodeInsert( node );
node.clearLayout();
var Layout = node.getLayout();
var parentLayout = parent.getLayout();
if ( sibling ) {
var siblingLayout = sibling.getLayout();
Layout.appendside = siblingLayout.appendside;
Layout.align = siblingLayout.align;
parent.insertChild( node, sibling.getIndex() + 1 );
if ( parent.getType() === "root" ) {
var len = parent.getChildren().length;
if ( len < 7 ) {
if ( len % 2 ) {
Layout.appendside = "right";
Layout.align = "left";
} else {
Layout.appendside = "left";
Layout.align = "right";
}
}
var sideList = parentLayout[ Layout.appendside + "List" ];
var idx = sideList.indexOf( sibling );
sideList.splice( idx + 1, 0, node );
}
} else {
if ( parent.getType() !== "root" ) {
var prtLayout = parent.getLayout();
Layout.appendside = prtLayout.appendside;
Layout.align = prtLayout.align;
parent.appendChild( node );
} else {
var nodeP = node.getPoint();
if ( nodeP && nodeP.x && nodeP.y ) {
if ( nodeP.x > parent.getPoint().x ) {
Layout.appendside = "right";
Layout.align = "left";
} else {
Layout.appendside = "left";
Layout.align = "right";
}
} else {
if ( parentLayout.rightList.length > 1 && parentLayout.rightList.length > parentLayout.leftList.length ) {
Layout.appendside = "left";
Layout.align = "right";
} else {
Layout.appendside = "right";
Layout.align = "left";
}
}
var sideList1 = parentLayout[ Layout.appendside + "List" ];
sideList1.push( node );
var idx1;
if ( Layout.appendside === "right" ) {
idx1 = sideList1.length;
} else {
idx1 = parent.getChildren().length;
}
parent.insertChild( node, idx1 );
}
}
//设置分支类型
if ( parent.getType() === "root" ) {
node.setType( "main" );
} else {
node.setType( "sub" );
var isExpand = parent.getData( "expand" );
if ( isExpand === undefined ) {
isExpand = true;
parent.setData( "expand", isExpand );
}
// if ( !isExpand ) {
// return false;
// }
}
//计算位置等流程
updateBg( node );
initLayout( node );
this._fire( new MinderEvent( "beforeRenderNode", {
node: node
}, false ) );
this._fire( new MinderEvent( "RenderNode", {
node: node
}, false ) );
updateShapeByCont( node );
var set1 = updateLayoutVertical( node, parent, "append" );
var set2 = updateLayoutHorizon( node );
var set = uSet( set1, set2 );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
},
appendSiblingNode: function ( sibling, node ) {
var parent = sibling.getParent();
this.appendChildNode( parent, node, sibling );
},
removeNode: function ( nodes ) {
while ( nodes.length !== 0 ) {
var parent = nodes[ 0 ].getParent();
if ( !parent ) {
nodes.splice( 0, 1 );
return false;
}
var nodeLayout = nodes[ 0 ].getLayout();
if ( parent.getType() === "root" ) {
var sideList = parent.getLayout()[ nodeLayout.appendside + "List" ];
var index = sideList.indexOf( nodes[ 0 ] );
sideList.splice( index, 1 );
}
parent.removeChild( nodes[ 0 ] );
var set = updateLayoutVertical( nodes[ 0 ], parent, "remove" );
for ( var j = 0; j < set.length; j++ ) {
translateNode( set[ j ] );
updateConnectAndshIcon( set[ j ] );
}
var _buffer = [ nodes[ 0 ] ];
while ( _buffer.length !== 0 ) {
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
try {
_buffer[ 0 ].getRenderContainer().remove();
var Layout = _buffer[ 0 ].getLayout();
Layout.connect.remove();
Layout.shicon.remove();
} catch ( error ) {
console.log( "isRemoved" );
}
//检测当前节点是否在选中的数组中,如果在的话,从选中数组中去除
var idx = nodes.indexOf( _buffer[ 0 ] );
if ( idx !== -1 ) {
nodes.splice( idx, 1 );
}
_buffer.shift();
}
}
},
expandNode: function ( ico ) {
var isExpand, node;
if ( ico instanceof MinderNode ) {
node = ico;
isExpand = node.getLayout().shicon.switchState();
} else {
isExpand = ico.icon.switchState();
node = ico.icon._node;
}
node.setData( "expand", isExpand );
var _buffer = node.getChildren();
var _cleanbuffer = [];
while ( _buffer.length !== 0 ) {
var Layout = _buffer[ 0 ].getLayout();
if ( isExpand ) {
var parent = _buffer[ 0 ].getParent();
Layout.parent = parent;
_cleanbuffer.push( _buffer[ 0 ] );
Layout.connect = null;
Layout.shicon = null;
} else {
try {
_buffer[ 0 ].getRenderContainer().remove();
Layout.connect.remove();
if ( Layout.shicon ) Layout.shicon.remove();
} catch ( error ) {}
}
_buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
_buffer.shift();
}
if ( isExpand ) {
node.clearChildren();
for ( var j = 0; j < _cleanbuffer.length; j++ ) {
_cleanbuffer[ j ].clearChildren();
minder.appendChildNode( _cleanbuffer[ j ].getLayout().parent, _cleanbuffer[ j ] );
}
}
var set = [];
if ( !isExpand ) set = updateLayoutVertical( node, node.getParent(), "contract" );
for ( var i = 0; i < set.length; i++ ) {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
}
};
this.addLayoutStyle( "default", _style );
return {};
} );
\ No newline at end of file
KityMinder.registerModule( "LayoutModule", function () {
kity.extendClass( Minder, {
addLayoutStyle: function ( name, style ) {
if ( !this._layoutStyles ) this._layoutStyles = {};
this._layoutStyles[ name ] = style;
},
getLayoutStyle: function ( name ) {
return this._layoutStyles[ name ];
},
getLayoutStyleItems: function () {
var items = [];
for ( var key in this._layoutStyles ) {
items.push( key );
}
return items;
},
getCurrentStyle: function () {
var _root = this.getRoot();
return _root.getData( "currentstyle" );
},
setCurrentStyle: function ( name ) {
var _root = this.getRoot();
_root.setData( "currentstyle", name );
return name;
},
highlightNode: function ( node ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).highlightNode.call( this, node );
},
initStyle: function () {
var curStyle = this.getCurrentStyle();
var lastTransform = this._rc.getTransform();
this._rc.remove();
this._rc = new kity.Group().setTransform( lastTransform );
this._paper.addShape( this._rc );
var _root = this.getRoot();
_root.preTraverse( function ( n ) {
n.clearLayout();
} );
this.getLayoutStyle( curStyle ).initStyle.call( this );
},
appendChildNode: function ( parent, node, index ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).appendChildNode.call( this, parent, node, index );
},
appendSiblingNode: function ( sibling, node ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).appendSiblingNode.call( this, sibling, node );
},
removeNode: function ( nodes ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).removeNode.call( this, nodes );
},
updateLayout: function ( node ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).updateLayout.call( this, node );
},
expandNode: function ( ico ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).expandNode.call( this, ico );
}
} );
kity.extendClass( MinderNode, {
setLayout: function ( k, v ) {
if ( this._layout === undefined ) {
this._layout = {};
}
var _pros = this.getLayout();
Utils.extend( _pros, {
k: v
} );
this._layout = _pros;
},
getLayout: function ( k ) {
if ( k === undefined ) {
return this._layout;
}
return this._layout[ k ];
},
clearLayout: function () {
this._layout = {};
}
} );
var switchLayout = function ( km, style ) {
var _root = km.getRoot();
_root.preTraverse( function ( n ) {
n.setPoint();
n.getBgRc().clear();
} );
km.setCurrentStyle( style );
km.initStyle();
return style;
};
var SwitchLayoutCommand = kity.createClass( "SwitchLayoutCommand", ( function () {
return {
base: Command,
execute: switchLayout,
queryValue: function ( km ) {
return km.getCurrentStyle();
}
};
} )() );
var AppendChildNodeCommand = kity.createClass( "AppendChildNodeCommand", ( function () {
return {
base: Command,
execute: function ( km, node ) {
var parent = km.getSelectedNode();
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) {
km.expandNode( parent );
}
km.appendChildNode( parent, node );
km.select( node, true );
return node;
},
queryState: function ( km ) {
var selectedNode = km.getSelectedNode();
if ( !selectedNode ) {
return -1;
} else {
return 0;
}
}
};
} )() );
var AppendSiblingNodeCommand = kity.createClass( "AppendSiblingNodeCommand", ( function () {
return {
base: Command,
execute: function ( km, node ) {
var selectedNode = km.getSelectedNode();
if ( selectedNode.isRoot() ) {
node.setType( "main" );
km.appendChildNode( selectedNode, node );
} else {
km.appendSiblingNode( selectedNode, node );
}
km.select( node, true );
return node;
},
queryState: function ( km ) {
var selectedNodes = km.getSelectedNodes();
//没选中节点和单选root的时候返回不可执行
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1;
} else {
return 0;
}
}
};
} )() );
var RemoveNodeCommand = kity.createClass( "RemoveNodeCommand", ( function () {
return {
base: Command,
execute: function ( km ) {
var selectedNodes = km.getSelectedNodes();
var _root = km.getRoot();
var _buffer = [];
for ( var i = 0; i < selectedNodes.length; i++ ) {
_buffer.push( selectedNodes[ i ] );
}
do {
var parent = _buffer[ 0 ].getParent();
if ( parent && _buffer.indexOf( parent ) === -1 ) _buffer.push( parent );
_buffer.shift();
} while ( _buffer.length > 1 );
km.removeNode( selectedNodes );
km.select( _buffer[ 0 ] );
},
queryState: function ( km ) {
var selectedNodes = km.getSelectedNodes();
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1;
} else {
return 0;
}
}
};
} )() );
return {
"commands": {
"appendchildnode": AppendChildNodeCommand,
"appendsiblingnode": AppendSiblingNodeCommand,
"removenode": RemoveNodeCommand,
"switchlayout": SwitchLayoutCommand
},
"events": {
"ready": function () {
this.setDefaultOptions( 'layoutstyle', this.getLayoutStyleItems() );
switchLayout( this, this.getOptions( 'defaultlayoutstyle' ) );
},
"click": function ( e ) {
var ico = e.kityEvent.targetShape && e.kityEvent.targetShape.container;
if ( ico && ico.class === "shicon" ) {
this.expandNode( ico );
}
},
"resize": function ( e ) {
clearTimeout( this._lastStyleResetTimeout );
this._lastStyleResetTimeout = setTimeout( function () {
this.updateLayout( this.getRoot() );
}.bind( this ), 100 );
},
"import": function ( e ) {
this.initStyle( this.getRoot() );
}
},
'contextmenu': [ {
label: this.getLang( 'node.appendsiblingnode' ),
exec: function () {
this.execCommand( 'appendsiblingnode', new MinderNode( this.getLang( 'topic' ) ) )
},
cmdName: 'appendsiblingnode'
}, {
label: this.getLang( 'node.appendchildnode' ),
exec: function () {
this.execCommand( 'appendchildnode', new MinderNode( this.getLang( 'topic' ) ) )
},
cmdName: 'appendchildnode'
}, {
label: this.getLang( 'node.removenode' ),
cmdName: 'removenode'
}, {
divider: 1
}
],
"defaultOptions": {
"defaultlayoutstyle": "default",
"node": {
'appendsiblingnode': 'appendsiblingnode',
'appendchildnode': 'appendchildnode',
'removenode': 'removenode'
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "pasteModule", function () {
var km = this;
//getSelectedTopNodes
return {
};
} );
\ No newline at end of file
KityMinder.registerModule( "Select", function () {
var minder = this;
var g = KityMinder.Geometry;
// 在实例上渲染框选矩形、计算框选范围的对象
var marqueeActivator = ( function () {
// 记录选区的开始位置(mousedown的位置)
var startPosition = null;
// 选区的图形
var marqueeShape = new kity.Path().fill( 'rgba(255,255,255,.3)' ).stroke( 'white' );
// 标记是否已经启动框选状态
// 并不是 mousedown 发生之后就启动框选状态,而是检测到移动了一定的距离(MARQUEE_MODE_THRESHOLD)之后
var marqueeMode = false;
var MARQUEE_MODE_THRESHOLD = 10;
return {
selectStart: function ( e ) {
// 只接受左键
if ( e.originEvent.button ) return;
// 清理不正确状态
if ( startPosition ) {
return this.selectEnd();
}
startPosition = g.snapToSharp( e.getPosition() );
},
selectMove: function ( e ) {
if ( minder.isTextEditStatus() ) {
return;
}
if ( !startPosition ) return;
var p1 = startPosition,
p2 = e.getPosition();
// 检测是否要进入选区模式
if ( !marqueeMode ) {
// 距离没达到阈值,退出
if ( g.getDistance( p1, p2 ) < MARQUEE_MODE_THRESHOLD ) {
return;
}
// 已经达到阈值,记录下来并且重置选区形状
marqueeMode = true;
minder.getPaper().addShape( marqueeShape );
marqueeShape.setOpacity( 0.8 ).getDrawer().clear();
}
var marquee = g.getBox( p1, p2 ),
selectedNodes = [];
// 使其犀利
g.snapToSharp( marquee );
// 选区形状更新
marqueeShape.getDrawer().pipe( function () {
this.clear();
this.moveTo( marquee.left, marquee.top );
this.lineTo( marquee.right, marquee.top );
this.lineTo( marquee.right, marquee.bottom );
this.lineTo( marquee.left, marquee.bottom );
this.close();
} );
// 计算选中范围
minder.getRoot().traverse( function ( node ) {
var renderBox = node.getRenderContainer().getRenderBox( "top" );
if ( g.isBoxIntersect( renderBox, marquee ) ) {
selectedNodes.push( node );
}
} );
// 应用选中范围
minder.select( selectedNodes, true );
},
selectEnd: function ( e ) {
if ( startPosition ) {
startPosition = null;
}
if ( marqueeMode ) {
marqueeShape.fadeOut( 200, 'ease', 0, function () {
if ( marqueeShape.remove ) marqueeShape.remove();
} );
marqueeMode = false;
}
}
};
} )();
var lastDownNode = null;
return {
"events": {
mousedown: function ( e ) {
var downNode = e.getTargetNode();
// 没有点中节点:
// 清除选中状态,并且标记选区开始位置
if ( !downNode ) {
this.removeAllSelectedNodes();
marqueeActivator.selectStart( e );
}
// 点中了节点,并且按了 shift 键:
// 被点中的节点切换选中状态
else if ( e.originEvent.shiftKey ) {
this.toggleSelect( downNode );
}
// 点中的节点没有被选择:
// 单选点中的节点
else if ( !downNode.isSelected() ) {
this.select( downNode, true );
}
// 点中的节点被选中了,并且不是单选:
// 完成整个点击之后需要使其变为单选。
// 不能马上变为单选,因为可能是需要拖动选中的多个节点
else if ( !this.isSingleSelect() ) {
lastDownNode = downNode;
}
},
mousemove: marqueeActivator.selectMove,
mouseup: function ( e ) {
var upNode = e.getTargetNode();
// 如果 mouseup 发生在 lastDownNode 外,是无需理会的
if ( upNode && upNode == lastDownNode ) {
this.select( lastDownNode, true );
lastDownNode = null;
}
// 清理一下选择状态
marqueeActivator.selectEnd( e );
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( 'Zoom', function () {
var MAX_ZOOM = 2,
MIN_ZOOM = 0.5,
ZOOM_STEP = Math.sqrt( 2 );
function zoom( minder, rate ) {
var paper = minder.getPaper();
var viewbox = paper.getViewBox();
var zoomValue = minder._zoomValue;
var w = viewbox.width,
h = viewbox.height,
x = viewbox.x,
y = viewbox.y;
var ww = w * rate,
hh = h * rate,
xx = x + ( w - ww ) / 2,
yy = y + ( h - hh ) / 2;
var animator = new kity.Animator( {
beginValue: viewbox,
finishValue: {
width: ww,
height: hh,
x: xx,
y: yy
},
setter: function ( target, value ) {
target.setViewBox( value.x, value.y, value.width, value.height );
}
} );
animator.start( paper, 100, 'ease' );
minder._zoomValue = zoomValue *= rate;
}
var ZoomInCommand = kity.createClass( 'ZoomInCommand', {
base: Command,
execute: function ( minder ) {
if( !this.queryState( minder ) ) {
zoom( minder, 1 / ZOOM_STEP );
}
},
queryState: function ( minder ) {
return (minder._zoomValue > MIN_ZOOM) ? 0 : -1;
}
} );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', {
base: Command,
execute: function ( minder ) {
if( !this.queryState( minder ) ) {
zoom( minder, ZOOM_STEP );
}
},
queryState: function ( minder ) {
return (minder._zoomValue < MAX_ZOOM) ? 0 : -1;
}
} );
return {
commands: {
'zoom-in': ZoomInCommand,
'zoom-out': ZoomOutCommand
},
addShortcutKeys: {
"zoom-in": "=", //=
"zoom-out": "-" //-
},
events: {
'ready': function () {
this._zoomValue = 1;
},
// disable mouse wheel
'mousewheel_': function ( e ) {
var delta = e.originEvent.wheelDelta;
var me = this;
// 稀释
if ( Math.abs( delta ) > 100 ) {
clearTimeout( this._wheelZoomTimeout );
} else {
return;
}
this._wheelZoomTimeout = setTimeout( function () {
var value;
var lastValue = me.getPaper()._zoom || 1;
if ( delta < 0 ) {
me.execCommand('zoom-in');
} else if ( delta > 0 ) {
me.execCommand('zoom-out');
}
}, 100 );
e.originEvent.preventDefault();
}
}
};
} );
\ No newline at end of file
KityMinder.registerProtocal( 'json', function () {
function filter( key, value ) {
if ( key == 'layout' || key == 'shicon' ) {
return undefined;
}
return value;
}
return {
fileDescription: 'KityMinder',
fileExtension: '.km',
encode: function ( json ) {
return JSON.stringify( json, filter );
},
decode: function ( local ) {
return JSON.parse( local );
},
recognize: function ( local ) {
return Utils.isString( local ) && local.charAt( 0 ) == '{' && local.charAt( local.length - 1 ) == '}';
},
recognizePriority: 0
};
} );
\ No newline at end of file
KityMinder.registerProtocal( "plain", function () {
var LINE_ENDING = '\n',
TAB_CHAR = '\t';
function repeat( s, n ) {
var result = "";
while ( n-- ) result += s;
return result;
}
function encode( json, level ) {
var local = "";
level = level || 0;
local += repeat( TAB_CHAR, level );
local += json.data.text + LINE_ENDING;
if ( json.children ) {
json.children.forEach( function ( child ) {
local += encode( child, level + 1 );
} );
}
return local;
}
function isEmpty( line ) {
return !/\S/.test( line );
}
function getLevel( line ) {
var level = 0;
while ( line.charAt( level ) === TAB_CHAR ) level++;
return level;
}
function getNode( line ) {
return {
data: {
text: line.replace( new RegExp( '^' + TAB_CHAR + '*' ), '' )
}
};
}
function decode( local ) {
var json,
parentMap = {},
lines = local.split( LINE_ENDING ),
line, level, node;
function addChild( parent, child ) {
var children = parent.children || ( parent.children = [] );
children.push( child );
}
for ( var i = 0; i < lines.length; i++ ) {
line = lines[ i ];
if ( isEmpty( line ) ) continue;
level = getLevel( line );
node = getNode( line );
if ( level === 0 ) {
if ( json ) {
throw new Error( 'Invalid local format' );
}
json = node;
} else {
if ( !parentMap[ level - 1 ] ) {
throw new Error( 'Invalid local format' );
}
addChild( parentMap[ level - 1 ], node );
}
parentMap[ level ] = node;
}
return json;
}
var lastTry, lastResult;
function recognize( local ) {
if ( !Utils.isString( local ) ) return false;
lastTry = local;
try {
lastResult = decode( local );
} catch ( e ) {
lastResult = null;
}
return !!lastResult;
}
return {
fileDescription: '大纲文本',
fileExtension: '.txt',
encode: function ( json ) {
return encode( json, 0 );
},
decode: function ( local ) {
if ( lastTry == local && lastResult ) {
return lastResult;
}
return decode( local );
},
recognize: recognize,
recognizePriority: -1
};
} );
\ No newline at end of file
KityMinder.registerProtocal( "png", function () {
var LINE_ENDING = '\n',
TAB_CHAR = '\t';
function repeat( s, n ) {
var result = "";
while ( n-- ) result += s;
return result;
}
function encode( json, level ) {
var local = "";
level = level || 0;
local += repeat( TAB_CHAR, level );
local += json.data.text + LINE_ENDING;
if ( json.children ) {
json.children.forEach( function ( child ) {
local += encode( child, level + 1 );
} );
}
return local;
}
function isEmpty( line ) {
return !/\S/.test( line );
}
function getLevel( line ) {
var level = 0;
while ( line.charAt( level ) === TAB_CHAR ) level++;
return level;
}
function getNode( line ) {
return {
data: {
text: line.replace( new RegExp( '^' + TAB_CHAR + '*' ), '' )
}
};
}
function decode( local ) {
var json,
parentMap = {},
lines = local.split( LINE_ENDING ),
line, level, node;
function addChild( parent, child ) {
var children = parent.children || ( parent.children = [] );
children.push( child );
}
for ( var i = 0; i < lines.length; i++ ) {
line = lines[ i ];
if ( isEmpty( line ) ) continue;
level = getLevel( line );
node = getNode( line );
if ( level === 0 ) {
if ( json ) {
throw new Error( 'Invalid local format' );
}
json = node;
} else {
if ( !parentMap[ level - 1 ] ) {
throw new Error( 'Invalid local format' );
}
addChild( parentMap[ level - 1 ], node );
}
parentMap[ level ] = node;
}
return json;
}
var lastTry, lastResult;
function recognize( local ) {
if ( !Utils.isString( local ) ) return false;
lastTry = local;
try {
lastResult = decode( local );
} catch ( e ) {
lastResult = null;
}
return !!lastResult;
}
return {
fileDescription: 'png',
fileExtension: '.png',
encode: function ( json ) {
return encode( json, 0 );
},
decode: function ( local ) {
if ( lastTry == local && lastResult ) {
return lastResult;
}
return decode( local );
},
recognize: recognize,
recognizePriority: -1
};
} );
\ No newline at end of file
KityMinder.registerProtocal( "svg", function () {
var LINE_ENDING = '\n',
TAB_CHAR = '\t';
function repeat( s, n ) {
var result = "";
while ( n-- ) result += s;
return result;
}
function encode( json, level ) {
var local = "";
level = level || 0;
local += repeat( TAB_CHAR, level );
local += json.data.text + LINE_ENDING;
if ( json.children ) {
json.children.forEach( function ( child ) {
local += encode( child, level + 1 );
} );
}
return local;
}
function isEmpty( line ) {
return !/\S/.test( line );
}
function getLevel( line ) {
var level = 0;
while ( line.charAt( level ) === TAB_CHAR ) level++;
return level;
}
function getNode( line ) {
return {
data: {
text: line.replace( new RegExp( '^' + TAB_CHAR + '*' ), '' )
}
};
}
function decode( local ) {
var json,
parentMap = {},
lines = local.split( LINE_ENDING ),
line, level, node;
function addChild( parent, child ) {
var children = parent.children || ( parent.children = [] );
children.push( child );
}
for ( var i = 0; i < lines.length; i++ ) {
line = lines[ i ];
if ( isEmpty( line ) ) continue;
level = getLevel( line );
node = getNode( line );
if ( level === 0 ) {
if ( json ) {
throw new Error( 'Invalid local format' );
}
json = node;
} else {
if ( !parentMap[ level - 1 ] ) {
throw new Error( 'Invalid local format' );
}
addChild( parentMap[ level - 1 ], node );
}
parentMap[ level ] = node;
}
return json;
}
var lastTry, lastResult;
function recognize( local ) {
if ( !Utils.isString( local ) ) return false;
lastTry = local;
try {
lastResult = decode( local );
} catch ( e ) {
lastResult = null;
}
return !!lastResult;
}
return {
fileDescription: 'svg',
fileExtension: '.svg',
encode: function ( json ) {
return encode( json, 0 );
},
decode: function ( local ) {
if ( lastTry == local && lastResult ) {
return lastResult;
}
return decode( local );
},
recognize: recognize,
recognizePriority: -1
};
} );
\ No newline at end of file
/*
http://www.xmind.net/developer/
Parsing XMind file
XMind files are generated in XMind Workbook (.xmind) format, an open format that is based on the principles of OpenDocument. It consists of a ZIP compressed archive containing separate XML documents for content and styles, a .jpg image file for thumbnails, and directories for related attachments.
*/
KityMinder.registerProtocal( 'xmind', {
fileExtension: '.xmind',
} );
\ No newline at end of file
# XMind 文件格式
## 官方说明
官方上对 XMind 文件的介绍是这样的:
> XMind files are generated in XMind Workbook (.xmind) format, an open format that is based on the principles of OpenDocument. It consists of a ZIP compressed archive containing separate XML documents for content and styles, a .jpg image file for thumbnails, and directories for related attachments.
整体来说这是一个 zip 包,里面有两个 XML 文档,一个存放内容,一个存放样式,还有一个 jpg 格式的缩略图。如果有附件,还会有存放附件的目录。
## 解析和生成目标
只解析 KityMinder 支持部分的文件内容;只生成 KityMinder 和 XMind 都支持的文件内容
\ No newline at end of file
//button 类
KM.ui.define('button', {
tpl: '<<%if(!texttype){%>div class="kmui-btn kmui-btn-<%=icon%> <%if(name){%>kmui-btn-name-<%=name%><%}%>" unselectable="on" onmousedown="return false" <%}else{%>a class="kmui-text-btn"<%}%><% if(title) {%> data-original-title="<%=title%>" <%};%>> ' +
'<% if(icon) {%><div unselectable="on" class="kmui-icon-<%=icon%> kmui-icon"></div><% }; %><%if(text) {%><span unselectable="on" onmousedown="return false" class="kmui-button-label"><%=text%></span><%}%>' +
'<%if(caret && text){%><span class="kmui-button-spacing"></span><%}%>' +
'<% if(caret) {%><span unselectable="on" onmousedown="return false" class="kmui-caret"></span><% };%></<%if(!texttype){%>div<%}else{%>a<%}%>>',
defaultOpt: {
text: '',
title: '',
icon: '',
width: '',
caret: false,
texttype: false,
click: function () {
}
},
init: function (options) {
var me = this;
me.root($($.parseTmpl(me.tpl, options)))
.click(function (evt) {
me.wrapclick(options.click, evt)
});
me.root().hover(function () {
if(!me.root().hasClass("kmui-disabled")){
me.root().toggleClass('kmui-hover')
}
})
return me;
},
wrapclick: function (fn, evt) {
if (!this.disabled()) {
this.root().trigger('wrapclick');
$.proxy(fn, this, evt)()
}
return this;
},
label: function (text) {
if (text === undefined) {
return this.root().find('.kmui-button-label').text();
} else {
this.root().find('.kmui-button-label').text(text);
return this;
}
},
disabled: function (state) {
if (state === undefined) {
return this.root().hasClass('kmui-disabled')
}
this.root().toggleClass('kmui-disabled', state);
if(this.root().hasClass('kmui-disabled')){
this.root().removeClass('kmui-hover')
}
return this;
},
active: function (state) {
if (state === undefined) {
return this.root().hasClass('kmui-active')
}
this.root().toggleClass('kmui-active', state)
return this;
},
mergeWith: function ($obj) {
var me = this;
me.data('$mergeObj', $obj);
$obj.kmui().data('$mergeObj', me.root());
if (!$.contains(document.body, $obj[0])) {
$obj.appendTo(me.root());
}
me.on('click',function () {
me.wrapclick(function () {
$obj.kmui().show();
})
}).register('click', me.root(), function (evt) {
$obj.hide()
});
}
});
\ No newline at end of file
/**
* Combox 抽象基类
* User: hn
* Date: 13-5-29
* Time: 下午8:01
* To change this template use File | Settings | File Templates.
*/
(function(){
var widgetName = 'buttoncombobox';
KM.ui.define( widgetName, ( function(){
return {
defaultOpt: {
//按钮初始文字
label: '',
title: ''
},
init: function( options ) {
var me = this;
var btnWidget = $.kmuibutton({
caret: true,
name: options.comboboxName,
title: options.title,
text: options.label,
click: function(){
me.show( this.root() );
}
});
me.supper.init.call( me, options );
//监听change, 改变button显示内容
me.on('changebefore', function( e, label ){
btnWidget.kmuibutton('label', label );
});
me.data( 'button', btnWidget );
me.attachTo(btnWidget)
},
button: function(){
return this.data( 'button' );
}
}
} )(), 'combobox' );
})();
//colorpicker 类
KM.ui.define('colorpicker', {
tpl: function (opt) {
var COLORS = (
'ffffff,000000,eeece1,1f497d,4f81bd,c0504d,9bbb59,8064a2,4bacc6,f79646,' +
'f2f2f2,7f7f7f,ddd9c3,c6d9f0,dbe5f1,f2dcdb,ebf1dd,e5e0ec,dbeef3,fdeada,' +
'd8d8d8,595959,c4bd97,8db3e2,b8cce4,e5b9b7,d7e3bc,ccc1d9,b7dde8,fbd5b5,' +
'bfbfbf,3f3f3f,938953,548dd4,95b3d7,d99694,c3d69b,b2a2c7,92cddc,fac08f,' +
'a5a5a5,262626,494429,17365d,366092,953734,76923c,5f497a,31859b,e36c09,' +
'7f7f7f,0c0c0c,1d1b10,0f243e,244061,632423,4f6128,3f3151,205867,974806,' +
'c00000,ff0000,ffc000,ffff00,92d050,00b050,00b0f0,0070c0,002060,7030a0,').split(',');
var html = '<div unselectable="on" onmousedown="return false" class="kmui-colorpicker<%if (name){%> kmui-colorpicker-<%=name%><%}%>" >' +
'<table unselectable="on" onmousedown="return false">' +
'<tr><td colspan="10">'+opt.lang_themeColor+'</td> </tr>' +
'<tr class="kmui-colorpicker-firstrow" >';
for (var i = 0; i < COLORS.length; i++) {
if (i && i % 10 === 0) {
html += '</tr>' + (i == 60 ? '<tr><td colspan="10">'+opt.lang_standardColor+'</td></tr>' : '') + '<tr' + (i == 60 ? ' class="kmui-colorpicker-firstrow"' : '') + '>';
}
html += i < 70 ? '<td><a unselectable="on" onmousedown="return false" title="' + COLORS[i] + '" class="kmui-colorpicker-colorcell"' +
' data-color="#' + COLORS[i] + '"' +
' style="background-color:#' + COLORS[i] + ';border:solid #ccc;' +
(i < 10 || i >= 60 ? 'border-width:1px;' :
i >= 10 && i < 20 ? 'border-width:1px 1px 0 1px;' :
'border-width:0 1px 0 1px;') +
'"' +
'></a></td>' : '';
}
html += '</tr></table></div>';
return html;
},
init: function (options) {
var me = this;
me.root($($.parseTmpl(me.supper.mergeTpl(me.tpl(options)),options)));
me.root().on("click",function (e) {
me.trigger('pickcolor', $(e.target).data('color'));
});
}
}, 'popup');
\ No newline at end of file
/**
* Created with JetBrains PhpStorm.
* User: hn
* Date: 13-7-10
* Time: 下午3:07
* To change this template use File | Settings | File Templates.
*/
KM.ui.define('colorsplitbutton',{
tpl : '<div class="kmui-splitbutton <%if (name){%>kmui-splitbutton-<%= name %><%}%>" unselectable="on" <%if(title){%>data-original-title="<%=title%>"<%}%>><div class="kmui-btn" unselectable="on" ><%if(icon){%><div unselectable="on" class="kmui-icon-<%=icon%> kmui-icon"></div><%}%><div class="kmui-splitbutton-color-label" <%if (color) {%>style="background: <%=color%>"<%}%>></div><%if(text){%><%=text%><%}%></div>'+
'<div unselectable="on" class="kmui-btn kmui-dropdown-toggle" >'+
'<div unselectable="on" class="kmui-caret"><\/div>'+
'</div>'+
'</div>',
defaultOpt: {
color: ''
},
init: function( options ){
var me = this;
me.supper.init.call( me, options );
},
colorLabel: function(){
return this.root().find('.kmui-splitbutton-color-label');
}
}, 'splitbutton');
\ No newline at end of file
/**
* Created with JetBrains PhpStorm.
* User: hn
* Date: 13-5-29
* Time: 下午8:01
* To change this template use File | Settings | File Templates.
*/
(function(){
var widgetName = 'combobox',
itemClassName = 'kmui-combobox-item',
HOVER_CLASS = 'kmui-combobox-item-hover',
ICON_CLASS = 'kmui-combobox-checked-icon',
labelClassName = 'kmui-combobox-item-label';
KM.ui.define( widgetName, ( function(){
return {
tpl: "<ul class=\"dropdown-menu kmui-combobox-menu<%if (comboboxName!=='') {%> kmui-combobox-<%=comboboxName%><%}%>\" unselectable=\"on\" onmousedown=\"return false\" role=\"menu\" aria-labelledby=\"dropdownMenu\">" +
"<%if(autoRecord) {%>" +
"<%for( var i=0, len = recordStack.length; i<len; i++ ) {%>" +
"<%var index = recordStack[i];%>" +
"<li class=\"<%=itemClassName%><%if( selected == index ) {%> kmui-combobox-checked<%}%><%if( disabled[ index ] === true ) {%> kmui-combobox-item-disabled<%}%>\" data-item-index=\"<%=index%>\" unselectable=\"on\" onmousedown=\"return false\">" +
"<span class=\"kmui-combobox-icon\" unselectable=\"on\" onmousedown=\"return false\"></span>" +
"<label class=\"<%=labelClassName%>\" style=\"<%=itemStyles[ index ]%>\" unselectable=\"on\" onmousedown=\"return false\"><%=items[index]%></label>" +
"</li>" +
"<%}%>" +
"<%if( i ) {%>" +
"<li class=\"kmui-combobox-item-separator\"></li>" +
"<%}%>" +
"<%}%>" +
"<%for( var i=0, label; label = items[i]; i++ ) {%>" +
"<li class=\"<%=itemClassName%><%if( selected == i ) {%> kmui-combobox-checked<%}%> kmui-combobox-item-<%=i%><%if( disabled[ i ] === true ) {%> kmui-combobox-item-disabled<%}%>\" data-item-index=\"<%=i%>\" unselectable=\"on\" onmousedown=\"return false\">" +
"<span class=\"kmui-combobox-icon\" unselectable=\"on\" onmousedown=\"return false\"></span>" +
"<label class=\"<%=labelClassName%>\" style=\"<%=itemStyles[ i ]%>\" unselectable=\"on\" onmousedown=\"return false\"><%=label%></label>" +
"</li>" +
"<%}%>" +
"</ul>",
defaultOpt: {
//记录栈初始列表
recordStack: [],
//可用项列表
items: [],
//item对应的值列表
value: [],
comboboxName: '',
selected: '',
//初始禁用状态
disabled: {},
//自动记录
autoRecord: true,
//最多记录条数
recordCount: 5,
enabledRecord:true
},
init: function( options ){
var me = this;
$.extend( me._optionAdaptation( options ), me._createItemMapping( options.recordStack, options.items ), {
itemClassName: itemClassName,
iconClass: ICON_CLASS,
labelClassName: labelClassName
} );
this._transStack( options );
me.root( $( $.parseTmpl( me.tpl, options ) ) );
this.data( 'options', options ).initEvent();
},
initEvent: function(){
var me = this;
me.initSelectItem();
this.initItemActive();
},
setLabelWithDefaultValue : function(){
var $btn = this.data('button');
$btn.kmui().label($btn.data('original-title'))
},
/**
* 初始化选择项
*/
initSelectItem: function(){
var me = this,
options = me.data( "options" ),
labelClass = "."+labelClassName;
me.root().delegate('.' + itemClassName, 'click', function(){
var $li = $(this),
index = $li.attr('data-item-index');
if ( options.disabled[ index ] ) {
return false;
}
me.trigger('comboboxselect', {
index: index,
label: $li.find(labelClass).text(),
value: me.data('options').value[ index ]
}).select( index );
me.hide();
me.trigger('aftercomboboxselect');
return false;
});
},
initItemActive: function(){
var fn = {
mouseenter: 'addClass',
mouseleave: 'removeClass'
};
if ($.IE6) {
this.root().delegate( '.'+itemClassName, 'mouseenter mouseleave', function( evt ){
$(this)[ fn[ evt.type ] ]( HOVER_CLASS );
}).one('afterhide', function(){
});
}
},
/**
* 选择给定索引的项
* @param index 项索引
* @returns {*} 如果存在对应索引的项,则返回该项;否则返回null
*/
select: function( index ){
var options = this.data( 'options' ),
itemCount = options.itemCount,
items = options.autowidthitem;
if ( items && !items.length ) {
items = options.items;
}
// 禁用
if ( options.disabled[ index ] ) {
return null;
}
if( itemCount == 0 ) {
return null;
}
if( index < 0 ) {
index = itemCount + index % itemCount;
} else if ( index >= itemCount ) {
index = itemCount-1;
}
this.trigger( 'changebefore', items[ index ] );
this._update( index );
this.trigger( 'changeafter', items[ index ] );
return null;
},
selectItemByLabel: function( label ){
var itemMapping = this.data('options').itemMapping,
me = this,
index = null;
!$.isArray( label ) && ( label = [ label ] );
$.each( label, function( i, item ){
index = itemMapping[ item ];
if( index !== undefined ) {
me.select( index );
return false;
}
} );
},
getItems: function () {
return this.data( "options" ).items;
},
traverseItems:function(fn){
var values = this.data('options').value;
var labels = this.data('options').items;
$.each(labels,function(i,label){
fn(label,values[i])
});
return this;
},
getItemMapping: function () {
return this.data( "options" ).itemMapping;
},
disableItemByIndex: function ( index ) {
var options = this.data( "options" );
options.disabled[ index ] = true;
this._repaint();
},
disableItemByLabel: function ( label ) {
var itemMapping = this.data('options').itemMapping,
index = itemMapping[ label ];
if ( typeof index === "number" ) {
return this.disableItemByIndex( index );
}
return false;
},
enableItemByIndex: function ( index ) {
var options = this.data( "options" );
delete options.disabled[ index ];
this._repaint();
},
enableItemByLabel: function ( label ) {
var itemMapping = this.data('options').itemMapping,
index = itemMapping[ label ];
if ( typeof index === "number" ) {
return this.enableItemByIndex( index );
}
return false;
},
/**
* 转换记录栈
*/
_transStack: function( options ) {
var temp = [],
itemIndex = -1,
selected = -1;
$.each( options.recordStack, function( index, item ){
itemIndex = options.itemMapping[ item ];
if( $.isNumeric( itemIndex ) ) {
temp.push( itemIndex );
//selected的合法性检测
if( item == options.selected ) {
selected = itemIndex;
}
}
} );
options.recordStack = temp;
options.selected = selected;
temp = null;
},
_optionAdaptation: function( options ) {
if( !( 'itemStyles' in options ) ) {
options.itemStyles = [];
for( var i = 0, len = options.items.length; i < len; i++ ) {
options.itemStyles.push('');
}
}
options.autowidthitem = options.autowidthitem || options.items;
options.itemCount = options.items.length;
return options;
},
_createItemMapping: function( stackItem, items ){
var temp = {},
result = {
recordStack: [],
mapping: {}
};
$.each( items, function( index, item ){
temp[ item ] = index;
} );
result.itemMapping = temp;
$.each( stackItem, function( index, item ){
if( temp[ item ] !== undefined ) {
result.recordStack.push( temp[ item ] );
result.mapping[ item ] = temp[ item ];
}
} );
return result;
},
_update: function ( index ) {
var options = this.data("options"),
newStack = [];
if(this.data('options').enabledRecord){
$.each( options.recordStack, function( i, item ){
if( item != index ) {
newStack.push( item );
}
} );
//压入最新的记录
newStack.unshift( index );
if( newStack.length > options.recordCount ) {
newStack.length = options.recordCount;
}
options.recordStack = newStack;
}
options.selected = index;
this._repaint();
newStack = null;
},
_repaint: function () {
var newChilds = $( $.parseTmpl( this.tpl, this.data("options") ) );
//重新渲染
this.root().html( newChilds.html() );
newChilds = null;
}
};
} )(), 'menu' );
})();
//dropmenu 类
KM.ui.define('dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}}%>' +
'<%}%>'+
'</ul>',
subTmpl:'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}}%>' +
'<%}%>',
defaultOpt: {
data: [],
click: function () {
}
},
setData:function(items){
this.root().html($.parseTmpl(this.subTmpl,items));
return this;
},
position:function(offset){
this.root().css({
left:offset.x,
top:offset.y
});
return this;
},
show:function(){
if(this.trigger('beforeshow') === false){
return;
}else{
this.root().css({display:'block'});
this.trigger('aftershow');
}
return this;
},
init: function (options) {
var me = this;
var eventName = {
click: 1,
mouseover: 1,
mouseout: 1
};
this.root($($.parseTmpl(this.tmpl, options))).on('click', 'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]',function (evt) {
$.proxy(options.click, me, evt, $(this).data('value'), $(this).data('label'),$(this))()
}).find('li').each(function (i, el) {
var $this = $(this);
if (!$this.hasClass("kmui-disabled kmui-divider kmui-dropdown-submenu")) {
var data = options.data[i];
$.each(eventName, function (k) {
data[k] && $this[k](function (evt) {
$.proxy(data[k], el)(evt, data, me.root)
})
})
}
});
},
_initEvent:function(){
this.root().on('mouseover','li[class="kmui-dropdown-submenu',function(e){
var $submenu = $(this).data('widget');
$submenu.kmui().show($(this),'right','position',5,2)
});
},
disabled: function (cb) {
$('li[class!=kmui-divider]', this.root()).each(function () {
var $el = $(this);
if (cb === true) {
$el.addClass('kmui-disabled')
} else if ($.isFunction(cb)) {
$el.toggleClass('kmui-disabled', cb(li))
} else {
$el.removeClass('kmui-disabled')
}
});
},
val: function (val) {
var currentVal;
$('li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]', this.root()).each(function () {
var $el = $(this);
if (val === undefined) {
if ($el.find('em.kmui-dropmenu-checked').length) {
currentVal = $el.data('value');
return false
}
} else {
$el.find('em').toggleClass('kmui-dropmenu-checked', $el.data('value') == val)
}
});
if (val === undefined) {
return currentVal
}
},
appendItem: function ( item ) {
var itemTpl = '<%if(item.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(item.active||item.disabled){%>class="<%= item.active|| \'\' %> <%=item.disabled||\'\' %>" <%}%> data-value="<%= item.value%>" data-label="<%= item.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= item.label%></a>' +
'</li><%}%>';
var html = $.parseTmpl( itemTpl, item );
var $item = $( html ).click( item.click );
this.root().append( $item );
},
addSubmenu: function (label, menu, index) {
index = index || 0;
var $list = $('li[class!=kmui-divider]', this.root());
var $node = $('<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">' + label + '</a></li>').append(menu);
$node.data('widget',menu);
if (index >= 0 && index < $list.length) {
$node.insertBefore($list[index]);
} else if (index < 0) {
$node.insertBefore($list[0]);
} else if (index >= $list.length) {
$node.appendTo($list);
}
}
}, 'menu');
\ No newline at end of file
/*! jQuery UI - v1.10.4 - 2014-02-18
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
(function(e,t){function i(t,i){var s,a,o,r=t.nodeName.toLowerCase();return"area"===r?(s=t.parentNode,a=s.name,t.href&&a&&"map"===s.nodeName.toLowerCase()?(o=e("img[usemap=#"+a+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,a=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,s,a=e(this[0]);a.length&&a[0]!==document;){if(n=a.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){a.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(o,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){e(this).css(o,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,a=e.ui[t].prototype;for(s in n)a.plugins[s]=a.plugins[s]||[],a.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)}})})(jQuery);(function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix||i:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),1===arguments.length)return o[i]===e?null:o[i];o[i]=s}else{if(1===arguments.length)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})})(jQuery);(function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(e){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=e.pageX,h=e.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var s=t(this).data("ui-draggable"),n=s.options,a=t.extend({},i,{item:s.element});s.sortables=[],t(n.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,a))})},stop:function(e,i){var s=t(this).data("ui-draggable"),n=t.extend({},i,{item:s.element});t.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,n))})},drag:function(e,i){var s=t(this).data("ui-draggable"),n=this;t.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,t.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",e),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",e),s.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._opacity&&t(i.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(document).scrollTop()<s.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<s.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(document).scrollLeft()<s.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<s.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),s=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(e,i){var s,n,a,o,r,l,h,c,u,d,p=t(this).data("ui-draggable"),g=p.options,f=g.snapTolerance,m=i.offset.left,_=m+p.helperProportions.width,v=i.offset.top,b=v+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)r=p.snapElements[u].left,l=r+p.snapElements[u].width,h=p.snapElements[u].top,c=h+p.snapElements[u].height,r-f>_||m>l+f||h-f>b||v>c+f||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==g.snapMode&&(s=f>=Math.abs(h-b),n=f>=Math.abs(c-v),a=f>=Math.abs(r-_),o=f>=Math.abs(l-m),s&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=s||n||a||o,"outer"!==g.snapMode&&(s=f>=Math.abs(h-v),n=f>=Math.abs(c-b),a=f>=Math.abs(r-m),o=f>=Math.abs(l-_),s&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=s||n||a||o||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,s=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});s.length&&(e=parseInt(t(s[0]).css("zIndex"),10)||0,t(s).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+s.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._zIndex&&t(i.helper).css("zIndex",s._zIndex)}})})(jQuery);
\ No newline at end of file
//menu 类
KM.ui.define('menu',{
show : function($obj,dir,fnname,topOffset,leftOffset){
fnname = fnname || 'position';
if(this.trigger('beforeshow') === false){
return;
}else{
this.root().css($.extend({display:'block'},$obj ? {
top : $obj[fnname]().top + ( dir == 'right' ? 0 : $obj.outerHeight()) - (topOffset || 0),
left : $obj[fnname]().left + (dir == 'right' ? $obj.outerWidth() : 0) - (leftOffset || 0)
}:{}))
this.trigger('aftershow');
}
},
hide : function(all){
var $parentmenu;
if(this.trigger('beforehide') === false){
return;
} else {
if($parentmenu = this.root().data('parentmenu')){
if($parentmenu.data('parentmenu')|| all)
$parentmenu.kmui().hide();
}
this.root().css('display','none');
this.trigger('afterhide');
}
},
attachTo : function($obj){
var me = this;
if(!$obj.data('$mergeObj')){
$obj.data('$mergeObj',me.root());
if($obj.kmui()){
$obj.on('wrapclick',function(evt){
me.supper.show.call(me,$obj,'','offset',15)
});
}else{
$obj.on('click',function(evt){
me.supper.show.call(me,$obj,'','offset',15)
})
}
me.register('click',$obj,function(evt){
me.hide()
});
me.data('$mergeObj',$obj)
}
}
});
\ No newline at end of file
/*modal 类*/
KM.ui.define( 'modal', {
tpl: '<div class="kmui-modal" tabindex="-1" >' +
'<div class="kmui-modal-header">' +
'<div class="kmui-close" data-hide="modal"></div>' +
'<h3 class="kmui-title"><%=title%></h3>' +
'</div>' +
'<div class="kmui-modal-body" style="<%if(width){%>width:<%=width%>px;<%}%>' +
'<%if(height){%>height:<%=height%>px;<%}%>">' +
' </div>' +
'<% if(cancellabel || oklabel) {%>' +
'<div class="kmui-modal-footer">' +
'<div class="kmui-modal-tip"></div>' +
'<%if(oklabel){%><div class="kmui-btn kmui-btn-primary" data-ok="modal"><%=oklabel%></div><%}%>' +
'<%if(cancellabel){%><div class="kmui-btn" data-hide="modal"><%=cancellabel%></div><%}%>' +
'</div>' +
'<%}%></div>',
defaultOpt: {
title: "",
cancellabel: "",
oklabel: "",
width: '',
height: '',
backdrop: true,
keyboard: true
},
init: function ( options ) {
var me = this;
me.root( $( $.parseTmpl( me.tpl, options || {} ) ) );
me.data( "options", options );
if ( options.okFn ) {
me.on( 'ok', $.proxy( options.okFn, me ) )
}
if ( options.cancelFn ) {
me.on( 'beforehide', $.proxy( options.cancelFn, me ) )
}
me.root().delegate( '[data-hide="modal"]', 'click', $.proxy( me.hide, me ) )
.delegate( '[data-ok="modal"]', 'click', $.proxy( me.ok, me ) );
$( '[data-hide="modal"],[data-ok="modal"]', me.root() ).hover( function () {
$( this ).toggleClass( 'kmui-hover' )
} );
setTimeout( function () {
$( '.kmui-modal' ).draggable( {
handle: '.kmui-modal-header'
} );
}, 100 );
},
toggle: function () {
var me = this;
return me[ !me.data( "isShown" ) ? 'show' : 'hide' ]();
},
show: function () {
var me = this;
me.trigger( "beforeshow" );
if ( me.data( "isShown" ) ) return;
me.data( "isShown", true );
me.escape();
me.backdrop( function () {
me.autoCenter();
me.root()
.show()
.focus()
.trigger( 'aftershow' );
} );
$( '.kmui-modal' ).draggable( {
handle: '.kmui-modal-header'
} );
},
showTip: function ( text ) {
$( '.kmui-modal-tip', this.root() ).html( text ).fadeIn();
},
hideTip: function ( text ) {
$( '.kmui-modal-tip', this.root() ).fadeOut( function () {
$( this ).html( '' );
} );
},
autoCenter: function () {
//ie6下不用处理了
!$.IE6 && this.root().css( "margin-left", -( this.root().width() / 2 ) );
},
hide: function () {
var me = this;
me.trigger( "beforehide" );
if ( !me.data( "isShown" ) ) return;
me.data( "isShown", false );
me.escape();
me.hideModal();
},
escape: function () {
var me = this;
if ( me.data( "isShown" ) && me.data( "options" ).keyboard ) {
me.root().on( 'keyup', function ( e ) {
e.which == 27 && me.hide();
} )
} else if ( !me.data( "isShown" ) ) {
me.root().off( 'keyup' );
}
},
hideModal: function () {
var me = this;
me.root().hide();
me.backdrop( function () {
me.removeBackdrop();
me.trigger( 'afterhide' );
} )
},
removeBackdrop: function () {
this.$backdrop && this.$backdrop.remove();
this.$backdrop = null;
},
backdrop: function ( callback ) {
var me = this;
if ( me.data( "isShown" ) && me.data( "options" ).backdrop ) {
me.$backdrop = $( '<div class="kmui-modal-backdrop" />' ).click(
me.data( "options" ).backdrop == 'static' ?
$.proxy( me.root()[ 0 ].focus, me.root()[ 0 ] ) : $.proxy( me.hide, me )
)
}
me.trigger( 'afterbackdrop' );
callback && callback();
},
attachTo: function ( $obj ) {
var me = this
if ( !$obj.data( '$mergeObj' ) ) {
$obj.data( '$mergeObj', me.root() );
$obj.on( 'click', function () {
me.toggle( $obj )
} );
me.data( '$mergeObj', $obj )
}
},
ok: function () {
var me = this;
me.trigger( 'beforeok' );
if ( me.trigger( "ok", me ) === false ) {
return;
}
me.hide();
},
getBodyContainer: function () {
return this.root().find( '.kmui-modal-body' )
}
} );
\ No newline at end of file
//popup 类
KM.ui.define('popup', {
tpl: '<div class="kmui-dropdown-menu kmui-popup"'+
'<%if(!<%=stopprop%>){%>onmousedown="return false"<%}%>'+
'><div class="kmui-popup-body" unselectable="on" onmousedown="return false"><%=subtpl%></div>' +
'<div class="kmui-popup-caret"></div>' +
'</div>',
defaultOpt: {
stopprop:false,
subtpl: '',
width: '',
height: ''
},
init: function (options) {
this.root($($.parseTmpl(this.tpl, options)));
return this;
},
mergeTpl: function (data) {
return $.parseTmpl(this.tpl, {subtpl: data});
},
show: function ($obj, posObj) {
if (!posObj) posObj = {};
var fnname = posObj.fnname || 'position';
if (this.trigger('beforeshow') === false) {
return;
} else {
this.root().css($.extend({display: 'block'}, $obj ? {
top: $obj[fnname]().top + ( posObj.dir == 'right' ? 0 : $obj.outerHeight()) - (posObj.offsetTop || 0),
left: $obj[fnname]().left + (posObj.dir == 'right' ? $obj.outerWidth() : 0) - (posObj.offsetLeft || 0),
position: 'absolute'
} : {}));
this.root().find('.kmui-popup-caret').css({
top: posObj.caretTop || 0,
left: posObj.caretLeft || 0,
position: 'absolute'
}).addClass(posObj.caretDir || "up")
}
this.trigger("aftershow");
},
hide: function () {
this.root().css('display', 'none');
this.trigger('afterhide')
},
attachTo: function ($obj, posObj) {
var me = this
if (!$obj.data('$mergeObj')) {
$obj.data('$mergeObj', me.root());
$obj.on('wrapclick', function (evt) {
me.show($obj, posObj)
});
me.register('click', $obj, function (evt) {
me.hide()
});
me.data('$mergeObj', $obj)
}
},
getBodyContainer: function () {
return this.root().find(".kmui-popup-body");
}
});
\ No newline at end of file
//scale 类
KM.ui.define('scale', {
tpl: '<div class="kmui-scale" unselectable="on">' +
'<span class="kmui-scale-hand0"></span>' +
'<span class="kmui-scale-hand1"></span>' +
'<span class="kmui-scale-hand2"></span>' +
'<span class="kmui-scale-hand3"></span>' +
'<span class="kmui-scale-hand4"></span>' +
'<span class="kmui-scale-hand5"></span>' +
'<span class="kmui-scale-hand6"></span>' +
'<span class="kmui-scale-hand7"></span>' +
'</div>',
defaultOpt: {
$doc: $(document),
$wrap: $(document)
},
init: function (options) {
if(options.$doc) this.defaultOpt.$doc = options.$doc;
if(options.$wrap) this.defaultOpt.$wrap = options.$wrap;
this.root($($.parseTmpl(this.tpl, options)));
this.initStyle();
this.startPos = this.prePos = {x: 0, y: 0};
this.dragId = -1;
return this;
},
initStyle: function () {
utils.cssRule('kmui-style-scale', '.kmui-scale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;}' +
'.kmui-scale span{position:absolute;left:0;top:0;width:7px;height:7px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}'
+ '.kmui-scale .kmui-scale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}'
+ '.kmui-scale .kmui-scale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}'
+ '.kmui-scale .kmui-scale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}'
+ '.kmui-scale .kmui-scale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}');
},
_eventHandler: function (e) {
var me = this,
$doc = me.defaultOpt.$doc;
switch (e.type) {
case 'mousedown':
var hand = e.target || e.srcElement, hand;
if (hand.className.indexOf('kmui-scale-hand') != -1) {
me.dragId = hand.className.slice(-1);
me.startPos.x = me.prePos.x = e.clientX;
me.startPos.y = me.prePos.y = e.clientY;
$doc.bind('mousemove', $.proxy(me._eventHandler, me));
}
break;
case 'mousemove':
if (me.dragId != -1) {
me.updateContainerStyle(me.dragId, {x: e.clientX - me.prePos.x, y: e.clientY - me.prePos.y});
me.prePos.x = e.clientX;
me.prePos.y = e.clientY;
me.updateTargetElement();
}
break;
case 'mouseup':
if (me.dragId != -1) {
me.dragId = -1;
me.updateTargetElement();
var $target = me.data('$scaleTarget');
if ($target.parent()) me.attachTo(me.data('$scaleTarget'));
}
$doc.unbind('mousemove', $.proxy(me._eventHandler, me));
break;
default:
break;
}
},
updateTargetElement: function () {
var me = this,
$root = me.root(),
$target = me.data('$scaleTarget');
$target.css({width: $root.width(), height: $root.height()});
me.attachTo($target);
},
updateContainerStyle: function (dir, offset) {
var me = this,
$dom = me.root(),
tmp,
rect = [
//[left, top, width, height]
[0, 0, -1, -1],
[0, 0, 0, -1],
[0, 0, 1, -1],
[0, 0, -1, 0],
[0, 0, 1, 0],
[0, 0, -1, 1],
[0, 0, 0, 1],
[0, 0, 1, 1]
];
if (rect[dir][0] != 0) {
tmp = parseInt($dom.offset().left) + offset.x;
$dom.css('left', me._validScaledProp('left', tmp));
}
if (rect[dir][1] != 0) {
tmp = parseInt($dom.offset().top) + offset.y;
$dom.css('top', me._validScaledProp('top', tmp));
}
if (rect[dir][2] != 0) {
tmp = $dom.width() + rect[dir][2] * offset.x;
$dom.css('width', me._validScaledProp('width', tmp));
}
if (rect[dir][3] != 0) {
tmp = $dom.height() + rect[dir][3] * offset.y;
$dom.css('height', me._validScaledProp('height', tmp));
}
},
_validScaledProp: function (prop, value) {
var $ele = this.root(),
$wrap = this.defaultOpt.$doc,
calc = function(val, a, b){
return (val + a) > b ? b - a : value;
};
value = isNaN(value) ? 0 : value;
switch (prop) {
case 'left':
return value < 0 ? 0 : calc(value, $ele.width(), $wrap.width());
case 'top':
return value < 0 ? 0 : calc(value, $ele.height(),$wrap.height());
case 'width':
return value <= 0 ? 1 : calc(value, $ele.offset().left, $wrap.width());
case 'height':
return value <= 0 ? 1 : calc(value, $ele.offset().top, $wrap.height());
}
},
show: function ($obj) {
var me = this;
if ($obj) me.attachTo($obj);
me.root().bind('mousedown', $.proxy(me._eventHandler, me));
me.defaultOpt.$doc.bind('mouseup', $.proxy(me._eventHandler, me));
me.root().show();
me.trigger("aftershow");
},
hide: function () {
var me = this;
me.root().unbind('mousedown', $.proxy(me._eventHandler, me));
me.defaultOpt.$doc.unbind('mouseup', $.proxy(me._eventHandler, me));
me.root().hide();
me.trigger('afterhide')
},
attachTo: function ($obj) {
var me = this,
imgPos = $obj.offset(),
$root = me.root(),
$wrap = me.defaultOpt.$wrap,
posObj = $wrap.offset();
me.data('$scaleTarget', $obj);
me.root().css({
position: 'absolute',
width: $obj.width(),
height: $obj.height(),
left: imgPos.left - posObj.left - parseInt($wrap.css('border-left-width')) - parseInt($root.css('border-left-width')),
top: imgPos.top - posObj.top - parseInt($wrap.css('border-top-width')) - parseInt($root.css('border-top-width'))
});
},
getScaleTarget: function () {
return this.data('$scaleTarget')[0];
}
});
\ No newline at end of file
//button 类
KM.ui.define('separator', {
tpl: '<div class="kmui-separator" unselectable="on" onmousedown="return false" ></div>',
init: function (options) {
var me = this;
me.root($($.parseTmpl(me.tpl, options)));
return me;
}
});
\ No newline at end of file
//splitbutton 类
///import button
KM.ui.define('splitbutton',{
tpl :'<div class="kmui-splitbutton <%if (name){%>kmui-splitbutton-<%= name %><%}%>" unselectable="on" <%if(title){%>data-original-title="<%=title%>"<%}%>><div class="kmui-btn" unselectable="on" ><%if(icon){%><div unselectable="on" class="kmui-icon-<%=icon%> kmui-icon"></div><%}%><%if(text){%><%=text%><%}%></div>'+
'<div unselectable="on" class="kmui-btn kmui-dropdown-toggle" >'+
'<div unselectable="on" class="kmui-caret"><\/div>'+
'</div>'+
'</div>',
defaultOpt:{
text:'',
title:'',
click:function(){}
},
init : function(options){
var me = this;
me.root( $($.parseTmpl(me.tpl,options)));
me.root().find('.kmui-btn:first').click(function(evt){
if(!me.disabled()){
$.proxy(options.click,me)();
}
});
me.root().find('.kmui-dropdown-toggle').click(function(){
if(!me.disabled()){
me.trigger('arrowclick')
}
});
me.root().hover(function () {
if(!me.root().hasClass("kmui-disabled")){
me.root().toggleClass('kmui-hover')
}
});
return me;
},
wrapclick:function(fn,evt){
if(!this.disabled()){
$.proxy(fn,this,evt)()
}
return this;
},
disabled : function(state){
if(state === undefined){
return this.root().hasClass('kmui-disabled')
}
this.root().toggleClass('kmui-disabled',state).find('.kmui-btn').toggleClass('kmui-disabled',state);
return this;
},
active:function(state){
if(state === undefined){
return this.root().hasClass('kmui-active')
}
this.root().toggleClass('kmui-active',state).find('.kmui-btn:first').toggleClass('kmui-active',state);
return this;
},
mergeWith:function($obj){
var me = this;
me.data('$mergeObj',$obj);
$obj.kmui().data('$mergeObj',me.root());
if(!$.contains(document.body,$obj[0])){
$obj.appendTo(me.root());
}
me.root().delegate('.kmui-dropdown-toggle','click',function(){
me.wrapclick(function(){
$obj.kmui().show();
})
});
me.register('click',me.root().find('.kmui-dropdown-toggle'),function(evt){
$obj.hide()
});
}
});
\ No newline at end of file
/*tab 类*/
KM.ui.define('tab', {
init: function (options) {
var me = this,
slr = options.selector;
if ($.type(slr)) {
me.root($(slr, options.context));
me.data("context", options.context);
$(slr, me.data("context")).on('click', function (e) {
me.show(e);
});
}
},
show: function (e) {
var me = this,
$cur = $(e.target),
$ul = $cur.closest('ul'),
selector,
previous,
$target,
e;
selector = $cur.attr('data-context');
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '');
var $tmp = $cur.parent('li');
if (!$tmp.length || $tmp.hasClass('kmui-active')) return;
previous = $ul.find('.kmui-active:last a')[0];
e = $.Event('beforeshow', {
target: $cur[0],
relatedTarget: previous
});
me.trigger(e);
if (e.isDefaultPrevented()) return;
$target = $(selector, me.data("context"));
me.activate($cur.parent('li'), $ul);
me.activate($target, $target.parent(), function () {
me.trigger({
type: 'aftershow', relatedTarget: previous
})
});
},
activate: function (element, container, callback) {
if (element === undefined) {
return $(".kmui-tab-item.kmui-active",this.root()).index();
}
var $active = container.find('> .kmui-active');
$active.removeClass('kmui-active');
element.addClass('kmui-active');
callback && callback();
}
});
//toolbar 类
(function () {
KM.ui.define('toolbar', {
tpl: '<div class="kmui-toolbar" ><div class="kmui-btn-toolbar" unselectable="on" onmousedown="return false" ></div></div>'
,
init: function () {
var $root = this.root($(this.tpl));
this.data('$btnToolbar', $root.find('.kmui-btn-toolbar'))
},
appendToBtnmenu : function(data){
var $cont = this.data('$btnToolbar');
data = $.isArray(data) ? data : [data];
$.each(data,function(i,$item){
$cont.append($item)
})
}
});
})();
/*tooltip 类*/
KM.ui.define('tooltip', {
tpl: '<div class="kmui-tooltip" unselectable="on" onmousedown="return false"><div class="kmui-tooltip-arrow" unselectable="on" onmousedown="return false"></div><div class="kmui-tooltip-inner" unselectable="on" onmousedown="return false"></div></div>',
init: function (options) {
var me = this;
me.root($($.parseTmpl(me.tpl, options || {})));
},
content: function (e) {
var me = this,
title = $(e.currentTarget).attr("data-original-title");
me.root().find('.kmui-tooltip-inner')['text'](title);
},
position: function (e) {
var me = this,
$obj = $(e.currentTarget);
me.root().css($.extend({display: 'block'}, $obj ? {
top: $obj.outerHeight(),
left: (($obj.outerWidth() - me.root().outerWidth()) / 2)
} : {}))
},
show: function (e) {
if ($(e.currentTarget).hasClass('kmui-disabled')) return;
var me = this;
me.content(e);
me.root().appendTo($(e.currentTarget));
me.position(e);
me.root().css('display', 'block');
},
hide: function () {
var me = this;
me.root().css('display', 'none')
},
attachTo: function ($obj) {
var me = this;
function tmp($obj) {
var me = this;
if (!$.contains(document.body, me.root()[0])) {
me.root().appendTo($obj);
}
me.data('tooltip', me.root());
$obj.each(function () {
if ($(this).attr("data-original-title")) {
$(this).on('mouseenter', $.proxy(me.show, me))
.on('mouseleave click', $.proxy(me.hide, me))
}
});
}
if ($.type($obj) === "undefined") {
$("[data-original-title]").each(function (i, el) {
tmp.call(me, $(el));
})
} else {
if (!$obj.data('tooltip')) {
tmp.call(me, $obj);
}
}
}
});
(function ($) {
//对jquery的扩展
$.parseTmpl = function parse(str, data) {
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' + 'with(obj||{}){__p.push(\'' + str.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/<%=([\s\S]+?)%>/g,function (match, code) {
return "'," + code.replace(/\\'/g, "'") + ",'";
}).replace(/<%([\s\S]+?)%>/g,function (match, code) {
return "');" + code.replace(/\\'/g, "'").replace(/[\r\n\t]/g, ' ') + "__p.push('";
}).replace(/\r/g, '\\r').replace(/\n/g, '\\n').replace(/\t/g, '\\t') + "');}return __p.join('');";
var func = new Function('obj', tmpl);
return data ? func(data) : func;
};
$.extend2 = function (t, s) {
var a = arguments,
notCover = $.type(a[a.length - 1]) == 'boolean' ? a[a.length - 1] : false,
len = $.type(a[a.length - 1]) == 'boolean' ? a.length - 1 : a.length;
for (var i = 1; i < len; i++) {
var x = a[i];
for (var k in x) {
if (!notCover || !t.hasOwnProperty(k)) {
t[k] = x[k];
}
}
}
return t;
};
$.IE6 = !!window.ActiveXObject && parseFloat(navigator.userAgent.match(/msie (\d+)/i)[1]) == 6;
//所有ui的基类
var _eventHandler = [];
var _widget = function () {
};
var _prefix = 'kmui';
_widget.prototype = {
on: function (ev, cb) {
this.root().on(ev, $.proxy(cb, this));
return this;
},
off: function (ev, cb) {
this.root().off(ev, $.proxy(cb, this));
return this;
},
trigger: function (ev, data) {
return this.root().trigger(ev, data) === false ? false : this;
},
root: function ($el) {
return this._$el || (this._$el = $el);
},
destroy: function () {
},
data: function (key, val) {
if (val !== undefined) {
this.root().data(_prefix + key, val);
return this;
} else {
return this.root().data(_prefix + key)
}
},
register: function (eventName, $el, fn) {
_eventHandler.push({
'evtname': eventName,
'$els': $.isArray($el) ? $el : [$el],
handler: $.proxy(fn, $el)
})
}
};
//从jq实例上拿到绑定的widget实例
$.fn.kmui = function (obj) {
return obj ? this.data('kmuiwidget', obj) : this.data('kmuiwidget');
};
function _createClass(ClassObj, properties, supperClass) {
ClassObj.prototype = $.extend2(
$.extend({}, properties),
(KM.ui[supperClass] || _widget).prototype,
true
);
ClassObj.prototype.supper = (KM.ui[supperClass] || _widget).prototype;
//父class的defaultOpt 合并
if( KM.ui[supperClass] && KM.ui[supperClass].prototype.defaultOpt ) {
var parentDefaultOptions = KM.ui[supperClass].prototype.defaultOpt,
subDefaultOptions = ClassObj.prototype.defaultOpt;
ClassObj.prototype.defaultOpt = $.extend( {}, parentDefaultOptions, subDefaultOptions || {} );
}
return ClassObj
}
var _guid = 1;
function mergeToJQ(ClassObj, className) {
$[_prefix + className] = ClassObj;
$.fn[_prefix + className] = function (opt) {
var result, args = Array.prototype.slice.call(arguments, 1);
this.each(function (i, el) {
var $this = $(el);
var obj = $this.kmui();
if (!obj) {
ClassObj(!opt || !$.isPlainObject(opt) ? {} : opt, $this);
$this.kmui(obj)
}
if ($.type(opt) == 'string') {
if (opt == 'this') {
result = obj;
} else {
result = obj[opt].apply(obj, args);
if (result !== obj && result !== undefined) {
return false;
}
result = null;
}
}
});
return result !== null ? result : this;
}
}
KM.ui = {
define: function (className, properties, supperClass) {
var ClassObj = KM.ui[className] = _createClass(function (options, $el) {
var _obj = function () {
};
$.extend(_obj.prototype, ClassObj.prototype, {
guid: className + _guid++,
widgetName: className
}
);
var obj = new _obj;
if ($.type(options) == 'string') {
obj.init && obj.init({});
obj.root().kmui(obj);
obj.root().find('a').click(function (evt) {
evt.preventDefault()
});
return obj.root()[_prefix + className].apply(obj.root(), arguments)
} else {
$el && obj.root($el);
obj.init && obj.init(!options || $.isPlainObject(options) ? $.extend2(options || {}, obj.defaultOpt || {}, true) : options);
try{
obj.root().find('a').click(function (evt) {
evt.preventDefault()
});
}catch(e){
}
return obj.root().kmui(obj);
}
},properties, supperClass);
mergeToJQ(ClassObj, className);
}
};
$(function () {
$(document).on('click mouseup mousedown dblclick mouseover', function (evt) {
$.each(_eventHandler, function (i, obj) {
if (obj.evtname == evt.type) {
$.each(obj.$els, function (i, $el) {
if ($el[0] !== evt.target && !$.contains($el[0], evt.target)) {
obj.handler(evt);
}
})
}
})
})
})
})(jQuery);
\ No newline at end of file
/*普通按钮*/
.kmui-btn-toolbar .kmui-btn{
position: relative;
display: inline-block;
vertical-align: middle;
*display: inline;
*zoom:1;
width:auto;
margin: 0 1px;
padding:1px;
border:none;
background: none;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon{
width: 20px;
height: 20px;
margin: 0;
padding:0;
background-repeat: no-repeat;
background-image: url(../images/icons.png);
background-image: url(../images/icons.gif) \9;
}
/*状态反射*/
.kmui-btn-toolbar .kmui-btn.kmui-hover,
.kmui-btn-toolbar .kmui-btn.kmui-active{
background-color: #d5e1f2;
border: 1px solid #a3bde3;
padding: 0;
_z-index: 1;
}
.kmui-btn-toolbar .kmui-btn.kmui-disabled{
opacity: 0.3;
filter: alpha(opacity = 30);
}
\ No newline at end of file
.kmui-btn-toolbar .kmui-btn .kmui-icon-undo {
background-position: -160px 0;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-redo {
background-position: -100px 0;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-bold{
background-position: 0 0;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-italic {
background-position: -60px 0;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-font, .kmui-btn-toolbar .kmui-btn .kmui-icon-forecolor {
background-position: -720px 1px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-hand {
background: url(../images/hand.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-markers {
background: url(../images/flag.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-clock {
background: url(../images/clock.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-zoom-in {
background: url(../images/zoom_in.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-zoom-out {
background: url(../images/zoom_out.png) no-repeat 2px 2px;
}
\ No newline at end of file
.kmui-splitbutton-color-label {
width: 16px;
height: 3px;
position: absolute;
bottom: 2px;
left: 50%;
margin-left: -8px;
overflow: hidden;
line-height: 3px;
}
.kmui-popup .kmui-colorpicker {
margin: 10px;
font-size: 12px;
}
.kmui-colorpicker .kmui-colorpicker-topbar{
height: 27px;
width: 200px;
overflow: hidden;
}
.kmui-colorpicker .kmui-colorpicker-topbar .kmui-colorpicker-preview{
height: 20px;
border: 1px inset black;
margin-left: 1px;
width: 128px;
float: left;
}
.kmui-colorpicker .kmui-colorpicker-topbar .kmui-colorpicker-nocolor{
float: right;
margin-right: 1px;
font-size: 12px;
line-height: 14px;
height: 14px;
border: 1px solid #333;
padding: 3px 5px;
cursor: pointer;
}
.kmui-colorpicker table{
border-collapse: collapse;
border-spacing: 2px;
}
.kmui-colorpicker tr.kmui-colorpicker-firstrow{
height: 30px;
}
.kmui-colorpicker table td{
padding: 0 2px;
}
.kmui-colorpicker table td .kmui-colorpicker-colorcell{
display: block;
text-decoration: none;
color: black;
width: 14px;
height: 14px;
margin: 0;
cursor: pointer;
}
\ No newline at end of file
.kmui-btn-toolbar .kmui-combobox{
border: 1px solid transparent;
padding:0;
margin:0 2px;
line-height: 20px;
font-family: Arial, "Heiti SC", "Microsoft Yahei";
}
.kmui-combobox .kmui-button-label{
position: relative;
display: inline-block;
vertical-align: middle;
*display: inline ;
*zoom:1;
height:20px;
line-height: 20px;
padding: 2px 5px;
margin: 0;
font-size: 12px;
text-align: center;
cursor: default;
}
.kmui-combobox .kmui-button-spacing{
position: relative;
display: inline-block ;
vertical-align: middle;
*display: inline ;
*zoom:1;
height:20px;
margin: 0;
/*padding:0 3px;*/
padding: 0;
}
.kmui-combobox .kmui-caret{
position: relative;
display: inline-block ;
vertical-align: middle;
*display: inline ;
*zoom:1;
height:20px;
width: 12px;
margin: 0;
padding: 0;
background: url(../images/icons.png) -740px 2px no-repeat;
_background: url(../images/icons.gif) -740px 2px no-repeat;
padding: 2px 0;
border-left: 1px solid transparent;
}
.kmui-combobox:hover .kmui-caret {
border-left-color: #a3bde3;
}
.kmui-btn-toolbar .kmui-combobox.kmui-disabled{
opacity: 0.2;
filter: alpha(opacity = 20);
}
.kmui-combobox-menu{
position: absolute;
display: none;
list-style: none;
text-decoration: none;
margin: 0;
padding: 5px 0;
background-color: #ffffff;
font-size: 12px;
box-shadow: 2px 5px 15px rgba(0, 0, 0, .5);
border-radius: 3px;
min-width: 160px;
_width: 160px;
-webkit-transform: translateX(2px);
font-family: Arial, "Heiti SC", "Microsoft Yahei";
}
.kmui-combobox-menu .kmui-combobox-item {
display: block;
padding: 2px 15px 2px 2px;
white-space:nowrap;
}
.kmui-combobox-menu .kmui-combobox-item:first-child:last-child {
border-radius: 2px;
}
.kmui-combobox-menu .kmui-combobox-item-label {
height: 25px;
line-height: 25px;
display: inline-block;
vertical-align: middle;
_display: inline;
_zoom: 1;
}
.kmui-combobox-menu .kmui-combobox-item:hover, .kmui-combobox-menu .kmui-combobox-stack-item:hover, .kmui-combobox-menu .kmui-combobox-item-hover {
background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */
color: white;
/*border: 1px solid #a3bde3;*/
}
.kmui-combobox-menu .kmui-combobox-item .kmui-combobox-icon {
display: inline-block;
*zoom: 1;
*display: inline;
width: 30px;
height: 12px;
line-height: 12px;
vertical-align: middle;
background: url(../images/check.png) no-repeat 1000px 1000px;
}
.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon {
background-position: center 0;
}
.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon {
background-position: center -12px;
}
.kmui-combobox-menu .kmui-combobox-item-separator {
min-width: 160px;
height: 1px;
line-height: 1px;
overflow: hidden;
background: #d3d3d3;
margin: 5px 0;
*margin-top: -8px;
}
/* 字体样式校正 */
.kmui-combobox-menu .kmui-combobox-item-disabled {
color: black;
opacity: 0.3;
}
.kmui-combobox-menu .kmui-combobox-item-disabled:hover {
border-color: #fff;
background: #fff;
color: black;
}
\ No newline at end of file
.kmui-modal {
position: fixed;
top: 60px;
right:10px;
background-color: #ffffff;
outline: 0;
border-radius: 5px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
}
.kmui-modal-header {
padding: 5px 10px;
border-bottom: 1px solid #eee;
cursor: move;
}
.kmui-modal-header .kmui-close {
float: right;
width:20px;
height:20px;
margin-top: 2px;
padding: 1px;
border: 0;
background: url("../images/close.png") no-repeat center center;
cursor: pointer;
}
.kmui-modal-header .kmui-close.kmui-hover {
background-color: #d5e1f2;
padding:0;
border: 1px solid #a3bde3;
}
.kmui-modal-header .kmui-title {
margin: 0;
line-height: 25px;
font-size: 20px;
}
.kmui-modal-body {
position: relative;
max-height: 400px;
font-size: 12px;
overflow-y: auto;
}
.kmui-modal-footer {
float: right;
padding: 5px 15px 15px;
overflow: hidden;
}
.kmui-modal-footer .kmui-btn {
float: left;
height: 24px;
width: 96px;
margin: 0 10px;
background-color: #ffffff;
padding: 0;
border: 1px solid #ababab;
font-size: 12px;
line-height: 24px;
text-align: center;
cursor: pointer;
}
.kmui-modal-footer .kmui-btn.kmui-hover{
background-color: #d5e1f2;
border: 1px solid #a3bde3;
}
.kmui-modal-backdrop{
opacity: 0.5;
filter: alpha(opacity=50);
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #c6c6c6;
}
.kmui-modal .kmui-modal-tip {
color: red;
position: absolute;
bottom: 10px;
left: 10px;
height: 30px;
line-height: 30px;
display: none;
}
\ No newline at end of file
.kmui-dropdown-menu {
position: absolute;
z-index: 1000;
display: none;
min-width: 160px;
padding: 5px 0;
font-size: 12px;
list-style: none;
background-color: #ffffff;
border-radius: 3px;
box-shadow: 2px 5px 15px rgba(0, 0, 0, .5);
background-clip: padding-box;
font-family: Arial, "Heiti SC", "Microsoft Yahei";
}
.kmui-dropdown-menu.pull-right {
right: 0;
left: auto;
}
.kmui-dropdown-menu .kmui-divider {
height: 1px;
margin: 5px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.kmui-dropdown-menu .kmui-divider:first-child,
.kmui-dropdown-menu .kmui-divider:last-child {
display: none;
}
.kmui-dropdown-menu > li > a {
display: block;
padding: 2px 15px 2px 30px;
height: 25px;
line-height: 25px;
clear: both;
font-weight: normal;
color: #333333;
white-space: nowrap;
text-decoration: none;
}
.kmui-dropdown-menu > li > a:hover,
.kmui-dropdown-menu > li > a:focus {
background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */
color: white;
}
.kmui-dropdown-menu > .active > a,
.kmui-dropdown-menu > .active > a:hover,
.kmui-dropdown-menu > .active > a:focus {
color: #ffffff;
text-decoration: none;
background-color: #428bca;
outline: 0;
}
.kmui-dropdown-menu > .disabled > a,
.kmui-dropdown-menu > .disabled > a:hover,
.kmui-dropdown-menu > .disabled > a:focus {
color: #999999;
}
.kmui-dropdown-menu > .disabled > a:hover,
.kmui-dropdown-menu > .disabled > a:focus {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.kmui-dropdown-menu >li > a:active, .kmui-dropdown-menu >li > a:hover {
outline: 0;
}
@import "kityminder.css";
@import "button.css";
@import "buttonicon.css";
@import "splitbutton.css";
@import "combobox.css";
@import "comboboxmenu.css";
@import "dialog.css";
@import "dialogsize.css";
@import "popup.css";
@import "tab.css";
@import "tooltip.css";
@import "colorpicker.css";
@import "separator.css";
@import "markers.css";
@import "dropmenu.css";
\ No newline at end of file
.kmui-container {
}
.kmui-container .kmui-toolbar{
background-color: #fafafa;
z-index: 99999;
}
.kmui-toolbar .kmui-btn-toolbar{
padding: 5px;
}
.kmui-toolbar {
position: absolute;
left: 10px;
top: 10px;
border-radius: 4px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
}
.kmui-container .kmui-editor-body {
background: rgb(50, 60, 61) url(../images/grid.png) repeat;
/*line-height: 0;*/
overflow: hidden;
}
svg {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
}
\ No newline at end of file
.kmui-modal-header .kmui-title{
font-size: 14px;
}
.kmui-dialog-markers-body {
padding-bottom: 5px
}
.icon-list{
margin: 0;
padding: 0
}
.icon-list li{
padding: 5px 10px;
margin: 0;
list-style: none;
cursor: pointer;
color: #333;
font-family:Arial, "Heiti SC", "Microsoft Yahei";
}
.icon-list li:hover,.icon-list li.active{
background: #cfe0f7
}
.icon-list li span.icon{
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 10px;
}
\ No newline at end of file
.kmui-popup{
display: none;
/*background: url('../images/pop-bg.png') repeat #fff;*/
background: white;
padding: 2px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, .5);
}
.kmui-popup .kmui-popup-body{
/*border: 1px solid #bfbfbf;*/
background-color: #fff;
}
.kmui-popup .kmui-popup-caret{
width: 21px;
height: 11px;
}
.kmui-popup .kmui-popup-caret.up{
/*background:url('../images/caret.png') no-repeat 0 0;*/
}
.kmui-popup .kmui-popup-caret.down{
/*background:url('../images/caret.png') no-repeat 0 0;*/
}
.kmui-toolbar .kmui-separator{
width: 2px;
height: 20px;
padding: 1px 2px;
background: url(../images/icons.png) -179px 1px;
background: url(../images/icons.gif) -179px 1px \9;
display: inline-block ;
vertical-align: middle;
*display: inline ;
*zoom:1;
border:none;
}
\ No newline at end of file
.kmui-btn-toolbar .kmui-splitbutton{
position: relative;
display: inline-block ;
vertical-align: middle;
*display: inline ;
*zoom:1;
margin:0 2px;
}
.kmui-splitbutton .kmui-btn{
margin: 0;
}
.kmui-splitbutton .kmui-caret{
position: relative;
display: inline-block ;
vertical-align: middle;
*display: inline ;
*zoom:1;
width: 8px;
height: 20px;
background: url(../images/icons.png) -741px 0;
_background: url(../images/icons.gif) -741px 0;
}
.kmui-btn-toolbar .kmui-splitbutton {
border: 1px solid transparent;
}
.kmui-btn-toolbar .kmui-splitbutton .kmui-dropdown-toggle {
padding: 1px 2px;
margin-left: -1px;
border-left: 1px solid transparent;
}
.kmui-btn-toolbar .kmui-splitbutton .kmui-dropdown-toggle:hover {
border-left-color: #a3bde3;
background-color: #dbe7f8;
}
/*状态反射*/
.kmui-btn-toolbar .kmui-splitbutton.kmui-hover {
background-color: #d5e1f2;
border: 1px solid #a3bde3;
}
.kmui-btn-toolbar .kmui-splitbutton.kmui-disabled{
opacity: 0.3;
filter: alpha(opacity = 30);
}
.kmui-tab-nav {
margin: 0;
padding:0;
border-bottom: 1px solid #ddd;
list-style: none;
height:30px;
}
.kmui-tab-nav .kmui-tab-item {
float:left;
margin-bottom: -1px;
margin-top: 1px;
margin-top: 0\9;
}
.kmui-tab-nav .kmui-tab-item .kmui-tab-text{
display: block;
padding:8px 12px;
border: 1px solid transparent;
color: #0088cc;
text-decoration: none;
outline: 0;
_border:1px solid #fff ;
cursor: pointer;
}
.kmui-tab-nav .kmui-tab-item .kmui-tab-text:FOCUS {
outline: none;
}
.kmui-tab-nav .kmui-tab-item.kmui-active .kmui-tab-text{
border: 1px solid #ddd;
border-bottom-color: transparent;
background-color: #fff;
padding:8px 12px;
color: #555555;
cursor: default;
}
.kmui-tab-content .kmui-tab-pane{
padding: 1px;
position: relative;
display: none;
background-color: #fff;
clear: both;
}
.kmui-tab-content .kmui-tab-pane.kmui-active{
display: block;
}
.kmui-btn-toolbar .kmui-tooltip{
position: absolute;
padding: 5px 0;
display: none;
/*opacity: 0.8;*/
/*filter: alpha(opacity=80);*/
z-index: 99999;
}
.kmui-tooltip .kmui-tooltip-arrow{
position: absolute;
top: 0;
_top: -19px;
left: 50%;
width: 0;
height: 0;
padding: 0;
margin-left: -5px;
border-color: transparent;
border-style: dashed dashed solid dashed;
border-bottom-color: #000000;
border-width: 0 5px 5px;
background: transparent;
}
.kmui-tooltip .kmui-tooltip-inner{
padding: 6px;
color: #ffffff;
text-align: center;
text-decoration: none;
font-size: 10px;
background-color: #000000;
white-space: nowrap;
line-height: 12px;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper EH</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper EH</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper.EH</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper EH</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>29.0.1547.31</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1547.31</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>213023</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper NP</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper NP</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper.NP</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper NP</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>29.0.1547.31</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1547.31</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>213023</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit Helper</string>
<key>CFBundleExecutable</key>
<string>node-webkit Helper</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw.helper</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit Helper</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>29.0.1547.31</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1547.31</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>213023</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>node-webkit</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>nw.icns</string>
<key>CFBundleTypeName</key>
<string>node-webkit App</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.intel.nw.app</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>node-webkit</string>
<key>CFBundleIconFile</key>
<string>nw.icns</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>node-webkit</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>29.0.1547.31</string>
<key>CFBundleVersion</key>
<string>1547.31</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>213023</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>node-webkit App</string>
<key>UTTypeIconFile</key>
<string>nw.icns</string>
<key>UTTypeIdentifier</key>
<string>com.intel.nw.app</string>
<key>UTTypeReferenceURL</key>
<string>https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>node-webkit</string>
<key>public.filename-extension</key>
<array>
<string>nw</string>
</array>
<key>public.mime-type</key>
<string>application/x-node-webkit-app</string>
</dict>
</dict>
</array>
</dict>
</plist>
APPL????
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment