1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687 |
- (function (e, $) {
- if (window.xheditor)return !1;
- var I = navigator.userAgent.toLowerCase(), Ba = -1 !== I.indexOf("mobile"), J = e.browser, pa = parseFloat(J.version), h = J.msie, qa = J.mozilla, R = J.safari, Ca = J.opera, eb = -1 < I.indexOf(" adobeair/"), Da = /OS 5(_\d)+ like Mac OS X/i.test(I);
- e.fn.xheditor = function (h) {
- if (Ba && !Da)return !1;
- var o = [];
- this.each(function () {
- if (e.nodeName(this, "TEXTAREA"))if (!1 === h) {
- if (this.xheditor)this.xheditor.remove(), this.xheditor = null
- } else if (this.xheditor)o.push(this.xheditor); else {
- var q = /({.*})/.exec(e(this).attr("class"));
- if (q) {
- try {
- q = eval("(" + q[1] + ")")
- } catch (t) {
- }
- h = e.extend({}, q, h)
- }
- q = new ra(this, h);
- if (q.init())this.xheditor = q, o.push(q)
- }
- });
- 0 === o.length && (o = !1);
- 1 === o.length && (o = o[0]);
- return o
- };
- var aa = 0, S = !1, sa = !0, ta = !1, Sa = !1, t, ba, ca, da, K, Ea, ea, Fa, Ga, Ha, A;
- e("script[src*=xheditor]").each(function () {
- var e = this.src;
- if (e.match(/xheditor[^\/]*\.js/i))return A = e.replace(/[\?#].*$/, "").replace(/(^|[\/\\])[^\/]*$/, "$1"), !1
- });
- if (h) {
- try {
- document.execCommand("BackgroundImageCache", !1, !0)
- } catch (qb) {
- }
- (I = e.fn.jquery) && I.match(/^1\.[67]/) &&
- (e.attrHooks.width = e.attrHooks.height = null)
- }
- var fb = {
- 27: "esc",
- 9: "tab",
- 32: "space",
- 13: "enter",
- 8: "backspace",
- 145: "scroll",
- 20: "capslock",
- 144: "numlock",
- 19: "pause",
- 45: "insert",
- 36: "home",
- 46: "del",
- 35: "end",
- 33: "pageup",
- 34: "pagedown",
- 37: "left",
- 38: "up",
- 39: "right",
- 40: "down",
- 112: "f1",
- 113: "f2",
- 114: "f3",
- 115: "f4",
- 116: "f5",
- 117: "f6",
- 118: "f7",
- 119: "f8",
- 120: "f9",
- 121: "f10",
- 122: "f11",
- 123: "f12"
- }, Ta = "#FFFFFF,#CCCCCC,#C0C0C0,#999999,#666666,#333333,#000000,#FFCCCC,#FF6666,#FF0000,#CC0000,#990000,#660000,#330000,#FFCC99,#FF9966,#FF9900,#FF6600,#CC6600,#993300,#663300,#FFFF99,#FFFF66,#FFCC66,#FFCC33,#CC9933,#996633,#663333,#FFFFCC,#FFFF33,#FFFF00,#FFCC00,#999900,#666600,#333300,#99FF99,#66FF99,#33FF33,#33CC00,#009900,#006600,#003300,#99FFFF,#33FFFF,#66CCCC,#00CCCC,#339999,#336666,#003333,#CCFFFF,#66FFFF,#33CCFF,#3366FF,#3333FF,#000099,#000066,#CCCCFF,#9999FF,#6666CC,#6633FF,#6600CC,#333399,#330099,#FFCCFF,#FF99FF,#CC66CC,#CC33CC,#993399,#663366,#330033".split(","),
- gb = [{n: "p", t: "Paragraph"}, {n: "h1", t: "Heading 1"}, {n: "h2", t: "Heading 2"}, {n: "h3", t: "Heading 3"}, {n: "h4", t: "Heading 4"}, {n: "h5", t: "Heading 5"}, {n: "h6", t: "Heading 6"}, {n: "pre", t: "Preformatted"}, {
- n: "address",
- t: "Address"
- }], hb = [{n: "Arial"}, {n: "Arial Black"}, {n: "Comic Sans MS"}, {n: "Courier New"}, {n: "System"}, {n: "Times New Roman"}, {n: "Tahoma"}, {n: "Verdana"}], T = [{n: "x-small", s: "10px", t: "1"}, {n: "small", s: "13px", t: "2"}, {n: "medium", s: "16px", t: "3"}, {n: "large", s: "18px", t: "4"}, {n: "x-large", s: "24px", t: "5"}, {
- n: "xx-large",
- s: "32px", t: "6"
- }, {n: "-webkit-xxx-large", s: "48px", t: "7"}], ib = [{s: "Align left", v: "justifyleft"}, {s: "Align center", v: "justifycenter"}, {s: "Align right", v: "justifyright"}, {s: "Align full", v: "justifyfull"}], jb = [{s: "Ordered list", v: "insertOrderedList"}, {s: "Unordered list", v: "insertUnorderedList"}], kb = {
- "default": {
- name: "Default", width: 24, height: 24, line: 7, list: {
- smile: "Smile", tongue: "Tongue", titter: "Titter", laugh: "Laugh", sad: "Sad", wronged: "Wronged", fastcry: "Fast cry", cry: "Cry", wail: "Wail", mad: "Mad", knock: "Knock",
- curse: "Curse", crazy: "Crazy", angry: "Angry", ohmy: "Oh my", awkward: "Awkward", panic: "Panic", shy: "Shy", cute: "Cute", envy: "Envy", proud: "Proud", struggle: "Struggle", quiet: "Quiet", shutup: "Shut up", doubt: "Doubt", despise: "Despise", sleep: "Sleep", bye: "Bye"
- }
- }
- }, ka = {
- Cut: {t: "Cut (Ctrl+X)"},
- Copy: {t: "Copy (Ctrl+C)"},
- Paste: {t: "Paste (Ctrl+V)"},
- Pastetext: {t: "Paste as plain text", h: h ? 0 : 1},
- Blocktag: {t: "Block tag", h: 1},
- Fontface: {t: "Font family", h: 1},
- FontSize: {t: "Font size", h: 1},
- Bold: {t: "Bold (Ctrl+B)", s: "Ctrl+B"},
- Italic: {
- t: "Italic (Ctrl+I)",
- s: "Ctrl+I"
- },
- Underline: {t: "Underline (Ctrl+U)", s: "Ctrl+U"},
- Strikethrough: {t: "Strikethrough"},
- FontColor: {t: "Select text color", h: 1},
- BackColor: {t: "Select background color", h: 1},
- SelectAll: {t: "SelectAll (Ctrl+A)"},
- Removeformat: {t: "Remove formatting"},
- Align: {t: "Align", h: 1},
- List: {t: "List", h: 1},
- Outdent: {t: "Outdent"},
- Indent: {t: "Indent"},
- Link: {t: "Insert/edit link (Ctrl+L)", s: "Ctrl+L", h: 1},
- Unlink: {t: "Unlink"},
- Anchor: {t: "Anchor", h: 1},
- Img: {t: "Insert/edit image", h: 1},
- Flash: {t: "Insert/edit flash", h: 1},
- Media: {
- t: "Insert/edit media",
- h: 1
- },
- Hr: {t: "Horizontal rule"},
- Emot: {t: "Emotions", s: "ctrl+e", h: 1},
- Table: {t: "Insert a new table", h: 1},
- Source: {t: "Edit source code"},
- Preview: {t: "Preview"},
- Print: {t: "Print (Ctrl+P)", s: "Ctrl+P"},
- Fullscreen: {t: "Toggle fullscreen (Esc)", s: "Esc"},
- About: {t: "About xhEditor"}
- }, Ia = {
- mini: "Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img",
- simple: "Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Img",
- full: "Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen"
- };
- Ia.mfull = Ia.full.replace(/\|(,Align)/i, "/$1");
- var lb = {a: "Link", img: "Img", embed: "Embed"}, mb = {"<": "<", ">": ">", '"': """, "\u00ae": "®", "\u00a9": "©"}, nb = /[<>"\u00ae\u00a9]/g, ra = function (z, o) {
- function q(a) {
- var a = a.target, b = lb[a.tagName.toLowerCase()];
- b && ("Embed" === b && (b = {"application/x-shockwave-flash": "Flash", "application/x-mplayer2": "Media"}[a.type.toLowerCase()]), d.exec(b))
- }
- function I(a) {
- if (27 === a.which)return ta ? d.removeModal() : S && d.hidePanel(), !1
- }
- function J() {
- setTimeout(d.setSource,
- 10)
- }
- function U() {
- d.getSource()
- }
- function Ua(a) {
- var b, c, f;
- if (a && (b = a.originalEvent.clipboardData) && (c = b.items) && (f = c[0]) && "file" == f.kind && f.type.match(/^image\//i))return a = f.getAsFile(), b = new FileReader, b.onload = function () {
- var a = '<img src="' + event.target.result + '">', a = Va(a);
- d.pasteHTML(a)
- }, b.readAsDataURL(a), !1;
- var i = g.cleanPaste;
- if (0 === i || x || Ja)return !0;
- Ja = !0;
- d.saveBookmark();
- var a = h ? "pre" : "div", m = e("<" + a + ' class="xhe-paste">\ufeff\ufeff</' + a + ">", l).appendTo(l.body), a = m[0];
- b = d.getSel();
- c = d.getRng(!0);
- m.css("top", fa.scrollTop());
- h ? (c.moveToElementText(a), c.select()) : (c.selectNodeContents(a), b.removeAllRanges(), b.addRange(c));
- setTimeout(function () {
- var a = 3 === i, b;
- if (a)b = m.text(); else {
- var c = [];
- e(".xhe-paste", l.body).each(function (a, b) {
- 0 == e(b).find(".xhe-paste").length && c.push(b.innerHTML)
- });
- b = c.join("<br />")
- }
- m.remove();
- d.loadBookmark();
- if (b = b.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""))if (a)d.pasteText(b); else if (b = d.cleanHTML(b), b = d.cleanWord(b), b = d.formatXHTML(b), !g.onPaste || g.onPaste && !1 !== (b = g.onPaste(b)))b =
- Va(b), d.pasteHTML(b);
- Ja = !1
- }, 0)
- }
- function Va(a) {
- var b = g.localUrlTest, c = g.remoteImgSaveUrl;
- if (b && c) {
- var f = [], i = 0, a = a.replace(/(<img)((?:\s+[^>]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig, function (a, c, d, e, s) {
- /^(https?|data:image)/i.test(e) && !/_xhe_temp/.test(d) && !b.test(e) && (f[i] = e, d = d.replace(/\s+(width|height)="[^"]*"/ig, "").replace(/\s+src="[^"]*"/ig, ' src="' + ua + 'img/waiting.gif" remoteimg="' + i++ + '"'));
- return c + d + s
- });
- 0 < f.length && e.post(c, {urls: f.join("|")}, function (a) {
- a = a.split("|");
- e("img[remoteimg]",
- d.doc).each(function () {
- var b = e(this);
- L(b, "src", a[b.attr("remoteimg")]);
- b.removeAttr("remoteimg")
- })
- })
- }
- return a
- }
- function Ka(a) {
- try {
- d._exec("styleWithCSS", a, !0)
- } catch (b) {
- try {
- d._exec("useCSS", !a, !0)
- } catch (c) {
- }
- }
- }
- function La() {
- if (Ma && !x) {
- Ka(!1);
- try {
- d._exec("enableObjectResizing", !0, !0)
- } catch (a) {
- }
- if (h)try {
- d._exec("BackgroundImageCache", !0, !0)
- } catch (b) {
- }
- }
- }
- function Ba(a) {
- if (x || 13 !== a.which || a.shiftKey || a.ctrlKey || a.altKey)return !0;
- a = d.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");
- if (a.is("li"))return !0;
- if (g.forcePtag)0 === a.length && d._exec("formatblock", "<p>"); else return d.pasteHTML("<br />"), h && 0 < a.length && 2 === d.getRng().parentElement().childNodes.length && d.pasteHTML("<br />"), !1
- }
- function Na() {
- !qa && !R && (la && B.height("100%").css("height", B.outerHeight() - n.outerHeight()), h && n.hide().show())
- }
- function Da(a) {
- a = a.target;
- if (a.tagName.match(/(img|embed)/i)) {
- var b = d.getSel(), c = d.getRng(!0);
- c.selectNode(a);
- b.removeAllRanges();
- b.addRange(c)
- }
- }
- function L(a, b, c) {
- if (!b)return !1;
- var d = "_xhe_" + b;
- c && (va && (c = V(c,
- va, F)), a.attr(b, F ? V(c, "abs", F) : c).removeAttr(d).attr(d, c));
- return a.attr(d) || a.attr(b)
- }
- function Oa() {
- sa && d.hidePanel()
- }
- function ob(a) {
- if (x)return !0;
- var b = a.which, c = fb[b], b = c ? c : String.fromCharCode(b).toLowerCase();
- sKey = "";
- sKey += a.ctrlKey ? "ctrl+" : "";
- sKey += a.altKey ? "alt+" : "";
- sKey += a.shiftKey ? "shift+" : "";
- sKey += b;
- var a = ma[sKey], f;
- for (f in a)if (f = a[f], e.isFunction(f)) {
- if (!1 === f.call(d))return !1
- } else return d.exec(f), !1
- }
- function M(a, b) {
- var c = typeof a;
- return !b ? "undefined" != c : "array" === b && a.hasOwnProperty &&
- a instanceof Array ? !0 : c === b
- }
- function V(a, b, c) {
- if (a.match(/^(\w+):\/\//i) && !a.match(/^https?:/i) || /^#/i.test(a) || /^data:/i.test(a))return a;
- var d = c ? e('<a href="' + c + '" />')[0] : location, c = d.protocol, i = d.host, m = d.hostname, j = d.port, d = d.pathname.replace(/\\/g, "/").replace(/[^\/]+$/i, "");
- "" === j && (j = "80");
- "" === d ? d = "/" : "/" !== d.charAt(0) && (d = "/" + d);
- a = e.trim(a);
- "abs" !== b && (a = a.replace(RegExp(c + "\\/\\/" + m.replace(/\./g, "\\.") + "(?::" + j + ")" + ("80" === j ? "?" : "") + "(/|$)", "i"), "/"));
- "rel" === b && (a = a.replace(RegExp("^" +
- d.replace(/([\/\.\+\[\]\(\)])/g, "\\$1"), "i"), ""));
- if ("rel" !== b && (a.match(/^(https?:\/\/|\/)/i) || (a = d + a), "/" === a.charAt(0))) {
- for (var m = [], a = a.split("/"), p = a.length, d = 0; d < p; d++)j = a[d], ".." === j ? m.pop() : "" !== j && "." !== j && m.push(j);
- "" === a[p - 1] && m.push("");
- a = "/" + m.join("/")
- }
- "abs" === b && !a.match(/^https?:\/\//i) && (a = c + "//" + i + a);
- return a = a.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i, "$1$2")
- }
- function Wa(a, b) {
- if ("*" === b || a.match(RegExp(".(" + b.replace(/,/g, "|") + ")$", "i")))return !0;
- alert("Upload file extension required for this: " +
- b);
- return !1
- }
- function Xa(a) {
- var b = Math.floor(Math.log(a) / Math.log(1024));
- return (a / Math.pow(1024, Math.floor(b))).toFixed(2) + "Byte,KB,MB,GB,TB,PB".split(",")[b]
- }
- function N() {
- return !1
- }
- var d = this, G = e(z), Ya = G.closest("form"), n, B, W, fa, l, ga, ha, Ma = !1, x = !1, la = !1, Ja = !1, Pa, na = !1, Za = "", v = null, wa, oa = !1, Qa = !1, ia = null, X = null, O = 0, g = d.settings = e.extend({}, ra.settings, o), xa = g.plugins, ya = [];
- xa && (ka = e.extend({}, ka, xa), e.each(xa, function (a) {
- ya.push(a)
- }), ya = ya.join(","));
- if (g.tools.match(/^\s*(m?full|simple|mini)\s*$/i)) {
- var $a =
- Ia[e.trim(g.tools)];
- g.tools = g.tools.match(/m?full/i) && xa ? $a.replace("Table", "Table," + ya) : $a
- }
- g.tools.match(/(^|,)\s*About\s*(,|$)/i) || (g.tools += ",About");
- g.tools = g.tools.split(",");
- if (g.editorRoot)A = g.editorRoot;
- !1 === eb && (A = V(A, "abs"));
- if (g.urlBase)g.urlBase = V(g.urlBase, "abs");
- var ab = "xheCSS_" + g.skin, ja = "xhe" + aa + "_container", bb = "xhe" + aa + "_Tool", cb = "xhe" + aa + "_iframearea", db = "xhe" + aa + "_iframe", za = "xhe" + aa + "_fixffcursor", P = "", Q = "", ua = A + "xheditor_skin/" + g.skin + "/", Aa = kb, va = g.urlType, F = g.urlBase, Y = g.emotPath,
- Y = Y ? Y : A + "xheditor_emot/", Ra = "", Aa = e.extend({}, Aa, g.emots), Y = V(Y, "rel", F ? F : null);
- (na = g.showBlocktag) && (Q += " showBlocktag");
- var ma = [];
- this.init = function () {
- 0 === e("#" + ab).length && e("head").append('<link id="' + ab + '" rel="stylesheet" type="text/css" href="' + ua + 'ui.css" />');
- var a = G.outerWidth(), b = G.outerHeight(), a = g.width || z.style.width || (10 < a ? a : 0);
- O = g.height || z.style.height || (10 < b ? b : 150);
- M(a, "number") && (a += "px");
- M(O, "string") && (O = O.replace(/[^\d]+/g, ""));
- var b = g.background || z.style.background, c = ['<span class="xheGStart"/>'],
- f, i, m = /\||\//i;
- e.each(g.tools, function (a, b) {
- b.match(m) && c.push('<span class="xheGEnd"/>');
- if ("|" === b)c.push('<span class="xheSeparator"/>'); else if ("/" === b)c.push("<br />"); else {
- f = ka[b];
- if (!f)return;
- i = f.c ? f.c : "xheIcon xheBtn" + b;
- c.push('<span><a href="#" title="' + f.t + '" cmd="' + b + '" class="xheButton xheEnabled" tabindex="-1" role="button"><span class="' + i + '" unselectable="on" style="font-size:0;color:transparent;text-indent:-999px;">' + f.t + "</span></a></span>");
- f.s && d.addShortcuts(f.s, b)
- }
- b.match(m) &&
- c.push('<span class="xheGStart"/>')
- });
- c.push('<span class="xheGEnd"/><br />');
- G.after(e('<input type="text" id="' + za + '" style="position:absolute;display:none;" /><span id="' + ja + '" class="xhe_' + g.skin + '" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="' + ("0px" != a ? "width:" + a + ";" : "") + "height:" + O + 'px;" role="presentation"><tr><td id="' + bb + '" class="xheTool" unselectable="on" style="height:1px;" role="presentation"></td></tr><tr><td id="' + cb + '" class="xheIframeArea" role="presentation"><iframe frameborder="0" id="' +
- db + '" src="javascript:;" style="width:100%;"></iframe></td></tr></table></span>'));
- n = e("#" + bb);
- B = e("#" + cb);
- P = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="' + ua + 'iframe.css"/>';
- if (a = g.loadCSS)if (M(a, "array"))for (var j in a)P += '<link rel="stylesheet" href="' + a[j] + '"/>'; else P = a.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i) ? P + a : P + ('<link rel="stylesheet" href="' + a + '"/>');
- j = "<html><head>" + P + "<title>WYSIWYG Editor,press alt+1-9,toogle to tool area,press tab,select button,press esc,return editor " +
- (g.readTip ? g.readTip : "") + "</title>";
- b && (j += "<style>html{background:" + b + ";}</style>");
- j += '</head><body spellcheck="0" class="editMode' + Q + '"></body></html>';
- d.win = W = e("#" + db)[0].contentWindow;
- fa = e(W);
- try {
- this.doc = l = W.document, ga = e(l), l.open(), l.write(j), l.close(), h ? l.body.contentEditable = "true" : l.designMode = "On"
- } catch (p) {
- }
- setTimeout(La, 300);
- d.setSource();
- W.setInterval = null;
- n.append(c.join("")).bind("mousedown contextmenu", N).click(function (a) {
- var b = e(a.target).closest("a");
- b.is(".xheEnabled") && (clearTimeout(wa),
- n.find("a").attr("tabindex", "-1"), v = a, d.exec(b.attr("cmd")));
- return !1
- });
- n.find(".xheButton").hover(function (a) {
- var b = e(this), c = g.hoverExecDelay, k = X;
- X = null;
- if (-1 === c || oa || !b.is(".xheEnabled"))return !1;
- if (k && 10 < k)return oa = !0, setTimeout(function () {
- oa = !1
- }, 100), !1;
- var f = b.attr("cmd");
- if (1 !== ka[f].h)return d.hidePanel(), !1;
- Qa && (c = 0);
- 0 <= c && (wa = setTimeout(function () {
- v = a;
- ia = {x: v.clientX, y: v.clientY};
- d.exec(f)
- }, c))
- }, function () {
- ia = null;
- wa && clearTimeout(wa)
- }).mousemove(function (a) {
- if (ia) {
- var b = a.clientX - ia.x,
- c = a.clientY - ia.y;
- if (1 < Math.abs(b) || 1 < Math.abs(c))0 < b && 0 < c ? (b = Math.round(Math.atan(c / b) / 0.017453293), X = X ? (X + b) / 2 : b) : X = null, ia = {x: a.clientX, y: a.clientY}
- }
- });
- t = e("#xhePanel");
- ba = e("#xheShadow");
- ca = e("#xheCntLine");
- 0 === t.length && (t = e('<div id="xhePanel"></div>').mousedown(function (a) {
- a.stopPropagation()
- }), ba = e('<div id="xheShadow"></div>'), ca = e('<div id="xheCntLine"></div>'), setTimeout(function () {
- e(document.body).append(t).append(ba).append(ca)
- }, 10));
- e("#" + ja).show();
- G.hide();
- B.css("height", O - n.outerHeight());
- h & 8 > pa && setTimeout(function () {
- B.css("height", O - n.outerHeight())
- }, 1);
- G.focus(d.focus);
- Ya.submit(U).bind("reset", J);
- g.submitID && e("#" + g.submitID).mousedown(U);
- e(window).bind("unload beforeunload", U).bind("resize", Na);
- e(document).mousedown(Oa);
- Sa || (e(document).keydown(I), Sa = !0);
- fa.focus(function () {
- g.focus && g.focus()
- }).blur(function () {
- g.blur && g.blur()
- });
- R && fa.click(Da);
- ga.mousedown(Oa).keydown(ob).keypress(Ba).dblclick(q).bind("mousedown click", function (a) {
- G.trigger(a.type)
- });
- if (h) {
- ga.keydown(function (a) {
- var b =
- d.getRng();
- if (8 === a.which && b.item)return e(b.item(0)).remove(), !1
- });
- var w = function (a) {
- var a = e(a.target), b;
- (b = a.css("width")) && a.css("width", "").attr("width", b.replace(/[^0-9%]+/g, ""));
- (b = a.css("height")) && a.css("height", "").attr("height", b.replace(/[^0-9%]+/g, ""))
- };
- ga.bind("controlselect", function (a) {
- a = a.target;
- e.nodeName(a, "IMG") && e(a).unbind("resizeend", w).bind("resizeend", w)
- })
- }
- ga.keydown(function (a) {
- var b = a.which;
- if (a.altKey && 49 <= b && 57 >= b)return n.find("a").attr("tabindex", "0"), n.find(".xheGStart").eq(b -
- 49).next().find("a").focus(), l.title = "\ufeff\ufeff", !1
- }).click(function () {
- n.find("a").attr("tabindex", "-1")
- });
- n.keydown(function (a) {
- var b = a.which;
- if (27 == b)n.find("a").attr("tabindex", "-1"), d.focus(); else if (a.altKey && 49 <= b && 57 >= b)return n.find(".xheGStart").eq(b - 49).next().find("a").focus(), !1
- });
- j = e(l.documentElement);
- Ca ? j.bind("keydown", function (a) {
- a.ctrlKey && 86 === a.which && Ua()
- }) : j.bind(h ? "beforepaste" : "paste", Ua);
- g.disableContextmenu && j.bind("contextmenu", N);
- g.html5Upload && j.bind("dragenter dragover",
- function (a) {
- var b;
- if ((b = a.originalEvent.dataTransfer.types) && -1 !== e.inArray("Files", b))return !1
- }).bind("drop", function (a) {
- var a = a.originalEvent.dataTransfer, b;
- if (a && (b = a.files) && 0 < b.length) {
- var c, k, a = ["Link", "Img", "Flash", "Media"], f = [], j;
- for (c in a)k = a[c], g["up" + k + "Url"] && g["up" + k + "Url"].match(/^[^!].*/i) && f.push(k + ":," + g["up" + k + "Ext"]);
- if (0 === f.length)return !1;
- j = f.join(",");
- k = function (a) {
- var b, d;
- for (c = 0; c < a.length; c++)if (b = a[c].name.replace(/.+\./, ""), b = j.match(RegExp("(\\w+):[^:]*," + b + "(?:,|$)",
- "i")))if (d) {
- if (d !== b[1])return 2
- } else d = b[1]; else return 1;
- return d
- }(b);
- 1 === k ? alert("Upload file extension required for this: " + j.replace(/\w+:,/g, "")) : 2 === k ? alert("You can only drag and drop the same type of files.") : k && d.startUpload(b, g["up" + k + "Url"], "*", function (a) {
- var b = [], c;
- (c = g.onUpload) && c(a);
- for (var f = 0, j = a.length; f < j; f++)c = a[f], url = M(c, "string") ? c : c.url, "!" === url.substr(0, 1) && (url = url.substr(1)), b.push(url);
- d.exec(k);
- e("#xhe" + k + "Url").val(b.join(" "));
- e("#xheSave").click()
- });
- return !1
- }
- });
- (j = g.shortcuts) && e.each(j, function (a, b) {
- d.addShortcuts(a, b)
- });
- aa++;
- Ma = !0;
- g.fullscreen ? d.toggleFullscreen() : g.sourceMode && setTimeout(d.toggleSource, 20);
- return !0
- };
- this.remove = function () {
- d.hidePanel();
- U();
- G.unbind("focus", d.focus);
- Ya.unbind("submit", U).unbind("reset", J);
- g.submitID && e("#" + g.submitID).unbind("mousedown", U);
- e(window).unbind("unload beforeunload", U).unbind("resize", Na);
- e(document).unbind("mousedown", Oa);
- e("#" + ja).remove();
- e("#" + za).remove();
- G.show();
- Ma = !1
- };
- this.saveBookmark = function () {
- if (!x) {
- d.focus();
- var a = d.getRng(), a = a.cloneRange ? a.cloneRange() : a;
- ha = {top: fa.scrollTop(), rng: a}
- }
- };
- this.loadBookmark = function () {
- if (!x && ha) {
- d.focus();
- var a = ha.rng;
- if (h)a.select(); else {
- var b = d.getSel();
- b.removeAllRanges();
- b.addRange(a)
- }
- fa.scrollTop(ha.top);
- ha = null
- }
- };
- this.focus = function () {
- x ? e("#sourceCode", l).focus() : W.focus();
- if (h) {
- var a = d.getRng();
- a.parentElement && a.parentElement().ownerDocument !== l && d.setTextCursor()
- }
- return !1
- };
- this.setTextCursor = function (a) {
- var b = d.getRng(!0), c = l.body;
- if (h)b.moveToElementText(c); else {
- for (var e =
- a ? "lastChild" : "firstChild"; 3 != c.nodeType && c[e];)c = c[e];
- b.selectNode(c)
- }
- b.collapse(a ? !1 : !0);
- h ? b.select() : (a = d.getSel(), a.removeAllRanges(), a.addRange(b))
- };
- this.getSel = function () {
- return l.selection ? l.selection : W.getSelection()
- };
- this.getRng = function (a) {
- var b, c;
- try {
- a || (b = d.getSel(), c = b.createRange ? b.createRange() : 0 < b.rangeCount ? b.getRangeAt(0) : null), c || (c = l.body.createTextRange ? l.body.createTextRange() : l.createRange())
- } catch (e) {
- }
- return c
- };
- this.getParent = function (a) {
- var b = d.getRng(), c;
- h ? c = b.item ? b.item(0) :
- b.parentElement() : (c = b.commonAncestorContainer, b.collapsed || b.startContainer === b.endContainer && 2 > b.startOffset - b.endOffset && b.startContainer.hasChildNodes() && (c = b.startContainer.childNodes[b.startOffset]));
- a = a ? a : "*";
- c = e(c);
- c.is(a) || (c = e(c).closest(a));
- return c
- };
- this.getSelect = function (a) {
- var b = d.getSel(), c = d.getRng(), f = !0, f = !c || c.item ? !1 : !b || 0 === c.boundingWidth || c.collapsed;
- if ("text" === a)return f ? "" : c.text || (b.toString ? b.toString() : "");
- c.cloneContents ? (a = e("<div></div>"), (c = c.cloneContents()) && a.append(c),
- c = a.html()) : c = M(c.item) ? c.item(0).outerHTML : M(c.htmlText) ? c.htmlText : c.toString();
- f && (c = "");
- c = d.processHTML(c, "read");
- c = d.cleanHTML(c);
- return c = d.formatXHTML(c)
- };
- this.pasteHTML = function (a, b) {
- if (x)return !1;
- d.focus();
- var a = d.processHTML(a, "write"), c = d.getSel(), f = d.getRng();
- if (b !== $) {
- if (f.item) {
- var i = f.item(0), f = d.getRng(!0);
- f.moveToElementText(i);
- f.select()
- }
- f.collapse(b)
- }
- a += "<" + (h ? "img" : "span") + ' id="_xhe_temp" width="0" height="0" />';
- if (f.insertNode) {
- if (0 < e(f.startContainer).closest("style,script").length)return !1;
- f.deleteContents();
- f.insertNode(f.createContextualFragment(a))
- } else"control" === c.type.toLowerCase() && (c.clear(), f = d.getRng()), f.pasteHTML(a);
- var i = e("#_xhe_temp", l), m = i[0];
- h ? (f.moveToElementText(m), f.select()) : (f.selectNode(m), c.removeAllRanges(), c.addRange(f));
- i.remove()
- };
- this.pasteText = function (a, b) {
- a || (a = "");
- a = d.domEncode(a);
- a = a.replace(/\r?\n/g, "<br />");
- d.pasteHTML(a, b)
- };
- this.appendHTML = function (a) {
- if (x)return !1;
- d.focus();
- a = d.processHTML(a, "write");
- e(l.body).append(a);
- d.setTextCursor(!0)
- };
- this.domEncode =
- function (a) {
- return a.replace(nb, function (a) {
- return mb[a]
- })
- };
- this.setSource = function (a) {
- ha = null;
- if ("string" !== typeof a && "" !== a)a = z.value;
- x ? e("#sourceCode", l).val(a) : (g.beforeSetSource && (a = g.beforeSetSource(a)), a = d.cleanHTML(a), a = d.formatXHTML(a), a = d.processHTML(a, "write"), h ? (l.body.innerHTML = '<img id="_xhe_temp" width="0" height="0" />' + a, e("#_xhe_temp", l).remove()) : l.body.innerHTML = a)
- };
- this.processHTML = function (a, b) {
- if ("write" === b) {
- a = a.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,
- function (a, b, c, d, e, f, i) {
- d = d.toLowerCase();
- qa ? "strong" === d ? d = "b" : "em" === d && (d = "i") : R && ("strong" === d ? (d = "span", c || (e += ' class="Apple-style-span" style="font-weight: bold;"')) : "em" === d ? (d = "span", c || (e += ' class="Apple-style-span" style="font-style: italic;"')) : "u" === d ? (d = "span", c || (e += ' class="Apple-style-span" style="text-decoration: underline;"')) : "strike" === d && (d = "span", c || (e += ' class="Apple-style-span" style="text-decoration: line-through;"')));
- var k, y = "";
- if ("del" === d)d = "strike"; else if ("img" === d)e =
- e.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i, function (a, b) {
- k = b.match(/^(["']?)(.*)\1/)[2];
- k = k.split(",");
- k[1] || (k[1] = k[0], k[0] = "");
- "default" === k[0] && (k[0] = "");
- return g.emotMark ? a : ""
- }); else if ("a" === d)!e.match(/ href=[^ ]/i) && e.match(/ name=[^ ]/i) && (y += " xhe-anchor"), i && (f = "></a>"); else if ("table" === d && !c && (a = e.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i), !a || a[1].match(/^(["']?)\s*0\s*\1$/)))y += " xhe-border";
- var Z, e = e.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g, function (a,
- b, c) {
- b = b.toLowerCase();
- c = c.match(/^(["']?)(.*)\1/)[2];
- aft = "";
- if (h && b.match(/^(disabled|checked|readonly|selected)$/) && c.match(/^(false|0)$/i) || "img" === d && k && "src" === b)return "";
- b.match(/^(src|href)$/) && (aft = " _xhe_" + b + '="' + c + '"', F && (c = V(c, "abs", F)));
- y && "class" === b && (c += " " + y, y = "");
- R && "style" === b && "span" === d && c.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i) && (Z = !0);
- return " " + b + '="' + c + '"' + aft
- });
- k && (a = Y + (k[0] ? k[0] : "default") + "/" + k[1] + ".gif", e += ' src="' + a + '" _xhe_src="' +
- a + '"');
- Z && (e += ' class="Apple-style-span"');
- y && (e += ' class="' + y + '"');
- return "<" + c + d + e + f
- });
- h && (a = a.replace(/'/ig, "'"));
- if (!R)var c = function (a, b, c, d, e, f) {
- var b = "", i, k;
- (i = d.match(/font-family\s*:\s*([^;"]+)/i)) && (b += ' face="' + i[1] + '"');
- if (i = d.match(/font-size\s*:\s*([^;"]+)/i)) {
- i = i[1].toLowerCase();
- for (var y = 0; y < T.length; y++)if (i === T[y].n || i === T[y].s) {
- k = y + 1;
- break
- }
- k && (b += ' size="' + k + '"', d = d.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig, "$1"))
- }
- if (k = d.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)) {
- if (i =
- k[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)) {
- k[1] = "#";
- for (y = 1; 3 >= y; y++)k[1] += ("0" + (i[y] - 0).toString(16)).slice(-2)
- }
- k[1] = k[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i, "#$1$1$2$2$3$3");
- b += ' color="' + k[1] + '"'
- }
- d = d.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig, "$1");
- return "" !== b ? (d && (b += ' style="' + d + '"'), "<font" + (c ? c : "") + b + (e ? e : "") + ">" + f + "</font>") : a
- }, a = a.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
- c), a = a.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig, c), a = a.replace(/<(span)(\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"( [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, c);
- a = a.replace(/<(td|th)(\s+[^>]*?)?>(\s| )*<\/\1>/ig, "<$1$2>" + (h ? "" : "<br />") + "</$1>")
- } else {
- if (R)for (var d = [{
- r: /font-weight\s*:\s*bold;?/ig,
- t: "strong"
- }, {r: /font-style\s*:\s*italic;?/ig, t: "em"}, {r: /text-decoration\s*:\s*underline;?/ig, t: "u"}, {r: /text-decoration\s*:\s*line-through;?/ig, t: "strike"}], c = function (a, b, c, e, i) {
- for (var a = (c ? c : "") + (e ? e : ""), g = [], D = [], k, c = 0; c < d.length; c++)b = d[c].r, k = d[c].t, a = a.replace(b, function () {
- g.push("<" + k + ">");
- D.push("</" + k + ">");
- return ""
- });
- a = a.replace(/\s+style\s*=\s*"\s*"/i, "");
- return (a ? "<span" + a + ">" : "") + g.join("") + i + D.join("") + (a ? "</span>" : "")
- }, e = 0; 2 > e; e++)a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
- c), a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig, c), a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, c);
- a = a.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g, function (a, b, c, d, e) {
- var c = c.toLowerCase(), f, d = d.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i, function (a,
- b) {
- f = b.match(/^(["']?)(.*)\1/)[2];
- return ""
- });
- f && va && (f = V(f, va, F));
- d = d.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g, function (a, b, c) {
- b = b.toLowerCase();
- c = c.match(/^(["']?)(.*)\1/)[2].replace(/"/g, "'");
- if ("class" === b) {
- if (c.match(/^["']?(apple|webkit)/i))return "";
- c = c.replace(/\s?xhe-[a-z]+/ig, "");
- if ("" === c)return ""
- } else {
- if (b.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return "";
- if (f && b.match(/^(src|href)$/i))return " " + b + '="' + f + '"';
- "style" === b && (c = c.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,
- function (a, b, c, d, e) {
- for (var f, i = 0; i < T.length; i++)if (a = T[i], d === a.n) {
- f = a.s;
- break
- }
- return b + c + ":" + f + e
- }))
- }
- return " " + b + '="' + c + '"'
- });
- "img" === c && !d.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i) && (d += ' alt=""');
- return b + d + e
- });
- a = a.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig, function (a, b, c, d) {
- return b + (d ? d : " ") + "</" + c + ">"
- });
- a = a.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>| )*\s*(?:<\/\1>)?\s*$/i, "")
- }
- return a = a.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,
- function (a, b, c, d) {
- return b + c.replace(/<br\s*\/?>/ig, "\r\n") + d
- })
- };
- this.getSource = function (a) {
- var b, c = g.beforeGetSource;
- x ? (b = e("#sourceCode", l).val(), c || (b = d.formatXHTML(b, !1))) : (b = d.processHTML(l.body.innerHTML, "read"), b = d.cleanHTML(b), b = d.formatXHTML(b, a), c && (b = c(b)));
- return z.value = b
- };
- this.cleanWord = function (a) {
- var b = g.cleanPaste;
- if (0 < b && 3 > b && /mso(-|normal)|WordDocument|<table\s+[^>]*?x:str|\s+class\s*=\s*"?xl[67]\d"/i.test(a)) {
- a = a.replace(/<\!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,
- "");
- a = a.replace(/\r?\n/ig, "");
- h ? (a = a.replace(/<v:shapetype(\s+[^>]*)?>[\s\S]*<\/v:shapetype>/ig, ""), a = a.replace(/<v:shape(\s+[^>]+)?>[\s\S]*?<v:imagedata(\s+[^>]+)?>\s*<\/v:imagedata>[\s\S]*?<\/v:shape>/ig, function (a, b, c) {
- if (a = c.match(/\s+src\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i)) {
- a[1].match(/^(["']?)(.*)\1/);
- c = '<img src="' + A + 'xheditor_skin/blank.gif" _xhe_temp="true" class="wordImage"';
- if (a = b.match(/\s+style\s*=\s*("[^"]+"|'[^']+'|[^>\s]+)/i))a = a[1].match(/^(["']?)(.*)\1/)[2], c += ' style="' + a + '"';
- return c +
- " />"
- }
- return ""
- })) : a = a.replace(/<img( [^<>]*(v:shapes|msohtmlclip)[^<>]*)\/?>/ig, function (a, b) {
- var c, d = '<img src="' + A + 'xheditor_skin/blank.gif" _xhe_temp="true" class="wordImage"';
- (c = b.match(/ width\s*=\s*"([^"]+)"/i)) && (d += ' width="' + c[1] + '"');
- (c = b.match(/ height\s*=\s*"([^"]+)"/i)) && (d += ' height="' + c[1] + '"');
- return d + " />"
- });
- for (var a = a.replace(/(<(\/?)([\w\-:]+))((?:\s+[\w\-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g, function (a, c, d, e, f, g) {
- e = e.toLowerCase();
- if (e.match(/^(link)$/) && f.match(/file:\/\//i) ||
- e.match(/:/) || "span" === e && 2 === b)return "";
- d || (f = f.replace(/\s([\w\-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig, function (a, c, d) {
- c = c.toLowerCase();
- if (/:/.test(c))return "";
- d = d.match(/^(["']?)(.*)\1/)[2];
- if (1 === b)switch (e) {
- case "p":
- if ("style" === c)return (d = d.replace(/"|"/ig, "'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig, function (a, b, c) {
- return /^(text-align)$/i.test(b) ? b + ":" + c + ";" : ""
- }).replace(/^\s+|\s+$/g, "")) ? " " + c + '="' + d + '"' : "";
- break;
- case "span":
- if ("style" === c)return (d = d.replace(/"|"/ig, "'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig,
- function (a, b, c) {
- return /^(color|background|font-size|font-family)$/i.test(b) ? b + ":" + c + ";" : ""
- }).replace(/^\s+|\s+$/g, "")) ? " " + c + '="' + d + '"' : "";
- break;
- case "table":
- if (c.match(/^(cellspacing|cellpadding|border|width)$/i))return a;
- break;
- case "td":
- if (c.match(/^(rowspan|colspan)$/i))return a;
- if ("style" === c)return (d = d.replace(/"|"/ig, "'").replace(/\s*([^:]+)\s*:\s*(.*?)(;|$)/ig, function (a, b, c) {
- return /^(width|height)$/i.test(b) ? b + ":" + c + ";" : ""
- }).replace(/^\s+|\s+$/g, "")) ? " " + c + '="' + d + '"' : "";
- break;
- case "a":
- if (c.match(/^(href)$/i))return a;
- break;
- case "font":
- case "img":
- return a
- } else if (2 === b)switch (e) {
- case "td":
- if (c.match(/^(rowspan|colspan)$/i))return a;
- break;
- case "img":
- return a
- }
- return ""
- }));
- return c + f + g
- }), c = 0; 3 > c; c++)a = a.replace(/<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g, "");
- for (var d = function (a, b, c) {
- return c
- }, c = 0; 3 > c; c++)a = a.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, d);
- for (c = 0; 3 > c; c++)a = a.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,
- d);
- for (c = 0; 3 > c; c++)a = a.replace(/<(span|a)>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, d);
- for (c = 0; 3 > c; c++)a = a.replace(/<font(\s+[^>]+)><font(\s+[^>]+)>/ig, function (a, b, c) {
- return "<font" + b + c + ">"
- });
- a = a.replace(/(<(\/?)(tr|td)(?:\s+[^>]+)?>)[^<>]+/ig, function (a, b, c, d) {
- return !c && /^td$/i.test(d) ? a : b
- })
- }
- return a
- };
- this.cleanHTML = function (a) {
- var a = a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig, ""), b, a = a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i, function (a, d) {
- b = d.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);
- return ""
- });
- b && (a = b.join("") + a);
- a = a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig, "");
- g.internalScript || (a = a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig, ""));
- g.internalStyle || (a = a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, ""));
- if (!g.linkTag || !g.inlineScript || !g.inlineStyle)a = a.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig, function (a, b, d, e, j) {
- if (!g.linkTag && "link" === d.toLowerCase())return "";
- g.inlineScript || (e = e.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,
- ""));
- g.inlineStyle || (e = e.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig, ""));
- return b + e + j
- });
- return a = a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>| )*?)<\1(\s+[^>]*?)?>/ig, "$2")
- };
- this.formatXHTML = function (a, b) {
- function c(a) {
- for (var b = {}, a = a.split(","), c = 0; c < a.length; c++)b[a[c]] = !0;
- return b
- }
- function e(a) {
- var a = a.toLowerCase(), b = o[a];
- return b ? b : a
- }
- function i(a, b, c) {
- if (k[a])for (; E.last() && y[E.last()];)g(E.last());
- Z[a] && E.last() === a && g(a);
- (c = D[a] || !!c) || E.push(a);
- var d = [];
- d.push("<" +
- a);
- b.replace(x, function (a, b, c, e, f) {
- b = b.toLowerCase();
- d.push(" " + b + '="' + (c ? c : e ? e : f ? f : l[b] ? b : "").replace(/"/g, "'") + '"')
- });
- d.push((c ? " /" : "") + ">");
- w(d.join(""), a, !0);
- "pre" === a && (B = !0)
- }
- function g(a) {
- if (a)for (b = E.length - 1; 0 <= b && !(E[b] === a); b--); else var b = 0;
- if (0 <= b) {
- for (var c = E.length - 1; c >= b; c--)w("</" + E[c] + ">", E[c]);
- E.length = b
- }
- "pre" === a && (B = !1, v--)
- }
- function j(a) {
- w(d.domEncode(a))
- }
- function p(a) {
- H.push(a.replace(/^[\s\r\n]+|[\s\r\n]+$/g, ""))
- }
- function w(a, c, d) {
- B || (a = a.replace(/(\t*\r?\n\t*)+/g, ""));
- if (!B &&
- !0 === b)if (a.match(/^\s*$/))H.push(a); else {
- var e = k[c];
- e ? (d && v++, "" === A && v--) : A && v++;
- ((e ? c : "") !== A || e) && s();
- H.push(a);
- "br" === c && s();
- e && (D[c] || !d) && v--;
- A = e ? c : ""
- } else H.push(a)
- }
- function s() {
- H.push("\r\n");
- if (0 < v)for (var a = v; a--;)H.push("\t")
- }
- function r(a, b, c, d) {
- if (!c)return d;
- var e = "", c = c.replace(/ face\s*=\s*"\s*([^"]*)\s*"/i, function (a, b) {
- b && (e += "font-family:" + b + ";");
- return ""
- }), c = c.replace(/ size\s*=\s*"\s*(\d+)\s*"/i, function (a, b) {
- e += "font-size:" + T[(7 < b ? 7 : 1 > b ? 1 : b) - 1].s + ";";
- return ""
- }), c = c.replace(/ color\s*=\s*"\s*([^"]*)\s*"/i,
- function (a, b) {
- b && (e += "color:" + b + ";");
- return ""
- }), c = c.replace(/ style\s*=\s*"\s*([^"]*)\s*"/i, function (a, b) {
- b && (e += b);
- return ""
- });
- return (c += ' style="' + e + '"') ? "<span" + c + ">" + d + "</span>" : d
- }
- var D = c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"), k = c("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,table,tbody,td,tfoot,th,thead,tr,ul,script"), y = c("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),
- Z = c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"), l = c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"), h = c("script,style"), o = {
- b: "strong",
- i: "em",
- s: "del",
- strike: "del"
- }, n = /<(?:\/([^\s>]+)|!([^>]*?)|([\w\-:]+)((?:"[^"]*"|'[^']*'|[^"'<>])*)\s*(\/?))>/g, x = /\s*([\w\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g, H = [], E = [];
- E.last = function () {
- return this[this.length - 1]
- };
- for (var u, C, q = 0, t, z, v = -1, A = "body", B = !1; u = n.exec(a);) {
- C = u.index;
- C > q && (q =
- a.substring(q, C), t ? z.push(q) : j(q));
- q = n.lastIndex;
- if (C = u[1])if (C = e(C), t && C === t && (p(z.join("")), z = t = null), !t) {
- g(C);
- continue
- }
- t ? z.push(u[0]) : (C = u[3]) ? (C = e(C), i(C, u[4], u[5]), h[C] && (t = C, z = [])) : u[2] && H.push(u[0])
- }
- a.length > q && j(a.substring(q, a.length));
- g();
- a = H.join("");
- H = null;
- a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, r);
- a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,
- r);
- a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, r);
- return a = a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g, "")
- };
- this.toggleShowBlocktag = function (a) {
- na !== a && (na = !na, a = e(l.body), na ? (Q += " showBlocktag", a.addClass("showBlocktag")) : (Q = Q.replace(" showBlocktag", ""), a.removeClass("showBlocktag")))
- };
- this.toggleSource = function (a) {
- if (x !== a) {
- n.find("[cmd=Source]").toggleClass("xheEnabled").toggleClass("xheActive");
- var b = l.body, c = e(b), f, i, a = 0, g = "";
- if (x)f = d.getSource(), c.html("").removeAttr("scroll").attr("class",
- "editMode" + Q), h ? b.contentEditable = "true" : l.designMode = "On", qa && (d._exec("inserthtml", "-"), e("#" + za).show().focus().hide()), g = "Source mode"; else {
- d.pasteHTML('<span id="_xhe_cursor"></span>', !0);
- f = d.getSource(!0);
- a = f.indexOf('<span id="_xhe_cursor"></span>');
- if (!Ca)a = f.substring(0, a).replace(/\r/g, "").length;
- f = f.replace(/(\r?\n\s*|)<span id="_xhe_cursor"><\/span>(\s*\r?\n|)/, function (a, b, c) {
- return b && c ? "\r\n" : b + c
- });
- h ? b.contentEditable = "false" : l.designMode = "Off";
- c.attr("scroll", "no").attr("class", "sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" style="width:100%;height:100%" />');
- i = e("#sourceCode", c).blur(d.getSource)[0];
- g = "WYSIWYG mode"
- }
- x = !x;
- d.setSource(f);
- d.focus();
- x ? i.setSelectionRange ? i.setSelectionRange(a, a) : (i = i.createTextRange(), i.move("character", a), i.select()) : d.setTextCursor();
- n.find("[cmd=Source]").attr("title", g).find("span").text(g);
- n.find("[cmd=Source],[cmd=Preview]").toggleClass("xheEnabled");
- n.find(".xheButton").not("[cmd=Source],[cmd=Fullscreen],[cmd=About]").toggleClass("xheEnabled").attr("aria-disabled", x ? !0 : !1);
- setTimeout(La, 300)
- }
- };
- this.showPreview = function () {
- var a =
- g.beforeSetSource, b = d.getSource();
- a && (b = a(b));
- var a = "<html><head>" + P + "<title>Preview</title>" + (F ? '<base href="' + F + '"/>' : "") + "</head><body>" + b + "</body></html>", b = window.screen, b = window.open("", "xhePreview", "toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=" + Math.round(0.9 * b.width) + ",height=" + Math.round(0.8 * b.height) + ",left=" + Math.round(0.05 * b.width)), c = b.document;
- c.open();
- c.write(a);
- c.close();
- b.focus()
- };
- this.toggleFullscreen = function (a) {
- if (la !== a) {
- var a = e("#" + ja).find(".xheLayout"),
- b = e("#" + ja), c = jQuery.browser.version, c = h && (6 == c || 7 == c);
- la ? (c && G.after(b), a.attr("style", Za), B.height(O - n.outerHeight()), e(window).scrollTop(Pa), setTimeout(function () {
- e(window).scrollTop(Pa)
- }, 10)) : (c && e("body").append(b), Pa = e(window).scrollTop(), Za = a.attr("style"), a.removeAttr("style"), B.height("100%"), setTimeout(Na, 100));
- qa ? (e("#" + za).show().focus().hide(), setTimeout(d.focus, 1)) : c && d.setTextCursor();
- la = !la;
- b.toggleClass("xhe_Fullscreen");
- e("html").toggleClass("xhe_Fullfix");
- n.find("[cmd=Fullscreen]").toggleClass("xheActive");
- setTimeout(La, 300)
- }
- };
- this.showMenu = function (a, b) {
- var c = e('<div class="xheMenu"></div>'), f = a.length, i = [];
- e.each(a, function (a, b) {
- "-" === b.s ? i.push('<div class="xheMenuSeparator"></div>') : i.push("<a href=\"javascript:void('" + b.v + '\')" title="' + (b.t ? b.t : b.s) + '" v="' + b.v + '" role="option" aria-setsize="' + f + '" aria-posinset="' + (a + 1) + '" tabindex="0">' + b.s + "</a>")
- });
- c.append(i.join(""));
- c.click(function (a) {
- a = a.target;
- if (!e.nodeName(a, "DIV"))return d.loadBookmark(), b(e(a).closest("a").attr("v")), d.hidePanel(),
- !1
- }).mousedown(N);
- d.saveBookmark();
- d.showPanel(c)
- };
- this.showColor = function (a) {
- var b = e('<div class="xheColor"></div>'), c = [], f = Ta.length, i = 0;
- e.each(Ta, function (a, b) {
- 0 === i % 7 && c.push((0 < i ? "</div>" : "") + "<div>");
- c.push("<a href=\"javascript:void('" + b + '\')" xhev="' + b + '" title="' + b + '" style="background:' + b + '" role="option" aria-setsize="' + f + '" aria-posinset="' + (i + 1) + '"></a>');
- i++
- });
- c.push("</div>");
- b.append(c.join(""));
- b.click(function (b) {
- b = b.target;
- if (e.nodeName(b, "A"))return d.loadBookmark(), a(e(b).attr("xhev")),
- d.hidePanel(), !1
- }).mousedown(N);
- d.saveBookmark();
- d.showPanel(b)
- };
- this.showPastetext = function () {
- var a = e('<div><label for="xhePastetextValue">Use Ctrl+V on your keyboard to paste the text.</label></div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>'), b = e("#xhePastetextValue", a);
- e("#xheSave", a).click(function () {
- d.loadBookmark();
- var a = b.val();
- a && d.pasteText(a);
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(a)
- };
- this.showLink = function () {
- var a = '<div><label for="xheLinkUrl">Link URL: </label><input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div><label for="xheLinkTarget">Target: </label><select id="xheLinkTarget"><option selected="selected" value="">Default</option><option value="_blank">New window</option><option value="_self">Same window</option><option value="_parent">Parent window</option></select></div><div style="display:none"><label for="xheLinkText">Link Text:</label><input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>',
- b = ga.find("a[name]").not("[href]"), c = 0 < b.length;
- if (c) {
- var f = [];
- b.each(function () {
- var a = e(this).attr("name");
- f.push('<option value="#' + a + '">' + a + "</option>")
- });
- a = a.replace(/(<div><label for="xheLinkTarget)/, '<div><label for="xheLinkAnchor">Anchor: </label><select id="xheLinkAnchor"><option value="">None selected</option>' + f.join("") + "</select></div>$1")
- }
- var a = e(a), i = d.getParent("a"), m = e("#xheLinkText", a), j = e("#xheLinkUrl", a), p = e("#xheLinkTarget", a), b = e("#xheSave", a), w = d.getSelect();
- c && a.find("#xheLinkAnchor").change(function () {
- var a =
- e(this).val();
- "" != a && j.val(a)
- });
- if (1 === i.length) {
- if (!i.attr("href"))return v = null, d.exec("Anchor");
- j.val(L(i, "href"));
- p.attr("value", i.attr("target"))
- } else"" === w && m.val(g.defLinkText).closest("div").show();
- g.upLinkUrl && d.uploadInit(j, g.upLinkUrl, g.upLinkExt);
- b.click(function () {
- d.loadBookmark();
- var a = j.val();
- ("" === a || 0 === i.length) && d._exec("unlink");
- if ("" !== a && "http://" !== a) {
- var b = a.split(" "), c = p.val(), f = m.val();
- if (1 < b.length) {
- d._exec("unlink");
- w = d.getSelect();
- var g = '<a href="xhe_tmpurl"', Z = [];
- "" !==
- c && (g += ' target="' + c + '"');
- for (var g = g + ">xhe_tmptext</a>", f = "" !== w ? w : f ? f : a, h = 0, pb = b.length; h < pb; h++)a = b[h], "" !== a && (a = a.split("||"), c = g, c = c.replace("xhe_tmpurl", a[0]), c = c.replace("xhe_tmptext", a[1] ? a[1] : f), Z.push(c));
- d.pasteHTML(Z.join(" "))
- } else a = b[0].split("||"), f || (f = a[0]), f = a[1] ? a[1] : "" !== w ? "" : f ? f : a[0], 0 === i.length ? (f ? d.pasteHTML('<a href="#xhe_tmpurl">' + f + "</a>") : d._exec("createlink", "#xhe_tmpurl"), i = e('a[href$="#xhe_tmpurl"]', l)) : f && !R && i.text(f), L(i, "href", a[0]), "" !== c ? i.attr("target",
- c) : i.removeAttr("target")
- }
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(a)
- };
- this.showAnchor = function () {
- var a = e('<div><label for="xheAnchorName">Anchor name: </label><input type="text" id="xheAnchorName" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>'), b = d.getParent("a"), c = e("#xheAnchorName", a), f = e("#xheSave", a);
- if (1 === b.length) {
- if (b.attr("href"))return v = null, d.exec("Link");
- c.val(b.attr("name"))
- }
- f.click(function () {
- d.loadBookmark();
- var a = c.val();
- a ? 0 === b.length ? d.pasteHTML('<a name="' + a + '"></a>') : b.attr("name", a) : 1 === b.length && b.remove();
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(a)
- };
- this.showImg = function () {
- var a = e('<div><label for="xheImgUrl">Img URL: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div><div><label for="xheImgAlt">Alt text: </label><input type="text" id="xheImgAlt" /></div><div><label for="xheImgAlign">Alignment:</label><select id="xheImgAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="right">Right</option><option value="top">Top</option><option value="middle">Middle</option><option value="baseline">Baseline</option><option value="bottom">Bottom</option></select></div><div><label for="xheImgWidth">Width: </label><input type="text" id="xheImgWidth" style="width:40px;" /> <label for="xheImgHeight">Height: </label><input type="text" id="xheImgHeight" style="width:40px;" /></div><div><label for="xheImgBorder">Border: </label><input type="text" id="xheImgBorder" style="width:40px;" /></div><div><label for="xheImgHspace">Hspace: </label><input type="text" id="xheImgHspace" style="width:40px;" /> <label for="xheImgVspace">Vspace: </label><input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>'),
- b = d.getParent("img"), c = e("#xheImgUrl", a), f = e("#xheImgAlt", a), i = e("#xheImgAlign", a), m = e("#xheImgWidth", a), j = e("#xheImgHeight", a), p = e("#xheImgBorder", a), w = e("#xheImgVspace", a), s = e("#xheImgHspace", a), r = e("#xheSave", a);
- if (1 === b.length) {
- c.val(L(b, "src"));
- f.val(b.attr("alt"));
- i.val(b.attr("align"));
- m.val(b.attr("width"));
- j.val(b.attr("height"));
- p.val(b.attr("border"));
- var D = b.attr("vspace"), k = b.attr("hspace");
- w.val(0 >= D ? "" : D);
- s.val(0 >= k ? "" : k)
- }
- g.upImgUrl && d.uploadInit(c, g.upImgUrl, g.upImgExt);
- r.click(function () {
- d.loadBookmark();
- var a = c.val();
- if ("" !== a && "http://" !== a) {
- var g = a.split(" "), k = f.val(), D = i.val(), r = m.val(), h = j.val(), o = p.val(), q = w.val(), n = s.val();
- if (1 < g.length) {
- var u = '<img src="xhe_tmpurl"', t = [];
- "" !== k && (u += ' alt="' + k + '"');
- "" !== D && (u += ' align="' + D + '"');
- "" !== r && (u += ' width="' + r + '"');
- "" !== h && (u += ' height="' + h + '"');
- "" !== o && (u += ' border="' + o + '"');
- "" !== q && (u += ' vspace="' + q + '"');
- "" !== n && (u += ' hspace="' + n + '"');
- var u = u + " />", v;
- for (v in g)a = g[v], "" !== a && (a = a.split("||"), k = u, k = k.replace("xhe_tmpurl", a[0]), a[1] && (k = '<a href="' +
- a[1] + '" target="_blank">' + k + "</a>"), t.push(k));
- d.pasteHTML(t.join(" "))
- } else 1 === g.length && (a = g[0], "" !== a && (a = a.split("||"), 0 === b.length && (d.pasteHTML('<img src="' + a[0] + '#xhe_tmpurl" />'), b = e('img[src$="#xhe_tmpurl"]', l)), L(b, "src", a[0]), "" !== k && b.attr("alt", k), "" !== D ? b.attr("align", D) : b.removeAttr("align"), "" !== r ? b.attr("width", r) : b.removeAttr("width"), "" !== h ? b.attr("height", h) : b.removeAttr("height"), "" !== o ? b.attr("border", o) : b.removeAttr("border"), "" !== q ? b.attr("vspace", q) : b.removeAttr("vspace"),
- "" !== n ? b.attr("hspace", n) : b.removeAttr("hspace"), a[1] && (g = b.parent("a"), 0 === g.length && (b.wrap("<a></a>"), g = b.parent("a")), L(g, "href", a[1]), g.attr("target", "_blank"))))
- } else 1 === b.length && b.remove();
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(a)
- };
- this.showEmbed = function (a, b, c, f, g, m, j) {
- var b = e(b), p = d.getParent('embed[type="' + c + '"],embed[classid="' + f + '"]'), w = e("#xhe" + a + "Url", b), s = e("#xhe" + a + "Width", b), r = e("#xhe" + a + "Height", b), a = e("#xheSave", b);
- m && d.uploadInit(w, m, j);
- 1 === p.length && (w.val(L(p,
- "src")), s.val(p.attr("width")), r.val(p.attr("height")));
- a.click(function () {
- d.loadBookmark();
- var a = w.val();
- if ("" !== a && "http://" !== a) {
- var b = s.val(), j = r.val(), m = /^\d+%?$/;
- m.test(b) || (b = 412);
- m.test(j) || (j = 300);
- var h = '<embed type="' + c + '" classid="' + f + '" src="xhe_tmpurl"' + g, m = a.split(" ");
- if (1 < m.length) {
- var o, q = [], h = h + ' width="xhe_width" height="xhe_height" />', n;
- for (n in m)a = m[n].split("||"), o = h, o = o.replace("xhe_tmpurl", a[0]), o = o.replace("xhe_width", a[1] ? a[1] : b), o = o.replace("xhe_height", a[2] ? a[2] : j), "" !==
- a && q.push(o);
- d.pasteHTML(q.join(" "))
- } else 1 === m.length && (a = m[0].split("||"), 0 === p.length && (d.pasteHTML(h.replace("xhe_tmpurl", a[0] + "#xhe_tmpurl") + " />"), p = e('embed[src$="#xhe_tmpurl"]', l)), L(p, "src", a[0]), p.attr("width", a[1] ? a[1] : b), p.attr("height", a[2] ? a[2] : j))
- } else 1 === p.length && p.remove();
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(b)
- };
- this.showEmot = function (a) {
- var b = e('<div class="xheEmot"></div>'), a = a ? a : Ra ? Ra : "default", c = Aa[a], f = Y + a + "/", g = 0, m = [], j = "", j = c.width, p = c.height, w = c.line,
- s = c.count, c = c.list;
- if (s)for (c = 1; c <= s; c++)g++, m.push("<a href=\"javascript:void('" + c + '\')" style="background-image:url(' + f + c + '.gif);" emot="' + a + "," + c + '" xhev="" title="' + c + '" role="option"> </a>'), 0 === g % w && m.push("<br />"); else e.each(c, function (b, c) {
- g++;
- m.push("<a href=\"javascript:void('" + c + '\')" style="background-image:url(' + f + b + '.gif);" emot="' + a + "," + b + '" title="' + c + '" xhev="' + c + '" role="option"> </a>');
- 0 === g % w && m.push("<br />")
- });
- var s = w * (j + 12), c = Math.ceil(g / w) * (p + 12), r = 0.75 * s;
- c <= r &&
- (r = "");
- j = e("<style>" + (r ? ".xheEmot div{width:" + (s + 20) + "px;height:" + r + "px;}" : "") + ".xheEmot div a{width:" + j + "px;height:" + p + "px;}</style><div>" + m.join("") + "</div>").click(function (a) {
- var a = a.target, b = e(a);
- if (e.nodeName(a, "A"))return d.loadBookmark(), d.pasteHTML('<img emot="' + b.attr("emot") + '" alt="' + b.attr("xhev") + '">'), d.hidePanel(), !1
- }).mousedown(N);
- b.append(j);
- var h = 0, k = ['<ul role="tablist">'];
- e.each(Aa, function (b, c) {
- h++;
- k.push("<li" + (a === b ? ' class="cur"' : "") + ' role="presentation"><a href="javascript:void(\'' +
- c.name + '\')" group="' + b + '" role="tab" tabindex="0">' + c.name + "</a></li>")
- });
- 1 < h && (k.push('</ul><br style="clear:both;" />'), j = e(k.join("")).click(function (a) {
- Ra = e(a.target).attr("group");
- d.exec("Emot");
- return !1
- }).mousedown(N), b.append(j));
- d.saveBookmark();
- d.showPanel(b)
- };
- this.showTable = function () {
- var a = e('<div><label for="xheTableRows">Rows: </label><input type="text" id="xheTableRows" style="width:40px;" value="3" /> <label for="xheTableColumns">Cols: </label><input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div><label for="xheTableHeaders">Headers: </label><select id="xheTableHeaders"><option selected="selected" value="">None</option><option value="row">First row</option><option value="col">First column</option><option value="both">Both</option></select></div><div><label for="xheTableWidth">Width: </label><input type="text" id="xheTableWidth" style="width:40px;" value="200" /> <label for="xheTableHeight">Height: </label><input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div><label for="xheTableBorder">Border: </label><input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div><label for="xheTableCellSpacing">CellSpacing:</label><input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> <label for="xheTableCellPadding">CellPadding:</label><input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div><label for="xheTableAlign">Align: </label><select id="xheTableAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="center">Center</option><option value="right">Right</option></select></div><div><label for="xheTableCaption">Caption: </label><input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>'),
- b = e("#xheTableRows", a), c = e("#xheTableColumns", a), f = e("#xheTableHeaders", a), g = e("#xheTableWidth", a), m = e("#xheTableHeight", a), j = e("#xheTableBorder", a), p = e("#xheTableCellSpacing", a), h = e("#xheTableCellPadding", a), s = e("#xheTableAlign", a), r = e("#xheTableCaption", a);
- e("#xheSave", a).click(function () {
- d.loadBookmark();
- var a = r.val(), e = j.val(), l = b.val(), o = c.val(), q = f.val(), n = g.val(), t = m.val(), v = p.val(), z = h.val(), x = s.val(), e = "<table" + ("" !== e ? ' border="' + e + '"' : "") + ("" !== n ? ' width="' + n + '"' : "") + ("" !== t ? ' height="' +
- t + '"' : "") + ("" !== v ? ' cellspacing="' + v + '"' : "") + ("" !== z ? ' cellpadding="' + z + '"' : "") + ("" !== x ? ' align="' + x + '"' : "") + ">";
- "" !== a && (e += "<caption>" + a + "</caption>");
- if ("row" === q || "both" === q) {
- e += "<tr>";
- for (a = 0; a < o; a++)e += '<th scope="col"></th>';
- e += "</tr>";
- l--
- }
- e += "<tbody>";
- for (a = 0; a < l; a++) {
- e += "<tr>";
- for (n = 0; n < o; n++)e = 0 === n && ("col" === q || "both" === q) ? e + '<th scope="row"></th>' : e + "<td></td>";
- e += "</tr>"
- }
- d.pasteHTML(e + "</tbody></table>");
- d.hidePanel();
- return !1
- });
- d.saveBookmark();
- d.showDialog(a)
- };
- this.showAbout = function () {
- var a =
- e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;outline:none;" role="dialog" tabindex="-1"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.14 (build 120701)</p><p>xhEditor is a platform independent WYSWYG XHTML editor based by jQuery,released as Open Source under <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>.</p><p>Copyright © <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
- a.find("p").attr("role", "presentation");
- d.showDialog(a, !0);
- setTimeout(function () {
- a.focus()
- }, 100)
- };
- this.addShortcuts = function (a, b) {
- a = a.toLowerCase();
- ma[a] === $ && (ma[a] = []);
- ma[a].push(b)
- };
- this.delShortcuts = function (a) {
- delete ma[a]
- };
- this.uploadInit = function (a, b, c) {
- function f(b) {
- M(b, "string") && (b = [b]);
- var c = !1, d, e = b.length, f, i = [];
- (d = g.onUpload) && d(b);
- for (d = 0; d < e; d++)f = b[d], f = M(f, "string") ? f : f.url, "!" === f.substr(0, 1) && (c = !0, f = f.substr(1)), i.push(f);
- a.val(i.join(" "));
- c && a.closest(".xheDialog").find("#xheSave").click()
- }
- var i = e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="' + g.upBtnText + '" class="xheBtn" tabindex="-1" /></span>'), m = e(".xheBtn", i), j = g.html5Upload, p = j ? g.upMultiple : 1;
- a.after(i);
- m.before(a);
- b = b.replace(/{editorRoot}/ig, A);
- if ("!" === b.substr(0, 1))m.click(function () {
- d.showIframeModal("Upload file", b.substr(1), f, null, null)
- }); else {
- i.append('<input type="file"' + (1 < p ? ' multiple=""' : "") + ' class="xheFile" size="13" name="filedata" tabindex="-1" />');
- var h = e(".xheFile", i);
- h.change(function () {
- d.startUpload(h[0], b, c, f)
- });
- setTimeout(function () {
- a.closest(".xheDialog").bind("dragenter dragover", N).bind("drop", function (a) {
- var a = a.originalEvent.dataTransfer, e;
- j && a && (e = a.files) && 0 < e.length && d.startUpload(e, b, c, f);
- return !1
- })
- }, 10)
- }
- };
- this.startUpload = function (a, b, c, f) {
- function i(a, c) {
- var e = Object, g = !1;
- try {
- e = eval("(" + a + ")")
- } catch (i) {
- }
- e.err === $ || e.msg === $ ? alert(b + " upload interface error!\r\n\r\nreturn error:\r\n\r\n" + a) : e.err ? alert(e.err) : (m.push(e.msg),
- g = !0);
- (!g || c) && d.removeModal();
- c && g && f(m);
- return g
- }
- var m = [], j = g.html5Upload, p = j ? g.upMultiple : 1, h, s = e('<div style="padding:22px 0;text-align:center;line-height:30px;">File uploading,please wait...<br /></div>'), r = '<img src="' + ua + 'img/loading.gif">';
- if (Ca || !j || a.nodeType && (!(h = a.files) || !h[0].name)) {
- if (!Wa(a.value, c))return;
- s.append(r);
- c = new d.html4Upload(a, b, i)
- } else {
- h || (h = a);
- a = h.length;
- if (a > p) {
- alert("Please do not upload more then " + p + " files.");
- return
- }
- for (p = 0; p < a; p++)if (!Wa(h[p].name, c))return;
- var l =
- e('<div class="xheProgress"><div><span>0%</span></div></div>');
- s.append(l);
- c = new d.html5Upload("filedata", h, b, i, function (a) {
- if (0 <= a.loaded) {
- var b = Math.round(100 * a.loaded / a.total) + "%";
- e("div", l).css("width", b);
- e("span", l).text(b + " ( " + Xa(a.loaded) + " / " + Xa(a.total) + " )")
- } else l.replaceWith(r)
- })
- }
- d.showModal("File uploading(Esc cancel)", s, 320, 150);
- c.start()
- };
- this.html4Upload = function (a, b, c) {
- var d = "jUploadFrame" + (new Date).getTime(), g = this, h = e('<iframe name="' + d + '" class="xheHideArea" />').appendTo("body"),
- j = e('<form action="' + b + '" target="' + d + '" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"), p = e(a), l = p.clone().attr("disabled", "true");
- p.before(l).appendTo(j);
- this.remove = function () {
- null !== g && (l.before(p).remove(), h.remove(), j.remove(), g = null)
- };
- this.onLoad = function () {
- var a = h[0].contentWindow.document, b = e(a.body).text();
- a.write("");
- g.remove();
- c(b, !0)
- };
- this.start = function () {
- j.submit();
- h.load(g.onLoad)
- };
- return this
- };
- this.html5Upload = function (a, b, c, d, e) {
- function g(b,
- c, d, e) {
- h = new XMLHttpRequest;
- upload = h.upload;
- h.onreadystatechange = function () {
- 4 === h.readyState && d(h.responseText)
- };
- upload ? upload.onprogress = function (a) {
- e(a.loaded)
- } : e(-1);
- h.open("POST", c);
- h.setRequestHeader("Content-Type", "application/octet-stream");
- h.setRequestHeader("Content-Disposition", 'attachment; name="' + encodeURIComponent(a) + '"; filename="' + encodeURIComponent(b.name) + '"');
- h.sendAsBinary && b.getAsBinary ? h.sendAsBinary(b.getAsBinary()) : h.send(b)
- }
- function j(a) {
- e && e({loaded: r + a, total: o})
- }
- for (var h,
- l = 0, s = b.length, r = 0, o = 0, k = this, n = 0; n < s; n++)o += b[n].size;
- this.remove = function () {
- h && (h.abort(), h = null)
- };
- this.uploadNext = function (a) {
- a && (r += b[l - 1].size, j(0));
- (!a || a && !0 === d(a, l === s)) && l < s && g(b[l++], c, k.uploadNext, function (a) {
- j(a)
- })
- };
- this.start = function () {
- k.uploadNext()
- }
- };
- this.showIframeModal = function (a, b, c, f, g, h) {
- function j() {
- try {
- r.callback = l, r.unloadme = d.removeModal, e(r.document).keydown(I), n = r.name
- } catch (a) {
- }
- }
- function l(a) {
- r.document.write("");
- d.removeModal();
- null != a && c(a)
- }
- var b = e('<iframe frameborder="0" src="' +
- b.replace(/{editorRoot}/ig, A) + (/\?/.test(b) ? "&" : "?") + "parenthost=" + location.host + '" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>'), o = b.eq(0), s = b.eq(1);
- d.showModal(a, b, f, g, h);
- var r = o[0].contentWindow, n;
- j();
- o.load(function () {
- j();
- if (n) {
- var a = !0;
- try {
- n = eval("(" + unescape(n) + ")")
- } catch (b) {
- a = !1
- }
- if (a)return l(n)
- }
- s.is(":visible") && (o.show().focus(), s.remove())
- })
- };
- this.showModal = function (a, b, c, f, i) {
- if (ta)return !1;
- d.panelState = S;
- S = !1;
- ea = g.layerShadow;
- c = c ? c : g.modalWidth;
- f =
- f ? f : g.modalHeight;
- K = e('<div class="xheModal" style="width:' + (c - 1) + "px;height:" + f + "px;margin-left:-" + Math.ceil(c / 2) + "px;" + (h && 7 > pa ? "" : "margin-top:-" + Math.ceil(f / 2) + "px") + '">' + (g.modalTitle ? '<div class="xheModalTitle"><span class="xheModalClose" title="Close (Esc)" tabindex="0" role="button"></span>' + a + "</div>" : "") + '<div class="xheModalContent"></div></div>').appendTo("body");
- Fa = e('<div class="xheModalOverlay"></div>').appendTo("body");
- 0 < ea && (Ea = e('<div class="xheModalShadow" style="width:' + K.outerWidth() +
- "px;height:" + K.outerHeight() + "px;margin-left:-" + (Math.ceil(c / 2) - ea - 2) + "px;" + (h && 7 > pa ? "" : "margin-top:-" + (Math.ceil(f / 2) - ea - 2) + "px") + '"></div>').appendTo("body"));
- e(".xheModalContent", K).css("height", f - (g.modalTitle ? e(".xheModalTitle").outerHeight() : 0)).html(b);
- h && 6 === pa && (Ga = e("select:visible").css("visibility", "hidden"));
- e(".xheModalClose", K).click(d.removeModal);
- Fa.show();
- 0 < ea && Ea.show();
- K.show();
- setTimeout(function () {
- K.find("a,input[type=text],textarea").filter(":visible").filter(function () {
- return "hidden" !==
- e(this).css("visibility")
- }).eq(0).focus()
- }, 10);
- ta = !0;
- Ha = i
- };
- this.removeModal = function () {
- Ga && Ga.css("visibility", "visible");
- K.html("").remove();
- 0 < ea && Ea.remove();
- Fa.remove();
- Ha && Ha();
- ta = !1;
- S = d.panelState
- };
- this.showDialog = function (a, b) {
- var c = e('<div class="xheDialog"></div>'), f = e(a), i = e("#xheSave", f);
- if (1 === i.length) {
- f.find("input[type=text],select").keypress(function (a) {
- if (13 === a.which)return i.click(), !1
- });
- f.find("textarea").keydown(function (a) {
- if (a.ctrlKey && 13 === a.which)return i.click(), !1
- });
- i.after(' <input type="button" id="xheCancel" value="Cancel" />');
- e("#xheCancel", f).click(d.hidePanel);
- if (!g.clickCancelDialog) {
- sa = !1;
- var h = e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(N), j = B.offset();
- h.css({left: j.left, top: j.top, width: B.outerWidth(), height: B.outerHeight()})
- }
- c.mousedown(function () {
- oa = !0
- })
- }
- c.append(f);
- d.showPanel(c, b)
- };
- this.showPanel = function (a, b) {
- if (!v.target)return !1;
- t.html("").append(a).css("left", -999).css("top", -999);
- da = e(v.target).closest("a").addClass("xheActive");
- var c = da.offset(), d = c.left, c = c.top, c = c + (da.outerHeight() -
- 1);
- ca.css({left: d + 1, top: c, width: da.width()}).show();
- var i = document.documentElement, h = document.body;
- if (d + t.outerWidth() > (window.pageXOffset || i.scrollLeft || h.scrollLeft) + (i.clientWidth || h.clientWidth))d -= t.outerWidth() - da.outerWidth();
- i = g.layerShadow;
- 0 < i && ba.css({left: d + i, top: c + i, width: t.outerWidth(), height: t.outerHeight()}).show();
- if ((i = e("#" + ja).offsetParent().css("zIndex")) && !isNaN(i))ba.css("zIndex", parseInt(i, 10) + 1), t.css("zIndex", parseInt(i, 10) + 2), ca.css("zIndex", parseInt(i, 10) + 3);
- t.css({
- left: d,
- top: c
- }).show();
- b || setTimeout(function () {
- t.find("a,input[type=text],textarea").filter(":visible").filter(function () {
- return "hidden" !== e(this).css("visibility")
- }).eq(0).focus()
- }, 10);
- Qa = S = !0
- };
- this.hidePanel = function () {
- S && (da.removeClass("xheActive"), ba.hide(), ca.hide(), t.hide(), S = !1, sa || (e(".xheFixCancel").remove(), sa = !0), Qa = oa = !1, X = null, d.focus(), d.loadBookmark())
- };
- this.exec = function (a) {
- d.hidePanel();
- var b = ka[a];
- if (!b)return !1;
- if (null === v) {
- v = {};
- var c = n.find(".xheButton[cmd=" + a + "]");
- if (1 === c.length)v.target =
- c
- }
- if (b.e)b.e.call(d); else switch (a = a.toLowerCase(), a) {
- case "cut":
- try {
- if (l.execCommand(a), !l.queryCommandSupported(a))throw"Error";
- } catch (f) {
- alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+X) instead.")
- }
- break;
- case "copy":
- try {
- if (l.execCommand(a), !l.queryCommandSupported(a))throw"Error";
- } catch (i) {
- alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+C) instead.")
- }
- break;
- case "paste":
- try {
- if (l.execCommand(a), !l.queryCommandSupported(a))throw"Error";
- } catch (m) {
- alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+V) instead.")
- }
- break;
- case "pastetext":
- window.clipboardData ? d.pasteText(window.clipboardData.getData("Text", !0)) : d.showPastetext();
- break;
- case "blocktag":
- var j = [];
- e.each(gb, function (a, b) {
- j.push({s: "<" + b.n + ">" + b.t + "</" + b.n + ">", v: "<" + b.n + ">", t: b.t})
- });
- d.showMenu(j, function (a) {
- d._exec("formatblock", a)
- });
- break;
- case "fontface":
- var o = [];
- e.each(hb, function (a, b) {
- b.c = b.c ? b.c : b.n;
- o.push({s: '<span style="font-family:' + b.c + '">' + b.n + "</span>", v: b.c, t: b.n})
- });
- d.showMenu(o, function (a) {
- d._exec("fontname", a)
- });
- break;
- case "fontsize":
- var q =
- [];
- e.each(T, function (a, b) {
- q.push({s: '<span style="font-size:' + b.s + ';">' + b.t + "(" + b.s + ")</span>", v: a + 1, t: b.t})
- });
- d.showMenu(q, function (a) {
- d._exec("fontsize", a)
- });
- break;
- case "fontcolor":
- d.showColor(function (a) {
- d._exec("forecolor", a)
- });
- break;
- case "backcolor":
- d.showColor(function (a) {
- h ? d._exec("backcolor", a) : (Ka(!0), d._exec("hilitecolor", a), Ka(!1))
- });
- break;
- case "align":
- d.showMenu(ib, function (a) {
- d._exec(a)
- });
- break;
- case "list":
- d.showMenu(jb, function (a) {
- d._exec(a)
- });
- break;
- case "link":
- d.showLink();
- break;
- case "anchor":
- d.showAnchor();
- break;
- case "img":
- d.showImg();
- break;
- case "flash":
- d.showEmbed("Flash", '<div><label for="xheFlashUrl">Flash URL:</label><input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div><label for="xheFlashWidth">Width: </label><input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> <label for="xheFlashHeight">Height: </label><input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>',
- "application/x-shockwave-flash", "clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000", ' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"', g.upFlashUrl, g.upFlashExt);
- break;
- case "media":
- d.showEmbed("Media", '<div><label for="xheMediaUrl">Media URL:</label><input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div><label for="xheMediaWidth">Width: </label><input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> <label for="xheMediaHeight">Height: </label><input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="Ok" /></div>',
- "application/x-mplayer2", "clsid:6bf52a52-394a-11d3-b153-00c04f79faa6", ' enablecontextmenu="false" autostart="false"', g.upMediaUrl, g.upMediaExt);
- break;
- case "hr":
- d.pasteHTML("<hr />");
- break;
- case "emot":
- d.showEmot();
- break;
- case "table":
- d.showTable();
- break;
- case "source":
- d.toggleSource();
- break;
- case "preview":
- d.showPreview();
- break;
- case "print":
- W.print();
- break;
- case "fullscreen":
- d.toggleFullscreen();
- break;
- case "about":
- d.showAbout();
- break;
- default:
- d._exec(a)
- }
- v = null
- };
- this._exec = function (a, b, c) {
- c || d.focus();
- return b !==
- $ ? l.execCommand(a, !1, b) : l.execCommand(a, !1, null)
- }
- };
- ra.settings = {
- skin: "default",
- tools: "full",
- clickCancelDialog: !0,
- linkTag: !1,
- internalScript: !1,
- inlineScript: !1,
- internalStyle: !0,
- inlineStyle: !0,
- showBlocktag: !1,
- forcePtag: !0,
- upLinkExt: "zip,rar,txt",
- upImgExt: "jpg,jpeg,gif,png",
- upFlashExt: "swf",
- upMediaExt: "wmv,avi,wma,mp3,mid",
- modalWidth: 350,
- modalHeight: 220,
- modalTitle: !0,
- defLinkText: "Click here",
- layerShadow: 3,
- emotMark: !1,
- upBtnText: "Upload",
- cleanPaste: 1,
- hoverExecDelay: 100,
- html5Upload: !0,
- upMultiple: 99
- };
- window.xheditor =
- ra;
- e(function () {
- e.fn.oldVal = e.fn.val;
- e.fn.val = function (e) {
- var h = this, q;
- return e === $ ? h[0] && (q = h[0].xheditor) ? q.getSource() : h.oldVal() : h.each(function () {
- (q = this.xheditor) ? q.setSource(e) : h.oldVal(e)
- })
- };
- e("textarea").each(function () {
- var h = e(this), o = h.attr("class");
- if (o && (o = o.match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i)))h.xheditor(o[1] ? {tools: o[1]} : null)
- })
- })
- })(jQuery);
|