"), d.focus && setTimeout(function () { c.focus(c.options.focusInEnd), !c.options.autoClearinitialContent && c._selectionChange() }, 0), c.container || (c.container = this.iframe.parentNode), d.fullscreen && c.ui && c.ui.setFullScreen(!0); try { c.document.execCommand("2D-position", !1, !1) } catch (h) { } try { c.document.execCommand("enableInlineTableEditing", !1, !1) } catch (h) { } try { c.document.execCommand("enableObjectResizing", !1, !1) } catch (h) { } c._bindshortcutKeys(), c.isReady = 1, c.fireEvent("ready"), d.onready && d.onready.call(c), browser.ie9below || domUtils.on(c.window, ["blur", "focus"], function (a) { if ("blur" == a.type) { c._bakRange = c.selection.getRange(); try { c._bakNativeRange = c.selection.getNative().getRangeAt(0), c.selection.getNative().removeAllRanges() } catch (a) { c._bakNativeRange = null } } else try { c._bakRange && c._bakRange.select() } catch (a) { } }), browser.gecko && browser.version <= 10902 && (c.body.contentEditable = !1, setTimeout(function () { c.body.contentEditable = !0 }, 100), setInterval(function () { c.body.style.height = c.iframe.offsetHeight - 20 + "px" }, 100)), !d.isShow && c.setHide(), d.readonly && c.setDisabled() }, sync: function (b) { var c = this, d = b ? document.getElementById(b) : domUtils.findParent(c.iframe.parentNode, function (a) { return "FORM" == a.tagName }, !0); d && a(d, c) }, setHeight: function (a, b) { a !== parseInt(this.iframe.parentNode.style.height) && (this.iframe.parentNode.style.height = a + "px"), !b && (this.options.minFrameHeight = this.options.initialFrameHeight = a), this.body.style.height = a + "px", !b && this.trigger("setHeight") }, addshortcutkey: function (a, b) { var c = {}; b ? c[a] = b : c = a, utils.extend(this.shortcutkeys, c) }, _bindshortcutKeys: function () { var a = this, b = this.shortcutkeys; a.addListener("keydown", function (c, d) { var e = d.keyCode || d.which; for (var f in b) for (var g, h = b[f].split(","), i = 0; g = h[i++];) { g = g.split(":"); var j = g[0], k = g[1]; (/^(ctrl)(\+shift)?\+(\d+)$/.test(j.toLowerCase()) || /^(\d+)$/.test(j)) && (("ctrl" == RegExp.$1 ? d.ctrlKey || d.metaKey : 0) && ("" != RegExp.$2 ? d[RegExp.$2.slice(1) + "Key"] : 1) && e == RegExp.$3 || e == RegExp.$1) && (a.queryCommandState(f, k) != -1 && a.execCommand(f, k), domUtils.preventDefault(d)) } }) }, getContent: function (a, b, c, d, e) { var f = this; if (a && utils.isFunction(a) && (b = a, a = ""), b ? !b() : !this.hasContents()) return ""; f.fireEvent("beforegetcontent"); var g = UE.htmlparser(f.body.innerHTML, d); return f.filterOutputRule(g), f.fireEvent("aftergetcontent", a, g), g.toHtml(e) }, getAllHtml: function () { var a = this, b = []; if (a.fireEvent("getAllHtml", b), browser.ie && browser.version > 8) { var c = ""; utils.each(a.document.styleSheets, function (a) { c += a.href ? '' : "" }), utils.each(a.document.getElementsByTagName("script"), function (a) { c += a.outerHTML }) } return "" + (a.options.charset ? '' : "") + (c || a.document.getElementsByTagName("head")[0].innerHTML) + b.join("\n") + "" + a.getContent(null, null, !0) + "" }, getPlainTxt: function () { var a = new RegExp(domUtils.fillChar, "g"), b = this.body.innerHTML.replace(/[\n\r]/g, ""); return b = b.replace(/<(p|div)[^>]*>( | )<\/\1>/gi, "\n").replace(/ /gi, "\n").replace(/<[^>\/]+>/g, "").replace(/(\n)?<\/([^>]+)>/g, function (a, b, c) { return dtd.$block[c] ? "\n" : b ? b : "" }), b.replace(a, "").replace(/\u00a0/g, " ").replace(/ /g, " ") }, getContentTxt: function () { var a = new RegExp(domUtils.fillChar, "g"); return this.body[browser.ie ? "innerText" : "textContent"].replace(a, "").replace(/\u00a0/g, " ") }, setContent: function (b, c, d) { function e(a) { return "DIV" == a.tagName && a.getAttribute("cdata_tag") } var f = this; f.fireEvent("beforesetcontent", b); var g = UE.htmlparser(b); if (f.filterInputRule(g), b = g.toHtml(), f.body.innerHTML = (c ? f.body.innerHTML : "") + b, "p" == f.options.enterTag) { var h, i = this.body.firstChild; if (!i || 1 == i.nodeType && (dtd.$cdata[i.tagName] || e(i) || domUtils.isCustomeNode(i)) && i === this.body.lastChild) this.body.innerHTML = "
" + (browser.ie ? " " : " ") + "
" + this.body.innerHTML; else for (var j = f.document.createElement("p"); i;) { for (; i && (3 == i.nodeType || 1 == i.nodeType && dtd.p[i.tagName] && !dtd.$cdata[i.tagName]);)h = i.nextSibling, j.appendChild(i), i = h; if (j.firstChild) { if (!i) { f.body.appendChild(j); break } i.parentNode.insertBefore(j, i), j = f.document.createElement("p") } i = i.nextSibling } } f.fireEvent("aftersetcontent"), f.fireEvent("contentchange"), !d && f._selectionChange(), f._bakRange = f._bakIERange = f._bakNativeRange = null; var k; browser.gecko && (k = this.selection.getNative()) && k.removeAllRanges(), f.options.autoSyncData && f.form && a(f.form, f) }, focus: function (a) { try { var b = this, c = b.selection.getRange(); if (a) { var d = b.body.lastChild; d && 1 == d.nodeType && !dtd.$empty[d.tagName] && (domUtils.isEmptyBlock(d) ? c.setStartAtFirst(d) : c.setStartAtLast(d), c.collapse(!0)), c.setCursor(!0) } else { if (!c.collapsed && domUtils.isBody(c.startContainer) && 0 == c.startOffset) { var d = b.body.firstChild; d && 1 == d.nodeType && !dtd.$empty[d.tagName] && c.setStartAtFirst(d).collapse(!0) } c.select(!0) } this.fireEvent("focus selectionchange") } catch (e) { } }, isFocus: function () { return this.selection.isFocus() }, blur: function () { var a = this.selection.getNative(); if (a.empty && browser.ie) { var b = document.body.createTextRange(); b.moveToElementText(document.body), b.collapse(!0), b.select(), a.empty() } else a.removeAllRanges() }, _initEvents: function () { var a = this, b = a.document, c = a.window; a._proxyDomEvent = utils.bind(a._proxyDomEvent, a), domUtils.on(b, ["click", "contextmenu", "mousedown", "keydown", "keyup", "keypress", "mouseup", "mouseover", "mouseout", "selectstart"], a._proxyDomEvent), domUtils.on(c, ["focus", "blur"], a._proxyDomEvent), domUtils.on(a.body, "drop", function (b) { browser.gecko && b.stopPropagation && b.stopPropagation(), a.fireEvent("contentchange") }), domUtils.on(b, ["mouseup", "keydown"], function (b) { "keydown" == b.type && (b.ctrlKey || b.metaKey || b.shiftKey || b.altKey) || 2 != b.button && a._selectionChange(250, b) }) }, _proxyDomEvent: function (a) { return this.fireEvent("before" + a.type.replace(/^on/, "").toLowerCase()) !== !1 && (this.fireEvent(a.type.replace(/^on/, ""), a) !== !1 && this.fireEvent("after" + a.type.replace(/^on/, "").toLowerCase())) }, _selectionChange: function (a, b) { var c, e, f = this, g = !1; if (browser.ie && browser.version < 9 && b && "mouseup" == b.type) { var h = this.selection.getRange(); h.collapsed || (g = !0, c = b.clientX, e = b.clientY) } clearTimeout(d), d = setTimeout(function () { if (f.selection && f.selection.getNative()) { var a; if (g && "None" == f.selection.getNative().type) { a = f.document.body.createTextRange(); try { a.moveToPoint(c, e) } catch (d) { a = null } } var h; a && (h = f.selection.getIERange, f.selection.getIERange = function () { return a }), f.selection.cache(), h && (f.selection.getIERange = h), f.selection._cachedRange && f.selection._cachedStartElement && (f.fireEvent("beforeselectionchange"), f.fireEvent("selectionchange", !!b), f.fireEvent("afterselectionchange"), f.selection.clear()) } }, a || 50) }, _callCmdFn: function (a, b) { var c, d, e = b[0].toLowerCase(); return c = this.commands[e] || UE.commands[e], d = c && c[a], c && d || "queryCommandState" != a ? d ? d.apply(this, b) : void 0 : 0 }, execCommand: function (a) { a = a.toLowerCase(); var b, c = this, d = c.commands[a] || UE.commands[a]; return d && d.execCommand ? (d.notNeedUndo || c.__hasEnterExecCommand ? (b = this._callCmdFn("execCommand", arguments), !c.__hasEnterExecCommand && !d.ignoreContentChange && !c._ignoreContentChange && c.fireEvent("contentchange")) : (c.__hasEnterExecCommand = !0, c.queryCommandState.apply(c, arguments) != -1 && (c.fireEvent("saveScene"), c.fireEvent.apply(c, ["beforeexeccommand", a].concat(arguments)), b = this._callCmdFn("execCommand", arguments), c.fireEvent.apply(c, ["afterexeccommand", a].concat(arguments)), c.fireEvent("saveScene")), c.__hasEnterExecCommand = !1), !c.__hasEnterExecCommand && !d.ignoreContentChange && !c._ignoreContentChange && c._selectionChange(), b) : null }, queryCommandState: function (a) { return this._callCmdFn("queryCommandState", arguments) }, queryCommandValue: function (a) { return this._callCmdFn("queryCommandValue", arguments) }, hasContents: function (a) { if (a) for (var b, c = 0; b = a[c++];)if (this.document.getElementsByTagName(b).length > 0) return !0; if (!domUtils.isEmptyBlock(this.body)) return !0; for (a = ["div"], c = 0; b = a[c++];)for (var d, e = domUtils.getElementsByTagName(this.document, b), f = 0; d = e[f++];)if (domUtils.isCustomeNode(d)) return !0; return !1 }, reset: function () { this.fireEvent("reset") }, setEnabled: function () { var a, b = this; if ("false" == b.body.contentEditable) { b.body.contentEditable = !0, a = b.selection.getRange(); try { a.moveToBookmark(b.lastBk), delete b.lastBk } catch (c) { a.setStartAtFirst(b.body).collapse(!0) } a.select(!0), b.bkqueryCommandState && (b.queryCommandState = b.bkqueryCommandState, delete b.bkqueryCommandState), b.bkqueryCommandValue && (b.queryCommandValue = b.bkqueryCommandValue, delete b.bkqueryCommandValue), b.fireEvent("selectionchange") } }, enable: function () { return this.setEnabled() }, setDisabled: function (a) { var b = this; a = a ? utils.isArray(a) ? a : [a] : [], "true" == b.body.contentEditable && (b.lastBk || (b.lastBk = b.selection.getRange().createBookmark(!0)), b.body.contentEditable = !1, b.bkqueryCommandState = b.queryCommandState, b.bkqueryCommandValue = b.queryCommandValue, b.queryCommandState = function (c) { return utils.indexOf(a, c) != -1 ? b.bkqueryCommandState.apply(b, arguments) : -1 }, b.queryCommandValue = function (c) { return utils.indexOf(a, c) != -1 ? b.bkqueryCommandValue.apply(b, arguments) : null }, b.fireEvent("selectionchange")) }, disable: function (a) { return this.setDisabled(a) }, _setDefaultContent: function () { function a() { var b = this; b.document.getElementById("initContent") && (b.body.innerHTML = "
" + (ie ? "" : " ") + "
", b.removeListener("firstBeforeExecCommand focus", a), setTimeout(function () { b.focus(), b._selectionChange() }, 0)) } return function (b) { var c = this; c.body.innerHTML = '
' + b + "
", c.addListener("firstBeforeExecCommand focus", a) } }(), setShow: function () { var a = this, b = a.selection.getRange(); if ("none" == a.container.style.display) { try { b.moveToBookmark(a.lastBk), delete a.lastBk } catch (c) { b.setStartAtFirst(a.body).collapse(!0) } setTimeout(function () { b.select(!0) }, 100), a.container.style.display = "" } }, show: function () {
return this.setShow();
}, setHide: function () { var a = this; a.lastBk || (a.lastBk = a.selection.getRange().createBookmark(!0)), a.container.style.display = "none" }, hide: function () { return this.setHide() }, getLang: function (a) { if (!this.options) return ""; var b = UE.I18N[this.options.lang]; if (!b) throw Error("not import language file"); a = (a || "").split("."); for (var c, d = 0; (c = a[d++]) && (b = b[c], b);); return b }, getContentLength: function (a, b) { var c = this.getContent(!1, !1, !0).length; if (a) { b = (b || []).concat(["hr", "img", "iframe"]), c = this.getContentTxt().replace(/[\t\r\n]+/g, "").length; for (var d, e = 0; d = b[e++];)c += this.document.getElementsByTagName(d).length } return c }, addInputRule: function (a) { this.inputRules.push(a) }, filterInputRule: function (a) { for (var b, c = 0; b = this.inputRules[c++];)b.call(this, a) }, addOutputRule: function (a) { this.outputRules.push(a) }, filterOutputRule: function (a) { for (var b, c = 0; b = this.outputRules[c++];)b.call(this, a) }, getActionUrl: function (a) { var b = this.getOpt(a) || a, c = this.getOpt("imageUrl"), d = this.getOpt("serverUrl"); return !d && c && (d = c.replace(/^(.*[\/]).+([\.].+)$/, "$1controller$2")), d ? (d = d + (d.indexOf("?") == -1 ? "?" : "&") + "action=" + (b || ""), utils.formatUrl(d)) : "" }
}, utils.inherits(f, EventBase)
}(), UE.Editor.defaultOptions = function (a) { var b = a.options.UEDITOR_HOME_URL; return { isShow: !0, initialContent: "", initialStyle: "", autoClearinitialContent: !1, iframeCssUrl: b + "themes/iframe.css", textarea: "editorValue", focus: !1, focusInEnd: !0, autoClearEmptyNode: !0, fullscreen: !1, readonly: !1, zIndex: 999, imagePopup: !0, enterTag: "p", customDomain: !1, lang: "zh-cn", langPath: b + "lang/", theme: "default", themePath: b + "themes/", allHtmlEnabled: !1, scaleEnabled: !1, tableNativeEditInFF: !1, autoSyncData: !0, fileNameFormat: "{time}{rand:6}" } }, function () { UE.Editor.prototype.loadServerConfig = function () { function showErrorMsg(a) { console && console.error(a) } var me = this; setTimeout(function () { try { me.options.imageUrl && me.setOpt("serverUrl", me.options.imageUrl.replace(/^(.*[\/]).+([\.].+)$/, "$1controller$2")); var configUrl = me.getActionUrl("config"), isJsonp = utils.isCrossDomainUrl(configUrl); me._serverConfigLoaded = !1, configUrl && UE.ajax.request(configUrl, { method: "GET", dataType: isJsonp ? "jsonp" : "", onsuccess: function (r) { try { var config = isJsonp ? r : eval("(" + r.responseText + ")"); utils.extend(me.options, config), me.fireEvent("serverConfigLoaded"), me._serverConfigLoaded = !0 } catch (e) { showErrorMsg(me.getLang("loadconfigFormatError")) } }, onerror: function () { showErrorMsg(me.getLang("loadconfigHttpError")) } }) } catch (e) { showErrorMsg(me.getLang("loadconfigError")) } }) }, UE.Editor.prototype.isServerConfigLoaded = function () { var a = this; return a._serverConfigLoaded || !1 }, UE.Editor.prototype.afterConfigReady = function (a) { if (a && utils.isFunction(a)) { var b = this, c = function () { a.apply(b, arguments), b.removeListener("serverConfigLoaded", c) }; b.isServerConfigLoaded() ? a.call(b, "serverConfigLoaded") : b.addListener("serverConfigLoaded", c) } } }(), UE.ajax = function () { function a(a) { var b = []; for (var c in a) if ("method" != c && "timeout" != c && "async" != c && "dataType" != c && "callback" != c && void 0 != a[c] && null != a[c]) if ("function" != (typeof a[c]).toLowerCase() && "object" != (typeof a[c]).toLowerCase()) b.push(encodeURIComponent(c) + "=" + encodeURIComponent(a[c])); else if (utils.isArray(a[c])) for (var d = 0; d < a[c].length; d++)b.push(encodeURIComponent(c) + "[]=" + encodeURIComponent(a[c][d])); return b.join("&") } function b(b, c) { var d = f(), e = !1, g = { method: "POST", timeout: 5e3, async: !0, data: {}, onsuccess: function () { }, onerror: function () { } }; if ("object" == typeof b && (c = b, b = c.url), d && b) { var h = c ? utils.extend(g, c) : g, i = a(h); utils.isEmptyObject(h.data) || (i += (i ? "&" : "") + a(h.data)); var j = setTimeout(function () { 4 != d.readyState && (e = !0, d.abort(), clearTimeout(j)) }, h.timeout), k = h.method.toUpperCase(), l = b + (b.indexOf("?") == -1 ? "?" : "&") + ("POST" == k ? "" : i + "&noCache=" + +new Date); d.open(k, l, h.async), d.onreadystatechange = function () { 4 == d.readyState && (e || 200 != d.status ? h.onerror(d) : h.onsuccess(d)) }, "POST" == k ? (d.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), d.send(i)) : d.send(null) } } function c(b, c) { function d(a, b, c) { a.setAttribute("type", "text/javascript"), a.setAttribute("defer", "defer"), c && a.setAttribute("charset", c), a.setAttribute("src", b), document.getElementsByTagName("head")[0].appendChild(a) } function e(a) { return function () { try { if (a) k.onerror && k.onerror(); else try { clearTimeout(g), i.apply(window, arguments) } catch (b) { } } catch (c) { k.onerror && k.onerror.call(window, c) } finally { k.oncomplete && k.oncomplete.apply(window, arguments), j.parentNode && j.parentNode.removeChild(j), window[f] = null; try { delete window[f] } catch (b) { } } } } var f, g, h, i = c.onsuccess || function () { }, j = document.createElement("SCRIPT"), k = c || {}, l = k.charset, m = k.jsonp || "callback", n = k.timeOut || 0, o = new RegExp("(\\?|&)" + m + "=([^&]*)"); utils.isFunction(i) ? (f = "bd__editor__" + Math.floor(2147483648 * Math.random()).toString(36), window[f] = e(0)) : utils.isString(i) ? f = i : (h = o.exec(b)) && (f = h[2]), b = b.replace(o, "$1" + m + "=" + f), b.search(o) < 0 && (b += (b.indexOf("?") < 0 ? "?" : "&") + m + "=" + f); var p = a(c); utils.isEmptyObject(c.data) || (p += (p ? "&" : "") + a(c.data)), p && (b = b.replace(/\?/, "?" + p + "&")), j.onerror = e(1), n && (g = setTimeout(e(1), n)), d(j, b, l) } var d = "XMLHttpRequest()"; try { new ActiveXObject("Msxml2.XMLHTTP"), d = "ActiveXObject('Msxml2.XMLHTTP')" } catch (e) { try { new ActiveXObject("Microsoft.XMLHTTP"), d = "ActiveXObject('Microsoft.XMLHTTP')" } catch (e) { } } var f = new Function("return new " + d); return { request: function (a, d) { d && "jsonp" == d.dataType ? c(a, d) : b(a, d) }, getJSONP: function (a, b, d) { var e = { data: b, oncomplete: d }; c(a, e) } } }(); var filterWord = UE.filterWord = function () { function a(a) { return /(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<(v|o):|lang=)/gi.test(a) } function b(a) { return a = a.replace(/[\d.]+\w+/g, function (a) { return utils.transUnitToPx(a) }) } function c(a) { return a.replace(/[\t\r\n]+/g, " ").replace(//gi, "").replace(/]*>[\s\S]*?.<\/v:shape>/gi, function (a) { if (browser.opera) return ""; try { if (/Bitmap/i.test(a)) return ""; var c = a.match(/width:([ \d.]*p[tx])/i)[1], d = a.match(/height:([ \d.]*p[tx])/i)[1], e = a.match(/src=\s*"([^"]*)"/i)[1]; return '' } catch (f) { return "" } }).replace(/<\/?div[^>]*>/g, "").replace(/v:\w+=(["']?)[^'"]+\1/g, "").replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi, "").replace(/
]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "
$1
").replace(/\s+(class|lang|align)\s*=\s*(['"]?)([\w-]+)\2/gi, function (a, b, c, d) { return "class" == b && "MsoListParagraph" == d ? a : "" }).replace(/<(font|span)[^>]*>(\s*)<\/\1>/gi, function (a, b, c) { return c.replace(/[\t\r\n ]+/g, " ") }).replace(/(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi, function (a, c, d, e) { for (var f, g = [], h = e.replace(/^\s+|\s+$/, "").replace(/'/g, "'").replace(/"/gi, "'").replace(/[\d.]+(cm|pt)/g, function (a) { return utils.transUnitToPx(a) }).split(/;\s*/g), i = 0; f = h[i]; i++) { var j, k, l = f.split(":"); if (2 == l.length) { if (j = l[0].toLowerCase(), k = l[1].toLowerCase(), /^(background)\w*/.test(j) && 0 == k.replace(/(initial|\s)/g, "").length || /^(margin)\w*/.test(j) && /^0\w+$/.test(k)) continue; switch (j) { case "mso-padding-alt": case "mso-padding-top-alt": case "mso-padding-right-alt": case "mso-padding-bottom-alt": case "mso-padding-left-alt": case "mso-margin-alt": case "mso-margin-top-alt": case "mso-margin-right-alt": case "mso-margin-bottom-alt": case "mso-margin-left-alt": case "mso-height": case "mso-width": case "mso-vertical-align-alt": /
1 && (a(h, j, !0), b(h, j)), c(k, h, i, j); break; case "text": d(g, h); break; case "element": e(g, h, i, j); break; case "comment": f(g, h, i) }return h } function d(a, b) { "pre" == a.parentNode.tagName ? b.push(a.data) : b.push(l[a.parentNode.tagName] ? utils.html(a.data) : a.data.replace(/[ ]{2}/g, " ")) } function e(d, e, f, g) { var h = ""; if (d.attrs) { h = []; var i = d.attrs; for (var j in i) h.push(j + (void 0 !== i[j] ? '="' + (k[j] ? utils.html(i[j]).replace(/["]/g, function (a) { return """ }) : utils.unhtml(i[j])) + '"' : "")); h = h.join(" ") } if (e.push("<" + d.tagName + (h ? " " + h : "") + (dtd.$empty[d.tagName] ? "/" : "") + ">"), f && !dtd.$inlineWithA[d.tagName] && "pre" != d.tagName && d.children && d.children.length && (g = a(e, g, !0), b(e, g)), d.children && d.children.length) for (var l, m = 0; l = d.children[m++];)f && "element" == l.type && !dtd.$inlineWithA[l.tagName] && m > 1 && (a(e, g), b(e, g)), c(l, e, f, g); dtd.$empty[d.tagName] || (f && !dtd.$inlineWithA[d.tagName] && "pre" != d.tagName && d.children && d.children.length && (g = a(e, g), b(e, g)), e.push("" + d.tagName + ">")) } function f(a, b) { b.push("") } function g(a, b) { var c; if ("element" == a.type && a.getAttr("id") == b) return a; if (a.children && a.children.length) for (var d, e = 0; d = a.children[e++];)if (c = g(d, b)) return c } function h(a, b, c) { if ("element" == a.type && a.tagName == b && c.push(a), a.children && a.children.length) for (var d, e = 0; d = a.children[e++];)h(d, b, c) } function i(a, b) { if (a.children && a.children.length) for (var c, d = 0; c = a.children[d];)i(c, b), c.parentNode && (c.children && c.children.length && b(c), c.parentNode && d++); else b(a) } var j = UE.uNode = function (a) { this.type = a.type, this.data = a.data, this.tagName = a.tagName, this.parentNode = a.parentNode, this.attrs = a.attrs || {}, this.children = a.children }, k = { href: 1, src: 1, _src: 1, _href: 1, cdata_data: 1 }, l = { style: 1, script: 1 }, m = " ", n = "\n"; j.createElement = function (a) { return /[<>]/.test(a) ? UE.htmlparser(a).children[0] : new j({ type: "element", children: [], tagName: a }) }, j.createText = function (a, b) { return new UE.uNode({ type: "text", data: b ? a : utils.unhtml(a || "") }) }, j.prototype = { toHtml: function (a) { var b = []; return c(this, b, a, 0), b.join("") }, innerHTML: function (a) { if ("element" != this.type || dtd.$empty[this.tagName]) return this; if (utils.isString(a)) { if (this.children) for (var b, c = 0; b = this.children[c++];)b.parentNode = null; this.children = []; for (var b, d = UE.htmlparser(a), c = 0; b = d.children[c++];)this.children.push(b), b.parentNode = this; return this } var d = new UE.uNode({ type: "root", children: this.children }); return d.toHtml() }, innerText: function (a, b) { if ("element" != this.type || dtd.$empty[this.tagName]) return this; if (a) { if (this.children) for (var c, d = 0; c = this.children[d++];)c.parentNode = null; return this.children = [], this.appendChild(j.createText(a, b)), this } return this.toHtml().replace(/<[^>]+>/g, "") }, getData: function () { return "element" == this.type ? "" : this.data }, firstChild: function () { return this.children ? this.children[0] : null }, lastChild: function () { return this.children ? this.children[this.children.length - 1] : null }, previousSibling: function () { for (var a, b = this.parentNode, c = 0; a = b.children[c]; c++)if (a === this) return 0 == c ? null : b.children[c - 1] }, nextSibling: function () { for (var a, b = this.parentNode, c = 0; a = b.children[c++];)if (a === this) return b.children[c] }, replaceChild: function (a, b) { if (this.children) { a.parentNode && a.parentNode.removeChild(a); for (var c, d = 0; c = this.children[d]; d++)if (c === b) return this.children.splice(d, 1, a), b.parentNode = null, a.parentNode = this, a } }, appendChild: function (a) { if ("root" == this.type || "element" == this.type && !dtd.$empty[this.tagName]) { this.children || (this.children = []), a.parentNode && a.parentNode.removeChild(a); for (var b, c = 0; b = this.children[c]; c++)if (b === a) { this.children.splice(c, 1); break } return this.children.push(a), a.parentNode = this, a } }, insertBefore: function (a, b) { if (this.children) { a.parentNode && a.parentNode.removeChild(a); for (var c, d = 0; c = this.children[d]; d++)if (c === b) return this.children.splice(d, 0, a), a.parentNode = this, a } }, insertAfter: function (a, b) { if (this.children) { a.parentNode && a.parentNode.removeChild(a); for (var c, d = 0; c = this.children[d]; d++)if (c === b) return this.children.splice(d + 1, 0, a), a.parentNode = this, a } }, removeChild: function (a, b) { if (this.children) for (var c, d = 0; c = this.children[d]; d++)if (c === a) { if (this.children.splice(d, 1), c.parentNode = null, b && c.children && c.children.length) for (var e, f = 0; e = c.children[f]; f++)this.children.splice(d + f, 0, e), e.parentNode = this; return c } }, getAttr: function (a) { return this.attrs && this.attrs[a.toLowerCase()] }, setAttr: function (a, b) { if (!a) return void delete this.attrs; if (this.attrs || (this.attrs = {}), utils.isObject(a)) for (var c in a) a[c] ? this.attrs[c.toLowerCase()] = a[c] : delete this.attrs[c]; else b ? this.attrs[a.toLowerCase()] = b : delete this.attrs[a] }, getIndex: function () { for (var a, b = this.parentNode, c = 0; a = b.children[c]; c++)if (a === this) return c; return -1 }, getNodeById: function (a) { var b; if (this.children && this.children.length) for (var c, d = 0; c = this.children[d++];)if (b = g(c, a)) return b }, getNodesByTagName: function (a) { a = utils.trim(a).replace(/[ ]{2,}/g, " ").split(" "); var b = [], c = this; return utils.each(a, function (a) { if (c.children && c.children.length) for (var d, e = 0; d = c.children[e++];)h(d, a, b) }), b }, getStyle: function (a) { var b = this.getAttr("style"); if (!b) return ""; var c = new RegExp("(^|;)\\s*" + a + ":([^;]+)", "i"), d = b.match(c); return d && d[0] ? d[2] : "" }, setStyle: function (a, b) { function c(a, b) { var c = new RegExp("(^|;)\\s*" + a + ":([^;]+;?)", "gi"); d = d.replace(c, "$1"), b && (d = a + ":" + utils.unhtml(b) + ";" + d) } var d = this.getAttr("style"); if (d || (d = ""), utils.isObject(a)) for (var e in a) c(e, a[e]); else c(a, b); this.setAttr("style", utils.trim(d)) }, traversal: function (a) { return this.children && this.children.length && i(this, a), this } } }(); var htmlparser = UE.htmlparser = function (a, b) { function c(a, b) { if (m[a.tagName]) { var c = k.createElement(m[a.tagName]); a.appendChild(c), c.appendChild(k.createText(b)), a = c } else a.appendChild(k.createText(b)) } function d(a, b, c) { var e; if (e = l[b]) { for (var f, h = a; "root" != h.type;) { if (utils.isArray(e) ? utils.indexOf(e, h.tagName) != -1 : e == h.tagName) { a = h, f = !0; break } h = h.parentNode } f || (a = d(a, utils.isArray(e) ? e[0] : e)) } var i = new k({ parentNode: a, type: "element", tagName: b.toLowerCase(), children: dtd.$empty[b] ? null : [] }); if (c) { for (var m, n = {}; m = g.exec(c);)n[m[1].toLowerCase()] = j[m[1].toLowerCase()] ? m[2] || m[3] || m[4] : utils.unhtml(m[2] || m[3] || m[4]); i.attrs = n } return a.children.push(i), dtd.$empty[b] ? a : i } function e(a, b) { a.children.push(new k({ type: "comment", data: b, parentNode: a })) } var f = /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\s\/<>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g, g = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g, h = { b: 1, code: 1, i: 1, u: 1, strike: 1, s: 1, tt: 1, strong: 1, q: 1, samp: 1, em: 1, span: 1, sub: 1, img: 1, sup: 1, font: 1, big: 1, small: 1, iframe: 1, a: 1, br: 1, pre: 1 }; a = a.replace(new RegExp(domUtils.fillChar, "g"), ""), b || (a = a.replace(new RegExp("[\\r\\t\\n" + (b ? "" : " ") + "]*?(\\w+)\\s*(?:[^>]*)>[\\r\\t\\n" + (b ? "" : " ") + "]*", "g"), function (a, c) { return c && h[c.toLowerCase()] ? a.replace(/(^[\n\r]+)|([\n\r]+$)/g, "") : a.replace(new RegExp("^[\\r\\n" + (b ? "" : " ") + "]+"), "").replace(new RegExp("[\\r\\n" + (b ? "" : " ") + "]+$"), "") })); for (var i, j = { href: 1, src: 1 }, k = UE.uNode, l = { td: "tr", tr: ["tbody", "thead", "tfoot"], tbody: "table", th: "tr", thead: "table", tfoot: "table", caption: "table", li: ["ul", "ol"], dt: "dl", dd: "dl", option: "select" }, m = { ol: "li", ul: "li" }, n = 0, o = 0, p = new k({ type: "root", children: [] }), q = p; i = f.exec(a);) { n = i.index; try { if (n > o && c(q, a.slice(o, n)), i[3]) dtd.$cdata[q.tagName] ? c(q, i[0]) : q = d(q, i[3].toLowerCase(), i[4]); else if (i[1]) { if ("root" != q.type) if (dtd.$cdata[q.tagName] && !dtd.$cdata[i[1]]) c(q, i[0]); else { for (var r = q; "element" == q.type && q.tagName != i[1].toLowerCase();)if (q = q.parentNode, "root" == q.type) throw q = r, "break"; q = q.parentNode } } else i[2] && e(q, i[2]) } catch (s) { } o = f.lastIndex } return o < a.length && c(q, a.slice(o)), p }, filterNode = UE.filterNode = function () { function a(b, c) { switch (b.type) { case "text": break; case "element": var d; if (d = c[b.tagName]) if ("-" === d) b.parentNode.removeChild(b); else if (utils.isFunction(d)) { var e = b.parentNode, f = b.getIndex(); if (d(b), b.parentNode) { if (b.children) for (var g, h = 0; g = b.children[h];)a(g, c), g.parentNode && h++ } else for (var g, h = f; g = e.children[h];)a(g, c), g.parentNode && h++ } else { var i = d.$; if (i && b.attrs) { var j, k = {}; for (var l in i) { if (j = b.getAttr(l), "style" == l && utils.isArray(i[l])) { var m = []; utils.each(i[l], function (a) { var c; (c = b.getStyle(a)) && m.push(a + ":" + c) }), j = m.join(";") } j && (k[l] = j) } b.attrs = k } if (b.children) for (var g, h = 0; g = b.children[h];)a(g, c), g.parentNode && h++ } else if (dtd.$cdata[b.tagName]) b.parentNode.removeChild(b); else { var e = b.parentNode, f = b.getIndex(); b.parentNode.removeChild(b, !0); for (var g, h = f; g = e.children[h];)a(g, c), g.parentNode && h++ } break; case "comment": b.parentNode.removeChild(b) } } return function (b, c) { if (utils.isEmptyObject(c)) return b; var d; (d = c["-"]) && utils.each(d.split(" "), function (a) { c[a] = "-" }); for (var e, f = 0; e = b.children[f];)a(e, c), e.parentNode && f++; return b } }(); UE.plugin = function () { var a = {}; return { register: function (b, c, d, e) { d && utils.isFunction(d) && (e = d, d = null), a[b] = { optionName: d || b, execFn: c, afterDisabled: e } }, load: function (b) { utils.each(a, function (a) { var c = a.execFn.call(b); b.options[a.optionName] !== !1 ? c && utils.each(c, function (a, c) { switch (c.toLowerCase()) { case "shortcutkey": b.addshortcutkey(a); break; case "bindevents": utils.each(a, function (a, c) { b.addListener(c, a) }); break; case "bindmultievents": utils.each(utils.isArray(a) ? a : [a], function (a) { var c = utils.trim(a.type).split(/\s+/); utils.each(c, function (c) { b.addListener(c, a.handler) }) }); break; case "commands": utils.each(a, function (a, c) { b.commands[c] = a }); break; case "outputrule": b.addOutputRule(a); break; case "inputrule": b.addInputRule(a); break; case "defaultoptions": b.setOpt(a) } }) : a.afterDisabled && a.afterDisabled.call(b) }), utils.each(UE.plugins, function (a) { a.call(b) }) }, run: function (b, c) { var d = a[b]; d && d.exeFn.call(c) } } }(); var keymap = UE.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, v: 86, x: 88, s: 83, n: 78 }, LocalStorage = UE.LocalStorage = function () { function a() { var a = document.createElement("div"); return a.style.display = "none", a.addBehavior ? (a.addBehavior("#default#userdata"), { getItem: function (b) { var d = null; try { document.body.appendChild(a), a.load(c), d = a.getAttribute(b), document.body.removeChild(a) } catch (e) { } return d }, setItem: function (b, d) { document.body.appendChild(a), a.setAttribute(b, d), a.save(c), document.body.removeChild(a) }, removeItem: function (b) { document.body.appendChild(a), a.removeAttribute(b), a.save(c), document.body.removeChild(a) } }) : null } var b = window.localStorage || a() || null, c = "localStorage"; return { saveLocalData: function (a, c) { return !(!b || !c) && (b.setItem(a, c), !0) }, getLocalData: function (a) { return b ? b.getItem(a) : null }, removeItem: function (a) { b && b.removeItem(a) } } }(); !function () { var a = "ueditor_preference"; UE.Editor.prototype.setPreferences = function (b, c) { var d = {}; utils.isString(b) ? d[b] = c : d = b; var e = LocalStorage.getLocalData(a); e && (e = utils.str2json(e)) ? utils.extend(e, d) : e = d, e && LocalStorage.saveLocalData(a, utils.json2str(e)) }, UE.Editor.prototype.getPreferences = function (b) { var c = LocalStorage.getLocalData(a); return c && (c = utils.str2json(c)) ? b ? c[b] : c : null }, UE.Editor.prototype.removePreferences = function (b) { var c = LocalStorage.getLocalData(a); c && (c = utils.str2json(c)) && (c[b] = void 0, delete c[b]), c && LocalStorage.saveLocalData(a, utils.json2str(c)) } }(), UE.plugins.defaultfilter = function () { var a = this; a.setOpt({ allowDivTransToP: !0, disabledTableInTable: !0 }), a.addInputRule(function (b) { function c(a) { for (; a && "element" == a.type;) { if ("td" == a.tagName) return !0; a = a.parentNode } return !1 } var d, e = this.options.allowDivTransToP; b.traversal(function (b) { if ("element" == b.type) { if (!dtd.$cdata[b.tagName] && a.options.autoClearEmptyNode && dtd.$inline[b.tagName] && !dtd.$empty[b.tagName] && (!b.attrs || utils.isEmptyObject(b.attrs))) return void (b.firstChild() ? "span" != b.tagName || b.attrs && !utils.isEmptyObject(b.attrs) || b.parentNode.removeChild(b, !0) : b.parentNode.removeChild(b)); switch (b.tagName) { case "style": case "script": b.setAttr({ cdata_tag: b.tagName, cdata_data: b.innerHTML() || "", _ue_custom_node_: "true" }), b.tagName = "div", b.innerHTML(""); break; case "a": (d = b.getAttr("href")) && b.setAttr("_href", d); break; case "img": if ((d = b.getAttr("src")) && /^data:/.test(d)) { b.parentNode.removeChild(b); break } b.setAttr("_src", b.getAttr("src")); break; case "span": browser.webkit && (d = b.getStyle("white-space")) && /nowrap|normal/.test(d) && (b.setStyle("white-space", ""), a.options.autoClearEmptyNode && utils.isEmptyObject(b.attrs) && b.parentNode.removeChild(b, !0)), d = b.getAttr("id"), d && /^_baidu_bookmark_/i.test(d) && b.parentNode.removeChild(b); break; case "p": (d = b.getAttr("align")) && (b.setAttr("align"), b.setStyle("text-align", d)), utils.each(b.children, function (a) { if ("element" == a.type && "p" == a.tagName) { var c = a.nextSibling(); b.parentNode.insertAfter(a, b); for (var d = a; c;) { var e = c.nextSibling(); b.parentNode.insertAfter(c, d), d = c, c = e } return !1 } }), b.firstChild() || b.innerHTML(browser.ie ? " " : " "); break; case "div": if (b.getAttr("cdata_tag")) break; if (d = b.getAttr("class"), d && /^line number\d+/.test(d)) break; if (!e) break; for (var f, g = UE.uNode.createElement("p"); f = b.firstChild();)"text" != f.type && UE.dom.dtd.$block[f.tagName] ? g.firstChild() ? (b.parentNode.insertBefore(g, b), g = UE.uNode.createElement("p")) : b.parentNode.insertBefore(f, b) : g.appendChild(f); g.firstChild() && b.parentNode.insertBefore(g, b), b.parentNode.removeChild(b); break; case "dl": b.tagName = "ul"; break; case "dt": case "dd": b.tagName = "li"; break; case "li": var h = b.getAttr("class"); h && /list\-/.test(h) || b.setAttr(); var i = b.getNodesByTagName("ol ul"); UE.utils.each(i, function (a) { b.parentNode.insertAfter(a, b) }); break; case "td": case "th": case "caption": b.children && b.children.length || b.appendChild(browser.ie11below ? UE.uNode.createText(" ") : UE.uNode.createElement("br")); break; case "table": a.options.disabledTableInTable && c(b) && (b.parentNode.insertBefore(UE.uNode.createText(b.innerText()), b), b.parentNode.removeChild(b)) } } }) }), a.addOutputRule(function (b) { var c; b.traversal(function (b) { if ("element" == b.type) { if (a.options.autoClearEmptyNode && dtd.$inline[b.tagName] && !dtd.$empty[b.tagName] && (!b.attrs || utils.isEmptyObject(b.attrs))) return void (b.firstChild() ? "span" != b.tagName || b.attrs && !utils.isEmptyObject(b.attrs) || b.parentNode.removeChild(b, !0) : b.parentNode.removeChild(b)); switch (b.tagName) { case "div": (c = b.getAttr("cdata_tag")) && (b.tagName = c, b.appendChild(UE.uNode.createText(b.getAttr("cdata_data"))), b.setAttr({ cdata_tag: "", cdata_data: "", _ue_custom_node_: "" })); break; case "a": (c = b.getAttr("_href")) && b.setAttr({ href: utils.html(c), _href: "" }); break; case "span": c = b.getAttr("id"), c && /^_baidu_bookmark_/i.test(c) && b.parentNode.removeChild(b); break; case "img": (c = b.getAttr("_src")) && b.setAttr({ src: b.getAttr("_src"), _src: "" }) } } }) }) }, UE.commands.inserthtml = { execCommand: function (a, b, c) { var d, e, f = this; if (b && f.fireEvent("beforeinserthtml", b) !== !0) { if (d = f.selection.getRange(), e = d.document.createElement("div"), e.style.display = "inline", !c) { var g = UE.htmlparser(b); f.options.filterRules && UE.filterNode(g, f.options.filterRules), f.filterInputRule(g), b = g.toHtml() } if (e.innerHTML = utils.trim(b), !d.collapsed) { var h = d.startContainer; if (domUtils.isFillChar(h) && d.setStartBefore(h), h = d.endContainer, domUtils.isFillChar(h) && d.setEndAfter(h), d.txtToElmBoundary(), d.endContainer && 1 == d.endContainer.nodeType && (h = d.endContainer.childNodes[d.endOffset], h && domUtils.isBr(h) && d.setEndAfter(h)), 0 == d.startOffset && (h = d.startContainer, domUtils.isBoundaryNode(h, "firstChild") && (h = d.endContainer, d.endOffset == (3 == h.nodeType ? h.nodeValue.length : h.childNodes.length) && domUtils.isBoundaryNode(h, "lastChild") && (f.body.innerHTML = "
" + (browser.ie ? "" : " ") + "
", d.setStart(f.body.firstChild, 0).collapse(!0)))), !d.collapsed && d.deleteContents(), 1 == d.startContainer.nodeType) { var i, j = d.startContainer.childNodes[d.startOffset]; if (j && domUtils.isBlockElm(j) && (i = j.previousSibling) && domUtils.isBlockElm(i)) { for (d.setEnd(i, i.childNodes.length).collapse(); j.firstChild;)i.appendChild(j.firstChild); domUtils.remove(j) } } } var j, k, i, l, m, n = 0; d.inFillChar() && (j = d.startContainer, domUtils.isFillChar(j) ? (d.setStartBefore(j).collapse(!0), domUtils.remove(j)) : domUtils.isFillChar(j, !0) && (j.nodeValue = j.nodeValue.replace(fillCharReg, ""), d.startOffset--, d.collapsed && d.collapse(!0))); var o = domUtils.findParentByTagName(d.startContainer, "li", !0); if (o) { for (var p, q; j = e.firstChild;) { for (; j && (3 == j.nodeType || !domUtils.isBlockElm(j) || "HR" == j.tagName);)p = j.nextSibling, d.insertNode(j).collapse(), q = j, j = p; if (j) if (/^(ol|ul)$/i.test(j.tagName)) { for (; j.firstChild;)q = j.firstChild, domUtils.insertAfter(o, j.firstChild), o = o.nextSibling; domUtils.remove(j) } else { var r; p = j.nextSibling, r = f.document.createElement("li"), domUtils.insertAfter(o, r), r.appendChild(j), q = j, j = p, o = r } } o = domUtils.findParentByTagName(d.startContainer, "li", !0), domUtils.isEmptyBlock(o) && domUtils.remove(o), q && d.setStartAfter(q).collapse(!0).select(!0) } else { for (; j = e.firstChild;) { if (n) { for (var s = f.document.createElement("p"); j && (3 == j.nodeType || !dtd.$block[j.tagName]);)m = j.nextSibling, s.appendChild(j), j = m; s.firstChild && (j = s) } if (d.insertNode(j), m = j.nextSibling, !n && j.nodeType == domUtils.NODE_ELEMENT && domUtils.isBlockElm(j) && (k = domUtils.findParent(j, function (a) { return domUtils.isBlockElm(a) }), k && "body" != k.tagName.toLowerCase() && (!dtd[k.tagName][j.nodeName] || j.parentNode !== k))) { if (dtd[k.tagName][j.nodeName]) for (l = j.parentNode; l !== k;)i = l, l = l.parentNode; else i = k; domUtils.breakParent(j, i || l); var i = j.previousSibling; domUtils.trimWhiteTextNode(i), i.childNodes.length || domUtils.remove(i), !browser.ie && (p = j.nextSibling) && domUtils.isBlockElm(p) && p.lastChild && !domUtils.isBr(p.lastChild) && p.appendChild(f.document.createElement("br")), n = 1 } var p = j.nextSibling; if (!e.firstChild && p && domUtils.isBlockElm(p)) { d.setStart(p, 0).collapse(!0); break } d.setEndAfter(j).collapse() } if (j = d.startContainer, m && domUtils.isBr(m) && domUtils.remove(m), domUtils.isBlockElm(j) && domUtils.isEmptyNode(j)) if (m = j.nextSibling) domUtils.remove(j), 1 == m.nodeType && dtd.$block[m.tagName] && d.setStart(m, 0).collapse(!0).shrinkBoundary(); else try { j.innerHTML = browser.ie ? domUtils.fillChar : " " } catch (t) { d.setStartBefore(j), domUtils.remove(j) } try { d.select(!0) } catch (t) { } } setTimeout(function () { d = f.selection.getRange(), d.scrollToView(f.autoHeightEnabled, f.autoHeightEnabled ? domUtils.getXY(f.iframe).y : 0), f.fireEvent("afterinserthtml", b) }, 200) } } }, UE.plugins.autotypeset = function () { function a(a, b) { return a && 3 != a.nodeType ? domUtils.isBr(a) ? 1 : a && a.parentNode && l[a.tagName.toLowerCase()] ? g && g.contains(a) || a.getAttribute("pagebreak") ? 0 : b ? !domUtils.isEmptyBlock(a) : domUtils.isEmptyBlock(a, new RegExp("[\\s" + domUtils.fillChar + "]", "g")) : void 0 : 0 } function b(a) { a.style.cssText || (domUtils.removeAttributes(a, ["style"]), "span" == a.tagName.toLowerCase() && domUtils.hasNoAttributes(a) && domUtils.remove(a, !0)) } function c(c, f) { var h, l = this; if (f) { if (!i.pasteFilter) return; h = l.document.createElement("div"), h.innerHTML = f.html } else h = l.document.body; for (var m, n = domUtils.getElementsByTagName(h, "*"), o = 0; m = n[o++];)if (l.fireEvent("excludeNodeinautotype", m) !== !0) { if (i.clearFontSize && m.style.fontSize && (domUtils.removeStyle(m, "font-size"), b(m)), i.clearFontFamily && m.style.fontFamily && (domUtils.removeStyle(m, "font-family"), b(m)), a(m)) { if (i.mergeEmptyline) for (var p, q = m.nextSibling, r = domUtils.isBr(m); a(q) && (p = q, q = p.nextSibling, !r || q && (!q || domUtils.isBr(q)));)domUtils.remove(p); if (i.removeEmptyline && domUtils.inDoc(m, h) && !k[m.parentNode.tagName.toLowerCase()]) { if (domUtils.isBr(m) && (q = m.nextSibling, q && !domUtils.isBr(q))) continue; domUtils.remove(m); continue } } if (a(m, !0) && "SPAN" != m.tagName && (i.indent && (m.style.textIndent = i.indentValue), i.textAlign && (m.style.textAlign = i.textAlign)), i.removeClass && m.className && !j[m.className.toLowerCase()]) { if (g && g.contains(m)) continue; domUtils.removeAttributes(m, ["class"]) } if (i.imageBlockLine && "img" == m.tagName.toLowerCase() && !m.getAttribute("emotion")) if (f) { var s = m; switch (i.imageBlockLine) { case "left": case "right": case "none": for (var p, t, q, u = s.parentNode; dtd.$inline[u.tagName] || "A" == u.tagName;)u = u.parentNode; if (p = u, "P" == p.tagName && "center" == domUtils.getStyle(p, "text-align") && !domUtils.isBody(p) && 1 == domUtils.getChildCount(p, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) })) if (t = p.previousSibling, q = p.nextSibling, t && q && 1 == t.nodeType && 1 == q.nodeType && t.tagName == q.tagName && domUtils.isBlockElm(t)) { for (t.appendChild(p.firstChild); q.firstChild;)t.appendChild(q.firstChild); domUtils.remove(p), domUtils.remove(q) } else domUtils.setStyle(p, "text-align", ""); domUtils.setStyle(s, "float", i.imageBlockLine); break; case "center": if ("center" != l.queryCommandValue("imagefloat")) { for (u = s.parentNode, domUtils.setStyle(s, "float", "none"), p = s; u && 1 == domUtils.getChildCount(u, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) }) && (dtd.$inline[u.tagName] || "A" == u.tagName);)p = u, u = u.parentNode; var v = l.document.createElement("p"); domUtils.setAttributes(v, { style: "text-align:center" }), p.parentNode.insertBefore(v, p), v.appendChild(p), domUtils.setStyle(p, "float", "") } } } else { var w = l.selection.getRange(); w.selectNode(m).select(), l.execCommand("imagefloat", i.imageBlockLine) } i.removeEmptyNode && i.removeTagNames[m.tagName.toLowerCase()] && domUtils.hasNoAttributes(m) && domUtils.isEmptyBlock(m) && domUtils.remove(m) } if (i.tobdc) { var x = UE.htmlparser(h.innerHTML); x.traversal(function (a) { "text" == a.type && (a.data = e(a.data)) }), h.innerHTML = x.toHtml() } if (i.bdc2sb) { var x = UE.htmlparser(h.innerHTML); x.traversal(function (a) { "text" == a.type && (a.data = d(a.data)) }), h.innerHTML = x.toHtml() } f && (f.html = h.innerHTML) } function d(a) { for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); b += d >= 65281 && d <= 65373 ? String.fromCharCode(a.charCodeAt(c) - 65248) : 12288 == d ? String.fromCharCode(a.charCodeAt(c) - 12288 + 32) : a.charAt(c) } return b } function e(a) { a = utils.html(a); for (var b = "", c = 0; c < a.length; c++)b += 32 == a.charCodeAt(c) ? String.fromCharCode(12288) : a.charCodeAt(c) < 127 ? String.fromCharCode(a.charCodeAt(c) + 65248) : a.charAt(c); return b } function f() { var a = h.getPreferences("autotypeset"); utils.extend(h.options.autotypeset, a) } this.setOpt({ autotypeset: { mergeEmptyline: !0, removeClass: !0, removeEmptyline: !1, textAlign: "left", imageBlockLine: "center", pasteFilter: !1, clearFontSize: !1, clearFontFamily: !1, removeEmptyNode: !1, removeTagNames: utils.extend({ div: 1 }, dtd.$removeEmpty), indent: !1, indentValue: "2em", bdc2sb: !1, tobdc: !1 } }); var g, h = this, i = h.options.autotypeset, j = { selectTdClass: 1, pagebreak: 1, anchorclass: 1 }, k = { li: 1 }, l = { div: 1, p: 1, blockquote: 1, center: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, span: 1 }; i && (f(), i.pasteFilter && h.addListener("beforepaste", c), h.commands.autotypeset = { execCommand: function () { h.removeListener("beforepaste", c), i.pasteFilter && h.addListener("beforepaste", c), c.call(h) } }) }, UE.plugin.register("autosubmit", function () { return { shortcutkey: { autosubmit: "ctrl+13" }, commands: { autosubmit: { execCommand: function () { var a = this, b = domUtils.findParentByTagName(a.iframe, "form", !1); if (b) { if (a.fireEvent("beforesubmit") === !1) return; a.sync(), b.submit() } } } } } }), UE.plugin.register("background", function () {
function a(a) { var b = {}, c = a.split(";"); return utils.each(c, function (a) { var c = a.indexOf(":"), d = utils.trim(a.substr(0, c)).toLowerCase(); d && (b[d] = utils.trim(a.substr(c + 1) || "")) }), b } function b(a) { if (a) { var b = []; for (var c in a) a.hasOwnProperty(c) && b.push(c + ":" + a[c] + "; "); utils.cssRule(e, b.length ? "body{" + b.join("") + "}" : "", d.document) } else utils.cssRule(e, "", d.document) } var c, d = this, e = "editor_background", f = new RegExp("body[\\s]*\\{(.+)\\}", "i"), g = d.hasContents; return d.hasContents = function () { return !!d.queryCommandValue("background") || g.apply(d, arguments) }, {
bindEvents: {
getAllHtml: function (a, b) { var c = this.body, e = domUtils.getComputedStyle(c, "background-image"), f = ""; f = e.indexOf(d.options.imagePath) > 0 ? e.substring(e.indexOf(d.options.imagePath), e.length - 1).replace(/"|\(|\)/gi, "") : "none" != e ? e.replace(/url\("?|"?\)/gi, "") : ""; var g = ' ", b.push(g) }, aftersetcontent: function () { 0 == c && b() }
}, inputRule: function (d) { c = !1, utils.each(d.getNodesByTagName("p"), function (d) { var e = d.getAttr("data-background"); e && (c = !0, b(a(e)), d.parentNode.removeChild(d)) }) }, outputRule: function (a) { var b = this, c = (utils.cssRule(e, b.document) || "").replace(/[\n\r]+/g, "").match(f); c && a.appendChild(UE.uNode.createElement('
')) }, commands: { background: { execCommand: function (a, c) { b(c) }, queryCommandValue: function () { var b = this, c = (utils.cssRule(e, b.document) || "").replace(/[\n\r]+/g, "").match(f); return c ? a(c[1]) : null }, notNeedUndo: !0 } }
}
}), UE.commands.imagefloat = { execCommand: function (a, b) { var c = this, d = c.selection.getRange(); if (!d.collapsed) { var e = d.getClosedNode(); if (e && "IMG" == e.tagName) switch (b) { case "left": case "right": case "none": for (var f, g, h, i = e.parentNode; dtd.$inline[i.tagName] || "A" == i.tagName;)i = i.parentNode; if (f = i, "P" == f.tagName && "center" == domUtils.getStyle(f, "text-align")) { if (!domUtils.isBody(f) && 1 == domUtils.getChildCount(f, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) })) if (g = f.previousSibling, h = f.nextSibling, g && h && 1 == g.nodeType && 1 == h.nodeType && g.tagName == h.tagName && domUtils.isBlockElm(g)) { for (g.appendChild(f.firstChild); h.firstChild;)g.appendChild(h.firstChild); domUtils.remove(f), domUtils.remove(h) } else domUtils.setStyle(f, "text-align", ""); d.selectNode(e).select() } domUtils.setStyle(e, "float", "none" == b ? "" : b), "none" == b && domUtils.removeAttributes(e, "align"); break; case "center": if ("center" != c.queryCommandValue("imagefloat")) { for (i = e.parentNode, domUtils.setStyle(e, "float", ""), domUtils.removeAttributes(e, "align"), f = e; i && 1 == domUtils.getChildCount(i, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) }) && (dtd.$inline[i.tagName] || "A" == i.tagName);)f = i, i = i.parentNode; d.setStartBefore(f).setCursor(!1), i = c.document.createElement("div"), i.appendChild(f), domUtils.setStyle(f, "float", ""), c.execCommand("insertHtml", '
' + i.innerHTML + "
"), f = c.document.getElementById("_img_parent_tmp"), f.removeAttribute("id"), f = f.firstChild, d.selectNode(f).select(), h = f.parentNode.nextSibling, h && domUtils.isEmptyNode(h) && domUtils.remove(h) } } } }, queryCommandValue: function () { var a, b, c = this.selection.getRange(); return c.collapsed ? "none" : (a = c.getClosedNode(), a && 1 == a.nodeType && "IMG" == a.tagName ? (b = domUtils.getComputedStyle(a, "float") || a.getAttribute("align"), "none" == b && (b = "center" == domUtils.getComputedStyle(a.parentNode, "text-align") ? "center" : b), { left: 1, right: 1, center: 1 }[b] ? b : "none") : "none") }, queryCommandState: function () { var a, b = this.selection.getRange(); return b.collapsed ? -1 : (a = b.getClosedNode(), a && 1 == a.nodeType && "IMG" == a.tagName ? 0 : -1) } }, UE.commands.insertimage = { execCommand: function (a, b) { function c(a) { utils.each("width,height,border,hspace,vspace".split(","), function (b) { a[b] && (a[b] = parseInt(a[b], 10) || 0) }), utils.each("src,_src".split(","), function (b) { a[b] && (a[b] = utils.unhtmlForUrl(a[b])) }), utils.each("title,alt".split(","), function (b) { a[b] && (a[b] = utils.unhtml(a[b])) }) } if (b = utils.isArray(b) ? b : [b], b.length) { var d = this, e = d.selection.getRange(), f = e.getClosedNode(); if (d.fireEvent("beforeinsertimage", b) !== !0) { if (!f || !/img/i.test(f.tagName) || "edui-faked-video" == f.className && f.className.indexOf("edui-upload-video") == -1 || f.getAttribute("word_img")) { var g, h = [], i = ""; if (g = b[0], 1 == b.length) c(g), i = '", "center" == g.floatStyle && (i = '
' + i + "
"), h.push(i); else for (var j = 0; g = b[j++];)c(g), i = "", h.push(i); d.execCommand("insertHtml", h.join("")) } else { var k = b.shift(), l = k.floatStyle; delete k.floatStyle, domUtils.setAttributes(f, k), d.execCommand("imagefloat", l), b.length > 0 && (e.setStartAfter(f).setCursor(!1, !0), d.execCommand("insertimage", b)) } d.fireEvent("afterinsertimage", b) } } } }, UE.plugins.justify = function () { var a = domUtils.isBlockElm, b = { left: 1, right: 1, center: 1, justify: 1 }, c = function (b, c) { var d = b.createBookmark(), e = function (a) { return 1 == a.nodeType ? "br" != a.tagName.toLowerCase() && !domUtils.isBookmarkNode(a) : !domUtils.isWhitespace(a) }; b.enlarge(!0); for (var f, g = b.createBookmark(), h = domUtils.getNextDomNode(g.start, !1, e), i = b.cloneRange(); h && !(domUtils.getPosition(h, g.end) & domUtils.POSITION_FOLLOWING);)if (3 != h.nodeType && a(h)) h = domUtils.getNextDomNode(h, !0, e); else { for (i.setStartBefore(h); h && h !== g.end && !a(h);)f = h, h = domUtils.getNextDomNode(h, !1, null, function (b) { return !a(b) }); i.setEndAfter(f); var j = i.getCommonAncestor(); if (!domUtils.isBody(j) && a(j)) domUtils.setStyles(j, utils.isString(c) ? { "text-align": c } : c), h = j; else { var k = b.document.createElement("p"); domUtils.setStyles(k, utils.isString(c) ? { "text-align": c } : c); var l = i.extractContents(); k.appendChild(l), i.insertNode(k), h = k } h = domUtils.getNextDomNode(h, !1, e) } return b.moveToBookmark(g).moveToBookmark(d) }; UE.commands.justify = { execCommand: function (a, b) { var d, e = this.selection.getRange(); return e.collapsed && (d = this.document.createTextNode("p"), e.insertNode(d)), c(e, b), d && (e.setStartBefore(d).collapse(!0), domUtils.remove(d)), e.select(), !0 }, queryCommandValue: function () { var a = this.selection.getStart(), c = domUtils.getComputedStyle(a, "text-align"); return b[c] ? c : "left" }, queryCommandState: function () { var a = this.selection.getStart(), b = a && domUtils.findParentByTagName(a, ["td", "th", "caption"], !0); return b ? -1 : 0 } } }, UE.plugins.font = function () { function a(a) { for (var b; (b = a.parentNode) && "SPAN" == b.tagName && 1 == domUtils.getChildCount(b, function (a) { return !domUtils.isBookmarkNode(a) && !domUtils.isBr(a) });)b.style.cssText += a.style.cssText, domUtils.remove(a, !0), a = b } function b(a, b, c) { if (g[b] && (a.adjustmentBoundary(), !a.collapsed && 1 == a.startContainer.nodeType)) { var d = a.startContainer.childNodes[a.startOffset]; if (d && domUtils.isTagNode(d, "span")) { var e = a.createBookmark(); utils.each(domUtils.getElementsByTagName(d, "span"), function (a) { a.parentNode && !domUtils.isBookmarkNode(a) && ("backcolor" == b && domUtils.getComputedStyle(a, "background-color").toLowerCase() === c || (domUtils.removeStyle(a, g[b]), 0 == a.style.cssText.replace(/^\s+$/, "").length && domUtils.remove(a, !0))) }), a.moveToBookmark(e) } } } function c(c, d, e) { var f, g = c.collapsed, h = c.createBookmark(); if (g) for (f = h.start.parentNode; dtd.$inline[f.tagName];)f = f.parentNode; else f = domUtils.getCommonAncestor(h.start, h.end); utils.each(domUtils.getElementsByTagName(f, "span"), function (b) { if (b.parentNode && !domUtils.isBookmarkNode(b)) { if (/\s*border\s*:\s*none;?\s*/i.test(b.style.cssText)) return void (/^\s*border\s*:\s*none;?\s*$/.test(b.style.cssText) ? domUtils.remove(b, !0) : domUtils.removeStyle(b, "border")); if (/border/i.test(b.style.cssText) && "SPAN" == b.parentNode.tagName && /border/i.test(b.parentNode.style.cssText) && (b.style.cssText = b.style.cssText.replace(/border[^:]*:[^;]+;?/gi, "")), "fontborder" != d || "none" != e) for (var c = b.nextSibling; c && 1 == c.nodeType && "SPAN" == c.tagName;)if (domUtils.isBookmarkNode(c) && "fontborder" == d) b.appendChild(c), c = b.nextSibling; else { if (c.style.cssText == b.style.cssText && (domUtils.moveChild(c, b), domUtils.remove(c)), b.nextSibling === c) break; c = b.nextSibling } if (a(b), browser.ie && browser.version > 8) { var f = domUtils.findParent(b, function (a) { return "SPAN" == a.tagName && /background-color/.test(a.style.cssText) }); f && !/background-color/.test(b.style.cssText) && (b.style.backgroundColor = f.style.backgroundColor) } } }), c.moveToBookmark(h), b(c, d, e) } var d = this, e = { forecolor: "color", backcolor: "background-color", fontsize: "font-size", fontfamily: "font-family", underline: "text-decoration", strikethrough: "text-decoration", fontborder: "border" }, f = { underline: 1, strikethrough: 1, fontborder: 1 }, g = { forecolor: "color", backcolor: "background-color", fontsize: "font-size", fontfamily: "font-family" }; d.setOpt({ 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" }], fontsize: [10, 11, 12, 14, 16, 18, 20, 24, 36] }), d.addInputRule(function (a) { utils.each(a.getNodesByTagName("u s del font strike"), function (a) { if ("font" == a.tagName) { var b = []; for (var c in a.attrs) switch (c) { case "size": b.push("font-size:" + ({ 1: "10", 2: "12", 3: "16", 4: "18", 5: "24", 6: "32", 7: "48" }[a.attrs[c]] || a.attrs[c]) + "px"); break; case "color": b.push("color:" + a.attrs[c]); break; case "face": b.push("font-family:" + a.attrs[c]); break; case "style": b.push(a.attrs[c]) }a.attrs = { style: b.join(";") } } else { var d = "u" == a.tagName ? "underline" : "line-through"; a.attrs = { style: (a.getAttr("style") || "") + "text-decoration:" + d + ";" } } a.tagName = "span" }) }); for (var h in e) !function (a, b) { UE.commands[a] = { execCommand: function (d, e) { e = e || (this.queryCommandState(d) ? "none" : "underline" == d ? "underline" : "fontborder" == d ? "1px solid #000" : "line-through"); var g, h = this, i = this.selection.getRange(); if ("default" == e) i.collapsed && (g = h.document.createTextNode("font"), i.insertNode(g).select()), h.execCommand("removeFormat", "span,a", b), g && (i.setStartBefore(g).collapse(!0), domUtils.remove(g)), c(i, d, e), i.select(); else if (i.collapsed) { var j = domUtils.findParentByTagName(i.startContainer, "span", !0); if (g = h.document.createTextNode("font"), !j || j.children.length || j[browser.ie ? "innerText" : "textContent"].replace(fillCharReg, "").length) { if (i.insertNode(g), i.selectNode(g).select(), j = i.document.createElement("span"), f[a]) { if (domUtils.findParentByTagName(g, "a", !0)) return i.setStartBefore(g).setCursor(), void domUtils.remove(g); h.execCommand("removeFormat", "span,a", b) } if (j.style.cssText = b + ":" + e, g.parentNode.insertBefore(j, g), !browser.ie || browser.ie && 9 == browser.version) for (var k = j.parentNode; !domUtils.isBlockElm(k);)"SPAN" == k.tagName && (j.style.cssText = k.style.cssText + ";" + j.style.cssText), k = k.parentNode; opera ? setTimeout(function () { i.setStart(j, 0).collapse(!0), c(i, d, e), i.select() }) : (i.setStart(j, 0).collapse(!0), c(i, d, e), i.select()) } else i.insertNode(g), f[a] && (i.selectNode(g).select(), h.execCommand("removeFormat", "span,a", b, null), j = domUtils.findParentByTagName(g, "span", !0), i.setStartBefore(g)), j && (j.style.cssText += ";" + b + ":" + e), i.collapse(!0).select(); domUtils.remove(g) } else f[a] && h.queryCommandValue(a) && h.execCommand("removeFormat", "span,a", b), i = h.selection.getRange(), i.applyInlineStyle("span", { style: b + ":" + e }), c(i, d, e), i.select(); return !0 }, queryCommandValue: function (a) { var c = this.selection.getStart(); if ("underline" == a || "strikethrough" == a) { for (var d, e = c; e && !domUtils.isBlockElm(e) && !domUtils.isBody(e);) { if (1 == e.nodeType && (d = domUtils.getComputedStyle(e, b), "none" != d)) return d; e = e.parentNode } return "none" } if ("fontborder" == a) { for (var f, g = c; g && dtd.$inline[g.tagName];) { if ((f = domUtils.getComputedStyle(g, "border")) && /1px/.test(f) && /solid/.test(f)) return f; g = g.parentNode } return "" } if ("FontSize" == a) { var h = domUtils.getComputedStyle(c, b), g = /^([\d\.]+)(\w+)$/.exec(h); return g ? Math.floor(g[1]) + g[2] : h } return domUtils.getComputedStyle(c, b) }, queryCommandState: function (a) { if (!f[a]) return 0; var b = this.queryCommandValue(a); return "fontborder" == a ? /1px/.test(b) && /solid/.test(b) : "underline" == a ? /underline/.test(b) : /line\-through/.test(b) } } }(h, e[h]) }, UE.plugins.link = function () { function a(a) { var b = a.startContainer, c = a.endContainer; (b = domUtils.findParentByTagName(b, "a", !0)) && a.setStartBefore(b), (c = domUtils.findParentByTagName(c, "a", !0)) && a.setEndAfter(c) } function b(b, c, d) { var e = b.cloneRange(), f = d.queryCommandValue("link"); a(b = b.adjustmentBoundary()); var g = b.startContainer; if (1 == g.nodeType && f && (g = g.childNodes[b.startOffset], g && 1 == g.nodeType && "A" == g.tagName && /^(?:https?|ftp|file)\s*:\s*\/\//.test(g[browser.ie ? "innerText" : "textContent"]) && (g[browser.ie ? "innerText" : "textContent"] = utils.html(c.textValue || c.href))), e.collapsed && !f || (b.removeInlineStyle("a"), e = b.cloneRange()), e.collapsed) { var h = b.document.createElement("a"), i = ""; c.textValue ? (i = utils.html(c.textValue), delete c.textValue) : i = utils.html(c.href), domUtils.setAttributes(h, c), g = domUtils.findParentByTagName(e.startContainer, "a", !0), g && domUtils.isInNodeEndBoundary(e, g) && b.setStartAfter(g).collapse(!0), h[browser.ie ? "innerText" : "textContent"] = i, b.insertNode(h).selectNode(h) } else b.applyInlineStyle("a", c) } UE.commands.unlink = { execCommand: function () { var b, c = this.selection.getRange(); c.collapsed && !domUtils.findParentByTagName(c.startContainer, "a", !0) || (b = c.createBookmark(), a(c), c.removeInlineStyle("a").moveToBookmark(b).select()) }, queryCommandState: function () { return !this.highlight && this.queryCommandValue("link") ? 0 : -1 } }, UE.commands.link = { execCommand: function (a, c) { var d; c._href && (c._href = utils.unhtml(c._href, /[<">]/g)), c.href && (c.href = utils.unhtml(c.href, /[<">]/g)), c.textValue && (c.textValue = utils.unhtml(c.textValue, /[<">]/g)), b(d = this.selection.getRange(), c, this), d.collapse().select(!0) }, queryCommandValue: function () { var a, b = this.selection.getRange(); if (!b.collapsed) { b.shrinkBoundary(); var c = 3 != b.startContainer.nodeType && b.startContainer.childNodes[b.startOffset] ? b.startContainer.childNodes[b.startOffset] : b.startContainer, d = 3 == b.endContainer.nodeType || 0 == b.endOffset ? b.endContainer : b.endContainer.childNodes[b.endOffset - 1], e = b.getCommonAncestor(); if (a = domUtils.findParentByTagName(e, "a", !0), !a && 1 == e.nodeType) for (var f, g, h, i = e.getElementsByTagName("a"), j = 0; h = i[j++];)if (f = domUtils.getPosition(h, c), g = domUtils.getPosition(h, d), (f & domUtils.POSITION_FOLLOWING || f & domUtils.POSITION_CONTAINS) && (g & domUtils.POSITION_PRECEDING || g & domUtils.POSITION_CONTAINS)) { a = h; break } return a } if (a = b.startContainer, a = 1 == a.nodeType ? a : a.parentNode, a && (a = domUtils.findParentByTagName(a, "a", !0)) && !domUtils.isInNodeEndBoundary(b, a)) return a }, queryCommandState: function () { var a = this.selection.getRange().getClosedNode(), b = a && ("edui-faked-video" == a.className || a.className.indexOf("edui-upload-video") != -1); return b ? -1 : 0 } } }, UE.plugins.insertframe = function () { function a() { b._iframe && delete b._iframe } var b = this; b.addListener("selectionchange", function () { a() }) }, UE.commands.scrawl = { queryCommandState: function () { return browser.ie && browser.version <= 8 ? -1 : 0 } }, UE.plugins.removeformat = function () { var a = this; a.setOpt({ removeFormatTags: "b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var", removeFormatAttributes: "class,style,lang,width,height,align,hspace,valign" }), a.commands.removeformat = { execCommand: function (a, b, c, d, e) { function f(a) { if (3 == a.nodeType || "span" != a.tagName.toLowerCase()) return 0; if (browser.ie) { var b = a.attributes; if (b.length) { for (var c = 0, d = b.length; c < d; c++)if (b[c].specified) return 0; return 1 } } return !a.attributes.length } function g(a) { var b = a.createBookmark(); if (a.collapsed && a.enlarge(!0), !e) { var d = domUtils.findParentByTagName(a.startContainer, "a", !0); d && a.setStartBefore(d), d = domUtils.findParentByTagName(a.endContainer, "a", !0), d && a.setEndAfter(d) } for (h = a.createBookmark(), p = h.start; (i = p.parentNode) && !domUtils.isBlockElm(i);)domUtils.breakParent(p, i), domUtils.clearEmptySibling(p); if (h.end) { for (p = h.end; (i = p.parentNode) && !domUtils.isBlockElm(i);)domUtils.breakParent(p, i), domUtils.clearEmptySibling(p); for (var g, l = domUtils.getNextDomNode(h.start, !1, m); l && l != h.end;)g = domUtils.getNextDomNode(l, !0, m), dtd.$empty[l.tagName.toLowerCase()] || domUtils.isBookmarkNode(l) || (j.test(l.tagName) ? c ? (domUtils.removeStyle(l, c), f(l) && "text-decoration" != c && domUtils.remove(l, !0)) : domUtils.remove(l, !0) : dtd.$tableContent[l.tagName] || dtd.$list[l.tagName] || (domUtils.removeAttributes(l, k), f(l) && domUtils.remove(l, !0))), l = g } var n = h.start.parentNode; !domUtils.isBlockElm(n) || dtd.$tableContent[n.tagName] || dtd.$list[n.tagName] || domUtils.removeAttributes(n, k), n = h.end.parentNode, h.end && domUtils.isBlockElm(n) && !dtd.$tableContent[n.tagName] && !dtd.$list[n.tagName] && domUtils.removeAttributes(n, k), a.moveToBookmark(h).moveToBookmark(b); for (var o, p = a.startContainer, q = a.collapsed; 1 == p.nodeType && domUtils.isEmptyNode(p) && dtd.$removeEmpty[p.tagName];)o = p.parentNode, a.setStartBefore(p), a.startContainer === a.endContainer && a.endOffset--, domUtils.remove(p), p = o; if (!q) for (p = a.endContainer; 1 == p.nodeType && domUtils.isEmptyNode(p) && dtd.$removeEmpty[p.tagName];)o = p.parentNode, a.setEndBefore(p), domUtils.remove(p), p = o } var h, i, j = new RegExp("^(?:" + (b || this.options.removeFormatTags).replace(/,/g, "|") + ")$", "i"), k = c ? [] : (d || this.options.removeFormatAttributes).split(","), l = new dom.Range(this.document), m = function (a) { return 1 == a.nodeType }; l = this.selection.getRange(), g(l), l.select() } } }, UE.plugins.blockquote = function () { function a(a) { return domUtils.filterNodeList(a.selection.getStartElementPath(), "blockquote") } var b = this; b.commands.blockquote = { execCommand: function (b, c) { var d = this.selection.getRange(), e = a(this), f = dtd.blockquote, g = d.createBookmark(); if (e) { var h = d.startContainer, i = domUtils.isBlockElm(h) ? h : domUtils.findParent(h, function (a) { return domUtils.isBlockElm(a) }), j = d.endContainer, k = domUtils.isBlockElm(j) ? j : domUtils.findParent(j, function (a) { return domUtils.isBlockElm(a) }); i = domUtils.findParentByTagName(i, "li", !0) || i, k = domUtils.findParentByTagName(k, "li", !0) || k, "LI" == i.tagName || "TD" == i.tagName || i === e || domUtils.isBody(i) ? domUtils.remove(e, !0) : domUtils.breakParent(i, e), i !== k && (e = domUtils.findParentByTagName(k, "blockquote"), e && ("LI" == k.tagName || "TD" == k.tagName || domUtils.isBody(k) ? e.parentNode && domUtils.remove(e, !0) : domUtils.breakParent(k, e))); for (var l, m = domUtils.getElementsByTagName(this.document, "blockquote"), n = 0; l = m[n++];)l.childNodes.length ? domUtils.getPosition(l, i) & domUtils.POSITION_FOLLOWING && domUtils.getPosition(l, k) & domUtils.POSITION_PRECEDING && domUtils.remove(l, !0) : domUtils.remove(l) } else { for (var o = d.cloneRange(), p = 1 == o.startContainer.nodeType ? o.startContainer : o.startContainer.parentNode, q = p, r = 1; ;) { if (domUtils.isBody(p)) { q !== p ? d.collapsed ? (o.selectNode(q), r = 0) : o.setStartBefore(q) : o.setStart(p, 0); break } if (!f[p.tagName]) { d.collapsed ? o.selectNode(q) : o.setStartBefore(q); break } q = p, p = p.parentNode } if (r) for (q = p = p = 1 == o.endContainer.nodeType ? o.endContainer : o.endContainer.parentNode; ;) { if (domUtils.isBody(p)) { q !== p ? o.setEndAfter(q) : o.setEnd(p, p.childNodes.length); break } if (!f[p.tagName]) { o.setEndAfter(q); break } q = p, p = p.parentNode } p = d.document.createElement("blockquote"), domUtils.setAttributes(p, c), p.appendChild(o.extractContents()), o.insertNode(p); for (var s, t = domUtils.getElementsByTagName(p, "blockquote"), n = 0; s = t[n++];)s.parentNode && domUtils.remove(s, !0) } d.moveToBookmark(g).select() }, queryCommandState: function () { return a(this) ? 1 : 0 } } }, UE.commands.touppercase = UE.commands.tolowercase = { execCommand: function (a) { var b = this, c = b.selection.getRange(); if (c.collapsed) return c; for (var d = c.createBookmark(), e = d.end, f = function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) }, g = domUtils.getNextDomNode(d.start, !1, f); g && domUtils.getPosition(g, e) & domUtils.POSITION_PRECEDING && (3 == g.nodeType && (g.nodeValue = g.nodeValue["touppercase" == a ? "toUpperCase" : "toLowerCase"]()), g = domUtils.getNextDomNode(g, !0, f), g !== e);); c.moveToBookmark(d).select() } }, UE.commands.indent = { execCommand: function () { var a = this, b = a.queryCommandState("indent") ? "0em" : a.options.indentValue || "2em"; a.execCommand("Paragraph", "p", { style: "text-indent:" + b }) }, queryCommandState: function () { var a = domUtils.filterNodeList(this.selection.getStartElementPath(), "p h1 h2 h3 h4 h5 h6"); return a && a.style.textIndent && parseInt(a.style.textIndent) ? 1 : 0 } }, UE.commands.print = { execCommand: function () { this.window.print() }, notNeedUndo: 1 }, UE.commands.preview = { execCommand: function () { var a = window.open("", "_blank", ""), b = a.document; b.open(), b.write('
" + this.getContent(null, null, !0) + "
"), b.close() }, notNeedUndo: 1 }, UE.plugins.selectall = function () { var a = this; a.commands.selectall = { execCommand: function () { var a = this, b = a.body, c = a.selection.getRange(); c.selectNodeContents(b), domUtils.isEmptyBlock(b) && (browser.opera && b.firstChild && 1 == b.firstChild.nodeType && c.setStartAtFirst(b.firstChild), c.collapse(!0)), c.select(!0) }, notNeedUndo: 1 }, a.addshortcutkey({ selectAll: "ctrl+65" }) }, UE.plugins.paragraph = function () { var a = this, b = domUtils.isBlockElm, c = ["TD", "LI", "PRE"], d = function (a, d, e, f) { var g, h = a.createBookmark(), i = function (a) { return 1 == a.nodeType ? "br" != a.tagName.toLowerCase() && !domUtils.isBookmarkNode(a) : !domUtils.isWhitespace(a) }; a.enlarge(!0); for (var j, k = a.createBookmark(), l = domUtils.getNextDomNode(k.start, !1, i), m = a.cloneRange(); l && !(domUtils.getPosition(l, k.end) & domUtils.POSITION_FOLLOWING);)if (3 != l.nodeType && b(l)) l = domUtils.getNextDomNode(l, !0, i); else { for (m.setStartBefore(l); l && l !== k.end && !b(l);)j = l, l = domUtils.getNextDomNode(l, !1, null, function (a) { return !b(a) }); m.setEndAfter(j), g = a.document.createElement(d), e && (domUtils.setAttributes(g, e), f && "customstyle" == f && e.style && (g.style.cssText = e.style)), g.appendChild(m.extractContents()), domUtils.isEmptyNode(g) && domUtils.fillChar(a.document, g), m.insertNode(g); var n = g.parentNode; b(n) && !domUtils.isBody(g.parentNode) && utils.indexOf(c, n.tagName) == -1 && (f && "customstyle" == f || (n.getAttribute("dir") && g.setAttribute("dir", n.getAttribute("dir")), n.style.cssText && (g.style.cssText = n.style.cssText + ";" + g.style.cssText), n.style.textAlign && !g.style.textAlign && (g.style.textAlign = n.style.textAlign), n.style.textIndent && !g.style.textIndent && (g.style.textIndent = n.style.textIndent), n.style.padding && !g.style.padding && (g.style.padding = n.style.padding)), e && /h\d/i.test(n.tagName) && !/h\d/i.test(g.tagName) ? (domUtils.setAttributes(n, e), f && "customstyle" == f && e.style && (n.style.cssText = e.style), domUtils.remove(g, !0), g = n) : domUtils.remove(g.parentNode, !0)), l = utils.indexOf(c, n.tagName) != -1 ? n : g, l = domUtils.getNextDomNode(l, !1, i) } return a.moveToBookmark(k).moveToBookmark(h) }; a.setOpt("paragraph", { p: "", h1: "", h2: "", h3: "", h4: "", h5: "", h6: "" }), a.commands.paragraph = { execCommand: function (a, b, c, e) { var f = this.selection.getRange(); if (f.collapsed) { var g = this.document.createTextNode("p"); if (f.insertNode(g), browser.ie) { var h = g.previousSibling; h && domUtils.isWhitespace(h) && domUtils.remove(h), h = g.nextSibling, h && domUtils.isWhitespace(h) && domUtils.remove(h) } } if (f = d(f, b, c, e), g && (f.setStartBefore(g).collapse(!0), pN = g.parentNode, domUtils.remove(g), domUtils.isBlockElm(pN) && domUtils.isEmptyNode(pN) && domUtils.fillNode(this.document, pN)), browser.gecko && f.collapsed && 1 == f.startContainer.nodeType) { var i = f.startContainer.childNodes[f.startOffset]; i && 1 == i.nodeType && i.tagName.toLowerCase() == b && f.setStart(i, 0).collapse(!0) } return f.select(), !0 }, queryCommandValue: function () { var a = domUtils.filterNodeList(this.selection.getStartElementPath(), "p h1 h2 h3 h4 h5 h6"); return a ? a.tagName.toLowerCase() : "" } } }, function () { var a = domUtils.isBlockElm, b = function (a) { return domUtils.filterNodeList(a.selection.getStartElementPath(), function (a) { return a && 1 == a.nodeType && a.getAttribute("dir") }) }, c = function (c, d, e) { var f, g = function (a) { return 1 == a.nodeType ? !domUtils.isBookmarkNode(a) : !domUtils.isWhitespace(a) }, h = b(d); if (h && c.collapsed) return h.setAttribute("dir", e), c; f = c.createBookmark(), c.enlarge(!0); for (var i, j = c.createBookmark(), k = domUtils.getNextDomNode(j.start, !1, g), l = c.cloneRange(); k && !(domUtils.getPosition(k, j.end) & domUtils.POSITION_FOLLOWING);)if (3 != k.nodeType && a(k)) k = domUtils.getNextDomNode(k, !0, g); else { for (l.setStartBefore(k); k && k !== j.end && !a(k);)i = k, k = domUtils.getNextDomNode(k, !1, null, function (b) { return !a(b) }); l.setEndAfter(i); var m = l.getCommonAncestor(); if (!domUtils.isBody(m) && a(m)) m.setAttribute("dir", e), k = m; else { var n = c.document.createElement("p"); n.setAttribute("dir", e); var o = l.extractContents(); n.appendChild(o), l.insertNode(n), k = n } k = domUtils.getNextDomNode(k, !1, g) } return c.moveToBookmark(j).moveToBookmark(f) }; UE.commands.directionality = { execCommand: function (a, b) { var d = this.selection.getRange(); if (d.collapsed) { var e = this.document.createTextNode("d"); d.insertNode(e) } return c(d, this, b), e && (d.setStartBefore(e).collapse(!0), domUtils.remove(e)), d.select(), !0 }, queryCommandValue: function () { var a = b(this); return a ? a.getAttribute("dir") : "ltr" } } }(), UE.plugins.horizontal = function () { var a = this; a.commands.horizontal = { execCommand: function (a) { var b = this; if (b.queryCommandState(a) !== -1) { b.execCommand("insertHtml", ""); var c = b.selection.getRange(), d = c.startContainer; if (1 == d.nodeType && !d.childNodes[c.startOffset]) { var e; (e = d.childNodes[c.startOffset - 1]) && 1 == e.nodeType && "HR" == e.tagName && ("p" == b.options.enterTag ? (e = b.document.createElement("p"), c.insertNode(e), c.setStart(e, 0).setCursor()) : (e = b.document.createElement("br"), c.insertNode(e), c.setStartBefore(e).setCursor())) } return !0 } }, queryCommandState: function () { return domUtils.filterNodeList(this.selection.getStartElementPath(), "table") ? -1 : 0 } }, a.addListener("delkeydown", function (a, b) { var c = this.selection.getRange(); if (c.txtToElmBoundary(!0), domUtils.isStartInblock(c)) { var d = c.startContainer, e = d.previousSibling; if (e && domUtils.isTagNode(e, "hr")) return domUtils.remove(e), c.select(), domUtils.preventDefault(b), !0 } }) }, UE.commands.time = UE.commands.date = { execCommand: function (a, b) { function c(a, b) { var c = ("0" + a.getHours()).slice(-2), d = ("0" + a.getMinutes()).slice(-2), e = ("0" + a.getSeconds()).slice(-2); return b = b || "hh:ii:ss", b.replace(/hh/gi, c).replace(/ii/gi, d).replace(/ss/gi, e) } function d(a, b) { var c = ("000" + a.getFullYear()).slice(-4), d = c.slice(-2), e = ("0" + (a.getMonth() + 1)).slice(-2), f = ("0" + a.getDate()).slice(-2); return b = b || "yyyy-mm-dd", b.replace(/yyyy/gi, c).replace(/yy/gi, d).replace(/mm/gi, e).replace(/dd/gi, f) } var e = new Date; this.execCommand("insertHtml", "time" == a ? c(e, b) : d(e, b)) } }, UE.plugins.rowspacing = function () { var a = this; a.setOpt({ rowspacingtop: ["5", "10", "15", "20", "25"], rowspacingbottom: ["5", "10", "15", "20", "25"] }), a.commands.rowspacing = { execCommand: function (a, b, c) { return this.execCommand("paragraph", "p", { style: "margin-" + c + ":" + b + "px" }), !0 }, queryCommandValue: function (a, b) { var c, d = domUtils.filterNodeList(this.selection.getStartElementPath(), function (a) { return domUtils.isBlockElm(a) }); return d ? (c = domUtils.getComputedStyle(d, "margin-" + b).replace(/[^\d]/g, ""), c ? c : 0) : 0 } } }, UE.plugins.lineheight = function () { var a = this; a.setOpt({ lineheight: ["1", "1.5", "1.75", "2", "3", "4", "5"] }), a.commands.lineheight = { execCommand: function (a, b) { return this.execCommand("paragraph", "p", { style: "line-height:" + ("1" == b ? "normal" : b + "em") }), !0 }, queryCommandValue: function () { var a = domUtils.filterNodeList(this.selection.getStartElementPath(), function (a) { return domUtils.isBlockElm(a) }); if (a) { var b = domUtils.getComputedStyle(a, "line-height"); return "normal" == b ? 1 : b.replace(/[^\d.]*/gi, "") } } } }, UE.plugins.insertcode = function () {
var a = this; a.ready(function () { utils.cssRule("pre", "pre{margin:.5em 0;padding:.4em .6em;border-radius:8px;background:#f8f8f8;}", a.document) }), a.setOpt("insertcode", { as3: "ActionScript3", bash: "Bash/Shell", cpp: "C/C++", css: "Css", cf: "CodeFunction", "c#": "C#", delphi: "Delphi", diff: "Diff", erlang: "Erlang", groovy: "Groovy", html: "Html", java: "Java", jfx: "JavaFx", js: "Javascript", pl: "Perl", php: "Php", plain: "Plain Text", ps: "PowerShell", python: "Python", ruby: "Ruby", scala: "Scala", sql: "Sql", vb: "Vb", xml: "Xml" }), a.commands.insertcode = { execCommand: function (a, b) { var c = this, d = c.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) e.className = "brush:" + b + ";toolbar:false;"; else { var f = ""; if (d.collapsed) f = browser.ie && browser.ie11below ? browser.version <= 8 ? " " : "" : " "; else { var g = d.extractContents(), h = c.document.createElement("div"); h.appendChild(g), utils.each(UE.filterNode(UE.htmlparser(h.innerHTML.replace(/[\r\t]/g, "")), c.options.filterTxtRules).children, function (a) { if (browser.ie && browser.ie11below && browser.version > 8) "element" == a.type ? "br" == a.tagName ? f += "\n" : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += "\n" : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /\n$/.test(f) || (f += "\n")) : f += a.data + "\n", !a.nextSibling() && /\n$/.test(f) && (f = f.replace(/\n$/, "")); else if (browser.ie && browser.ie11below) "element" == a.type ? "br" == a.tagName ? f += " " : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += " " : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /br>$/.test(f) || (f += " ")) : f += a.data + " ", !a.nextSibling() && / $/.test(f) && (f = f.replace(/ $/, "")); else if (f += "element" == a.type ? dtd.$empty[a.tagName] ? "" : a.innerText() : a.data, !/br\/?\s*>$/.test(f)) { if (!a.nextSibling()) return; f += " " } }) } c.execCommand("inserthtml", '
' + f + "
", !0), e = c.document.getElementById("coder"), domUtils.removeAttributes(e, "id"); var i = e.previousSibling; i && (3 == i.nodeType && 1 == i.nodeValue.length && browser.ie && 6 == browser.version || domUtils.isEmptyBlock(i)) && domUtils.remove(i); var d = c.selection.getRange(); domUtils.isEmptyBlock(e) ? d.setStart(e, 0).setCursor(!1, !0) : d.selectNodeContents(e).select() } }, queryCommandValue: function () { var a = this.selection.getStartElementPath(), b = ""; return utils.each(a, function (a) { if ("PRE" == a.nodeName) { var c = a.className.match(/brush:([^;]+)/); return b = c && c[1] ? c[1] : "", !1 } }), b } }, a.addInputRule(function (a) { utils.each(a.getNodesByTagName("pre"), function (a) { var b = a.getNodesByTagName("br"); if (b.length) return void (browser.ie && browser.ie11below && browser.version > 8 && utils.each(b, function (a) { var b = UE.uNode.createText("\n"); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) })); if (!(browser.ie && browser.ie11below && browser.version > 8)) { var c = a.innerText().split(/\n/); a.innerHTML(""), utils.each(c, function (b) { b.length && a.appendChild(UE.uNode.createText(b)), a.appendChild(UE.uNode.createElement("br")) }) } }) }), a.addOutputRule(function (a) { utils.each(a.getNodesByTagName("pre"), function (a) { var b = ""; utils.each(a.children, function (a) { b += "text" == a.type ? a.data.replace(/[ ]/g, " ").replace(/\n$/, "") : "br" == a.tagName ? "\n" : dtd.$empty[a.tagName] ? a.innerText() : "" }), a.innerText(b.replace(/( |\n)+$/, "")) }) }), a.notNeedCodeQuery = { help: 1, undo: 1, redo: 1, source: 1, print: 1, searchreplace: 1, fullscreen: 1, preview: 1, insertparagraph: 1, elementpath: 1, insertcode: 1, inserthtml: 1, selectall: 1 }; a.queryCommandState; a.queryCommandState = function (a) { var b = this; return !b.notNeedCodeQuery[a.toLowerCase()] && b.selection && b.queryCommandValue("insertcode") ? -1 : UE.Editor.prototype.queryCommandState.apply(this, arguments) }, a.addListener("beforeenterkeydown", function () {
var b = a.selection.getRange(), c = domUtils.findParentByTagName(b.startContainer, "pre", !0); if (c) {
if (a.fireEvent("saveScene"), b.collapsed || b.deleteContents(), !browser.ie || browser.ie9above) {
var c, d = a.document.createElement("br"); b.insertNode(d).setStartAfter(d).collapse(!0);
var e = d.nextSibling; e || browser.ie && !(browser.version > 10) ? b.setStartAfter(d) : b.insertNode(d.cloneNode(!1)), c = d.previousSibling; for (var f; c;)if (f = c, c = c.previousSibling, !c || "BR" == c.nodeName) { c = f; break } if (c) { for (var g = ""; c && "BR" != c.nodeName && new RegExp("^[\\s" + domUtils.fillChar + "]*$").test(c.nodeValue);)g += c.nodeValue, c = c.nextSibling; if ("BR" != c.nodeName) { var h = c.nodeValue.match(new RegExp("^([\\s" + domUtils.fillChar + "]+)")); h && h[1] && (g += h[1]) } g && (g = a.document.createTextNode(g), b.insertNode(g).setStartAfter(g)) } b.collapse(!0).select(!0)
} else if (browser.version > 8) { var i = a.document.createTextNode("\n"), j = b.startContainer; if (0 == b.startOffset) { var k = j.previousSibling; if (k) { b.insertNode(i); var l = a.document.createTextNode(" "); b.setStartAfter(i).insertNode(l).setStart(l, 0).collapse(!0).select(!0) } } else { b.insertNode(i).setStartAfter(i); var l = a.document.createTextNode(" "); j = b.startContainer.childNodes[b.startOffset], j && !/^\n/.test(j.nodeValue) && b.setStartBefore(i), b.insertNode(l).setStart(l, 0).collapse(!0).select(!0) } } else { var d = a.document.createElement("br"); b.insertNode(d), b.insertNode(a.document.createTextNode(domUtils.fillChar)), b.setStartAfter(d), c = d.previousSibling; for (var f; c;)if (f = c, c = c.previousSibling, !c || "BR" == c.nodeName) { c = f; break } if (c) { for (var g = ""; c && "BR" != c.nodeName && new RegExp("^[ " + domUtils.fillChar + "]*$").test(c.nodeValue);)g += c.nodeValue, c = c.nextSibling; if ("BR" != c.nodeName) { var h = c.nodeValue.match(new RegExp("^([ " + domUtils.fillChar + "]+)")); h && h[1] && (g += h[1]) } g = a.document.createTextNode(g), b.insertNode(g).setStartAfter(g) } b.collapse(!0).select() } return a.fireEvent("saveScene"), !0
}
}), a.addListener("tabkeydown", function (b, c) { var d = a.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) { if (a.fireEvent("saveScene"), c.shiftKey); else if (d.collapsed) { var f = a.document.createTextNode(" "); d.insertNode(f).setStartAfter(f).collapse(!0).select(!0) } else { for (var g = d.createBookmark(), h = g.start.previousSibling; h;) { if (e.firstChild === h && !domUtils.isBr(h)) { e.insertBefore(a.document.createTextNode(" "), h); break } if (domUtils.isBr(h)) { e.insertBefore(a.document.createTextNode(" "), h.nextSibling); break } h = h.previousSibling } var i = g.end; for (h = g.start.nextSibling, e.firstChild === g.start && e.insertBefore(a.document.createTextNode(" "), h.nextSibling); h && h !== i;) { if (domUtils.isBr(h) && h.nextSibling) { if (h.nextSibling === i) break; e.insertBefore(a.document.createTextNode(" "), h.nextSibling) } h = h.nextSibling } d.moveToBookmark(g).select() } return a.fireEvent("saveScene"), !0 } }), a.addListener("beforeinserthtml", function (a, b) { var c = this, d = c.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) { d.collapsed || d.deleteContents(); var f = ""; if (browser.ie && browser.version > 8) { utils.each(UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules).children, function (a) { "element" == a.type ? "br" == a.tagName ? f += "\n" : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += "\n" : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /\n$/.test(f) || (f += "\n")) : f += a.data + "\n", !a.nextSibling() && /\n$/.test(f) && (f = f.replace(/\n$/, "")) }); var g = c.document.createTextNode(utils.html(f.replace(/ /g, " "))); d.insertNode(g).selectNode(g).select() } else { var h = c.document.createDocumentFragment(); utils.each(UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules).children, function (a) { "element" == a.type ? "br" == a.tagName ? h.appendChild(c.document.createElement("br")) : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? h.appendChild(c.document.createElement("br")) : dtd.$empty[a.tagName] || h.appendChild(c.document.createTextNode(utils.html(b.innerText().replace(/ /g, " ")))) : h.appendChild(c.document.createTextNode(utils.html(b.data.replace(/ /g, " ")))) }), "BR" != h.lastChild.nodeName && h.appendChild(c.document.createElement("br"))) : h.appendChild(c.document.createTextNode(utils.html(a.data.replace(/ /g, " ")))), a.nextSibling() || "BR" != h.lastChild.nodeName || h.removeChild(h.lastChild) }), d.insertNode(h).select() } return !0 } }), a.addListener("keydown", function (a, b) { var c = this, d = b.keyCode || b.which; if (40 == d) { var e, f = c.selection.getRange(), g = f.startContainer; if (f.collapsed && (e = domUtils.findParentByTagName(f.startContainer, "pre", !0)) && !e.nextSibling) { for (var h = e.lastChild; h && "BR" == h.nodeName;)h = h.previousSibling; (h === g || f.startContainer === e && f.startOffset == e.childNodes.length) && (c.execCommand("insertparagraph"), domUtils.preventDefault(b)) } } }), a.addListener("delkeydown", function (b, c) { var d = this.selection.getRange(); d.txtToElmBoundary(!0); var e = d.startContainer; if (domUtils.isTagNode(e, "pre") && d.collapsed && domUtils.isStartInblock(d)) { var f = a.document.createElement("p"); return domUtils.fillNode(a.document, f), e.parentNode.insertBefore(f, e), domUtils.remove(e), d.setStart(f, 0).setCursor(!1, !0), domUtils.preventDefault(c), !0 } })
}, UE.commands.cleardoc = { execCommand: function (a) { var b = this, c = b.options.enterTag, d = b.selection.getRange(); "br" == c ? (b.body.innerHTML = " ", d.setStart(b.body, 0).setCursor()) : (b.body.innerHTML = "
" + (ie ? "" : " ") + "
", d.setStart(b.body.firstChild, 0).setCursor(!1, !0)), setTimeout(function () { b.fireEvent("clearDoc") }, 0) } }, UE.plugin.register("anchor", function () { return { bindEvents: { ready: function () { utils.cssRule("anchor", ".anchorclass{background: url('" + this.options.themePath + this.options.theme + "/images/anchor.gif') no-repeat scroll left center transparent;cursor: auto;display: inline-block;height: 16px;width: 15px;}", this.document) } }, outputRule: function (a) { utils.each(a.getNodesByTagName("img"), function (a) { var b; (b = a.getAttr("anchorname")) && (a.tagName = "a", a.setAttr({ anchorname: "", name: b, "class": "" })) }) }, inputRule: function (a) { utils.each(a.getNodesByTagName("a"), function (a) { var b; (b = a.getAttr("name")) && !a.getAttr("href") && (a.tagName = "img", a.setAttr({ anchorname: a.getAttr("name"), "class": "anchorclass" }), a.setAttr("name")) }) }, commands: { anchor: { execCommand: function (a, b) { var c = this.selection.getRange(), d = c.getClosedNode(); if (d && d.getAttribute("anchorname")) b ? d.setAttribute("anchorname", b) : (c.setStartBefore(d).setCursor(), domUtils.remove(d)); else if (b) { var e = this.document.createElement("img"); c.collapse(!0), domUtils.setAttributes(e, { anchorname: b, "class": "anchorclass" }), c.insertNode(e).setStartAfter(e).setCursor(!1, !0) } } } } } }), UE.plugins.wordcount = function () { var a = this; a.setOpt("wordCount", !0), a.addListener("contentchange", function () { a.fireEvent("wordcount") }); var b; a.addListener("ready", function () { var a = this; domUtils.on(a.body, "keyup", function (c) { var d = c.keyCode || c.which, e = { 16: 1, 18: 1, 20: 1, 37: 1, 38: 1, 39: 1, 40: 1 }; d in e || (clearTimeout(b), b = setTimeout(function () { a.fireEvent("wordcount") }, 200)) }) }) }, UE.plugins.pagebreak = function () { function a(a) { if (domUtils.isEmptyBlock(a)) { for (var b, d = a.firstChild; d && 1 == d.nodeType && domUtils.isEmptyBlock(d);)b = d, d = d.firstChild; !b && (b = a), domUtils.fillNode(c.document, b) } } function b(a) { return a && 1 == a.nodeType && "HR" == a.tagName && "pagebreak" == a.className } var c = this, d = ["td"]; c.setOpt("pageBreakTag", "_ueditor_page_break_tag_"), c.ready(function () { utils.cssRule("pagebreak", ".pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}", c.document) }), c.addInputRule(function (a) { a.traversal(function (a) { if ("text" == a.type && a.data == c.options.pageBreakTag) { var b = UE.uNode.createElement(''); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) } }) }), c.addOutputRule(function (a) { utils.each(a.getNodesByTagName("hr"), function (a) { if ("pagebreak" == a.getAttr("class")) { var b = UE.uNode.createText(c.options.pageBreakTag); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) } }) }), c.commands.pagebreak = { execCommand: function () { var e = c.selection.getRange(), f = c.document.createElement("hr"); domUtils.setAttributes(f, { "class": "pagebreak", noshade: "noshade", size: "5" }), domUtils.unSelectable(f); var g, h = domUtils.findParentByTagName(e.startContainer, d, !0), i = []; if (h) switch (h.tagName) { case "TD": if (g = h.parentNode, g.previousSibling) g.parentNode.insertBefore(f, g), i = domUtils.findParents(f); else { var j = domUtils.findParentByTagName(g, "table"); j.parentNode.insertBefore(f, j), i = domUtils.findParents(f, !0) } g = i[1], f !== g && domUtils.breakParent(f, g), c.fireEvent("afteradjusttable", c.document) } else { if (!e.collapsed) { e.deleteContents(); for (var k = e.startContainer; !domUtils.isBody(k) && domUtils.isBlockElm(k) && domUtils.isEmptyNode(k);)e.setStartBefore(k).collapse(!0), domUtils.remove(k), k = e.startContainer } e.insertNode(f); for (var l, g = f.parentNode; !domUtils.isBody(g);)domUtils.breakParent(f, g), l = f.nextSibling, l && domUtils.isEmptyBlock(l) && domUtils.remove(l), g = f.parentNode; l = f.nextSibling; var m = f.previousSibling; if (b(m) ? domUtils.remove(m) : m && a(m), l) b(l) ? domUtils.remove(l) : a(l), e.setEndAfter(f).collapse(!1); else { var n = c.document.createElement("p"); f.parentNode.appendChild(n), domUtils.fillNode(c.document, n), e.setStart(n, 0).collapse(!0) } e.select(!0) } } } }, UE.plugin.register("wordimage", function () { var a = this, b = []; return { commands: { wordimage: { execCommand: function () { for (var b, c = domUtils.getElementsByTagName(a.body, "img"), d = [], e = 0; b = c[e++];) { var f = b.getAttribute("word_img"); f && d.push(f) } return d }, queryCommandState: function () { b = domUtils.getElementsByTagName(a.body, "img"); for (var c, d = 0; c = b[d++];)if (c.getAttribute("word_img")) return 1; return -1 }, notNeedUndo: !0 } }, inputRule: function (b) { utils.each(b.getNodesByTagName("img"), function (b) { var c = b.attrs, d = parseInt(c.width) < 128 || parseInt(c.height) < 43, e = a.options, f = e.UEDITOR_HOME_URL + "themes/default/images/spacer.gif"; c.src && /^(?:(file:\/+))/.test(c.src) && b.setAttr({ width: c.width, height: c.height, alt: c.alt, word_img: c.src, src: f, style: "background:url(" + (d ? e.themePath + e.theme + "/images/word.gif" : e.langPath + e.lang + "/images/localimage.png") + ") no-repeat center center;border:1px solid #ddd" }) }) } } }), UE.plugins.dragdrop = function () { var a = this; a.ready(function () { domUtils.on(this.body, "dragend", function () { var b = a.selection.getRange(), c = b.getClosedNode() || a.selection.getStart(); if (c && "IMG" == c.tagName) { for (var d, e = c.previousSibling; (d = c.nextSibling) && 1 == d.nodeType && "SPAN" == d.tagName && !d.firstChild;)domUtils.remove(d); (!e || 1 != e.nodeType || domUtils.isEmptyBlock(e)) && e || d && (!d || domUtils.isEmptyBlock(d)) || (e && "P" == e.tagName && !domUtils.isEmptyBlock(e) ? (e.appendChild(c), domUtils.moveChild(d, e), domUtils.remove(d)) : d && "P" == d.tagName && !domUtils.isEmptyBlock(d) && d.insertBefore(c, d.firstChild), e && "P" == e.tagName && domUtils.isEmptyBlock(e) && domUtils.remove(e), d && "P" == d.tagName && domUtils.isEmptyBlock(d) && domUtils.remove(d), b.selectNode(c).select(), a.fireEvent("saveScene")) } }) }), a.addListener("keyup", function (b, c) { var d = c.keyCode || c.which; if (13 == d) { var e, f = a.selection.getRange(); (e = domUtils.findParentByTagName(f.startContainer, "p", !0)) && "center" == domUtils.getComputedStyle(e, "text-align") && domUtils.removeStyle(e, "text-align") } }) }, UE.plugins.undo = function () { function a(a, b) { if (a.length != b.length) return 0; for (var c = 0, d = a.length; c < d; c++)if (a[c] != b[c]) return 0; return 1 } function b(b, c) { return b.collapsed != c.collapsed ? 0 : a(b.startAddress, c.startAddress) && a(b.endAddress, c.endAddress) ? 1 : 0 } function c() { this.list = [], this.index = 0, this.hasUndo = !1, this.hasRedo = !1, this.undo = function () { if (this.hasUndo) { if (!this.list[this.index - 1] && 1 == this.list.length) return void this.reset(); for (; this.list[this.index].content == this.list[this.index - 1].content;)if (this.index--, 0 == this.index) return this.restore(0); this.restore(--this.index) } }, this.redo = function () { if (this.hasRedo) { for (; this.list[this.index].content == this.list[this.index + 1].content;)if (this.index++, this.index == this.list.length - 1) return this.restore(this.index); this.restore(++this.index) } }, this.restore = function () { var a = this.editor, b = this.list[this.index], c = UE.htmlparser(b.content.replace(h, "")); a.options.autoClearEmptyNode = !1, a.filterInputRule(c), a.options.autoClearEmptyNode = j, a.document.body.innerHTML = c.toHtml(), a.fireEvent("afterscencerestore"), browser.ie && utils.each(domUtils.getElementsByTagName(a.document, "td th caption p"), function (b) { domUtils.isEmptyNode(b) && domUtils.fillNode(a.document, b) }); try { var d = new dom.Range(a.document).moveToAddress(b.address); d.select(i[d.startContainer.nodeName.toLowerCase()]) } catch (e) { } this.update(), this.clearKey(), a.fireEvent("reset", !0) }, this.getScene = function () { var a = this.editor, b = a.selection.getRange(), c = b.createAddress(!1, !0); a.fireEvent("beforegetscene"); var d = UE.htmlparser(a.body.innerHTML); a.options.autoClearEmptyNode = !1, a.filterOutputRule(d), a.options.autoClearEmptyNode = j; var e = d.toHtml(); return a.fireEvent("aftergetscene"), { address: c, content: e } }, this.save = function (a, c) { clearTimeout(d); var g = this.getScene(c), h = this.list[this.index]; h && h.content != g.content && e.trigger("contentchange"), h && h.content == g.content && (a ? 1 : b(h.address, g.address)) || (this.list = this.list.slice(0, this.index + 1), this.list.push(g), this.list.length > f && this.list.shift(), this.index = this.list.length - 1, this.clearKey(), this.update()) }, this.update = function () { this.hasRedo = !!this.list[this.index + 1], this.hasUndo = !!this.list[this.index - 1] }, this.reset = function () { this.list = [], this.index = 0, this.hasUndo = !1, this.hasRedo = !1, this.clearKey() }, this.clearKey = function () { m = 0, k = null } } var d, e = this, f = e.options.maxUndoCount || 20, g = e.options.maxInputCount || 20, h = new RegExp(domUtils.fillChar + "|", "gi"), i = { ol: 1, ul: 1, table: 1, tbody: 1, tr: 1, body: 1 }, j = e.options.autoClearEmptyNode; e.undoManger = new c, e.undoManger.editor = e, e.addListener("saveScene", function () { var a = Array.prototype.splice.call(arguments, 1); this.undoManger.save.apply(this.undoManger, a) }), e.addListener("reset", function (a, b) { b || this.undoManger.reset() }), e.commands.redo = e.commands.undo = { execCommand: function (a) { this.undoManger[a]() }, queryCommandState: function (a) { return this.undoManger["has" + ("undo" == a.toLowerCase() ? "Undo" : "Redo")] ? 0 : -1 }, notNeedUndo: 1 }; var k, l = { 16: 1, 17: 1, 18: 1, 37: 1, 38: 1, 39: 1, 40: 1 }, m = 0, n = !1; e.addListener("ready", function () { domUtils.on(this.body, "compositionstart", function () { n = !0 }), domUtils.on(this.body, "compositionend", function () { n = !1 }) }), e.addshortcutkey({ Undo: "ctrl+90", Redo: "ctrl+89" }); var o = !0; e.addListener("keydown", function (a, b) { function c(a) { a.undoManger.save(!1, !0), a.fireEvent("selectionchange") } var e = this, f = b.keyCode || b.which; if (!(l[f] || b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)) { if (n) return; if (!e.selection.getRange().collapsed) return e.undoManger.save(!1, !0), void (o = !1); 0 == e.undoManger.list.length && e.undoManger.save(!0), clearTimeout(d), d = setTimeout(function () { if (n) var a = setInterval(function () { n || (c(e), clearInterval(a)) }, 300); else c(e) }, 200), k = f, m++, m >= g && c(e) } }), e.addListener("keyup", function (a, b) { var c = b.keyCode || b.which; if (!(l[c] || b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)) { if (n) return; o || (this.undoManger.save(!1, !0), o = !0) } }), e.stopCmdUndo = function () { e.__hasEnterExecCommand = !0 }, e.startCmdUndo = function () { e.__hasEnterExecCommand = !1 } }, UE.plugin.register("copy", function () { function a() { ZeroClipboard.config({ debug: !1, swfPath: b.options.UEDITOR_HOME_URL + "third-party/zeroclipboard/ZeroClipboard.swf" }); var a = b.zeroclipboard = new ZeroClipboard; a.on("copy", function (a) { var c = a.client, d = b.selection.getRange(), e = document.createElement("div"); e.appendChild(d.cloneContents()), c.setText(e.innerText || e.textContent), c.setHtml(e.innerHTML), d.select() }), a.on("mouseover mouseout", function (a) { var b = a.target; "mouseover" == a.type ? domUtils.addClass(b, "edui-state-hover") : "mouseout" == a.type && domUtils.removeClasses(b, "edui-state-hover") }), a.on("wrongflash noflash", function () { ZeroClipboard.destroy() }) } var b = this; return { bindEvents: { ready: function () { browser.ie || (window.ZeroClipboard ? a() : utils.loadFile(document, { src: b.options.UEDITOR_HOME_URL + "third-party/zeroclipboard/ZeroClipboard.js", tag: "script", type: "text/javascript", defer: "defer" }, function () { a() })) } }, commands: { copy: { execCommand: function (a) { b.document.execCommand("copy") || alert(b.getLang("copymsg")) } } } } }), UE.plugins.paste = function () { function a(a) { var b = this.document; if (!b.getElementById("baidu_pastebin")) { var c = this.selection.getRange(), d = c.createBookmark(), e = b.createElement("div"); e.id = "baidu_pastebin", browser.webkit && e.appendChild(b.createTextNode(domUtils.fillChar + domUtils.fillChar)), b.body.appendChild(e), d.start.style.display = "", e.style.cssText = "position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:" + domUtils.getXY(d.start).y + "px", c.selectNodeContents(e).select(!0), setTimeout(function () { if (browser.webkit) for (var f, g = 0, h = b.querySelectorAll("#baidu_pastebin"); f = h[g++];) { if (!domUtils.isEmptyNode(f)) { e = f; break } domUtils.remove(f) } try { e.parentNode.removeChild(e) } catch (i) { } c.moveToBookmark(d).select(!0), a(e) }, 0) } } function b(a) { return a.replace(/<(\/?)([\w\-]+)([^>]*)>/gi, function (a, b, c, d) { return c = c.toLowerCase(), { img: 1 }[c] ? a : (d = d.replace(/([\w\-]*?)\s*=\s*(("([^"]*)")|('([^']*)')|([^\s>]+))/gi, function (a, b, c) { return { src: 1, href: 1, name: 1 }[b.toLowerCase()] ? b + "=" + c + " " : "" }), { span: 1, div: 1 }[c] ? "" : "<" + b + c + " " + utils.trim(d) + ">") }) } function c(a) { var c; if (a.firstChild) { for (var h, i = domUtils.getElementsByTagName(a, "span"), j = 0; h = i[j++];)"_baidu_cut_start" != h.id && "_baidu_cut_end" != h.id || domUtils.remove(h); if (browser.webkit) { for (var k, l = a.querySelectorAll("div br"), j = 0; k = l[j++];) { var m = k.parentNode; "DIV" == m.tagName && 1 == m.childNodes.length && (m.innerHTML = "
", domUtils.remove(m)) } for (var n, o = a.querySelectorAll("#baidu_pastebin"), j = 0; n = o[j++];) { var p = d.document.createElement("p"); for (n.parentNode.insertBefore(p, n); n.firstChild;)p.appendChild(n.firstChild); domUtils.remove(n) } for (var q, r = a.querySelectorAll("meta"), j = 0; q = r[j++];)domUtils.remove(q); var l = a.querySelectorAll("br"); for (j = 0; q = l[j++];)/^apple-/i.test(q.className) && domUtils.remove(q) } if (browser.gecko) { var s = a.querySelectorAll("[_moz_dirty]"); for (j = 0; q = s[j++];)q.removeAttribute("_moz_dirty") } if (!browser.ie) for (var q, t = a.querySelectorAll("span.Apple-style-span"), j = 0; q = t[j++];)domUtils.remove(q, !0); c = a.innerHTML, c = UE.filterWord(c); var u = UE.htmlparser(c); if (d.options.filterRules && UE.filterNode(u, d.options.filterRules), d.filterInputRule(u), browser.webkit) { var v = u.lastChild(); v && "element" == v.type && "br" == v.tagName && u.removeChild(v), utils.each(d.body.querySelectorAll("div"), function (a) { domUtils.isEmptyBlock(a) && domUtils.remove(a, !0) }) } if (c = { html: u.toHtml() }, d.fireEvent("beforepaste", c, u), !c.html) return; u = UE.htmlparser(c.html, !0), 1 === d.queryCommandState("pasteplain") ? d.execCommand("insertHtml", UE.filterNode(u, d.options.filterTxtRules).toHtml(), !0) : (UE.filterNode(u, d.options.filterTxtRules), e = u.toHtml(), f = c.html, g = d.selection.getRange().createAddress(!0), d.execCommand("insertHtml", d.getOpt("retainOnlyLabelPasted") === !0 ? b(f) : f, !0)), d.fireEvent("afterpaste", c) } } var d = this; d.setOpt({ retainOnlyLabelPasted: !1 }); var e, f, g; d.addListener("pasteTransfer", function (a, c) { if (g && e && f && e != f) { var h = d.selection.getRange(); if (h.moveToAddress(g, !0), !h.collapsed) { for (; !domUtils.isBody(h.startContainer);) { var i = h.startContainer; if (1 == i.nodeType) { if (i = i.childNodes[h.startOffset], !i) { h.setStartBefore(h.startContainer); continue } var j = i.previousSibling; j && 3 == j.nodeType && new RegExp("^[\n\r\t " + domUtils.fillChar + "]*$").test(j.nodeValue) && h.setStartBefore(j) } if (0 != h.startOffset) break; h.setStartBefore(h.startContainer) } for (; !domUtils.isBody(h.endContainer);) { var k = h.endContainer; if (1 == k.nodeType) { if (k = k.childNodes[h.endOffset], !k) { h.setEndAfter(h.endContainer); continue } var l = k.nextSibling; l && 3 == l.nodeType && new RegExp("^[\n\r\t" + domUtils.fillChar + "]*$").test(l.nodeValue) && h.setEndAfter(l) } if (h.endOffset != h.endContainer[3 == h.endContainer.nodeType ? "nodeValue" : "childNodes"].length) break; h.setEndAfter(h.endContainer) } } h.deleteContents(), h.select(!0), d.__hasEnterExecCommand = !0; var m = f; 2 === c ? m = b(m) : c && (m = e), d.execCommand("inserthtml", m, !0), d.__hasEnterExecCommand = !1; for (var n = d.selection.getRange(); !domUtils.isBody(n.startContainer) && !n.startOffset && n.startContainer[3 == n.startContainer.nodeType ? "nodeValue" : "childNodes"].length;)n.setStartBefore(n.startContainer); var o = n.createAddress(!0); g.endAddress = o.startAddress } }), d.addListener("ready", function () { domUtils.on(d.body, "cut", function () { var a = d.selection.getRange(); !a.collapsed && d.undoManger && d.undoManger.save() }), domUtils.on(d.body, browser.ie || browser.opera ? "keydown" : "paste", function (b) { (!browser.ie && !browser.opera || (b.ctrlKey || b.metaKey) && "86" == b.keyCode) && a.call(d, function (a) { c(a) }) }) }), d.commands.paste = { execCommand: function (b) { browser.ie ? (a.call(d, function (a) { c(a) }), d.document.execCommand("paste")) : alert(d.getLang("pastemsg")) } } }, UE.plugins.pasteplain = function () { var a = this; a.setOpt({ pasteplain: !1, filterTxtRules: function () { function a(a) { a.tagName = "p", a.setStyle() } function b(a) { a.parentNode.removeChild(a, !0) } return { "-": "script style object iframe embed input select", p: { $: {} }, br: { $: {} }, div: function (a) { for (var b, c = UE.uNode.createElement("p"); b = a.firstChild();)"text" != b.type && UE.dom.dtd.$block[b.tagName] ? c.firstChild() ? (a.parentNode.insertBefore(c, a), c = UE.uNode.createElement("p")) : a.parentNode.insertBefore(b, a) : c.appendChild(b); c.firstChild() && a.parentNode.insertBefore(c, a), a.parentNode.removeChild(a) }, ol: b, ul: b, dl: b, dt: b, dd: b, li: b, caption: a, th: a, tr: a, h1: a, h2: a, h3: a, h4: a, h5: a, h6: a, td: function (a) { var b = !!a.innerText(); b && a.parentNode.insertAfter(UE.uNode.createText(" "), a), a.parentNode.removeChild(a, a.innerText()) } } }() }); var b = a.options.pasteplain; a.commands.pasteplain = { queryCommandState: function () { return b ? 1 : 0 }, execCommand: function () { b = 0 | !b }, notNeedUndo: 1 } }, UE.plugins.list = function () {
function a(a) { var b = []; for (var c in a) b.push(c); return b } function b(a) { var b = a.className; return domUtils.hasClass(a, /custom_/) ? b.match(/custom_(\w+)/)[1] : domUtils.getStyle(a, "list-style-type") } function c(a, c) { utils.each(domUtils.getElementsByTagName(a, "ol ul"), function (f) { if (domUtils.inDoc(f, a)) { var g = f.parentNode; if (g.tagName == f.tagName) { var h = b(f) || ("OL" == f.tagName ? "decimal" : "disc"), i = b(g) || ("OL" == g.tagName ? "decimal" : "disc"); if (h == i) { var l = utils.indexOf(k[f.tagName], h); l = l + 1 == k[f.tagName].length ? 0 : l + 1, e(f, k[f.tagName][l]) } } var m = 0, n = 2; domUtils.hasClass(f, /custom_/) ? /[ou]l/i.test(g.tagName) && domUtils.hasClass(g, /custom_/) || (n = 1) : /[ou]l/i.test(g.tagName) && domUtils.hasClass(g, /custom_/) && (n = 3); var o = domUtils.getStyle(f, "list-style-type"); o && (f.style.cssText = "list-style-type:" + o), f.className = utils.trim(f.className.replace(/list-paddingleft-\w+/, "")) + " list-paddingleft-" + n, utils.each(domUtils.getElementsByTagName(f, "li"), function (a) { if (a.style.cssText && (a.style.cssText = ""), !a.firstChild) return void domUtils.remove(a); if (a.parentNode === f) { if (m++, domUtils.hasClass(f, /custom_/)) { var c = 1, d = b(f); if ("OL" == f.tagName) { if (d) switch (d) { case "cn": case "cn1": case "cn2": m > 10 && (m % 10 == 0 || m > 10 && m < 20) ? c = 2 : m > 20 && (c = 3); break; case "num2": m > 9 && (c = 2) }a.className = "list-" + j[d] + m + " list-" + d + "-paddingleft-" + c } else a.className = "list-" + j[d] + " list-" + d + "-paddingleft" } else a.className = a.className.replace(/list-[\w\-]+/gi, ""); var e = a.getAttribute("class"); null === e || e.replace(/\s/g, "") || domUtils.removeAttributes(a, "class") } }), !c && d(f, f.tagName.toLowerCase(), b(f) || domUtils.getStyle(f, "list-style-type"), !0) } }) } function d(a, d, e, f) { var g = a.nextSibling; g && 1 == g.nodeType && g.tagName.toLowerCase() == d && (b(g) || domUtils.getStyle(g, "list-style-type") || ("ol" == d ? "decimal" : "disc")) == e && (domUtils.moveChild(g, a), 0 == g.childNodes.length && domUtils.remove(g)), g && domUtils.isFillChar(g) && domUtils.remove(g); var h = a.previousSibling; h && 1 == h.nodeType && h.tagName.toLowerCase() == d && (b(h) || domUtils.getStyle(h, "list-style-type") || ("ol" == d ? "decimal" : "disc")) == e && domUtils.moveChild(a, h), h && domUtils.isFillChar(h) && domUtils.remove(h), !f && domUtils.isEmptyBlock(a) && domUtils.remove(a), b(a) && c(a.ownerDocument, !0) } function e(a, b) { j[b] && (a.className = "custom_" + b); try { domUtils.setStyle(a, "list-style-type", b) } catch (c) { } } function f(a) { var b = a.previousSibling; b && domUtils.isEmptyBlock(b) && domUtils.remove(b), b = a.nextSibling, b && domUtils.isEmptyBlock(b) && domUtils.remove(b) } function g(a) { for (; a && !domUtils.isBody(a);) { if ("TABLE" == a.nodeName) return null; if ("LI" == a.nodeName) return a; a = a.parentNode } } var h = this, i = { TD: 1, PRE: 1, BLOCKQUOTE: 1 }, j = { cn: "cn-1-", cn1: "cn-2-", cn2: "cn-3-", num: "num-1-", num1: "num-2-", num2: "num-3-", dash: "dash", dot: "dot" }; h.setOpt({ autoTransWordToList: !1, insertorderedlist: { num: "", num1: "", num2: "", cn: "", cn1: "", cn2: "", decimal: "", "lower-alpha": "", "lower-roman": "", "upper-alpha": "", "upper-roman": "" }, insertunorderedlist: { circle: "", disc: "", square: "", dash: "", dot: "" }, listDefaultPaddingLeft: "30", listiconpath: "http://bs.baidu.com/listicon/", maxListLevel: -1, disablePInList: !1 }); var k = { OL: a(h.options.insertorderedlist), UL: a(h.options.insertunorderedlist) }, l = h.options.listiconpath; for (var m in j) h.options.insertorderedlist.hasOwnProperty(m) || h.options.insertunorderedlist.hasOwnProperty(m) || delete j[m]; h.ready(function () { var a = []; for (var b in j) { if ("dash" == b || "dot" == b) a.push("li.list-" + j[b] + "{background-image:url(" + l + j[b] + ".gif)}"), a.push("ul.custom_" + b + "{list-style:none;}ul.custom_" + b + " li{background-position:0 3px;background-repeat:no-repeat}"); else { for (var c = 0; c < 99; c++)a.push("li.list-" + j[b] + c + "{background-image:url(" + l + "list-" + j[b] + c + ".gif)}"); a.push("ol.custom_" + b + "{list-style:none;}ol.custom_" + b + " li{background-position:0 3px;background-repeat:no-repeat}") } switch (b) { case "cn": a.push("li.list-" + b + "-paddingleft-1{padding-left:25px}"), a.push("li.list-" + b + "-paddingleft-2{padding-left:40px}"), a.push("li.list-" + b + "-paddingleft-3{padding-left:55px}"); break; case "cn1": a.push("li.list-" + b + "-paddingleft-1{padding-left:30px}"), a.push("li.list-" + b + "-paddingleft-2{padding-left:40px}"), a.push("li.list-" + b + "-paddingleft-3{padding-left:55px}"); break; case "cn2": a.push("li.list-" + b + "-paddingleft-1{padding-left:40px}"), a.push("li.list-" + b + "-paddingleft-2{padding-left:55px}"), a.push("li.list-" + b + "-paddingleft-3{padding-left:68px}"); break; case "num": case "num1": a.push("li.list-" + b + "-paddingleft-1{padding-left:25px}"); break; case "num2": a.push("li.list-" + b + "-paddingleft-1{padding-left:35px}"), a.push("li.list-" + b + "-paddingleft-2{padding-left:40px}"); break; case "dash": a.push("li.list-" + b + "-paddingleft{padding-left:35px}"); break; case "dot": a.push("li.list-" + b + "-paddingleft{padding-left:20px}") } } a.push(".list-paddingleft-1{padding-left:0}"), a.push(".list-paddingleft-2{padding-left:" + h.options.listDefaultPaddingLeft + "px}"), a.push(".list-paddingleft-3{padding-left:" + 2 * h.options.listDefaultPaddingLeft + "px}"), utils.cssRule("list", "ol,ul{margin:0;pading:0;" + (browser.ie ? "" : "width:95%") + "}li{clear:both;}" + a.join("\n"), h.document) }), h.ready(function () { domUtils.on(h.body, "cut", function () { setTimeout(function () { var a, b = h.selection.getRange(); if (!b.collapsed && (a = domUtils.findParentByTagName(b.startContainer, "li", !0)) && !a.nextSibling && domUtils.isEmptyBlock(a)) { var c, d = a.parentNode; if (c = d.previousSibling) domUtils.remove(d), b.setStartAtLast(c).collapse(!0), b.select(!0); else if (c = d.nextSibling) domUtils.remove(d), b.setStartAtFirst(c).collapse(!0), b.select(!0); else { var e = h.document.createElement("p"); domUtils.fillNode(h.document, e), d.parentNode.insertBefore(e, d), domUtils.remove(d), b.setStart(e, 0).collapse(!0), b.select(!0) } } }) }) }), h.addListener("beforepaste", function (a, c) { var d, e = this, f = e.selection.getRange(), g = UE.htmlparser(c.html, !0); if (d = domUtils.findParentByTagName(f.startContainer, "li", !0)) { var h = d.parentNode, i = "OL" == h.tagName ? "ul" : "ol"; utils.each(g.getNodesByTagName(i), function (c) { if (c.tagName = h.tagName, c.setAttr(), c.parentNode === g) a = b(h) || ("OL" == h.tagName ? "decimal" : "disc"); else { var d = c.parentNode.getAttr("class"); a = d && /custom_/.test(d) ? d.match(/custom_(\w+)/)[1] : c.parentNode.getStyle("list-style-type"), a || (a = "OL" == h.tagName ? "decimal" : "disc") } var e = utils.indexOf(k[h.tagName], a); c.parentNode !== g && (e = e + 1 == k[h.tagName].length ? 0 : e + 1); var f = k[h.tagName][e]; j[f] ? c.setAttr("class", "custom_" + f) : c.setStyle("list-style-type", f) }) } c.html = g.toHtml() }), h.getOpt("disablePInList") === !0 && h.addOutputRule(function (a) { utils.each(a.getNodesByTagName("li"), function (a) { var b = [], c = 0; utils.each(a.children, function (d) { if ("p" == d.tagName) { for (var e; e = d.children.pop();)b.splice(c, 0, e), e.parentNode = a, lastNode = e; if (e = b[b.length - 1], !e || "element" != e.type || "br" != e.tagName) { var f = UE.uNode.createElement("br"); f.parentNode = a, b.push(f) } c = b.length } }), b.length && (a.children = b) }) }), h.addInputRule(function (a) { function b(a, b) { var e = b.firstChild(); if (e && "element" == e.type && "span" == e.tagName && /Wingdings|Symbol/.test(e.getStyle("font-family"))) { for (var f in d) if (d[f] == e.data) return f; return "disc" } for (var f in c) if (c[f].test(a)) return f } if (utils.each(a.getNodesByTagName("li"), function (a) { for (var b, c = UE.uNode.createElement("p"), d = 0; b = a.children[d];)"text" == b.type || dtd.p[b.tagName] ? c.appendChild(b) : c.firstChild() ? (a.insertBefore(c, b), c = UE.uNode.createElement("p"), d += 2) : d++; (c.firstChild() && !c.parentNode || !a.firstChild()) && a.appendChild(c), c.firstChild() || c.innerHTML(browser.ie ? " " : " "); var e = a.firstChild(), f = e.lastChild(); f && "text" == f.type && /^\s*$/.test(f.data) && e.removeChild(f) }), h.options.autoTransWordToList) { var c = { num1: /^\d+\)/, decimal: /^\d+\./, "lower-alpha": /^[a-z]+\)/, "upper-alpha": /^[A-Z]+\./, cn: /^[\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+[\u3001]/, cn2: /^\([\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+\)/ }, d = { square: "n" }; utils.each(a.getNodesByTagName("p"), function (a) { function d(a, b, d) { if ("ol" == a.tagName) if (browser.ie) { var e = b.firstChild(); "element" == e.type && "span" == e.tagName && c[d].test(e.innerText()) && b.removeChild(e) } else b.innerHTML(b.innerHTML().replace(c[d], "")); else b.removeChild(b.firstChild()); var f = UE.uNode.createElement("li"); f.appendChild(b), a.appendChild(f) } if ("MsoListParagraph" == a.getAttr("class")) { a.setStyle("margin", ""), a.setStyle("margin-left", ""), a.setAttr("class", ""); var e, f = a, g = a; if ("li" != a.parentNode.tagName && (e = b(a.innerText(), a))) { var i = UE.uNode.createElement(h.options.insertorderedlist.hasOwnProperty(e) ? "ol" : "ul"); for (j[e] ? i.setAttr("class", "custom_" + e) : i.setStyle("list-style-type", e); a && "li" != a.parentNode.tagName && b(a.innerText(), a);)f = a.nextSibling(), f || a.parentNode.insertBefore(i, a), d(i, a, e), a = f; !i.parentNode && a && a.parentNode && a.parentNode.insertBefore(i, a) } var k = g.firstChild(); k && "element" == k.type && "span" == k.tagName && /^\s*( )+\s*$/.test(k.innerText()) && k.parentNode.removeChild(k) } }) } }), h.addListener("contentchange", function () { c(h.document) }), h.addListener("keydown", function (a, b) {
function c() { b.preventDefault ? b.preventDefault() : b.returnValue = !1, h.fireEvent("contentchange"), h.undoManger && h.undoManger.save() } function d(a, b) { for (; a && !domUtils.isBody(a);) { if (b(a)) return null; if (1 == a.nodeType && /[ou]l/i.test(a.tagName)) return a; a = a.parentNode } return null } var e = b.keyCode || b.which; if (13 == e && !b.shiftKey) {
var g = h.selection.getRange(), i = domUtils.findParent(g.startContainer, function (a) { return domUtils.isBlockElm(a) }, !0), j = domUtils.findParentByTagName(g.startContainer, "li", !0); if (i && "PRE" != i.tagName && !j) { var k = i.innerHTML.replace(new RegExp(domUtils.fillChar, "g"), ""); /^\s*1\s*\.[^\d]/.test(k) && (i.innerHTML = k.replace(/^\s*1\s*\./, ""), g.setStartAtLast(i).collapse(!0).select(), h.__hasEnterExecCommand = !0, h.execCommand("insertorderedlist"), h.__hasEnterExecCommand = !1) } var l = h.selection.getRange(), m = d(l.startContainer, function (a) { return "TABLE" == a.tagName }), n = l.collapsed ? m : d(l.endContainer, function (a) { return "TABLE" == a.tagName }); if (m && n && m === n) {
if (!l.collapsed) {
if (m = domUtils.findParentByTagName(l.startContainer, "li", !0), n = domUtils.findParentByTagName(l.endContainer, "li", !0), !m || !n || m !== n) { var o = l.cloneRange(), p = o.collapse(!1).createBookmark(); l.deleteContents(), o.moveToBookmark(p); var j = domUtils.findParentByTagName(o.startContainer, "li", !0); return f(j), o.select(), void c() } if (l.deleteContents(), j = domUtils.findParentByTagName(l.startContainer, "li", !0), j && domUtils.isEmptyBlock(j)) return v = j.previousSibling, next = j.nextSibling, s = h.document.createElement("p"), domUtils.fillNode(h.document, s), q = j.parentNode, v && next ? (l.setStart(next, 0).collapse(!0).select(!0), domUtils.remove(j)) : ((v || next) && v ? j.parentNode.parentNode.insertBefore(s, q.nextSibling) : q.parentNode.insertBefore(s, q), domUtils.remove(j), q.firstChild || domUtils.remove(q),
l.setStart(s, 0).setCursor()), void c()
} if (j = domUtils.findParentByTagName(l.startContainer, "li", !0)) { if (domUtils.isEmptyBlock(j)) { p = l.createBookmark(); var q = j.parentNode; if (j !== q.lastChild ? (domUtils.breakParent(j, q), f(j)) : (q.parentNode.insertBefore(j, q.nextSibling), domUtils.isEmptyNode(q) && domUtils.remove(q)), !dtd.$list[j.parentNode.tagName]) if (domUtils.isBlockElm(j.firstChild)) domUtils.remove(j, !0); else { for (s = h.document.createElement("p"), j.parentNode.insertBefore(s, j); j.firstChild;)s.appendChild(j.firstChild); domUtils.remove(j) } l.moveToBookmark(p).select() } else { var r = j.firstChild; if (!r || !domUtils.isBlockElm(r)) { var s = h.document.createElement("p"); for (!j.firstChild && domUtils.fillNode(h.document, s); j.firstChild;)s.appendChild(j.firstChild); j.appendChild(s), r = s } var t = h.document.createElement("span"); l.insertNode(t), domUtils.breakParent(t, j); var u = t.nextSibling; r = u.firstChild, r || (s = h.document.createElement("p"), domUtils.fillNode(h.document, s), u.appendChild(s), r = s), domUtils.isEmptyNode(r) && (r.innerHTML = "", domUtils.fillNode(h.document, r)), l.setStart(r, 0).collapse(!0).shrinkBoundary().select(), domUtils.remove(t); var v = u.previousSibling; v && domUtils.isEmptyBlock(v) && (v.innerHTML = "", domUtils.fillNode(h.document, v.firstChild)) } c() }
}
} if (8 == e && (l = h.selection.getRange(), l.collapsed && domUtils.isStartInblock(l) && (o = l.cloneRange().trimBoundary(), j = domUtils.findParentByTagName(l.startContainer, "li", !0), j && domUtils.isStartInblock(o)))) { if (m = domUtils.findParentByTagName(l.startContainer, "p", !0), m && m !== j.firstChild) { var q = domUtils.findParentByTagName(m, ["ol", "ul"]); return domUtils.breakParent(m, q), f(m), h.fireEvent("contentchange"), l.setStart(m, 0).setCursor(!1, !0), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } if (j && (v = j.previousSibling)) { if (46 == e && j.childNodes.length) return; if (dtd.$list[v.tagName] && (v = v.lastChild), h.undoManger && h.undoManger.save(), r = j.firstChild, domUtils.isBlockElm(r)) if (domUtils.isEmptyNode(r)) for (v.appendChild(r), l.setStart(r, 0).setCursor(!1, !0); j.firstChild;)v.appendChild(j.firstChild); else t = h.document.createElement("span"), l.insertNode(t), domUtils.isEmptyBlock(v) && (v.innerHTML = ""), domUtils.moveChild(j, v), l.setStartBefore(t).collapse(!0).select(!0), domUtils.remove(t); else if (domUtils.isEmptyNode(j)) { var s = h.document.createElement("p"); v.appendChild(s), l.setStart(s, 0).setCursor() } else for (l.setEnd(v, v.childNodes.length).collapse().select(!0); j.firstChild;)v.appendChild(j.firstChild); return domUtils.remove(j), h.fireEvent("contentchange"), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } if (j && !j.previousSibling) { var q = j.parentNode, p = l.createBookmark(); if (domUtils.isTagNode(q.parentNode, "ol ul")) q.parentNode.insertBefore(j, q), domUtils.isEmptyNode(q) && domUtils.remove(q); else { for (; j.firstChild;)q.parentNode.insertBefore(j.firstChild, q); domUtils.remove(j), domUtils.isEmptyNode(q) && domUtils.remove(q) } return l.moveToBookmark(p).setCursor(!1, !0), h.fireEvent("contentchange"), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } }
}), h.addListener("keyup", function (a, c) { var e = c.keyCode || c.which; if (8 == e) { var f, g = h.selection.getRange(); (f = domUtils.findParentByTagName(g.startContainer, ["ol", "ul"], !0)) && d(f, f.tagName.toLowerCase(), b(f) || domUtils.getComputedStyle(f, "list-style-type"), !0) } }), h.addListener("tabkeydown", function () { function a(a) { if (h.options.maxListLevel != -1) { for (var b = a.parentNode, c = 0; /[ou]l/i.test(b.tagName);)c++, b = b.parentNode; if (c >= h.options.maxListLevel) return !0 } } var c = h.selection.getRange(), f = domUtils.findParentByTagName(c.startContainer, "li", !0); if (f) { var g; if (!c.collapsed) { h.fireEvent("saveScene"), g = c.createBookmark(); for (var i, j, l = 0, m = domUtils.findParents(f); j = m[l++];)if (domUtils.isTagNode(j, "ol ul")) { i = j; break } var n = f; if (g.end) for (; n && !(domUtils.getPosition(n, g.end) & domUtils.POSITION_FOLLOWING);)if (a(n)) n = domUtils.getNextDomNode(n, !1, null, function (a) { return a !== i }); else { var o = n.parentNode, p = h.document.createElement(o.tagName), q = utils.indexOf(k[p.tagName], b(o) || domUtils.getComputedStyle(o, "list-style-type")), r = q + 1 == k[p.tagName].length ? 0 : q + 1, s = k[p.tagName][r]; for (e(p, s), o.insertBefore(p, n); n && !(domUtils.getPosition(n, g.end) & domUtils.POSITION_FOLLOWING);) { if (f = n.nextSibling, p.appendChild(n), !f || domUtils.isTagNode(f, "ol ul")) { if (f) for (; (f = f.firstChild) && "LI" != f.tagName;); else f = domUtils.getNextDomNode(n, !1, null, function (a) { return a !== i }); break } n = f } d(p, p.tagName.toLowerCase(), s), n = f } return h.fireEvent("contentchange"), c.moveToBookmark(g).select(), !0 } if (a(f)) return !0; var o = f.parentNode, p = h.document.createElement(o.tagName), q = utils.indexOf(k[p.tagName], b(o) || domUtils.getComputedStyle(o, "list-style-type")); q = q + 1 == k[p.tagName].length ? 0 : q + 1; var s = k[p.tagName][q]; if (e(p, s), domUtils.isStartInblock(c)) return h.fireEvent("saveScene"), g = c.createBookmark(), o.insertBefore(p, f), p.appendChild(f), d(p, p.tagName.toLowerCase(), s), h.fireEvent("contentchange"), c.moveToBookmark(g).select(!0), !0 } }), h.commands.insertorderedlist = h.commands.insertunorderedlist = { execCommand: function (a, c) { c || (c = "insertorderedlist" == a.toLowerCase() ? "decimal" : "disc"); var f = this, h = this.selection.getRange(), j = function (a) { return 1 == a.nodeType ? "br" != a.tagName.toLowerCase() : !domUtils.isWhitespace(a) }, k = "insertorderedlist" == a.toLowerCase() ? "ol" : "ul", l = f.document.createDocumentFragment(); h.adjustmentBoundary().shrinkBoundary(); var m, n, o, p, q = h.createBookmark(!0), r = g(f.document.getElementById(q.start)), s = 0, t = g(f.document.getElementById(q.end)), u = 0; if (r || t) { if (r && (m = r.parentNode), q.end || (t = r), t && (n = t.parentNode), m === n) { for (; r !== t;) { if (p = r, r = r.nextSibling, !domUtils.isBlockElm(p.firstChild)) { for (var v = f.document.createElement("p"); p.firstChild;)v.appendChild(p.firstChild); p.appendChild(v) } l.appendChild(p) } if (p = f.document.createElement("span"), m.insertBefore(p, t), !domUtils.isBlockElm(t.firstChild)) { for (v = f.document.createElement("p"); t.firstChild;)v.appendChild(t.firstChild); t.appendChild(v) } l.appendChild(t), domUtils.breakParent(p, m), domUtils.isEmptyNode(p.previousSibling) && domUtils.remove(p.previousSibling), domUtils.isEmptyNode(p.nextSibling) && domUtils.remove(p.nextSibling); var w = b(m) || domUtils.getComputedStyle(m, "list-style-type") || ("insertorderedlist" == a.toLowerCase() ? "decimal" : "disc"); if (m.tagName.toLowerCase() == k && w == c) { for (var x, y = 0, z = f.document.createDocumentFragment(); x = l.firstChild;)if (domUtils.isTagNode(x, "ol ul")) z.appendChild(x); else for (; x.firstChild;)z.appendChild(x.firstChild), domUtils.remove(x); p.parentNode.insertBefore(z, p) } else o = f.document.createElement(k), e(o, c), o.appendChild(l), p.parentNode.insertBefore(o, p); return domUtils.remove(p), o && d(o, k, c), void h.moveToBookmark(q).select() } if (r) { for (; r;) { if (p = r.nextSibling, domUtils.isTagNode(r, "ol ul")) l.appendChild(r); else { for (var A = f.document.createDocumentFragment(), B = 0; r.firstChild;)domUtils.isBlockElm(r.firstChild) && (B = 1), A.appendChild(r.firstChild); if (B) l.appendChild(A); else { var C = f.document.createElement("p"); C.appendChild(A), l.appendChild(C) } domUtils.remove(r) } r = p } m.parentNode.insertBefore(l, m.nextSibling), domUtils.isEmptyNode(m) ? (h.setStartBefore(m), domUtils.remove(m)) : h.setStartAfter(m), s = 1 } if (t && domUtils.inDoc(n, f.document)) { for (r = n.firstChild; r && r !== t;) { if (p = r.nextSibling, domUtils.isTagNode(r, "ol ul")) l.appendChild(r); else { for (A = f.document.createDocumentFragment(), B = 0; r.firstChild;)domUtils.isBlockElm(r.firstChild) && (B = 1), A.appendChild(r.firstChild); B ? l.appendChild(A) : (C = f.document.createElement("p"), C.appendChild(A), l.appendChild(C)), domUtils.remove(r) } r = p } var D = domUtils.createElement(f.document, "div", { tmpDiv: 1 }); domUtils.moveChild(t, D), l.appendChild(D), domUtils.remove(t), n.parentNode.insertBefore(l, n), h.setEndBefore(n), domUtils.isEmptyNode(n) && domUtils.remove(n), u = 1 } } s || h.setStartBefore(f.document.getElementById(q.start)), q.end && !u && h.setEndAfter(f.document.getElementById(q.end)), h.enlarge(!0, function (a) { return i[a.tagName] }), l = f.document.createDocumentFragment(); for (var E, F = h.createBookmark(), G = domUtils.getNextDomNode(F.start, !1, j), H = h.cloneRange(), I = domUtils.isBlockElm; G && G !== F.end && domUtils.getPosition(G, F.end) & domUtils.POSITION_PRECEDING;)if (3 == G.nodeType || dtd.li[G.tagName]) { if (1 == G.nodeType && dtd.$list[G.tagName]) { for (; G.firstChild;)l.appendChild(G.firstChild); E = domUtils.getNextDomNode(G, !1, j), domUtils.remove(G), G = E; continue } for (E = G, H.setStartBefore(G); G && G !== F.end && (!I(G) || domUtils.isBookmarkNode(G));)E = G, G = domUtils.getNextDomNode(G, !1, null, function (a) { return !i[a.tagName] }); G && I(G) && (p = domUtils.getNextDomNode(E, !1, j), p && domUtils.isBookmarkNode(p) && (G = domUtils.getNextDomNode(p, !1, j), E = p)), H.setEndAfter(E), G = domUtils.getNextDomNode(E, !1, j); var J = h.document.createElement("li"); if (J.appendChild(H.extractContents()), domUtils.isEmptyNode(J)) { for (var E = h.document.createElement("p"); J.firstChild;)E.appendChild(J.firstChild); J.appendChild(E) } l.appendChild(J) } else G = domUtils.getNextDomNode(G, !0, j); h.moveToBookmark(F).collapse(!0), o = f.document.createElement(k), e(o, c), o.appendChild(l), h.insertNode(o), d(o, k, c); for (var x, y = 0, K = domUtils.getElementsByTagName(o, "div"); x = K[y++];)x.getAttribute("tmpDiv") && domUtils.remove(x, !0); h.moveToBookmark(q).select() }, queryCommandState: function (a) { for (var b, c = "insertorderedlist" == a.toLowerCase() ? "ol" : "ul", d = this.selection.getStartElementPath(), e = 0; b = d[e++];) { if ("TABLE" == b.nodeName) return 0; if (c == b.nodeName.toLowerCase()) return 1 } return 0 }, queryCommandValue: function (a) { for (var c, d, e = "insertorderedlist" == a.toLowerCase() ? "ol" : "ul", f = this.selection.getStartElementPath(), g = 0; d = f[g++];) { if ("TABLE" == d.nodeName) { c = null; break } if (e == d.nodeName.toLowerCase()) { c = d; break } } return c ? b(c) || domUtils.getComputedStyle(c, "list-style-type") : null } }
}, function () { var a = { textarea: function (a, b) { var c = b.ownerDocument.createElement("textarea"); return c.style.cssText = "position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;", browser.ie && browser.version < 8 && (c.style.width = b.offsetWidth + "px", c.style.height = b.offsetHeight + "px", b.onresize = function () { c.style.width = b.offsetWidth + "px", c.style.height = b.offsetHeight + "px" }), b.appendChild(c), { setContent: function (a) { c.value = a }, getContent: function () { return c.value }, select: function () { var a; browser.ie ? (a = c.createTextRange(), a.collapse(!0), a.select()) : (c.setSelectionRange(0, 0), c.focus()) }, dispose: function () { b.removeChild(c), b.onresize = null, c = null, b = null } } }, codemirror: function (a, b) { var c = window.CodeMirror(b, { mode: "text/html", tabMode: "indent", lineNumbers: !0, lineWrapping: !0 }), d = c.getWrapperElement(); return d.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;', c.getScrollerElement().style.cssText = "position:absolute;left:0;top:0;width:100%;height:100%;", c.refresh(), { getCodeMirror: function () { return c }, setContent: function (a) { c.setValue(a) }, getContent: function () { return c.getValue() }, select: function () { c.focus() }, dispose: function () { b.removeChild(d), d = null, c = null } } } }; UE.plugins.source = function () { function b(b) { return a["codemirror" == f.sourceEditor && window.CodeMirror ? "codemirror" : "textarea"](e, b) } var c, d, e = this, f = this.options, g = !1; f.sourceEditor = browser.ie ? "textarea" : f.sourceEditor || "codemirror", e.setOpt({ sourceEditorFirst: !1 }); var h, i, j; e.commands.source = { execCommand: function () { if (g = !g) { j = e.selection.getRange().createAddress(!1, !0), e.undoManger && e.undoManger.save(!0), browser.gecko && (e.body.contentEditable = !1), h = e.iframe.style.cssText, e.iframe.style.cssText += "position:absolute;left:-32768px;top:-32768px;", e.fireEvent("beforegetcontent"); var a = UE.htmlparser(e.body.innerHTML); e.filterOutputRule(a), a.traversal(function (a) { if ("element" == a.type) switch (a.tagName) { case "td": case "th": case "caption": a.children && 1 == a.children.length && "br" == a.firstChild().tagName && a.removeChild(a.firstChild()); break; case "pre": a.innerText(a.innerText().replace(/ /g, " ")) } }), e.fireEvent("aftergetcontent"); var f = a.toHtml(!0); c = b(e.iframe.parentNode), c.setContent(f), d = e.setContent, e.setContent = function (a) { var b = UE.htmlparser(a); e.filterInputRule(b), a = b.toHtml(), c.setContent(a) }, setTimeout(function () { c.select(), e.addListener("fullscreenchanged", function () { try { c.getCodeMirror().refresh() } catch (a) { } }) }), i = e.getContent, e.getContent = function () { return c.getContent() || "
" + (browser.ie ? "" : " ") + "
" } } else { e.iframe.style.cssText = h; var k = c.getContent() || "
" + (browser.ie ? "" : " ") + "
"; k = k.replace(new RegExp("[\\r\\t\\n ]*?(\\w+)\\s*(?:[^>]*)>", "g"), function (a, b) { return b && !dtd.$inlineWithA[b.toLowerCase()] ? a.replace(/(^[\n\r\t ]*)|([\n\r\t ]*$)/g, "") : a.replace(/(^[\n\r\t]*)|([\n\r\t]*$)/g, "") }), e.setContent = d, e.setContent(k), c.dispose(), c = null, e.getContent = i; var l = e.body.firstChild; if (l || (e.body.innerHTML = "
" + (browser.ie ? "" : " ") + "
", l = e.body.firstChild), e.undoManger && e.undoManger.save(!0), browser.gecko) { var m = document.createElement("input"); m.style.cssText = "position:absolute;left:0;top:-32768px", document.body.appendChild(m), e.body.contentEditable = !1, setTimeout(function () { domUtils.setViewportOffset(m, { left: -32768, top: 0 }), m.focus(), setTimeout(function () { e.body.contentEditable = !0, e.selection.getRange().moveToAddress(j).select(!0), domUtils.remove(m) }) }) } else try { e.selection.getRange().moveToAddress(j).select(!0) } catch (n) { } } this.fireEvent("sourcemodechanged", g) }, queryCommandState: function () { return 0 | g }, notNeedUndo: 1 }; var k = e.queryCommandState; e.queryCommandState = function (a) { return a = a.toLowerCase(), g ? a in { source: 1, fullscreen: 1 } ? 1 : -1 : k.apply(this, arguments) }, "codemirror" == f.sourceEditor && e.addListener("ready", function () { utils.loadFile(document, { src: f.codeMirrorJsUrl || f.UEDITOR_HOME_URL + "third-party/codemirror/codemirror.js", tag: "script", type: "text/javascript", defer: "defer" }, function () { f.sourceEditorFirst && setTimeout(function () { e.execCommand("source") }, 0) }), utils.loadFile(document, { tag: "link", rel: "stylesheet", type: "text/css", href: f.codeMirrorCssUrl || f.UEDITOR_HOME_URL + "third-party/codemirror/codemirror.css" }) }) } }(), UE.plugins.enterkey = function () { var a, b = this, c = b.options.enterTag; b.addListener("keyup", function (c, d) { var e = d.keyCode || d.which; if (13 == e) { var f, g = b.selection.getRange(), h = g.startContainer; if (browser.ie) b.fireEvent("saveScene", !0, !0); else { if (/h\d/i.test(a)) { if (browser.gecko) { var i = domUtils.findParentByTagName(h, ["h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "caption", "table"], !0); i || (b.document.execCommand("formatBlock", !1, "
"), f = 1) } else if (1 == h.nodeType) { var j, k = b.document.createTextNode(""); if (g.insertNode(k), j = domUtils.findParentByTagName(k, "div", !0)) { for (var l = b.document.createElement("p"); j.firstChild;)l.appendChild(j.firstChild); j.parentNode.insertBefore(l, j), domUtils.remove(j), g.setStartBefore(k).setCursor(), f = 1 } domUtils.remove(k) } b.undoManger && f && b.undoManger.save() } browser.opera && g.select() } } }), b.addListener("keydown", function (d, e) { var f = e.keyCode || e.which; if (13 == f) { if (b.fireEvent("beforeenterkeydown")) return void domUtils.preventDefault(e); b.fireEvent("saveScene", !0, !0), a = ""; var g = b.selection.getRange(); if (!g.collapsed) { var h = g.startContainer, i = g.endContainer, j = domUtils.findParentByTagName(h, "td", !0), k = domUtils.findParentByTagName(i, "td", !0); if (j && k && j !== k || !j && k || j && !k) return void (e.preventDefault ? e.preventDefault() : e.returnValue = !1) } if ("p" == c) browser.ie || (h = domUtils.findParentByTagName(g.startContainer, ["ol", "ul", "p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "caption"], !0), h || browser.opera ? (a = h.tagName, "p" == h.tagName.toLowerCase() && browser.gecko && domUtils.removeDirtyAttr(h)) : (b.document.execCommand("formatBlock", !1, "
"), browser.gecko && (g = b.selection.getRange(), h = domUtils.findParentByTagName(g.startContainer, "p", !0), h && domUtils.removeDirtyAttr(h)))); else if (e.preventDefault ? e.preventDefault() : e.returnValue = !1, g.collapsed) { m = g.document.createElement("br"), g.insertNode(m); var l = m.parentNode; l.lastChild === m ? (m.parentNode.insertBefore(m.cloneNode(!0), m), g.setStartBefore(m)) : g.setStartAfter(m), g.setCursor() } else if (g.deleteContents(), h = g.startContainer, 1 == h.nodeType && (h = h.childNodes[g.startOffset])) { for (; 1 == h.nodeType;) { if (dtd.$empty[h.tagName]) return g.setStartBefore(h).setCursor(), b.undoManger && b.undoManger.save(), !1; if (!h.firstChild) { var m = g.document.createElement("br"); return h.appendChild(m), g.setStart(h, 0).setCursor(), b.undoManger && b.undoManger.save(), !1 } h = h.firstChild } h === g.startContainer.childNodes[g.startOffset] ? (m = g.document.createElement("br"), g.insertNode(m).setCursor()) : g.setStart(h, 0).setCursor() } else m = g.document.createElement("br"), g.insertNode(m).setStartAfter(m).setCursor() } }) }, UE.plugins.keystrokes = function () { var a = this, b = !0; a.addListener("keydown", function (c, d) { var e = d.keyCode || d.which, f = a.selection.getRange(); if (!f.collapsed && !(d.ctrlKey || d.shiftKey || d.altKey || d.metaKey) && (e >= 65 && e <= 90 || e >= 48 && e <= 57 || e >= 96 && e <= 111 || { 13: 1, 8: 1, 46: 1 }[e])) { var g = f.startContainer; if (domUtils.isFillChar(g) && f.setStartBefore(g), g = f.endContainer, domUtils.isFillChar(g) && f.setEndAfter(g), f.txtToElmBoundary(), f.endContainer && 1 == f.endContainer.nodeType && (g = f.endContainer.childNodes[f.endOffset], g && domUtils.isBr(g) && f.setEndAfter(g)), 0 == f.startOffset && (g = f.startContainer, domUtils.isBoundaryNode(g, "firstChild") && (g = f.endContainer, f.endOffset == (3 == g.nodeType ? g.nodeValue.length : g.childNodes.length) && domUtils.isBoundaryNode(g, "lastChild")))) return a.fireEvent("saveScene"), a.body.innerHTML = "
" + (browser.ie ? "" : " ") + "
", f.setStart(a.body.firstChild, 0).setCursor(!1, !0), void a._selectionChange() } if (e == keymap.Backspace) { if (f = a.selection.getRange(), b = f.collapsed, a.fireEvent("delkeydown", d)) return; var h, i; if (f.collapsed && f.inFillChar() && (h = f.startContainer, domUtils.isFillChar(h) ? (f.setStartBefore(h).shrinkBoundary(!0).collapse(!0), domUtils.remove(h)) : (h.nodeValue = h.nodeValue.replace(new RegExp("^" + domUtils.fillChar), ""), f.startOffset--, f.collapse(!0).select(!0))), h = f.getClosedNode()) return a.fireEvent("saveScene"), f.setStartBefore(h), domUtils.remove(h), f.setCursor(), a.fireEvent("saveScene"), void domUtils.preventDefault(d); if (!browser.ie && (h = domUtils.findParentByTagName(f.startContainer, "table", !0), i = domUtils.findParentByTagName(f.endContainer, "table", !0), h && !i || !h && i || h !== i)) return void d.preventDefault() } if (e == keymap.Tab) { var j = { ol: 1, ul: 1, table: 1 }; if (a.fireEvent("tabkeydown", d)) return void domUtils.preventDefault(d); var k = a.selection.getRange(); a.fireEvent("saveScene"); for (var l = 0, m = "", n = a.options.tabSize || 4, o = a.options.tabNode || " "; l < n; l++)m += o; var p = a.document.createElement("span"); if (p.innerHTML = m + domUtils.fillChar, k.collapsed) k.insertNode(p.cloneNode(!0).firstChild).setCursor(!0); else { var q = function (a) { return domUtils.isBlockElm(a) && !j[a.tagName.toLowerCase()] }; if (h = domUtils.findParent(k.startContainer, q, !0), i = domUtils.findParent(k.endContainer, q, !0), h && i && h === i) k.deleteContents(), k.insertNode(p.cloneNode(!0).firstChild).setCursor(!0); else { var r = k.createBookmark(); k.enlarge(!0); for (var s = k.createBookmark(), t = domUtils.getNextDomNode(s.start, !1, q); t && !(domUtils.getPosition(t, s.end) & domUtils.POSITION_FOLLOWING);)t.insertBefore(p.cloneNode(!0).firstChild, t.firstChild), t = domUtils.getNextDomNode(t, !1, q); k.moveToBookmark(s).moveToBookmark(r).select() } } domUtils.preventDefault(d) } if (browser.gecko && 46 == e && (k = a.selection.getRange(), k.collapsed && (h = k.startContainer, domUtils.isEmptyBlock(h)))) { for (var u = h.parentNode; 1 == domUtils.getChildCount(u) && !domUtils.isBody(u);)h = u, u = u.parentNode; return void (h === u.lastChild && d.preventDefault()) } }), a.addListener("keyup", function (a, c) { var d, e = c.keyCode || c.which, f = this; if (e == keymap.Backspace) { if (f.fireEvent("delkeyup")) return; if (d = f.selection.getRange(), d.collapsed) { var g, h = ["h1", "h2", "h3", "h4", "h5", "h6"]; if ((g = domUtils.findParentByTagName(d.startContainer, h, !0)) && domUtils.isEmptyBlock(g)) { var i = g.previousSibling; if (i && "TABLE" != i.nodeName) return domUtils.remove(g), void d.setStartAtLast(i).setCursor(!1, !0); var j = g.nextSibling; if (j && "TABLE" != j.nodeName) return domUtils.remove(g), void d.setStartAtFirst(j).setCursor(!1, !0) } if (domUtils.isBody(d.startContainer)) { var g = domUtils.createElement(f.document, "p", { innerHTML: browser.ie ? domUtils.fillChar : " " }); d.insertNode(g).setStart(g, 0).setCursor(!1, !0) } } if (!b && (3 == d.startContainer.nodeType || 1 == d.startContainer.nodeType && domUtils.isEmptyBlock(d.startContainer))) if (browser.ie) { var k = d.document.createElement("span"); d.insertNode(k).setStartBefore(k).collapse(!0), d.select(), domUtils.remove(k) } else d.select() } }) }, UE.plugins.fiximgclick = function () { function a() { this.editor = null, this.resizer = null, this.cover = null, this.doc = document, this.prePos = { x: 0, y: 0 }, this.startPos = { x: 0, y: 0 } } var b = !1; return function () { var c = [[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]]; a.prototype = { init: function (a) { var b = this; b.editor = a, b.startPos = this.prePos = { x: 0, y: 0 }, b.dragId = -1; var c = [], d = b.cover = document.createElement("div"), e = b.resizer = document.createElement("div"); for (d.id = b.editor.ui.id + "_imagescale_cover", d.style.cssText = "position:absolute;display:none;z-index:" + b.editor.options.zIndex + ";filter:alpha(opacity=0); opacity:0;background:#CCC;", domUtils.on(d, "mousedown click", function () { b.hide() }), i = 0; i < 8; i++)c.push(''); e.id = b.editor.ui.id + "_imagescale", e.className = "edui-editor-imagescale", e.innerHTML = c.join(""), e.style.cssText += ";display:none;border:1px solid #3b77ff;z-index:" + b.editor.options.zIndex + ";", b.editor.ui.getDom().appendChild(d), b.editor.ui.getDom().appendChild(e), b.initStyle(), b.initEvents() }, initStyle: function () { utils.cssRule("imagescale", ".edui-editor-imagescale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;}.edui-editor-imagescale span{position:absolute;width:6px;height:6px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}.edui-editor-imagescale .edui-editor-imagescale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}") }, initEvents: function () { var a = this; a.startPos.x = a.startPos.y = 0, a.isDraging = !1 }, _eventHandler: function (a) { var c = this; switch (a.type) { case "mousedown": var d, d = a.target || a.srcElement; d.className.indexOf("edui-editor-imagescale-hand") != -1 && c.dragId == -1 && (c.dragId = d.className.slice(-1), c.startPos.x = c.prePos.x = a.clientX, c.startPos.y = c.prePos.y = a.clientY, domUtils.on(c.doc, "mousemove", c.proxy(c._eventHandler, c))); break; case "mousemove": c.dragId != -1 && (c.updateContainerStyle(c.dragId, { x: a.clientX - c.prePos.x, y: a.clientY - c.prePos.y }), c.prePos.x = a.clientX, c.prePos.y = a.clientY, b = !0, c.updateTargetElement()); break; case "mouseup": c.dragId != -1 && (c.updateContainerStyle(c.dragId, { x: a.clientX - c.prePos.x, y: a.clientY - c.prePos.y }), c.updateTargetElement(), c.target.parentNode && c.attachTo(c.target), c.dragId = -1), domUtils.un(c.doc, "mousemove", c.proxy(c._eventHandler, c)), b && (b = !1, c.editor.fireEvent("contentchange")) } }, updateTargetElement: function () { var a = this; domUtils.setStyles(a.target, { width: a.resizer.style.width, height: a.resizer.style.height }), a.target.width = parseInt(a.resizer.style.width), a.target.height = parseInt(a.resizer.style.height), a.attachTo(a.target) }, updateContainerStyle: function (a, b) { var d, e = this, f = e.resizer; 0 != c[a][0] && (d = parseInt(f.style.left) + b.x, f.style.left = e._validScaledProp("left", d) + "px"), 0 != c[a][1] && (d = parseInt(f.style.top) + b.y, f.style.top = e._validScaledProp("top", d) + "px"), 0 != c[a][2] && (d = f.clientWidth + c[a][2] * b.x, f.style.width = e._validScaledProp("width", d) + "px"), 0 != c[a][3] && (d = f.clientHeight + c[a][3] * b.y, f.style.height = e._validScaledProp("height", d) + "px") }, _validScaledProp: function (a, b) { var c = this.resizer, d = document; switch (b = isNaN(b) ? 0 : b, a) { case "left": return b < 0 ? 0 : b + c.clientWidth > d.clientWidth ? d.clientWidth - c.clientWidth : b; case "top": return b < 0 ? 0 : b + c.clientHeight > d.clientHeight ? d.clientHeight - c.clientHeight : b; case "width": return b <= 0 ? 1 : b + c.offsetLeft > d.clientWidth ? d.clientWidth - c.offsetLeft : b; case "height": return b <= 0 ? 1 : b + c.offsetTop > d.clientHeight ? d.clientHeight - c.offsetTop : b } }, hideCover: function () { this.cover.style.display = "none" }, showCover: function () { var a = this, b = domUtils.getXY(a.editor.ui.getDom()), c = domUtils.getXY(a.editor.iframe); domUtils.setStyles(a.cover, { width: a.editor.iframe.offsetWidth + "px", height: a.editor.iframe.offsetHeight + "px", top: c.y - b.y + "px", left: c.x - b.x + "px", position: "absolute", display: "" }) }, show: function (a) { var b = this; b.resizer.style.display = "block", a && b.attachTo(a), domUtils.on(this.resizer, "mousedown", b.proxy(b._eventHandler, b)), domUtils.on(b.doc, "mouseup", b.proxy(b._eventHandler, b)), b.showCover(), b.editor.fireEvent("afterscaleshow", b), b.editor.fireEvent("saveScene") }, hide: function () { var a = this; a.hideCover(), a.resizer.style.display = "none", domUtils.un(a.resizer, "mousedown", a.proxy(a._eventHandler, a)), domUtils.un(a.doc, "mouseup", a.proxy(a._eventHandler, a)), a.editor.fireEvent("afterscalehide", a) }, proxy: function (a, b) { return function (c) { return a.apply(b || this, arguments) } }, attachTo: function (a) { var b = this, c = b.target = a, d = this.resizer, e = domUtils.getXY(c), f = domUtils.getXY(b.editor.iframe), g = domUtils.getXY(d.parentNode); domUtils.setStyles(d, { width: c.width + "px", height: c.height + "px", left: f.x + e.x - b.editor.document.body.scrollLeft - g.x - parseInt(d.style.borderLeftWidth) + "px", top: f.y + e.y - b.editor.document.body.scrollTop - g.y - parseInt(d.style.borderTopWidth) + "px" }) } } }(), function () { var b, c = this; c.setOpt("imageScaleEnabled", !0), !browser.ie && c.options.imageScaleEnabled && c.addListener("click", function (d, e) { var f = c.selection.getRange(), g = f.getClosedNode(); if (g && "IMG" == g.tagName && "false" != c.body.contentEditable) { if (g.className.indexOf("edui-faked-music") != -1 || g.getAttribute("anchorname") || domUtils.hasClass(g, "loadingclass") || domUtils.hasClass(g, "loaderrorclass")) return; if (!b) { b = new a, b.init(c), c.ui.getDom().appendChild(b.resizer); var h, i = function (a) { b.hide(), b.target && c.selection.getRange().selectNode(b.target).select() }, j = function (a) { var b = a.target || a.srcElement; !b || void 0 !== b.className && b.className.indexOf("edui-editor-imagescale") != -1 || i(a) }; c.addListener("afterscaleshow", function (a) { c.addListener("beforekeydown", i), c.addListener("beforemousedown", j), domUtils.on(document, "keydown", i), domUtils.on(document, "mousedown", j), c.selection.getNative().removeAllRanges() }), c.addListener("afterscalehide", function (a) { c.removeListener("beforekeydown", i), c.removeListener("beforemousedown", j), domUtils.un(document, "keydown", i), domUtils.un(document, "mousedown", j); var d = b.target; d.parentNode && c.selection.getRange().selectNode(d).select() }), domUtils.on(b.resizer, "mousedown", function (a) { c.selection.getNative().removeAllRanges(); var d = a.target || a.srcElement; d && d.className.indexOf("edui-editor-imagescale-hand") == -1 && (h = setTimeout(function () { b.hide(), b.target && c.selection.getRange().selectNode(d).select() }, 200)) }), domUtils.on(b.resizer, "mouseup", function (a) { var b = a.target || a.srcElement; b && b.className.indexOf("edui-editor-imagescale-hand") == -1 && clearTimeout(h) }) } b.show(g) } else b && "none" != b.resizer.style.display && b.hide() }), browser.webkit && c.addListener("click", function (a, b) { if ("IMG" == b.target.tagName && "false" != c.body.contentEditable) { var d = new dom.Range(c.document); d.selectNode(b.target).select() } }) } }(), UE.plugin.register("autolink", function () { var a = 0; return browser.ie ? {} : { bindEvents: { reset: function () { a = 0 }, keydown: function (a, b) { var c = this, d = b.keyCode || b.which; if (32 == d || 13 == d) { for (var e, f, g = c.selection.getNative(), h = g.getRangeAt(0).cloneRange(), i = h.startContainer; 1 == i.nodeType && h.startOffset > 0 && (i = h.startContainer.childNodes[h.startOffset - 1]);)h.setStart(i, 1 == i.nodeType ? i.childNodes.length : i.nodeValue.length), h.collapse(!0), i = h.startContainer; do { if (0 == h.startOffset) { for (i = h.startContainer.previousSibling; i && 1 == i.nodeType;)i = i.lastChild; if (!i || domUtils.isFillChar(i)) break; e = i.nodeValue.length } else i = h.startContainer, e = h.startOffset; h.setStart(i, e - 1), f = h.toString().charCodeAt(0) } while (160 != f && 32 != f); if (h.toString().replace(new RegExp(domUtils.fillChar, "g"), "").match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)) { for (; h.toString().length && !/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(h.toString());)try { h.setStart(h.startContainer, h.startOffset + 1) } catch (j) { for (var i = h.startContainer; !(next = i.nextSibling);) { if (domUtils.isBody(i)) return; i = i.parentNode } h.setStart(next, 0) } if (domUtils.findParentByTagName(h.startContainer, "a", !0)) return; var k, l = c.document.createElement("a"), m = c.document.createTextNode(" "); c.undoManger && c.undoManger.save(), l.appendChild(h.extractContents()), l.href = l.innerHTML = l.innerHTML.replace(/<[^>]+>/g, ""), k = l.getAttribute("href").replace(new RegExp(domUtils.fillChar, "g"), ""), k = /^(?:https?:\/\/)/gi.test(k) ? k : "http://" + k, l.setAttribute("_src", utils.html(k)), l.href = utils.html(k), h.insertNode(l), l.parentNode.insertBefore(m, l.nextSibling), h.setStart(m, 0), h.collapse(!0), g.removeAllRanges(), g.addRange(h), c.undoManger && c.undoManger.save() } } } } } }, function () { function a(a) { if (3 == a.nodeType) return null; if ("A" == a.nodeName) return a; for (var b = a.lastChild; b;) { if ("A" == b.nodeName) return b; if (3 == b.nodeType) { if (domUtils.isWhitespace(b)) { b = b.previousSibling; continue } return null } b = b.lastChild } } var b = { 37: 1, 38: 1, 39: 1, 40: 1, 13: 1, 32: 1 }; browser.ie && this.addListener("keyup", function (c, d) { var e = this, f = d.keyCode; if (b[f]) { var g = e.selection.getRange(), h = g.startContainer; if (13 == f) { for (; h && !domUtils.isBody(h) && !domUtils.isBlockElm(h);)h = h.parentNode; if (h && !domUtils.isBody(h) && "P" == h.nodeName) { var i = h.previousSibling; if (i && 1 == i.nodeType) { var i = a(i); i && !i.getAttribute("_href") && domUtils.remove(i, !0) } } } else if (32 == f) 3 == h.nodeType && /^\s$/.test(h.nodeValue) && (h = h.previousSibling, h && "A" == h.nodeName && !h.getAttribute("_href") && domUtils.remove(h, !0)); else if (h = domUtils.findParentByTagName(h, "a", !0), h && !h.getAttribute("_href")) { var j = g.createBookmark(); domUtils.remove(h, !0), g.moveToBookmark(j).select(!0) } } }) }), UE.plugins.autoheight = function () {
function a() { var a = this; clearTimeout(e), f || (!a.queryCommandState || a.queryCommandState && 1 != a.queryCommandState("source")) && (e = setTimeout(function () { for (var b = a.body.lastChild; b && 1 != b.nodeType;)b = b.previousSibling; b && 1 == b.nodeType && (b.style.clear = "both", d = Math.max(domUtils.getXY(b).y + b.offsetHeight + 25, Math.max(h.minFrameHeight, h.initialFrameHeight)), d != g && (d !== parseInt(a.iframe.parentNode.style.height) && (a.iframe.parentNode.style.height = d + "px"), a.body.style.height = d + "px", g = d), domUtils.removeStyle(b, "clear")) }, 50)) } var b = this; if (b.autoHeightEnabled = b.options.autoHeightEnabled !== !1, b.autoHeightEnabled) {
var c, d, e, f, g = 0, h = b.options; b.addListener("fullscreenchanged", function (a, b) { f = b }), b.addListener("destroy", function () { b.removeListener("contentchange afterinserthtml keyup mouseup", a) }), b.enableAutoHeight = function () { var b = this; if (b.autoHeightEnabled) { var d = b.document; b.autoHeightEnabled = !0, c = d.body.style.overflowY, d.body.style.overflowY = "hidden", b.addListener("contentchange afterinserthtml keyup mouseup", a), setTimeout(function () { a.call(b) }, browser.gecko ? 100 : 0), b.fireEvent("autoheightchanged", b.autoHeightEnabled) } }, b.disableAutoHeight = function () { b.body.style.overflowY = c || "", b.removeListener("contentchange", a), b.removeListener("keyup", a), b.removeListener("mouseup", a), b.autoHeightEnabled = !1, b.fireEvent("autoheightchanged", b.autoHeightEnabled) }, b.on("setHeight", function () { b.disableAutoHeight() }), b.addListener("ready", function () {
b.enableAutoHeight(); var c; domUtils.on(browser.ie ? b.body : b.document, browser.webkit ? "dragover" : "drop", function () {
clearTimeout(c), c = setTimeout(function () { a.call(b) }, 100)
}); var d; window.onscroll = function () { null === d ? d = this.scrollY : 0 == this.scrollY && 0 != d && (b.window.scrollTo(0, 0), d = null) }
})
}
}, UE.plugins.autofloat = function () { function a() { return UE.ui ? 1 : (alert(g.autofloatMsg), 0) } function b() { var a = document.body.style; a.backgroundImage = 'url("about:blank")', a.backgroundAttachment = "fixed" } function c() { var a = domUtils.getXY(k), b = domUtils.getComputedStyle(k, "position"), c = domUtils.getComputedStyle(k, "left"); k.style.width = k.offsetWidth + "px", k.style.zIndex = 1 * f.options.zIndex + 1, k.parentNode.insertBefore(q, k), o || p && browser.ie ? ("absolute" != k.style.position && (k.style.position = "absolute"), k.style.top = (document.body.scrollTop || document.documentElement.scrollTop) - l + i + "px") : (browser.ie7Compat && r && (r = !1, k.style.left = domUtils.getXY(k).x - document.documentElement.getBoundingClientRect().left + 2 + "px"), "fixed" != k.style.position && (k.style.position = "fixed", k.style.top = i + "px", ("absolute" == b || "relative" == b) && parseFloat(c) && (k.style.left = a.x + "px"))) } function d() { r = !0, q.parentNode && q.parentNode.removeChild(q), k.style.cssText = j } function e() { var a = m(f.container), b = f.options.toolbarTopOffset || 0; a.top < 0 && a.bottom - k.offsetHeight > b ? c() : d() } var f = this, g = f.getLang(); f.setOpt({ topOffset: 0 }); var h = f.options.autoFloatEnabled !== !1, i = f.options.topOffset; if (h) { var j, k, l, m, n = UE.ui.uiUtils, o = browser.ie && browser.version <= 6, p = browser.quirks, q = document.createElement("div"), r = !0, s = utils.defer(function () { e() }, browser.ie ? 200 : 100, !0); f.addListener("destroy", function () { domUtils.un(window, ["scroll", "resize"], e), f.removeListener("keydown", s) }), f.addListener("ready", function () { if (a(f)) { if (!f.ui) return; m = n.getClientRect, k = f.ui.getDom("toolbarbox"), l = m(k).top, j = k.style.cssText, q.style.height = k.offsetHeight + "px", o && b(), domUtils.on(window, ["scroll", "resize"], e), f.addListener("keydown", s), f.addListener("beforefullscreenchange", function (a, b) { b && d() }), f.addListener("fullscreenchanged", function (a, b) { b || e() }), f.addListener("sourcemodechanged", function (a, b) { setTimeout(function () { e() }, 0) }), f.addListener("clearDoc", function () { setTimeout(function () { e() }, 0) }) } }) } }, UE.plugins.video = function () { function a(a, b, d, e, f, g, h) { a = utils.unhtmlForUrl(a), f = utils.unhtml(f), g = utils.unhtml(g).trim(), b = parseInt(b, 10) || 0, d = parseInt(d, 10) || 0; var i; switch (h) { case "image": i = "'; break; case "embed": i = '