(function (e, $) {
if (window.xheditor)return !1;
var I = navigator.userAgent.toLowerCase(), Ba = -1 !== I.indexOf("mobile"), J = e.browser, pa = parseFloat(J.version), h = J.msie, qa = J.mozilla, R = J.safari, Ca = J.opera, eb = -1 < I.indexOf(" adobeair/"), Da = /OS 5(_\d)+ like Mac OS X/i.test(I);
e.fn.xheditor = function (h) {
if (Ba && !Da)return !1;
var o = [];
this.each(function () {
if (e.nodeName(this, "TEXTAREA"))if (!1 === h) {
if (this.xheditor)this.xheditor.remove(), this.xheditor = null
} else if (this.xheditor)o.push(this.xheditor); else {
var q = /({.*})/.exec(e(this).attr("class"));
if (q) {
try {
q = eval("(" + q[1] + ")")
} catch (t) {
}
h = e.extend({}, q, h)
}
q = new ra(this, h);
if (q.init())this.xheditor = q, o.push(q)
}
});
0 === o.length && (o = !1);
1 === o.length && (o = o[0]);
return o
};
var aa = 0, S = !1, sa = !0, ta = !1, Sa = !1, t, ba, ca, da, K, Ea, ea, Fa, Ga, Ha, A;
e("script[src*=xheditor]").each(function () {
var e = this.src;
if (e.match(/xheditor[^\/]*\.js/i))return A = e.replace(/[\?#].*$/, "").replace(/(^|[\/\\])[^\/]*$/, "$1"), !1
});
if (h) {
try {
document.execCommand("BackgroundImageCache", !1, !0)
} catch (qb) {
}
(I = e.fn.jquery) && I.match(/^1\.[67]/) &&
(e.attrHooks.width = e.attrHooks.height = null)
}
var fb = {
27: "esc",
9: "tab",
32: "space",
13: "enter",
8: "backspace",
145: "scroll",
20: "capslock",
144: "numlock",
19: "pause",
45: "insert",
36: "home",
46: "del",
35: "end",
33: "pageup",
34: "pagedown",
37: "left",
38: "up",
39: "right",
40: "down",
112: "f1",
113: "f2",
114: "f3",
115: "f4",
116: "f5",
117: "f6",
118: "f7",
119: "f8",
120: "f9",
121: "f10",
122: "f11",
123: "f12"
}, Ta = "#FFFFFF,#CCCCCC,#C0C0C0,#999999,#666666,#333333,#000000,#FFCCCC,#FF6666,#FF0000,#CC0000,#990000,#660000,#330000,#FFCC99,#FF9966,#FF9900,#FF6600,#CC6600,#993300,#663300,#FFFF99,#FFFF66,#FFCC66,#FFCC33,#CC9933,#996633,#663333,#FFFFCC,#FFFF33,#FFFF00,#FFCC00,#999900,#666600,#333300,#99FF99,#66FF99,#33FF33,#33CC00,#009900,#006600,#003300,#99FFFF,#33FFFF,#66CCCC,#00CCCC,#339999,#336666,#003333,#CCFFFF,#66FFFF,#33CCFF,#3366FF,#3333FF,#000099,#000066,#CCCCFF,#9999FF,#6666CC,#6633FF,#6600CC,#333399,#330099,#FFCCFF,#FF99FF,#CC66CC,#CC33CC,#993399,#663366,#330033".split(","),
gb = [{n: "p", t: "\u666e\u901a\u6bb5\u843d"}, {n: "h1", t: "\u6807\u98981"}, {n: "h2", t: "\u6807\u98982"}, {n: "h3", t: "\u6807\u98983"}, {n: "h4", t: "\u6807\u98984"}, {n: "h5", t: "\u6807\u98985"}, {n: "h6", t: "\u6807\u98986"}, {n: "pre", t: "\u5df2\u7f16\u6392\u683c\u5f0f"}, {n: "address", t: "\u5730\u5740"}], hb = [{n: "\u5b8b\u4f53", c: "SimSun"}, {
n: "\u4eff\u5b8b\u4f53",
c: "FangSong_GB2312"
}, {n: "\u9ed1\u4f53", c: "SimHei"}, {n: "\u6977\u4f53", c: "KaiTi_GB2312"}, {n: "\u5fae\u8f6f\u96c5\u9ed1", c: "Microsoft YaHei"}, {n: "Arial"}, {n: "Arial Black"},
{n: "Comic Sans MS"}, {n: "Courier New"}, {n: "System"}, {n: "Times New Roman"}, {n: "Tahoma"}, {n: "Verdana"}], T = [{n: "x-small", s: "10px", t: "\u6781\u5c0f"}, {n: "small", s: "12px", t: "\u7279\u5c0f"}, {n: "medium", s: "16px", t: "\u5c0f"}, {n: "large", s: "18px", t: "\u4e2d"}, {n: "x-large", s: "24px", t: "\u5927"}, {n: "xx-large", s: "32px", t: "\u7279\u5927"}, {
n: "-webkit-xxx-large",
s: "48px",
t: "\u6781\u5927"
}], ib = [{s: "\u5de6\u5bf9\u9f50", v: "justifyleft"}, {s: "\u5c45\u4e2d", v: "justifycenter"}, {s: "\u53f3\u5bf9\u9f50", v: "justifyright"}, {
s: "\u4e24\u7aef\u5bf9\u9f50",
v: "justifyfull"
}], jb = [{s: "\u6570\u5b57\u5217\u8868", v: "insertOrderedList"}, {s: "\u7b26\u53f7\u5217\u8868", v: "insertUnorderedList"}], kb = {
"default": {
name: "\u9ed8\u8ba4", width: 24, height: 24, line: 7, list: {
smile: "\u5fae\u7b11", tongue: "\u5410\u820c\u5934", titter: "\u5077\u7b11", laugh: "\u5927\u7b11", sad: "\u96be\u8fc7", wronged: "\u59d4\u5c48", fastcry: "\u5feb\u54ed\u4e86", cry: "\u54ed", wail: "\u5927\u54ed", mad: "\u751f\u6c14", knock: "\u6572\u6253", curse: "\u9a82\u4eba", crazy: "\u6293\u72c2", angry: "\u53d1\u706b", ohmy: "\u60ca\u8bb6",
awkward: "\u5c34\u5c2c", panic: "\u60ca\u6050", shy: "\u5bb3\u7f9e", cute: "\u53ef\u601c", envy: "\u7fa1\u6155", proud: "\u5f97\u610f", struggle: "\u594b\u6597", quiet: "\u5b89\u9759", shutup: "\u95ed\u5634", doubt: "\u7591\u95ee", despise: "\u9119\u89c6", sleep: "\u7761\u89c9", bye: "\u518d\u89c1"
}
}
}, ka = {
Cut: {t: "\u526a\u5207 (Ctrl+X)"},
Copy: {t: "\u590d\u5236 (Ctrl+C)"},
Paste: {t: "\u7c98\u8d34 (Ctrl+V)"},
Pastetext: {t: "\u7c98\u8d34\u6587\u672c", h: h ? 0 : 1},
Blocktag: {t: "\u6bb5\u843d\u6807\u7b7e", h: 1},
Fontface: {
t: "\u5b57\u4f53",
h: 1
},
FontSize: {t: "\u5b57\u4f53\u5927\u5c0f", h: 1},
Bold: {t: "\u52a0\u7c97 (Ctrl+B)", s: "Ctrl+B"},
Italic: {t: "\u659c\u4f53 (Ctrl+I)", s: "Ctrl+I"},
Underline: {t: "\u4e0b\u5212\u7ebf (Ctrl+U)", s: "Ctrl+U"},
Strikethrough: {t: "\u5220\u9664\u7ebf"},
FontColor: {t: "\u5b57\u4f53\u989c\u8272", h: 1},
BackColor: {t: "\u80cc\u666f\u989c\u8272", h: 1},
SelectAll: {t: "\u5168\u9009 (Ctrl+A)"},
Removeformat: {t: "\u5220\u9664\u6587\u5b57\u683c\u5f0f"},
Align: {t: "\u5bf9\u9f50", h: 1},
List: {t: "\u5217\u8868", h: 1},
Outdent: {t: "\u51cf\u5c11\u7f29\u8fdb"},
Indent: {t: "\u589e\u52a0\u7f29\u8fdb"},
Link: {t: "\u8d85\u94fe\u63a5 (Ctrl+L)", s: "Ctrl+L", h: 1},
Unlink: {t: "\u53d6\u6d88\u8d85\u94fe\u63a5"},
Anchor: {t: "\u951a\u70b9", h: 1},
Img: {t: "\u56fe\u7247", h: 1},
Flash: {t: "Flash\u52a8\u753b", h: 1},
Media: {t: "\u591a\u5a92\u4f53\u6587\u4ef6", h: 1},
Hr: {t: "\u63d2\u5165\u6c34\u5e73\u7ebf"},
Emot: {t: "\u8868\u60c5", s: "ctrl+e", h: 1},
Table: {t: "\u8868\u683c", h: 1},
Source: {t: "\u6e90\u4ee3\u7801"},
Preview: {t: "\u9884\u89c8"},
Print: {t: "\u6253\u5370 (Ctrl+P)", s: "Ctrl+P"},
Fullscreen: {
t: "\u5168\u5c4f\u7f16\u8f91 (Esc)",
s: "Esc"
},
About: {t: "\u5173\u4e8e xhEditor"}
}, Ia = {
mini: "Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img",
simple: "Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Img",
full: "Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen"
};
Ia.mfull = Ia.full.replace(/\|(,Align)/i, "/$1");
var lb = {a: "Link", img: "Img", embed: "Embed"}, mb = {"<": "<", ">": ">", '"': """, "\u00ae": "®", "\u00a9": "©"}, nb = /[<>"\u00ae\u00a9]/g, ra = function (z, o) {
function q(a) {
var a = a.target, b = lb[a.tagName.toLowerCase()];
b && ("Embed" === b && (b = {"application/x-shockwave-flash": "Flash", "application/x-mplayer2": "Media"}[a.type.toLowerCase()]), d.exec(b))
}
function I(a) {
if (27 === a.which)return ta ? d.removeModal() : S && d.hidePanel(), !1
}
function J() {
setTimeout(d.setSource,
10)
}
function U() {
d.getSource()
}
function Ua(a) {
var b, c, f;
if (a && (b = a.originalEvent.clipboardData) && (c = b.items) && (f = c[0]) && "file" == f.kind && f.type.match(/^image\//i))return a = f.getAsFile(), b = new FileReader, b.onload = function () {
var a = '', a = Va(a);
d.pasteHTML(a)
}, b.readAsDataURL(a), !1;
var i = g.cleanPaste;
if (0 === i || x || Ja)return !0;
Ja = !0;
d.saveBookmark();
var a = h ? "pre" : "div", m = e("<" + a + ' class="xhe-paste">\ufeff\ufeff' + a + ">", l).appendTo(l.body), a = m[0];
b = d.getSel();
c = d.getRng(!0);
m.css("top", fa.scrollTop());
h ? (c.moveToElementText(a), c.select()) : (c.selectNodeContents(a), b.removeAllRanges(), b.addRange(c));
setTimeout(function () {
var a = 3 === i, b;
if (a)b = m.text(); else {
var c = [];
e(".xhe-paste", l.body).each(function (a, b) {
0 == e(b).find(".xhe-paste").length && c.push(b.innerHTML)
});
b = c.join("
")
}
m.remove();
d.loadBookmark();
if (b = b.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""))if (a)d.pasteText(b); else if (b = d.cleanHTML(b), b = d.cleanWord(b), b = d.formatXHTML(b), !g.onPaste || g.onPaste && !1 !== (b = g.onPaste(b)))b =
Va(b), d.pasteHTML(b);
Ja = !1
}, 0)
}
function Va(a) {
var b = g.localUrlTest, c = g.remoteImgSaveUrl;
if (b && c) {
var f = [], i = 0, a = a.replace(/(]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig, function (a, c, d, e, s) {
/^(https?|data:image)/i.test(e) && !/_xhe_temp/.test(d) && !b.test(e) && (f[i] = e, d = d.replace(/\s+(width|height)="[^"]*"/ig, "").replace(/\s+src="[^"]*"/ig, ' src="' + ua + 'img/waiting.gif" remoteimg="' + i++ + '"'));
return c + d + s
});
0 < f.length && e.post(c, {urls: f.join("|")}, function (a) {
a = a.split("|");
e("img[remoteimg]",
d.doc).each(function () {
var b = e(this);
L(b, "src", a[b.attr("remoteimg")]);
b.removeAttr("remoteimg")
})
})
}
return a
}
function Ka(a) {
try {
d._exec("styleWithCSS", a, !0)
} catch (b) {
try {
d._exec("useCSS", !a, !0)
} catch (c) {
}
}
}
function La() {
if (Ma && !x) {
Ka(!1);
try {
d._exec("enableObjectResizing", !0, !0)
} catch (a) {
}
if (h)try {
d._exec("BackgroundImageCache", !0, !0)
} catch (b) {
}
}
}
function Ba(a) {
if (x || 13 !== a.which || a.shiftKey || a.ctrlKey || a.altKey)return !0;
a = d.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");
if (a.is("li"))return !0;
if (g.forcePtag)0 === a.length && d._exec("formatblock", "
"); else return d.pasteHTML("
"), h && 0 < a.length && 2 === d.getRng().parentElement().childNodes.length && d.pasteHTML("
"), !1
}
function Na() {
!qa && !R && (la && B.height("100%").css("height", B.outerHeight() - n.outerHeight()), h && n.hide().show())
}
function Da(a) {
a = a.target;
if (a.tagName.match(/(img|embed)/i)) {
var b = d.getSel(), c = d.getRng(!0);
c.selectNode(a);
b.removeAllRanges();
b.addRange(c)
}
}
function L(a, b, c) {
if (!b)return !1;
var d = "_xhe_" + b;
c && (va && (c = V(c,
va, F)), a.attr(b, F ? V(c, "abs", F) : c).removeAttr(d).attr(d, c));
return a.attr(d) || a.attr(b)
}
function Oa() {
sa && d.hidePanel()
}
function ob(a) {
if (x)return !0;
var b = a.which, c = fb[b], b = c ? c : String.fromCharCode(b).toLowerCase();
sKey = "";
sKey += a.ctrlKey ? "ctrl+" : "";
sKey += a.altKey ? "alt+" : "";
sKey += a.shiftKey ? "shift+" : "";
sKey += b;
var a = ma[sKey], f;
for (f in a)if (f = a[f], e.isFunction(f)) {
if (!1 === f.call(d))return !1
} else return d.exec(f), !1
}
function M(a, b) {
var c = typeof a;
return !b ? "undefined" != c : "array" === b && a.hasOwnProperty &&
a instanceof Array ? !0 : c === b
}
function V(a, b, c) {
if (a.match(/^(\w+):\/\//i) && !a.match(/^https?:/i) || /^#/i.test(a) || /^data:/i.test(a))return a;
var d = c ? e('')[0] : location, c = d.protocol, i = d.host, m = d.hostname, j = d.port, d = d.pathname.replace(/\\/g, "/").replace(/[^\/]+$/i, "");
"" === j && (j = "80");
"" === d ? d = "/" : "/" !== d.charAt(0) && (d = "/" + d);
a = e.trim(a);
"abs" !== b && (a = a.replace(RegExp(c + "\\/\\/" + m.replace(/\./g, "\\.") + "(?::" + j + ")" + ("80" === j ? "?" : "") + "(/|$)", "i"), "/"));
"rel" === b && (a = a.replace(RegExp("^" +
d.replace(/([\/\.\+\[\]\(\)])/g, "\\$1"), "i"), ""));
if ("rel" !== b && (a.match(/^(https?:\/\/|\/)/i) || (a = d + a), "/" === a.charAt(0))) {
for (var m = [], a = a.split("/"), p = a.length, d = 0; d < p; d++)j = a[d], ".." === j ? m.pop() : "" !== j && "." !== j && m.push(j);
"" === a[p - 1] && m.push("");
a = "/" + m.join("/")
}
"abs" === b && !a.match(/^https?:\/\//i) && (a = c + "//" + i + a);
return a = a.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i, "$1$2")
}
function Wa(a, b) {
if ("*" === b || a.match(RegExp(".(" + b.replace(/,/g, "|") + ")$", "i")))return !0;
alert("\u4e0a\u4f20\u6587\u4ef6\u6269\u5c55\u540d\u5fc5\u9700\u4e3a: " +
b);
return !1
}
function Xa(a) {
var b = Math.floor(Math.log(a) / Math.log(1024));
return (a / Math.pow(1024, Math.floor(b))).toFixed(2) + "Byte,KB,MB,GB,TB,PB".split(",")[b]
}
function N() {
return !1
}
var d = this, G = e(z), Ya = G.closest("form"), n, B, W, fa, l, ga, ha, Ma = !1, x = !1, la = !1, Ja = !1, Pa, na = !1, Za = "", v = null, wa, oa = !1, Qa = !1, ia = null, X = null, O = 0, g = d.settings = e.extend({}, ra.settings, o), xa = g.plugins, ya = [];
xa && (ka = e.extend({}, ka, xa), e.each(xa, function (a) {
ya.push(a)
}), ya = ya.join(","));
if (g.tools.match(/^\s*(m?full|simple|mini)\s*$/i)) {
var $a =
Ia[e.trim(g.tools)];
g.tools = g.tools.match(/m?full/i) && xa ? $a.replace("Table", "Table," + ya) : $a
}
g.tools.match(/(^|,)\s*About\s*(,|$)/i) || (g.tools += ",About");
g.tools = g.tools.split(",");
if (g.editorRoot)A = g.editorRoot;
!1 === eb && (A = V(A, "abs"));
if (g.urlBase)g.urlBase = V(g.urlBase, "abs");
var ab = "xheCSS_" + g.skin, ja = "xhe" + aa + "_container", bb = "xhe" + aa + "_Tool", cb = "xhe" + aa + "_iframearea", db = "xhe" + aa + "_iframe", za = "xhe" + aa + "_fixffcursor", P = "", Q = "", ua = A + "xheditor_skin/" + g.skin + "/", Aa = kb, va = g.urlType, F = g.urlBase, Y = g.emotPath,
Y = Y ? Y : A + "xheditor_emot/", Ra = "", Aa = e.extend({}, Aa, g.emots), Y = V(Y, "rel", F ? F : null);
(na = g.showBlocktag) && (Q += " showBlocktag");
var ma = [];
this.init = function () {
0 === e("#" + ab).length && e("head").append('');
var a = G.outerWidth(), b = G.outerHeight(), a = g.width || z.style.width || (10 < a ? a : 0);
O = g.height || z.style.height || (10 < b ? b : 150);
M(a, "number") && (a += "px");
M(O, "string") && (O = O.replace(/[^\d]+/g, ""));
var b = g.background || z.style.background, c = [''],
f, i, m = /\||\//i;
e.each(g.tools, function (a, b) {
b.match(m) && c.push('');
if ("|" === b)c.push(''); else if ("/" === b)c.push("
"); else {
f = ka[b];
if (!f)return;
i = f.c ? f.c : "xheIcon xheBtn" + b;
c.push('' + f.t + "");
f.s && d.addShortcuts(f.s, b)
}
b.match(m) &&
c.push('')
});
c.push('
');
G.after(e(' '));
n = e("#" + bb);
B = e("#" + cb);
P = '';
if (a = g.loadCSS)if (M(a, "array"))for (var j in a)P += ''; else P = a.match(/\s*");
j += '