Incs/UEditor/ueditor.all.min.js

(开头部分) 64KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

!function () { UEDITOR_CONFIG = window.UEDITOR_CONFIG || {}; var baidu = window.baidu || {}; window.baidu = baidu, window.UE = baidu.editor = window.UE || {}, UE.plugins = {}, UE.commands = {}, UE.instants = {}, UE.I18N = {}, UE._customizeUI = {}, UE.version = "1.4.3"; var dom = UE.dom = {}, browser = UE.browser = function () { var e = navigator.userAgent.toLowerCase(), t = window.opera, i = { ie: /(msie\s|trident.*rv:)([\w.]+)/.test(e), opera: !!t && t.version, webkit: e.indexOf(" applewebkit/") > -1, mac: e.indexOf("macintosh") > -1, quirks: "BackCompat" == document.compatMode }; i.gecko = "Gecko" == navigator.product && !i.webkit && !i.opera && !i.ie; var n = 0; if (i.ie) { var o = e.match(/(?:msie\s([\w.]+))/), r = e.match(/(?:trident.*rv:([\w.]+))/); n = o && r && o[1] && r[1] ? Math.max(1 * o[1], 1 * r[1]) : o && o[1] ? 1 * o[1] : r && r[1] ? 1 * r[1] : 0, i.ie11Compat = 11 == document.documentMode, i.ie9Compat = 9 == document.documentMode, i.ie8 = !!document.documentMode, i.ie8Compat = 8 == document.documentMode, i.ie7Compat = 7 == n && !document.documentMode || 7 == document.documentMode, i.ie6Compat = n < 7 || i.quirks, i.ie9above = n > 8, i.ie9below = n < 9, i.ie11above = n > 10, i.ie11below = n < 11 } if (i.gecko) { var a = e.match(/rv:([\d\.]+)/); a && (n = 1e4 * (a = a[1].split("."))[0] + 100 * (a[1] || 0) + 1 * (a[2] || 0)) } return /chrome\/(\d+\.\d)/i.test(e) && (i.chrome = +RegExp.$1), /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e) && !/chrome/i.test(e) && (i.safari = +(RegExp.$1 || RegExp.$2)), i.opera && (n = parseFloat(t.version())), i.webkit && (n = parseFloat(e.match(/ applewebkit\/(\d+)/)[1])), i.version = n, i.isCompatible = !i.mobile && (i.ie && n >= 6 || i.gecko && n >= 10801 || i.opera && n >= 9.5 || i.air && n >= 1 || i.webkit && n >= 522 || !1), i }(), ie = browser.ie, webkit = browser.webkit, gecko = browser.gecko, opera = browser.opera, utils = UE.utils = { each: function (e, t, i) { if (null != e) if (e.length === +e.length) { for (var n = 0, o = e.length; n < o; n++)if (!1 === t.call(i, e[n], n, e)) return !1 } else for (var r in e) if (e.hasOwnProperty(r) && !1 === t.call(i, e[r], r, e)) return !1 }, makeInstance: function (e) { var t = new Function; return t.prototype = e, e = new t, t.prototype = null, e }, extend: function (e, t, i) { if (t) for (var n in t) i && e.hasOwnProperty(n) || (e[n] = t[n]); return e }, extend2: function (e) { for (var t = arguments, i = 1; i < t.length; i++) { var n = t[i]; for (var o in n) e.hasOwnProperty(o) || (e[o] = n[o]) } return e }, inherits: function (e, t) { var i = e.prototype, n = utils.makeInstance(t.prototype); return utils.extend(n, i, !0), e.prototype = n, n.constructor = e }, bind: function (e, t) { return function () { return e.apply(t, arguments) } }, defer: function (e, t, i) { var n; return function () { i && clearTimeout(n), n = setTimeout(e, t) } }, indexOf: function (e, t, i) { var n = -1; return i = this.isNumber(i) ? i : 0, this.each(e, function (e, o) { if (o >= i && e === t) return n = o, !1 }), n }, removeItem: function (e, t) { for (var i = 0, n = e.length; i < n; i++)e[i] === t && (e.splice(i, 1), i--) }, trim: function (e) { return e.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, "") }, listToMap: function (e) { if (!e) return {}; e = utils.isArray(e) ? e : e.split(","); for (var t, i = 0, n = {}; t = e[i++];)n[t.toUpperCase()] = n[t] = 1; return n }, unhtml: function (e, t) { return e ? e.replace(t || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (e, t) { return t ? e : { "<": "&lt;", "&": "&amp;", '"': "&quot;", ">": "&gt;", "'": "&#39;" }[e] }) : "" }, unhtmlForUrl: function (e, t) { return e ? e.replace(t || /[<">']/g, function (e) { return { "<": "&lt;", "&": "&amp;", '"': "&quot;", ">": "&gt;", "'": "&#39;" }[e] }) : "" }, html: function (e) { return e ? e.replace(/&((g|l|quo)t|amp|#39|nbsp);/g, function (e) { return { "&lt;": "<", "&amp;": "&", "&quot;": '"', "&gt;": ">", "&#39;": "'", "&nbsp;": " " }[e] }) : "" }, cssStyleToDomStyle: (test = document.createElement("div").style, cache = { float: null != test.cssFloat ? "cssFloat" : null != test.styleFloat ? "styleFloat" : "float" }, function (e) { return cache[e] || (cache[e] = e.toLowerCase().replace(/-./g, function (e) { return e.charAt(1).toUpperCase() })) }), loadFile: function () { var e = []; function t(t, i) { try { for (var n, o = 0; n = e[o++];)if (n.doc === t && n.url == (i.src || i.href)) return n } catch (e) { return null } } return function (i, n, o) { var r = t(i, n); if (r) r.ready ? o && o() : r.funs.push(o); else if (e.push({ doc: i, url: n.src || n.href, funs: [o] }), i.body) { if (!n.id || !i.getElementById(n.id)) { var a = i.createElement(n.tag); for (var s in delete n.tag, n) a.setAttribute(s, n[s]); a.onload = a.onreadystatechange = function () { if (!this.readyState || /loaded|complete/.test(this.readyState)) { if ((r = t(i, n)).funs.length > 0) { r.ready = 1; for (var e; e = r.funs.pop();)e() } a.onload = a.onreadystatechange = null } }, a.onerror = function () { throw Error("The load " + (n.href || n.src) + " fails,check the url settings of file ueditor.config.js ") }, i.getElementsByTagName("head")[0].appendChild(a) } } else { var l = []; for (var s in n) "tag" != s && l.push(s + '="' + n[s] + '"'); i.write("<" + n.tag + " " + l.join(" ") + " ></" + n.tag + ">") } } }(), isEmptyObject: function (e) { if (null == e) return !0; if (this.isArray(e) || this.isString(e)) return 0 === e.length; for (var t in e) if (e.hasOwnProperty(t)) return !1; return !0 }, fixColor: function (e, t) { if (/color/i.test(e) && /rgba?/.test(t)) { var i = t.split(","); if (i.length > 3) return ""; t = "#"; for (var n, o = 0; n = i[o++];)t += 1 == (n = parseInt(n.replace(/[^\d]/gi, ""), 10).toString(16)).length ? "0" + n : n; t = t.toUpperCase() } return t }, optCss: function (e) { var t, i; function n(e, t) { if (!e) return ""; var i = e.top, n = e.bottom, o = e.left, r = e.right, a = ""; if (i && o && n && r) a += ";" + t + ":" + (i == n && n == o && o == r ? i : i == n && o == r ? i + " " + o : o == r ? i + " " + o + " " + n : i + " " + r + " " + n + " " + o) + ";"; else for (var s in e) a += ";" + t + "-" + s + ":" + e[s] + ";"; return a } return e = e.replace(/(padding|margin|border)\-([^:]+):([^;]+);?/gi, function (e, n, o, r) { if (1 == r.split(" ").length) switch (n) { case "padding": return !t && (t = {}), t[o] = r, ""; case "margin": return !i && (i = {}), i[o] = r, ""; case "border": return "initial" == r ? "" : e }return e }), (e += n(t, "padding") + n(i, "margin")).replace(/^[ \n\r\t;]*|[ \n\r\t]*$/, "").replace(/;([ \n\r\t]+)|\1;/g, ";").replace(/(&((l|g)t|quot|#39))?;{2,}/g, function (e, t) { return t ? t + ";;" : ";" }) }, clone: function (e, t) { var i; for (var n in t = t || {}, e) e.hasOwnProperty(n) && ("object" == typeof (i = e[n]) ? (t[n] = utils.isArray(i) ? [] : {}, utils.clone(e[n], t[n])) : t[n] = i); return t }, transUnitToPx: function (e) { if (!/(pt|cm)/.test(e)) return e; var t; switch (e.replace(/([\d.]+)(\w+)/, function (i, n, o) { e = n, t = o }), t) { case "cm": e = 25 * parseFloat(e); break; case "pt": e = Math.round(96 * parseFloat(e) / 72) }return e + (e ? "px" : "") }, domReady: function () { var e = []; function t(t) { t.isReady = !0; for (var i; i = e.pop(); i()); } return function (i, n) { var o = (n = n || window).document; i && e.push(i), "complete" === o.readyState ? t(o) : (o.isReady && t(o), browser.ie && 11 != browser.version ? (!function () { if (!o.isReady) { try { o.documentElement.doScroll("left") } catch (e) { return void setTimeout(arguments.callee, 0) } t(o) } }(), n.attachEvent("onload", function () { t(o) })) : (o.addEventListener("DOMContentLoaded", function () { o.removeEventListener("DOMContentLoaded", arguments.callee, !1), t(o) }, !1), n.addEventListener("load", function () { t(o) }, !1))) } }(), cssRule: browser.ie && 11 != browser.version ? function (e, t, i) { var n, o; return void 0 === t || t && t.nodeType && 9 == t.nodeType ? void 0 !== (o = (n = (i = t && t.nodeType && 9 == t.nodeType ? t : i || document).indexList || (i.indexList = {}))[e]) ? i.styleSheets[o].cssText : void 0 : (o = (n = (i = i || document).indexList || (i.indexList = {}))[e], "" === t ? void 0 !== o && (i.styleSheets[o].cssText = "", delete n[e], !0) : (void 0 !== o ? sheetStyle = i.styleSheets[o] : (sheetStyle = i.createStyleSheet("", o = i.styleSheets.length), n[e] = o), void (sheetStyle.cssText = t))) } : function (e, t, i) { var n; return void 0 === t || t && t.nodeType && 9 == t.nodeType ? (n = (i = t && t.nodeType && 9 == t.nodeType ? t : i || document).getElementById(e)) ? n.innerHTML : void 0 : (n = (i = i || document).getElementById(e), "" === t ? !!n && (n.parentNode.removeChild(n), !0) : void (n ? n.innerHTML = t : ((n = i.createElement("style")).id = e, n.innerHTML = t, i.getElementsByTagName("head")[0].appendChild(n)))) }, sort: function (e, t) { t = t || function (e, t) { return e.localeCompare(t) }; for (var i = 0, n = e.length; i < n; i++)for (var o = i, r = e.length; o < r; o++)if (t(e[i], e[o]) > 0) { var a = e[i]; e[i] = e[o], e[o] = a } return e }, serializeParam: function (e) { var t = []; for (var i in e) if ("method" != i && "timeout" != i && "async" != i) if ("function" != (typeof e[i]).toLowerCase() && "object" != (typeof e[i]).toLowerCase()) t.push(encodeURIComponent(i) + "=" + encodeURIComponent(e[i])); else if (utils.isArray(e[i])) for (var n = 0; n < e[i].length; n++)t.push(encodeURIComponent(i) + "[]=" + encodeURIComponent(e[i][n])); return t.join("&") }, formatUrl: function (e) { var t = e.replace(/&&/g, "&"); return t = (t = (t = (t = t.replace(/\?&/g, "?")).replace(/&$/g, "")).replace(/&#/g, "#")).replace(/&+/g, "&") }, isCrossDomainUrl: function (e) { var t = document.createElement("a"); return t.href = e, browser.ie && (t.href = t.href), !(t.protocol == location.protocol && t.hostname == location.hostname && (t.port == location.port || "80" == t.port && "" == location.port || "" == t.port && "80" == location.port)) }, clearEmptyAttrs: function (e) { for (var t in e) "" === e[t] && delete e[t]; return e }, str2json: function (e) { return utils.isString(e) ? window.JSON ? JSON.parse(e) : new Function("return " + utils.trim(e || ""))() : null }, json2str: function () { if (window.JSON) return JSON.stringify; { var e = { "\b": "\\b", "\t": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }; function t(e) { return e < 10 ? "0" + e : e } return function (i) { switch (typeof i) { case "undefined": return "undefined"; case "number": return isFinite(i) ? String(i) : "null"; case "string": return /["\\\x00-\x1f]/.test(l = i) && (l = l.replace(/["\\\x00-\x1f]/g, function (t) { var i = e[t]; return i || (i = t.charCodeAt(), "\\u00" + Math.floor(i / 16).toString(16) + (i % 16).toString(16)) })), '"' + l + '"'; case "boolean": return String(i); default: if (null === i) return "null"; if (utils.isArray(i)) return function (e) { var t, i, n, o = ["["], r = e.length; for (i = 0; i < r; i++)switch (typeof (n = e[i])) { case "undefined": case "function": case "unknown": break; default: t && o.push(","), o.push(utils.json2str(n)), t = 1 }return o.push("]"), o.join("") }(i); if (utils.isDate(i)) return function (e) { return '"' + e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + "T" + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + '"' }(i); var n, o, r = ["{"], a = utils.json2str; for (var s in i) if (Object.prototype.hasOwnProperty.call(i, s)) switch (typeof (o = i[s])) { case "undefined": case "unknown": case "function": break; default: n && r.push(","), n = 1, r.push(a(s) + ":" + a(o)) }return r.push("}"), r.join("") }var l } } }() }, test, cache; utils.each(["String", "Function", "Array", "Number", "RegExp", "Object", "Date"], function (e) { UE.utils["is" + e] = function (t) { return Object.prototype.toString.apply(t) == "[object " + e + "]" } }); var EventBase = UE.EventBase = function () { }; function getListener(e, t, i) { var n; return t = t.toLowerCase(), (n = e.__allListeners || i && (e.__allListeners = {})) && (n[t] || i && (n[t] = [])) } EventBase.prototype = { addListener: function (e, t) { e = utils.trim(e).split(/\s+/); for (var i, n = 0; i = e[n++];)getListener(this, i, !0).push(t) }, on: function (e, t) { return this.addListener(e, t) }, off: function (e, t) { return this.removeListener(e, t) }, trigger: function () { return this.fireEvent.apply(this, arguments) }, removeListener: function (e, t) { e = utils.trim(e).split(/\s+/); for (var i, n = 0; i = e[n++];)utils.removeItem(getListener(this, i) || [], t) }, fireEvent: function () { var e = arguments[0]; e = utils.trim(e).split(" "); for (var t, i = 0; t = e[i++];) { var n, o, r, a = getListener(this, t); if (a) for (r = a.length; r--;)if (a[r]) { if (!0 === (o = a[r].apply(this, arguments))) return o; void 0 !== o && (n = o) } (o = this["on" + t.toLowerCase()]) && (n = o.apply(this, arguments)) } return n } }; var dtd = dom.dtd = function () { function e(e) { for (var t in e) e[t.toUpperCase()] = e[t]; return e } var t = utils.extend2, i = e({ isindex: 1, fieldset: 1 }), n = e({ input: 1, button: 1, select: 1, textarea: 1, label: 1 }), o = t(e({ a: 1 }), n), r = t({ iframe: 1 }, o), a = e({ hr: 1, ul: 1, menu: 1, div: 1, blockquote: 1, noscript: 1, table: 1, center: 1, address: 1, dir: 1, pre: 1, h5: 1, dl: 1, h4: 1, noframes: 1, h6: 1, ol: 1, h1: 1, h3: 1, h2: 1 }), s = e({ ins: 1, del: 1, script: 1, style: 1 }), l = t(e({ b: 1, acronym: 1, bdo: 1, var: 1, "#": 1, abbr: 1, code: 1, br: 1, i: 1, cite: 1, kbd: 1, u: 1, strike: 1, s: 1, tt: 1, strong: 1, q: 1, samp: 1, em: 1, dfn: 1, span: 1 }), s), d = t(e({ sub: 1, img: 1, embed: 1, object: 1, sup: 1, basefont: 1, map: 1, applet: 1, font: 1, big: 1, small: 1 }), l), c = t(e({ p: 1 }), d), u = t(e({ iframe: 1 }), d, n), m = e({ img: 1, embed: 1, noscript: 1, br: 1, kbd: 1, center: 1, button: 1, basefont: 1, h5: 1, h4: 1, samp: 1, h6: 1, ol: 1, h1: 1, h3: 1, h2: 1, form: 1, font: 1, "#": 1, select: 1, menu: 1, ins: 1, abbr: 1, label: 1, code: 1, table: 1, script: 1, cite: 1, input: 1, iframe: 1, strong: 1, textarea: 1, noframes: 1, big: 1, small: 1, span: 1, hr: 1, sub: 1, bdo: 1, var: 1, div: 1, object: 1, sup: 1, strike: 1, dir: 1, map: 1, dl: 1, applet: 1, del: 1, isindex: 1, fieldset: 1, ul: 1, b: 1, acronym: 1, a: 1, blockquote: 1, i: 1, u: 1, s: 1, tt: 1, address: 1, q: 1, pre: 1, p: 1, em: 1, dfn: 1 }), f = t(e({ a: 0 }), u), h = e({ tr: 1 }), p = e({ "#": 1 }), g = t(e({ param: 1 }), m), v = t(e({ form: 1 }), i, r, a, c), b = e({ li: 1, ol: 1, ul: 1 }), y = e({ style: 1, script: 1 }), C = e({ base: 1, link: 1, meta: 1, title: 1 }), N = t(C, y), x = e({ head: 1, body: 1 }), w = e({ html: 1 }), U = e({ address: 1, blockquote: 1, center: 1, dir: 1, div: 1, dl: 1, fieldset: 1, form: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, hr: 1, isindex: 1, menu: 1, noframes: 1, ol: 1, p: 1, pre: 1, table: 1, ul: 1 }), E = e({ area: 1, base: 1, basefont: 1, br: 1, col: 1, command: 1, dialog: 1, embed: 1, hr: 1, img: 1, input: 1, isindex: 1, keygen: 1, link: 1, meta: 1, param: 1, source: 1, track: 1, wbr: 1 }); return e({ $nonBodyContent: t(w, x, C), $block: U, $inline: f, $inlineWithA: t(e({ a: 1 }), f), $body: t(e({ script: 1, style: 1 }), U), $cdata: e({ script: 1, style: 1 }), $empty: E, $nonChild: e({ iframe: 1, textarea: 1 }), $listItem: e({ dd: 1, dt: 1, li: 1 }), $list: e({ ul: 1, ol: 1, dl: 1 }), $isNotEmpty: e({ table: 1, ul: 1, ol: 1, dl: 1, iframe: 1, area: 1, base: 1, col: 1, hr: 1, img: 1, embed: 1, input: 1, link: 1, meta: 1, param: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1 }), $removeEmpty: e({ a: 1, abbr: 1, acronym: 1, address: 1, b: 1, bdo: 1, big: 1, cite: 1, code: 1, del: 1, dfn: 1, em: 1, font: 1, i: 1, ins: 1, label: 1, kbd: 1, q: 1, s: 1, samp: 1, small: 1, span: 1, strike: 1, strong: 1, sub: 1, sup: 1, tt: 1, u: 1, var: 1 }), $removeEmptyBlock: e({ p: 1, div: 1 }), $tableContent: e({ caption: 1, col: 1, colgroup: 1, tbody: 1, td: 1, tfoot: 1, th: 1, thead: 1, tr: 1, table: 1 }), $notTransContent: e({ pre: 1, script: 1, style: 1, textarea: 1 }), html: x, head: N, style: p, script: p, body: v, base: {}, link: {}, meta: {}, title: p, col: {}, tr: e({ td: 1, th: 1 }), img: {}, embed: {}, colgroup: e({ thead: 1, col: 1, tbody: 1, tr: 1, tfoot: 1 }), noscript: v, td: v, br: {}, th: v, center: v, kbd: f, button: t(c, a), basefont: {}, h5: f, h4: f, samp: f, h6: f, ol: b, h1: f, h3: f, option: p, h2: f, form: t(i, r, a, c), select: e({ optgroup: 1, option: 1 }), font: f, ins: f, menu: b, abbr: f, label: f, table: e({ thead: 1, col: 1, tbody: 1, tr: 1, colgroup: 1, caption: 1, tfoot: 1 }), code: f, tfoot: h, cite: f, li: v, input: {}, iframe: v, strong: f, textarea: p, noframes: v, big: f, small: f, span: e({ "#": 1, br: 1, b: 1, strong: 1, u: 1, i: 1, em: 1, sub: 1, sup: 1, strike: 1, span: 1 }), hr: f, dt: f, sub: f, optgroup: e({ option: 1 }), param: {}, bdo: f, var: f, div: v, object: g, sup: f, dd: v, strike: f, area: {}, dir: b, map: t(e({ area: 1, form: 1, p: 1 }), i, s, a), applet: g, dl: e({ dt: 1, dd: 1 }), del: f, isindex: {}, fieldset: t(e({ legend: 1 }), m), thead: h, ul: b, acronym: f, b: f, a: t(e({ a: 1 }), u), blockquote: t(e({ td: 1, tr: 1, tbody: 1, li: 1 }), v), caption: f, i: f, u: f, tbody: h, s: f, address: t(r, c), tt: f, legend: f, q: f, pre: t(l, o), p: t(e({ a: 1 }), f), em: f, dfn: f }) }(); function getDomNode(e, t, i, n, o, r) { var a, s = n && e[t]; for (!s && (s = e[i]); !s && (a = (a || e).parentNode);) { if ("BODY" == a.tagName || r && !r(a)) return null; s = a[i] } return s && o && !o(s) ? getDomNode(s, t, i, !1, o) : s } var attrFix = ie && browser.version < 9 ? { tabindex: "tabIndex", readonly: "readOnly", for: "htmlFor", class: "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder" } : { tabindex: "tabIndex", readonly: "readOnly" }, styleBlock = utils.listToMap(["-webkit-box", "-moz-box", "block", "list-item", "table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption"]), domUtils = dom.domUtils = { NODE_ELEMENT: 1, NODE_DOCUMENT: 9, NODE_TEXT: 3, NODE_COMMENT: 8, NODE_DOCUMENT_FRAGMENT: 11, POSITION_IDENTICAL: 0, POSITION_DISCONNECTED: 1, POSITION_FOLLOWING: 2, POSITION_PRECEDING: 4, POSITION_IS_CONTAINED: 8, POSITION_CONTAINS: 16, fillChar: ie && "6" == browser.version ? "\ufeff" : "​", keys: { 8: 1, 46: 1, 16: 1, 17: 1, 18: 1, 37: 1, 38: 1, 39: 1, 40: 1, 13: 1 }, getPosition: function (e, t) { if (e === t) return 0; var i, n = [e], o = [t]; for (i = e; i = i.parentNode;) { if (i === t) return 10; n.push(i) } for (i = t; i = i.parentNode;) { if (i === e) return 20; o.push(i) } if (n.reverse(), o.reverse(), n[0] !== o[0]) return 1; for (var r = -1; n[++r] === o[r];); for (e = n[r], t = o[r]; e = e.nextSibling;)if (e === t) return 4; return 2 }, getNodeIndex: function (e, t) { for (var i = e, n = 0; i = i.previousSibling;)t && 3 == i.nodeType ? i.nodeType != i.nextSibling.nodeType && n++ : n++; return n }, inDoc: function (e, t) { return 10 == domUtils.getPosition(e, t) }, findParent: function (e, t, i) { if (e && !domUtils.isBody(e)) for (e = i ? e : e.parentNode; e;) { if (!t || t(e) || domUtils.isBody(e)) return t && !t(e) && domUtils.isBody(e) ? null : e; e = e.parentNode } return null }, findParentByTagName: function (e, t, i, n) { return t = utils.listToMap(utils.isArray(t) ? t : [t]), domUtils.findParent(e, function (e) { return t[e.tagName] && !(n && n(e)) }, i) }, findParents: function (e, t, i, n) { for (var o = t && (i && i(e) || !i) ? [e] : []; e = domUtils.findParent(e, i);)o.push(e); return n ? o : o.reverse() }, insertAfter: function (e, t) { return e.nextSibling ? e.parentNode.insertBefore(t, e.nextSibling) : e.parentNode.appendChild(t) }, remove: function (e, t) { var i, n = e.parentNode; if (n) { if (t && e.hasChildNodes()) for (; i = e.firstChild;)n.insertBefore(i, e); n.removeChild(e) } return e }, getNextDomNode: function (e, t, i, n) { return getDomNode(e, "firstChild", "nextSibling", t, i, n) }, getPreDomNode: function (e, t, i, n) { return getDomNode(e, "lastChild", "previousSibling", t, i, n) }, isBookmarkNode: function (e) { return 1 == e.nodeType && e.id && /^_baidu_bookmark_/i.test(e.id) }, getWindow: function (e) { var t = e.ownerDocument || e; return t.defaultView || t.parentWindow }, getCommonAncestor: function (e, t) { if (e === t) return e; for (var i = [e], n = [t], o = e, r = -1; o = o.parentNode;) { if (o === t) return o; i.push(o) } for (o = t; o = o.parentNode;) { if (o === e) return o; n.push(o) } for (i.reverse(), n.reverse(); i[++r] === n[r];); return 0 == r ? null : i[r - 1] }, clearEmptySibling: function (e, t, i) { function n(e, t) { for (var i; e && !domUtils.isBookmarkNode(e) && (domUtils.isEmptyInlineElement(e) || !new RegExp("[^\t\n\r" + domUtils.fillChar + "]").test(e.nodeValue));)i = e[t], domUtils.remove(e), e = i } !t && n(e.nextSibling, "nextSibling"), !i && n(e.previousSibling, "previousSibling") }, split: function (e, t) { var i = e.ownerDocument; if (browser.ie && t == e.nodeValue.length) { var n = i.createTextNode(""); return domUtils.insertAfter(e, n) } var o = e.splitText(t); if (browser.ie8) { var r = i.createTextNode(""); domUtils.insertAfter(o, r), domUtils.remove(r) } return o }, isWhitespace: function (e) { return !new RegExp("[^ \t\n\r" + domUtils.fillChar + "]").test(e.nodeValue) }, getXY: function (e) { for (var t = 0, i = 0; e.offsetParent;)i += e.offsetTop, t += e.offsetLeft, e = e.offsetParent; return { x: t, y: i } }, on: function (e, t, i) { var n = utils.isArray(t) ? t : utils.trim(t).split(/\s+/), o = n.length; if (o) for (; o--;)if (t = n[o], e.addEventListener) e.addEventListener(t, i, !1); else { i._d || (i._d = { els: [] }); var r = t + i.toString(), a = utils.indexOf(i._d.els, e); i._d[r] && -1 != a || (-1 == a && i._d.els.push(e), i._d[r] || (i._d[r] = function (e) { return i.call(e.srcElement, e || window.event) }), e.attachEvent("on" + t, i._d[r])) } e = null }, un: function (e, t, i) { var n = utils.isArray(t) ? t : utils.trim(t).split(/\s+/), o = n.length; if (o) for (; o--;)if (t = n[o], e.removeEventListener) e.removeEventListener(t, i, !1); else { var r = t + i.toString(); try { e.detachEvent("on" + t, i._d ? i._d[r] : i) } catch (e) { } if (i._d && i._d[r]) { var a = utils.indexOf(i._d.els, e); -1 != a && i._d.els.splice(a, 1), 0 == i._d.els.length && delete i._d[r] } } }, isSameElement: function (e, t) { if (e.tagName != t.tagName) return !1; var i = e.attributes, n = t.attributes; if (!ie && i.length != n.length) return !1; for (var o, r, a = 0, s = 0, l = 0; o = i[l++];) { if ("style" == o.nodeName) { if (o.specified && a++, domUtils.isSameStyle(e, t)) continue; return !1 } if (ie) { if (!o.specified) continue; a++, r = n.getNamedItem(o.nodeName) } else r = t.attributes[o.nodeName]; if (!r.specified || o.nodeValue != r.nodeValue) return !1 } if (ie) { for (l = 0; r = n[l++];)r.specified && s++; if (a != s) return !1 } return !0 }, isSameStyle: function (e, t) { var i = e.style.cssText.replace(/( ?; ?)/g, ";").replace(/( ?: ?)/g, ":"), n = t.style.cssText.replace(/( ?; ?)/g, ";").replace(/( ?: ?)/g, ":"); if (browser.opera) { if (i = e.style, n = t.style, i.length != n.length) return !1; for (var o in i) if (!/^(\d+|csstext)$/i.test(o) && i[o] != n[o]) return !1; return !0 } if (!i || !n) return i == n; if (i = i.split(";"), n = n.split(";"), i.length != n.length) return !1; for (var r, a = 0; r = i[a++];)if (-1 == utils.indexOf(n, r)) return !1; return !0 }, isBlockElm: function (e) { return 1 == e.nodeType && (dtd.$block[e.tagName] || styleBlock[domUtils.getComputedStyle(e, "display")]) && !dtd.$nonChild[e.tagName] }, isBody: function (e) { return e && 1 == e.nodeType && "body" == e.tagName.toLowerCase() }, breakParent: function (e, t) { var i, n, o, r = e, a = e; do { for (r = r.parentNode, n ? ((i = r.cloneNode(!1)).appendChild(n), n = i, (i = r.cloneNode(!1)).appendChild(o), o = i) : o = (n = r.cloneNode(!1)).cloneNode(!1); i = a.previousSibling;)n.insertBefore(i, n.firstChild); for (; i = a.nextSibling;)o.appendChild(i); a = r } while (t !== r); return (i = t.parentNode).insertBefore(n, t), i.insertBefore(o, t), i.insertBefore(e, o), domUtils.remove(t), e }, isEmptyInlineElement: function (e) { if (1 != e.nodeType || !dtd.$removeEmpty[e.tagName]) return 0; for (e = e.firstChild; e;) { if (domUtils.isBookmarkNode(e)) return 0; if (1 == e.nodeType && !domUtils.isEmptyInlineElement(e) || 3 == e.nodeType && !domUtils.isWhitespace(e)) return 0; e = e.nextSibling } return 1 }, trimWhiteTextNode: function (e) { function t(t) { for (var i; (i = e[t]) && 3 == i.nodeType && domUtils.isWhitespace(i);)e.removeChild(i) } t("firstChild"), t("lastChild") }, mergeChild: function (e, t, i) { for (var n, o = domUtils.getElementsByTagName(e, e.tagName.toLowerCase()), r = 0; n = o[r++];)if (n.parentNode && !domUtils.isBookmarkNode(n)) if ("span" != n.tagName.toLowerCase()) domUtils.isSameElement(e, n) && domUtils.remove(n, !0); else { if (e === n.parentNode && (domUtils.trimWhiteTextNode(e), 1 == e.childNodes.length)) { e.style.cssText = n.style.cssText + ";" + e.style.cssText, domUtils.remove(n, !0); continue } if (n.style.cssText = e.style.cssText + ";" + n.style.cssText, i) { var a = i.style; if (a) { a = a.split(";"); for (var s, l = 0; s = a[l++];)n.style[utils.cssStyleToDomStyle(s.split(":")[0])] = s.split(":")[1] } } domUtils.isSameStyle(n, e) && domUtils.remove(n, !0) } }, getElementsByTagName: function (e, t, i) { if (i && utils.isString(i)) { var n = i; i = function (e) { return domUtils.hasClass(e, n) } } t = utils.trim(t).replace(/[ ]{2,}/g, " ").split(" "); for (var o, r = [], a = 0; o = t[a++];)for (var s, l = e.getElementsByTagName(o), d = 0; s = l[d++];)i && !i(s) || r.push(s); return r }, mergeToParent: function (e) { for (var t = e.parentNode; t && dtd.$removeEmpty[t.tagName];) { if (t.tagName == e.tagName || "A" == t.tagName) { if (domUtils.trimWhiteTextNode(t), "SPAN" == t.tagName && !domUtils.isSameStyle(t, e) || "A" == t.tagName && "SPAN" == e.tagName) { if (t.childNodes.length > 1 || t !== e.parentNode) { e.style.cssText = t.style.cssText + ";" + e.style.cssText, t = t.parentNode; continue } t.style.cssText += ";" + e.style.cssText, "A" == t.tagName && (t.style.textDecoration = "underline") } if ("A" != t.tagName) { t === e.parentNode && domUtils.remove(e, !0); break } } t = t.parentNode } }, mergeSibling: function (e, t, i) { function n(e, t, i) { var n; if ((n = i[e]) && !domUtils.isBookmarkNode(n) && 1 == n.nodeType && domUtils.isSameElement(i, n)) { for (; n.firstChild;)"firstChild" == t ? i.insertBefore(n.lastChild, i.firstChild) : i.appendChild(n.firstChild); domUtils.remove(n) } } !t && n("previousSibling", "firstChild", e), !i && n("nextSibling", "lastChild", e) }, unSelectable: ie && browser.ie9below || browser.opera ? function (e) { e.onselectstart = function () { return !1 }, e.onclick = e.onkeyup = e.onkeydown = function () { return !1 }, e.unselectable = "on", e.setAttribute("unselectable", "on"); for (var t, i = 0; t = e.all[i++];)switch (t.tagName.toLowerCase()) { case "iframe": case "textarea": case "input": case "select": break; default: t.unselectable = "on", e.setAttribute("unselectable", "on") } } : function (e) { e.style.MozUserSelect = e.style.webkitUserSelect = e.style.msUserSelect = e.style.KhtmlUserSelect = "none" }, removeAttributes: function (e, t) { t = utils.isArray(t) ? t : utils.trim(t).replace(/[ ]{2,}/g, " ").split(" "); for (var i, n = 0; i = t[n++];) { switch (i = attrFix[i] || i) { case "className": e[i] = ""; break; case "style": e.style.cssText = ""; var o = e.getAttributeNode("style"); !browser.ie && o && e.removeAttributeNode(o) }e.removeAttribute(i) } }, createElement: function (e, t, i) { return domUtils.setAttributes(e.createElement(t), i) }, setAttributes: function (e, t) { for (var i in t) if (t.hasOwnProperty(i)) { var n = t[i]; switch (i) { case "class": e.className = n; break; case "style": e.style.cssText = e.style.cssText + ";" + n; break; case "innerHTML": e[i] = n; break; case "value": e.value = n; break; default: e.setAttribute(attrFix[i] || i, n) } } return e }, getComputedStyle: function (e, t) { if ("width height top left".indexOf(t) > -1) return e["offset" + t.replace(/^\w/, function (e) { return e.toUpperCase() })] + "px"; if (3 == e.nodeType && (e = e.parentNode), browser.ie && browser.version < 9 && "font-size" == t && !e.style.fontSize && !dtd.$empty[e.tagName] && !dtd.$nonChild[e.tagName]) { var i = e.ownerDocument.createElement("span"); i.style.cssText = "padding:0;border:0;font-family:simsun;", i.innerHTML = ".", e.appendChild(i); var n = i.offsetHeight; return e.removeChild(i), i = null, n + "px" } try { var o = domUtils.getStyle(e, t) || (window.getComputedStyle ? domUtils.getWindow(e).getComputedStyle(e, "").getPropertyValue(t) : (e.currentStyle || e.style)[utils.cssStyleToDomStyle(t)]) } catch (e) { return "" } return utils.transUnitToPx(utils.fixColor(t, o)) }, removeClasses: function (e, t) { t = utils.isArray(t) ? t : utils.trim(t).replace(/[ ]{2,}/g, " ").split(" "); for (var i, n = 0, o = e.className; i = t[n++];)o = o.replace(new RegExp("\\b" + i + "\\b"), ""); (o = utils.trim(o).replace(/[ ]{2,}/g, " ")) ? e.className = o : domUtils.removeAttributes(e, ["class"]) }, addClass: function (e, t) { if (e) { t = utils.trim(t).replace(/[ ]{2,}/g, " ").split(" "); for (var i, n = 0, o = e.className; i = t[n++];)new RegExp("\\b" + i + "\\b").test(o) || (o += " " + i); e.className = utils.trim(o) } }, hasClass: function (e, t) { if (utils.isRegExp(t)) return t.test(e.className); t = utils.trim(t).replace(/[ ]{2,}/g, " ").split(" "); for (var i, n = 0, o = e.className; i = t[n++];)if (!new RegExp("\\b" + i + "\\b", "i").test(o)) return !1; return n - 1 == t.length }, preventDefault: function (e) { e.preventDefault ? e.preventDefault() : e.returnValue = !1 }, removeStyle: function (e, t) { browser.ie ? ("color" == t && (t = "(^|;)" + t), e.style.cssText = e.style.cssText.replace(new RegExp(t + "[^:]*:[^;]+;?", "ig"), "")) : e.style.removeProperty ? e.style.removeProperty(t) : e.style.removeAttribute(utils.cssStyleToDomStyle(t)), e.style.cssText || domUtils.removeAttributes(e, ["style"]) }, getStyle: function (e, t) { var i = e.style[utils.cssStyleToDomStyle(t)]; return utils.fixColor(t, i) }, setStyle: function (e, t, i) { e.style[utils.cssStyleToDomStyle(t)] = i, utils.trim(e.style.cssText) || this.removeAttributes(e, "style") }, setStyles: function (e, t) { for (var i in t) t.hasOwnProperty(i) && domUtils.setStyle(e, i, t[i]) }, removeDirtyAttr: function (e) { for (var t, i = 0, n = e.getElementsByTagName("*"); t = n[i++];)t.removeAttribute("_moz_dirty"); e.removeAttribute("_moz_dirty") }, getChildCount: function (e, t) { var i = 0, n = e.firstChild; for (t = t || function () { return 1 }; n;)t(n) && i++, n = n.nextSibling; return i }, isEmptyNode: function (e) { return !e.firstChild || 0 == domUtils.getChildCount(e, function (e) { return !domUtils.isBr(e) && !domUtils.isBookmarkNode(e) && !domUtils.isWhitespace(e) }) }, clearSelectedArr: function (e) { for (var t; t = e.pop();)domUtils.removeAttributes(t, ["class"]) }, scrollToView: function (e, t, i) { var n, o, r = (n = t.document, o = "CSS1Compat" == n.compatMode, { width: (o ? n.documentElement.clientWidth : n.body.clientWidth) || 0, height: (o ? n.documentElement.clientHeight : n.body.clientHeight) || 0 }).height, a = -1 * r + i; a += e.offsetHeight || 0, a += domUtils.getXY(e).y; var s = function (e) { if ("pageXOffset" in e) return { x: e.pageXOffset || 0, y: e.pageYOffset || 0 }; var t = e.document; return { x: t.documentElement.scrollLeft || t.body.scrollLeft || 0, y: t.documentElement.scrollTop || t.body.scrollTop || 0 } }(t).y; (a > s || a < s - r) && t.scrollTo(0, a + (a < 0 ? -20 : 20)) }, isBr: function (e) { return 1 == e.nodeType && "BR" == e.tagName }, isFillChar: function (e, t) { if (3 != e.nodeType) return !1; var i = e.nodeValue; return t ? new RegExp("^" + domUtils.fillChar).test(i) : !i.replace(new RegExp(domUtils.fillChar, "g"), "").length }, isStartInblock: function (e) { var t, i = e.cloneRange(), n = 0, o = i.startContainer; if (1 == o.nodeType && o.childNodes[i.startOffset]) for (var r = (o = o.childNodes[i.startOffset]).previousSibling; r && domUtils.isFillChar(r);)o = r, r = r.previousSibling; for (this.isFillChar(o, !0) && 1 == i.startOffset && (i.setStartBefore(o), o = i.startContainer); o && domUtils.isFillChar(o);)t = o, o = o.previousSibling; for (t && (i.setStartBefore(t), o = i.startContainer), 1 == o.nodeType && domUtils.isEmptyNode(o) && 1 == i.startOffset && i.setStart(o, 0).collapse(!0); !i.startOffset;) { if (o = i.startContainer, domUtils.isBlockElm(o) || domUtils.isBody(o)) { n = 1; break } var a; if (r = i.startContainer.previousSibling) { for (; r && domUtils.isFillChar(r);)a = r, r = r.previousSibling; a ? i.setStartBefore(a) : i.setStartBefore(i.startContainer) } else i.setStartBefore(i.startContainer) } return n && !domUtils.isBody(i.startContainer) ? 1 : 0 }, isEmptyBlock: function (e, t) { if (1 != e.nodeType) return 0; if (t = t || new RegExp("[  \t\r\n" + domUtils.fillChar + "]", "g"), e[browser.ie ? "innerText" : "textContent"].replace(t, "").length > 0) return 0; for (var i in dtd.$isNotEmpty) if (e.getElementsByTagName(i).length) return 0; return 1 }, setViewportOffset: function (e, t) { var i = 0 | parseInt(e.style.left), n = 0 | parseInt(e.style.top), o = e.getBoundingClientRect(), r = t.left - o.left, a = t.top - o.top; r && (e.style.left = i + r + "px"), a && (e.style.top = n + a + "px") }, fillNode: function (e, t) { var i = browser.ie ? e.createTextNode(domUtils.fillChar) : e.createElement("br"); t.innerHTML = "", t.appendChild(i) }, moveChild: function (e, t, i) { for (; e.firstChild;)i && t.firstChild ? t.insertBefore(e.lastChild, t.firstChild) : t.appendChild(e.firstChild) }, hasNoAttributes: function (e) { return browser.ie ? /^<\w+\s*?>/.test(e.outerHTML) : 0 == e.attributes.length }, isCustomeNode: function (e) { return 1 == e.nodeType && e.getAttribute("_ue_custom_node_") }, isTagNode: function (e, t) { return 1 == e.nodeType && new RegExp("\\b" + e.tagName + "\\b", "i").test(t) }, filterNodeList: function (e, t, i) { var n = []; if (!utils.isFunction(t)) { var o = t; t = function (e) { return -1 != utils.indexOf(utils.isArray(o) ? o : o.split(" "), e.tagName.toLowerCase()) } } return utils.each(e, function (e) { t(e) && n.push(e) }), 0 == n.length ? null : 1 != n.length && i ? n : n[0] }, isInNodeEndBoundary: function (e, t) { var i = e.startContainer; if (3 == i.nodeType && e.startOffset != i.nodeValue.length) return 0; if (1 == i.nodeType && e.startOffset != i.childNodes.length) return 0; for (; i !== t;) { if (i.nextSibling) return 0; i = i.parentNode } return 1 }, isBoundaryNode: function (e, t) { for (; !domUtils.isBody(e);)if (e !== (e = e.parentNode)[t]) return !1; return !0 }, fillHtml: browser.ie11below ? "&nbsp;" : "<br/>" }, fillCharReg = new RegExp(domUtils.fillChar, "g"); !function () { var e, t = 0, i = domUtils.fillChar; function n(e) { return !e.collapsed && 1 == e.startContainer.nodeType && e.startContainer === e.endContainer && e.endOffset - e.startOffset == 1 } function o(e, t, i, n) { return 1 == t.nodeType && (dtd.$empty[t.tagName] || dtd.$nonChild[t.tagName]) && (i = domUtils.getNodeIndex(t) + (e ? 0 : 1), t = t.parentNode), e ? (n.startContainer = t, n.startOffset = i, n.endContainer || n.collapse(!0)) : (n.endContainer = t, n.endOffset = i, n.startContainer || n.collapse(!1)), function (e) { e.collapsed = e.startContainer && e.endContainer && e.startContainer === e.endContainer && e.startOffset == e.endOffset }(n), n } function r(e, t) { var i, n, o = e.startContainer, r = e.endContainer, a = e.startOffset, s = e.endOffset, l = e.document, d = l.createDocumentFragment(); if (1 == o.nodeType && (o = o.childNodes[a] || (i = o.appendChild(l.createTextNode("")))), 1 == r.nodeType && (r = r.childNodes[s] || (n = r.appendChild(l.createTextNode("")))), o === r && 3 == o.nodeType) return d.appendChild(l.createTextNode(o.substringData(a, s - a))), t && (o.deleteData(a, s - a), e.collapse(!0)), d; for (var c, u, m = d, f = domUtils.findParents(o, !0), h = domUtils.findParents(r, !0), p = 0; f[p] == h[p];)p++; for (var g, v = p; g = f[v]; v++) { for (c = g.nextSibling, g == o ? i || (3 == e.startContainer.nodeType ? (m.appendChild(l.createTextNode(o.nodeValue.slice(a))), t && o.deleteData(a, o.nodeValue.length - a)) : m.appendChild(t ? o : o.cloneNode(!0))) : (u = g.cloneNode(!1), m.appendChild(u)); c && c !== r && c !== h[v];)g = c.nextSibling, m.appendChild(t ? c : c.cloneNode(!0)), c = g; m = u } m = d, f[p] || (m.appendChild(f[p - 1].cloneNode(!1)), m = m.firstChild); var b; for (v = p; b = h[v]; v++) { if (c = b.previousSibling, b == r ? n || 3 != e.endContainer.nodeType || (m.appendChild(l.createTextNode(r.substringData(0, s))), t && r.deleteData(0, s)) : (u = b.cloneNode(!1), m.appendChild(u)), v != p || !f[p]) for (; c && c !== o;)b = c.previousSibling, m.insertBefore(t ? c : c.cloneNode(!0), m.firstChild), c = b; m = u } return t && e.setStartBefore(h[p] ? f[p] ? h[p] : f[p - 1] : h[p - 1]).collapse(!0), i && domUtils.remove(i), n && domUtils.remove(n), d } var a = dom.Range = function (e) { var t = this; t.startContainer = t.startOffset = t.endContainer = t.endOffset = null, t.document = e, t.collapsed = !0 }; function s(t, i) { try { if (e && domUtils.inDoc(e, t)) if (e.nodeValue.replace(fillCharReg, "").length) e.nodeValue = e.nodeValue.replace(fillCharReg, ""); else { var n = e.parentNode; for (domUtils.remove(e); n && domUtils.isEmptyInlineElement(n) && (browser.safari ? !(domUtils.getPosition(n, i) & domUtils.POSITION_CONTAINS) : !n.contains(i));)e = n.parentNode, domUtils.remove(n), n = e } } catch (e) { } } function l(e, t) { var i; for (e = e[t]; e && domUtils.isFillChar(e);)i = e[t], domUtils.remove(e), e = i } a.prototype = { cloneContents: function () { return this.collapsed ? null : r(this, 0) }, deleteContents: function () { var e; return this.collapsed || r(this, 1), browser.webkit && (3 != (e = this.startContainer).nodeType || e.nodeValue.length || (this.setStartBefore(e).collapse(!0), domUtils.remove(e))), this }, extractContents: function () { return this.collapsed ? null : r(this, 2) }, setStart: function (e, t) { return o(!0, e, t, this) }, setEnd: function (e, t) { return o(!1, e, t, this) }, setStartAfter: function (e) { return this.setStart(e.parentNode, domUtils.getNodeIndex(e) + 1) }, setStartBefore: function (e) { return this.setStart(e.parentNode, domUtils.getNodeIndex(e)) }, setEndAfter: function (e) { return this.setEnd(e.parentNode, domUtils.getNodeIndex(e) + 1) }, setEndBefore: function (e) { return this.setEnd(e.parentNode, domUtils.getNodeIndex(e)) }, setStartAtFirst: function (e) { return this.setStart(e, 0) }, setStartAtLast: function (e) { return this.setStart(e, 3 == e.nodeType ? e.nodeValue.length : e.childNodes.length) }, setEndAtFirst: function (e) { return this.setEnd(e, 0) }, setEndAtLast: function (e) { return this.setEnd(e, 3 == e.nodeType ? e.nodeValue.length : e.childNodes.length) }, selectNode: function (e) { return this.setStartBefore(e).setEndAfter(e) }, selectNodeContents: function (e) { return this.setStart(e, 0).setEndAtLast(e) }, cloneRange: function () { var e = this; return new a(e.document).setStart(e.startContainer, e.startOffset).setEnd(e.endContainer, e.endOffset) }, collapse: function (e) { var t = this; return e ? (t.endContainer = t.startContainer, t.endOffset = t.startOffset) : (t.startContainer = t.endContainer, t.startOffset = t.endOffset), t.collapsed = !0, t }, shrinkBoundary: function (e) { var t, i = this, n = i.collapsed; function o(e) { return 1 == e.nodeType && !domUtils.isBookmarkNode(e) && !dtd.$empty[e.tagName] && !dtd.$nonChild[e.tagName] } for (; 1 == i.startContainer.nodeType && (t = i.startContainer.childNodes[i.startOffset]) && o(t);)i.setStart(t, 0); if (n) return i.collapse(!0); if (!e) for (; 1 == i.endContainer.nodeType && i.endOffset > 0 && (t = i.endContainer.childNodes[i.endOffset - 1]) && o(t);)i.setEnd(t, t.childNodes.length); return i }, getCommonAncestor: function (e, t) { var i = this.startContainer, o = this.endContainer; return i === o ? e && n(this) && 1 == (i = i.childNodes[this.startOffset]).nodeType ? i : t && 3 == i.nodeType ? i.parentNode : i : domUtils.getCommonAncestor(i, o) }, trimBoundary: function (e) { this.txtToElmBoundary(); var t = this.startContainer, i = this.startOffset, n = this.collapsed, o = this.endContainer; if (3 == t.nodeType) { if (0 == i) this.setStartBefore(t); else if (i >= t.nodeValue.length) this.setStartAfter(t); else { var r = domUtils.split(t, i); t === o ? this.setEnd(r, this.endOffset - i) : t.parentNode === o && (this.endOffset += 1), this.setStartBefore(r) } if (n) return this.collapse(!0) } return e || (i = this.endOffset, 3 == (o = this.endContainer).nodeType && (0 == i ? this.setEndBefore(o) : (i < o.nodeValue.length && domUtils.split(o, i), this.setEndAfter(o)))), this }, txtToElmBoundary: function (e) { function t(e, t) { var i = e[t + "Container"], n = e[t + "Offset"]; 3 == i.nodeType && (n ? n >= i.nodeValue.length && e["set" + t.replace(/(\w)/, function (e) { return e.toUpperCase() }) + "After"](i) : e["set" + t.replace(/(\w)/, function (e) { return e.toUpperCase() }) + "Before"](i)) } return !e && this.collapsed || (t(this, "start"), t(this, "end")), this }, insertNode: function (e) { var t = e, i = 1; 11 == e.nodeType && (t = e.firstChild, i = e.childNodes.length), this.trimBoundary(!0); var n = this.startContainer, o = this.startOffset, r = n.childNodes[o]; return r ? n.insertBefore(e, r) : n.appendChild(e), t.parentNode === this.endContainer && (this.endOffset = this.endOffset + i), this.setStartBefore(t) }, setCursor: function (e, t) { return this.collapse(!e).select(t) }, createBookmark: function (e, i) { var n, o = this.document.createElement("span"); return o.style.cssText = "display:none;line-height:0px;", o.appendChild(this.document.createTextNode("‍")), o.id = "_baidu_bookmark_start_" + (i ? "" : t++), this.collapsed || ((n = o.cloneNode(!0)).id = "_baidu_bookmark_end_" + (i ? "" : t++)), this.insertNode(o), n && this.collapse().insertNode(n).setEndBefore(n), this.setStartAfter(o), { start: e ? o.id : o, end: n ? e ? n.id : n : null, id: e } }, moveToBookmark: function (e) { var t = e.id ? this.document.getElementById(e.start) : e.start, i = e.end && e.id ? this.document.getElementById(e.end) : e.end; return this.setStartBefore(t), domUtils.remove(t), i ? (this.setEndBefore(i), domUtils.remove(i)) : this.collapse(!0), this }, enlarge: function (e, t) { var i, n, o = domUtils.isBody, r = this.document.createTextNode(""); if (e) { for (1 == (n = this.startContainer).nodeType ? n.childNodes[this.startOffset] ? i = n = n.childNodes[this.startOffset] : (n.appendChild(r), i = n = r) : i = n; ;) { if (domUtils.isBlockElm(n)) { for (n = i; (i = n.previousSibling) && !domUtils.isBlockElm(i);)n = i; this.setStartBefore(n); break } i = n, n = n.parentNode } for (1 == (n = this.endContainer).nodeType ? ((i = n.childNodes[this.endOffset]) ? n.insertBefore(r, i) : n.appendChild(r), i = n = r) : i = n; ;) { if (domUtils.isBlockElm(n)) { for (n = i; (i = n.nextSibling) && !domUtils.isBlockElm(i);)n = i; this.setEndAfter(n); break } i = n, n = n.parentNode } r.parentNode === this.endContainer && this.endOffset--, domUtils.remove(r) } if (!this.collapsed) { for (; !(0 != this.startOffset || t && t(this.startContainer) || o(this.startContainer));)this.setStartBefore(this.startContainer); for (; !(this.endOffset != (1 == this.endContainer.nodeType ? this.endContainer.childNodes.length : this.endContainer.nodeValue.length) || t && t(this.endContainer) || o(this.endContainer));)this.setEndAfter(this.endContainer) } return this }, enlargeToBlockElm: function (e) { for (; !domUtils.isBlockElm(this.startContainer);)this.setStartBefore(this.startContainer); if (!e) for (; !domUtils.isBlockElm(this.endContainer);)this.setEndAfter(this.endContainer); return this }, adjustmentBoundary: function () { if (!this.collapsed) { for (; !domUtils.isBody(this.startContainer) && this.startOffset == this.startContainer[3 == this.startContainer.nodeType ? "nodeValue" : "childNodes"].length && this.startContainer[3 == this.startContainer.nodeType ? "nodeValue" : "childNodes"].length;)this.setStartAfter(this.startContainer); for (; !domUtils.isBody(this.endContainer) && !this.endOffset && this.endContainer[3 == this.endContainer.nodeType ? "nodeValue" : "childNodes"].length;)this.setEndBefore(this.endContainer) } return this }, applyInlineStyle: function (e, t, i) { if (this.collapsed) return this; this.trimBoundary().enlarge(!1, function (e) { return 1 == e.nodeType && domUtils.isBlockElm(e) }).adjustmentBoundary(); for (var n, o, r = this.createBookmark(), a = r.end, s = function (e) { return 1 == e.nodeType ? "br" != e.tagName.toLowerCase() : !domUtils.isWhitespace(e) }, l = domUtils.getNextDomNode(r.start, !1, s), d = this.cloneRange(); l && domUtils.getPosition(l, a) & domUtils.POSITION_PRECEDING;)if (3 == l.nodeType || dtd[e][l.tagName]) { for (d.setStartBefore(l), n = l; n && (3 == n.nodeType || dtd[e][n.tagName]) && n !== a;)o = n, n = domUtils.getNextDomNode(n, 1 == n.nodeType, null, function (t) { return dtd[e][t.tagName] }); var c, u, m = d.setEndAfter(o).extractContents(); if (i && i.length > 0) { var f, h; h = f = i[0].cloneNode(!1); for (var p, g = 1; p = i[g++];)f.appendChild(p.cloneNode(!1)), f = f.firstChild; c = f } else c = d.document.createElement(e); if (t && domUtils.setAttributes(c, t), c.appendChild(m), d.insertNode(i ? h : c), "span" == e && t.style && /text\-decoration/.test(t.style) && (u = domUtils.findParentByTagName(c, "a", !0)) ? (domUtils.setAttributes(u, t), domUtils.remove(c, !0), c = u) : (domUtils.mergeSibling(c), domUtils.clearEmptySibling(c)), domUtils.mergeChild(c, t), l = domUtils.getNextDomNode(c, !1, s), domUtils.mergeToParent(c), n === a) break } else l = domUtils.getNextDomNode(l, !0, s); return this.moveToBookmark(r) }, removeInlineStyle: function (e) { if (this.collapsed) return this; e = utils.isArray(e) ? e : [e], this.shrinkBoundary().adjustmentBoundary(); for (var t = this.startContainer, i = this.endContainer; ;) { if (1 == t.nodeType) { if (utils.indexOf(e, t.tagName.toLowerCase()) > -1) break; if ("body" == t.tagName.toLowerCase()) { t = null; break } } t = t.parentNode } for (; ;) { if (1 == i.nodeType) { if (utils.indexOf(e, i.tagName.toLowerCase()) > -1) break; if ("body" == i.tagName.toLowerCase()) { i = null; break } } i = i.parentNode } var n, o, r = this.createBookmark(); t && (n = (o = this.cloneRange().setEndBefore(r.start).setStartBefore(t)).extractContents(), o.insertNode(n), domUtils.clearEmptySibling(t, !0), t.parentNode.insertBefore(r.start, t)), i && (n = (o = this.cloneRange().setStartAfter(r.end).setEndAfter(i)).extractContents(), o.insertNode(n), domUtils.clearEmptySibling(i, !1, !0), i.parentNode.insertBefore(r.end, i.nextSibling)); for (var a, s = domUtils.getNextDomNode(r.start, !1, function (e) { return 1 == e.nodeType }); s && s !== r.end;)a = domUtils.getNextDomNode(s, !0, function (e) { return 1 == e.nodeType }), utils.indexOf(e, s.tagName.toLowerCase()) > -1 && domUtils.remove(s, !0), s = a; return this.moveToBookmark(r) }, getClosedNode: function () { var e; if (!this.collapsed) { var t = this.cloneRange().adjustmentBoundary().shrinkBoundary(); if (n(t)) { var i = t.startContainer.childNodes[t.startOffset]; i && 1 == i.nodeType && (dtd.$empty[i.tagName] || dtd.$nonChild[i.tagName]) && (e = i) } } return e }, select: browser.ie ? function (t, n) { var o; this.collapsed || this.shrinkBoundary(); var r = this.getClosedNode(); if (r && !n) { try { (o = this.document.body.createControlRange()).addElement(r), o.select() } catch (e) { } return this } var a, d = this.createBookmark(), c = d.start; if ((o = this.document.body.createTextRange()).moveToElementText(c), o.moveStart("character", 1), this.collapsed) { if (!t && 3 != this.startContainer.nodeType) { var u = this.document.createTextNode(i), m = this.document.createElement("span"); m.appendChild(this.document.createTextNode(i)), c.parentNode.insertBefore(m, c), c.parentNode.insertBefore(u, c), s(this.document, u), e = u, l(m, "previousSibling"), l(c, "nextSibling"), o.moveStart("character", -1), o.collapse(!0) } } else { var f = this.document.body.createTextRange(); a = d.end, f.moveToElementText(a), o.setEndPoint("EndToEnd", f) } this.moveToBookmark(d), m && domUtils.remove(m); try { o.select() } catch (e) { } return this } : function (t) { var n, o = domUtils.getWindow(this.document), r = o.getSelection(); if (browser.gecko ? this.document.body.focus() : o.focus(), r) { if (r.removeAllRanges(), this.collapsed && !t) { var a = this.startContainer, d = a; 1 == a.nodeType && (d = a.childNodes[this.startOffset]), 3 == a.nodeType && this.startOffset || (d ? d.previousSibling && 3 == d.previousSibling.nodeType : a.lastChild && 3 == a.lastChild.nodeType) || (n = this.document.createTextNode(i), this.insertNode(n), s(this.document, n), l(n, "previousSibling"), l(n, "nextSibling"), e = n, this.setStart(n, browser.webkit ? 1 : 0).collapse(!0)) } var c = this.document.createRange(); if (this.collapsed && browser.opera && 1 == this.startContainer.nodeType) if (d = this.startContainer.childNodes[this.startOffset]) { for (; d && domUtils.isBlockElm(d) && 1 == d.nodeType && d.childNodes[0];)d = d.childNodes[0]; d && this.setStartBefore(d).collapse(!0) } else (d = this.startContainer.lastChild) && domUtils.isBr(d) && this.setStartBefore(d).collapse(!0); !function (e) { function t(t, i, n) { 3 == t.nodeType && t.nodeValue.length < i && (e[n + "Offset"] = t.nodeValue.length) } t(e.startContainer, e.startOffset, "start"), t(e.endContainer, e.endOffset, "end") }(this), c.setStart(this.startContainer, this.startOffset), c.setEnd(this.endContainer, this.endOffset), r.addRange(c) } return this }, scrollToView: function (e, t) { e = e ? window : domUtils.getWindow(this.document); var i = this.document.createElement("span"); return i.innerHTML = "&nbsp;", this.cloneRange().insertNode(i), domUtils.scrollToView(i, e, t), domUtils.remove(i), this }, inFillChar: function () { var e = this.startContainer; return !(!this.collapsed || 3 != e.nodeType || e.nodeValue.replace(new RegExp("^" + domUtils.fillChar), "").length + 1 != e.nodeValue.length) }, createAddress: function (e, t) { var i = {}, n = this; function o(e) { for (var i, o = e ? n.startContainer : n.endContainer, r = domUtils.findParents(o, !0, function (e) { return !domUtils.isBody(e) }), a = [], s = 0; i = r[s++];)a.push(domUtils.getNodeIndex(i, t)); var l = 0; if (t) if (3 == o.nodeType) { for (var d = o.previousSibling; d && 3 == d.nodeType;)l += d.nodeValue.replace(fillCharReg, "").length, d = d.previousSibling; l += e ? n.startOffset : n.endOffset } else if (o = o.childNodes[e ? n.startOffset : n.endOffset]) l = domUtils.getNodeIndex(o, t); else for (var c = (o = e ? n.startContainer : n.endContainer).firstChild; c;)if (domUtils.isFillChar(c)) c = c.nextSibling; else if (l++, 3 == c.nodeType) for (; c && 3 == c.nodeType;)c = c.nextSibling; else c = c.nextSibling; else l = e ? domUtils.isFillChar(o) ? 0 : n.startOffset : n.endOffset; return l < 0 && (l = 0), a.push(l), a } return i.startAddress = o(!0), e || (i.endAddress = n.collapsed ? [].concat(i.startAddress) : o()), i }, moveToAddress: function (e, t) { var i = this; function n(e, t) { for (var n, o, r, a = i.document.body, s = 0, l = e.length; s < l; s++)if (r = e[s], n = a, !(a = a.childNodes[r])) { o = r; break } t ? a ? i.setStartBefore(a) : i.setStart(n, o) : a ? i.setEndBefore(a) : i.setEnd(n, o) } return n(e.startAddress, !0), !t && e.endAddress && n(e.endAddress), i }, equals: function (e) { for (var t in this) if (this.hasOwnProperty(t) && this[t] !== e[t]) return !1; return !0 }, traversal: function (e, t) { if (this.collapsed) return this; for (var i = this.createBookmark(), n = i.end, o = domUtils.getNextDomNode(i.start, !1, t); o && o !== n && domUtils.getPosition(o, n) & domUtils.POSITION_PRECEDING;) { var r = domUtils.getNextDomNode(o, !1, t); e(o), o = r } return this.moveToBookmark(i) } } }(), function () { function e(e, t) { var i = domUtils.getNodeIndex; (e = e.duplicate()).collapse(t); var n = e.parentElement(); if (!n.hasChildNodes()) return { container: n, offset: 0 }; for (var o, r, a = n.children, s = e.duplicate(), l = 0, d = a.length - 1, c = -1; l <= d;) { o = a[c = Math.floor((l + d) / 2)], s.moveToElementText(o); var u = s.compareEndPoints("StartToStart", e); if (u > 0) d = c - 1; else { if (!(u < 0)) return { container: n, offset: i(o) }; l = c + 1 } } if (-1 == c) { if (s.moveToElementText(n), s.setEndPoint("StartToStart", e), r = s.text.replace(/(\r\n|\r)/g, "\n").length, a = n.childNodes, !r) return { container: o = a[a.length - 1], offset: o.nodeValue.length }; for (var m = a.length; r > 0;)r -= a[--m].nodeValue.length; return { container: a[m], offset: -r } } if (s.collapse(u > 0), s.setEndPoint(u > 0 ? "StartToStart" : "EndToStart", e), !(r = s.text.replace(/(\r\n|\r)/g, "\n").length)) return dtd.$empty[o.tagName] || dtd.$nonChild[o.tagName] ? { container: n, offset: i(o) + (u > 0 ? 0 : 1) } : { container: o, offset: u > 0 ? 0 : o.childNodes.length }; for (; r > 0;)try { var f = o; r -= (o = o[u > 0 ? "previousSibling" : "nextSibling"]).nodeValue.length } catch (e) { return { container: n, offset: i(f) } } return { container: o, offset: u > 0 ? -r : o.nodeValue.length + r } } function t(e) { var t; try { t = e.getNative().createRange() } catch (e) { return null } var i = t.item ? t.item(0) : t.parentElement(); return (i.ownerDocument || i) === e.document ? t : null } (dom.Selection = function (e) { var i, n = this; n.document = e, browser.ie9below && (i = domUtils.getWindow(e).frameElement, domUtils.on(i, "beforedeactivate", function () { n._bakIERange = n.getIERange() }), domUtils.on(i, "activate", function () { try { !t(n) && n._bakIERange && n._bakIERange.select() } catch (e) { } n._bakIERange = null })), i = e = null }).prototype = { rangeInBody: function (e, t) { var i = browser.ie9below || t ? e.item ? e.item() : e.parentElement() : e.startContainer; return i === this.document.body || domUtils.inDoc(i, this.document) }, getNative: function () { var e = this.document; try { return e ? browser.ie9below ? e.selection : domUtils.getWindow(e).getSelection() : null } catch (e) { return null } }, getIERange: function () { var e = t(this); return !e && this._bakIERange ? this._bakIERange : e }, cache: function () { this.clear(), this._cachedRange = this.getRange(), this._cachedStartElement = this.getStart(), this._cachedStartElementPath = this.getStartElementPath() }, getStartElementPath: function () { if (this._cachedStartElementPath) return this._cachedStartElementPath; var e = this.getStart(); return e ? domUtils.findParents(e, !0, null, !0) : [] }, clear: function () { this._cachedStartElementPath = this._cachedRange = this._cachedStartElement = null }, isFocus: function () { try { if (browser.ie9below) { var e = t(this); return !(!e || !this.rangeInBody(e)) } return !!this.getNative().rangeCount } catch (e) { return !1 } }, getRange: function () { var t = this; function i(e) { for (var i = t.document.body.firstChild, n = e.collapsed; i && i.firstChild;)e.setStart(i, 0), i = i.firstChild; e.startContainer || e.setStart(t.document.body, 0), n && e.collapse(!0) } if (null != t._cachedRange) return this._cachedRange; var n = new baidu.editor.dom.Range(t.document); if (browser.ie9below) { var o = t.getIERange(); if (o) try { !function (t, i) { if (t.item) i.selectNode(t.item(0)); else { var n = e(t, !0); i.setStart(n.container, n.offset), 0 != t.compareEndPoints("StartToEnd", t) && (n = e(t, !1), i.setEnd(n.container, n.offset)) } }(o, n) } catch (e) { i(n) } else i(n) } else { var r = t.getNative(); if (r && r.rangeCount) { var a = r.getRangeAt(0), s = r.getRangeAt(r.rangeCount - 1); n.setStart(a.startContainer, a.startOffset).setEnd(s.endContainer, s.endOffset), n.collapsed && domUtils.isBody(n.startContainer) && !n.startOffset && i(n) } else { if (this._bakRange && domUtils.inDoc(this._bakRange.startContainer, this.document)) return this._bakRange; i(n) } } return this._bakRange = n }, getStart: function () { if (this._cachedStartElement) return this._cachedStartElement; var e, t, i, n, o = browser.ie9below ? this.getIERange() : this.getRange(); if (browser.ie9below) { if (!o) return this.document.body.firstChild; if (o.item) return o.item(0); for ((e = o.duplicate()).text.length > 0 && e.moveStart("character", 1), e.collapse(1), t = e.parentElement(), n = i = o.parentElement(); i = i.parentNode;)if (i == t) { t = n; break } } else if (o.shrinkBoundary(), 1 == (t = o.startContainer).nodeType && t.hasChildNodes() && (t = t.childNodes[Math.min(t.childNodes.length - 1, o.startOffset)]), 3 == t.nodeType) return t.parentNode; return t }, getText: function () { var e, t; return this.isFocus() && (e = this.getNative()) ? (t = browser.ie9below ? e.createRange() : e.getRangeAt(0), browser.ie9below ? t.text : t.toString()) : "" }, clearRange: function () { this.getNative()[browser.ie9below ? "empty" : "removeAllRanges"]() } } }(), function () { var e, t = 0; function i(e, t) { var i; if (t.textarea) if (utils.isString(t.textarea)) { for (var n, o = 0, r = domUtils.getElementsByTagName(e, "textarea"); n = r[o++];)if (n.id == "ueditor_textarea_" + t.options.textarea) { i = n; break } } else i = t.textarea; i || (e.appendChild(i = domUtils.createElement(document, "textarea", { name: t.options.textarea, id: "ueditor_textarea_" + t.options.textarea, style: "display:none" })), t.textarea = i), !i.getAttribute("name") && i.setAttribute("name", t.options.textarea), i.value = t.hasContents() ? t.options.allHtmlEnabled ? t.getAllHtml() : t.getContent(null, null, !0) : "" } function n(e) { e.langIsReady = !0, e.fireEvent("langReady") } var o = UE.Editor = function (e) { var i = this; i.uid = t++, EventBase.call(i), i.commands = {}, i.options = utils.extend(utils.clone(e || {}), UEDITOR_CONFIG, !0), i.shortcutkeys = {}, i.inputRules = [], i.outputRules = [], i.setOpt(o.defaultOptions(i)), i.loadServerConfig(), utils.isEmptyObject(UE.I18N) ? utils.loadFile(document, { src: i.options.langPath + i.options.lang + "/" + i.options.lang + ".js", tag: "script", type: "text/javascript", defer: "defer" }, function () { UE.plugin.load(i), n(i) }) : (i.options.lang = function (e) { for (var t in e) return t }(UE.I18N), UE.plugin.load(i), n(i)), UE.instants["ueditorInstant" + i.uid] = i }; o.prototype = { registerCommand: function (e, t) { this.commands[e] = t }, ready: function (e) { e && (this.isReady ? e.apply(this) : this.addListener("ready", e)) }, setOpt: function (e, t) { var i = {}; utils.isString(e) ? i[e] = t : i = e, utils.extend(this.options, i, !0) }, getOpt: function (e) { return this.options[e] }, destroy: function () { var e = this; e.fireEvent("destroy"); var t = e.container.parentNode, i = e.textarea; i ? i.style.display = "" : (i = document.createElement("textarea"), t.parentNode.insertBefore(i, t)), i.style.width = e.iframe.offsetWidth + "px", i.style.height = e.iframe.offsetHeight + "px", i.value = e.getContent(), i.id = e.key, t.innerHTML = "", domUtils.remove(t); var n = e.key; for (var o in e) e.hasOwnProperty(o) && delete this[o]; UE.delEditor(n) }, render: function (e) { var t = this.options, i = function (t) { return parseInt(domUtils.getComputedStyle(e, t)) }; if (utils.isString(e) && (e = document.getElementById(e)), e) { t.initialFrameWidth ? t.minFrameWidth = t.initialFrameWidth : t.minFrameWidth = t.initialFrameWidth = e.offsetWidth, t.initialFrameHeight ? t.minFrameHeight = t.initialFrameHeight : t.initialFrameHeight = t.minFrameHeight = e.offsetHeight, e.style.width = /%$/.test(t.initialFrameWidth) ? "100%" : t.initialFrameWidth - i("padding-left") - i("padding-right") + "px", e.style.height = /%$/.test(t.initialFrameHeight) ? "100%" : t.initialFrameHeight - i("padding-top") - i("padding-bottom") + "px", e.style.zIndex = t.zIndex; var n = (ie && browser.version < 9 ? "" : "<!DOCTYPE html>") + "<html xmlns='http://www.w3.org/1999/xhtml' class='view' ><head><style type='text/css'>.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\nbody{margin:8px;font-family:sans-serif;font-size:16px;}img{max-width:100%;max-height:800px}p{margin:5px 0;}</style>" + (t.iframeCssUrl ? "<link rel='stylesheet' type='text/css' href='" + utils.unhtml(t.iframeCssUrl) + "'/>" : "") + (t.initialStyle ? "<style>" + t.initialStyle + "</style>" : "") + "</head><body class='view' ></body><script type='text/javascript' " + (ie ? "defer='defer'" : "") + " id='_initialScript'>setTimeout(function(){editor = window.parent.UE.instants['ueditorInstant" + this.uid + "'];editor._setup(document);},0);var _tmpScript = document.getElementById('_initialScript');_tmpScript.parentNode.removeChild(_tmpScript);<\/script></html>"; e.appendChild(domUtils.createElement(document, "iframe", { id: "ueditor_" + this.uid, width: "100%", height: "100%", frameborder: "0", src: "javascript:void(function(){document.open();" + (t.customDomain && document.domain != location.hostname ? 'document.domain="' + document.domain + '";' : "") + 'document.write("' + n + '");document.close();}())' })), e.style.overflow = "hidden", setTimeout(function () { /%$/.test(t.initialFrameWidth) && (t.minFrameWidth = t.initialFrameWidth = e.offsetWidth), /%$/.test(t.initialFrameHeight) && (t.minFrameHeight = t.initialFrameHeight = e.offsetHeight, e.style.height = t.initialFrameHeight + "px") }) } }, _setup: function (e) { var t, n = this, o = n.options; ie ? (e.body.disabled = !0, e.body.contentEditable = !0, e.body.disabled = !1) : e.body.contentEditable = !0, e.body.spellcheck = !1, n.document = e, n.window = e.defaultView || e.parentWindow, n.iframe = n.window.frameElement, n.body = e.body, n.selection = new dom.Selection(e), browser.gecko && (t = this.selection.getNative()) && t.removeAllRanges(), this._initEvents(); for (var r = this.iframe.parentNode; !domUtils.isBody(r); r = r.parentNode)if ("FORM" == r.tagName) { n.form = r, n.options.autoSyncData ? domUtils.on(n.window, "blur", function () { i(r, n) }) : domUtils.on(r, "submit", function () { i(this, n) }); break } if (o.initialContent) if (o.autoClearinitialContent) { var a = n.execCommand; n.execCommand = function () { return n.fireEvent("firstBeforeExecCommand"), a.apply(n, arguments) }, this._setDefaultContent(o.initialContent) } else this.setContent(o.initialContent, !1, !0); domUtils.isEmptyNode(n.body) && (n.body.innerHTML = "<p>" + (browser.ie ? "" : "<br/>") + "</p>"), o.focus && setTimeout(function () { n.focus(n.options.focusInEnd), !n.options.autoClearinitialContent && n._selectionChange() }, 0), n.container || (n.container = this.iframe.parentNode), o.fullscreen && n.ui && n.ui.setFullScreen(!0); try { n.document.execCommand("2D-position", !1, !1) } catch (e) { } try { n.document.execCommand("enableInlineTableEditing", !1, !1) } catch (e) { } try { n.document.execCommand("enableObjectResizing", !1, !1) } catch (e) { } n._bindshortcutKeys(), n.isReady = 1, n.fireEvent("ready"), o.onready && o.onready.call(n), browser.ie9below || domUtils.on(n.window, ["blur", "focus"], function (e) { if ("blur" == e.type) { n._bakRange = n.selection.getRange(); try { n._bakNativeRange = n.selection.getNative().getRangeAt(0), n.selection.getNative().removeAllRanges() } catch (e) { n._bakNativeRange = null } } else try { n._bakRange && n._bakRange.select() } catch (e) { } }), browser.gecko && browser.version <= 10902 && (n.body.contentEditable = !1, setTimeout(function () { n.body.contentEditable = !0 }, 100), setInterval(function () { n.body.style.height = n.iframe.offsetHeight - 20 + "px" }, 100)), !o.isShow && n.setHide(), o.readonly && n.setDisabled() }, sync: function (e) { var t = e ? document.getElementById(e) : domUtils.findParent(this.iframe.parentNode, function (e) { return "FORM" == e.tagName }, !0); t && i(t, this) }, setHeight: function (e, t) { e !== parseInt(this.iframe.parentNode.style.height) && (this.iframe.parentNode.style.height = e + "px"), !t && (this.options.minFrameHeight = this.options.initialFrameHeight = e), this.body.style.height = e + "px", !t && this.trigger("setHeight") }, addshortcutkey: function (e, t) { var i = {}; t ? i[e] = t : i = e, utils.extend(this.shortcutkeys, i) }, _bindshortcutKeys: function () { var e = this, t = this.shortcutkeys; e.addListener("keydown", function (i, n) { var o = n.keyCode || n.which; for (var r in t) for (var a, s = t[r].split(","), l = 0; a = s[l++];) { var d = (a = a.split(":"))[0], c = a[1]; (/^(ctrl)(\+shift)?\+(\d+)$/.test(d.toLowerCase()) || /^(\d+)$/.test(d)) && ("ctrl" == RegExp.$1 && (n.ctrlKey || n.metaKey) && ("" == RegExp.$2 || n[RegExp.$2.slice(1) + "Key"]) && o == RegExp.$3 || o == RegExp.$1) && (-1 != e.queryCommandState(r, c) && e.execCommand(r, c), domUtils.preventDefault(n)) } }) }, getContent: function (e, t, i, n, o) { if (e && utils.isFunction(e) && (t = e, e = ""), t ? !t() : 

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。