/* CLEditor WYSIWYG HTML Editor v1.3.0 http://premiumsoftware.net/cleditor requires jQuery v1.4.2 or later Copyright 2010, Chris Landowski, Premium Software, LLC Dual licensed under the MIT or GPL Version 2 licenses. */ (function (e) { function aa(a) { var b = this, c = a.target, d = e.data(c, x), h = s[d], f = h.popupName, i = p[f]; if (!(b.disabled || e(c).attr(n) == n)) { var g = { editor: b, button: c, buttonName: d, popup: i, popupName: f, command: h.command, useCSS: b.options.useCSS }; if (h.buttonClick && h.buttonClick(a, g) === false) return false; if (d == "source") { if (t(b)) { delete b.range; b.$area.hide(); b.$frame.show(); c.title = h.title } else { b.$frame.hide(); b.$area.show(); c.title = "Show Rich Text" } setTimeout(function () { u(b) }, 100) } else if (!t(b)) if (f) { var j = e(i); if (f == "url") { if (d == "link" && M(b) === "") { z(b, "A selection is required when inserting a link.", c); return false } j.children(":button").unbind(q).bind(q, function () { var k = j.find(":text"), o = e.trim(k.val()); o !== "" && v(b, g.command, o, null, g.button); k.val("http://"); r(); w(b) }) } else f == "pastetext" && j.children(":button").unbind(q).bind(q, function () { var k = j.find("textarea"), o = k.val().replace(/\n/g, "
"); o !== "" && v(b, g.command, o, null, g.button); k.val(""); r(); w(b) }); if (c !== e.data(i, A)) { N(b, i, c); return false } return } else if (d == "print") b.$frame[0].contentWindow.print(); else if (!v(b, g.command, g.value, g.useCSS, c)) return false; w(b) } } function O(a) { a = e(a.target).closest("div"); a.css(H, a.data(x) ? "#FFF" : "#FFC") } function P(a) { e(a.target).closest("div").css(H, "transparent") } function ba(a) { var b = a.data.popup, c = a.target; if (!(b === p.msg || e(b).hasClass(B))) { var d = e.data(b, A), h = e.data(d, x), f = s[h], i = f.command, g, j = this.options.useCSS; if (h == "font") g = c.style.fontFamily.replace(/"/g, ""); else if (h == "size") { if (c.tagName == "DIV") c = c.children[0]; g = c.innerHTML } else if (h == "style") g = "<" + c.tagName + ">"; else if (h == "color") g = Q(c.style.backgroundColor); else if (h == "highlight") { g = Q(c.style.backgroundColor); if (l) i = "backcolor"; else j = true } b = { editor: this, button: d, buttonName: h, popup: b, popupName: f.popupName, command: i, value: g, useCSS: j }; if (!(f.popupClick && f.popupClick(a, b) === false)) { if (b.command && !v(this, b.command, b.value, b.useCSS, d)) return false; r(); w(this) } } } function C(a) { for (var b = 1, c = 0, d = 0; d < a.length; ++d) { b = (b + a.charCodeAt(d)) % 65521; c = (c + b) % 65521 } return c << 16 | b } function R(a, b, c, d, h) { if (p[a]) return p[a]; var f = e(m).hide().addClass(ca).appendTo("body"); if (d) f.html(d); else if (a == "color") { b = b.colors.split(" "); b.length < 10 && f.width("auto"); e.each(b, function (i, g) { e(m).appendTo(f).css(H, "#" + g) }); c = da } else if (a == "font") e.each(b.fonts.split(","), function (i, g) { e(m).appendTo(f).css("fontFamily", g).html(g) }); else if (a == "size") e.each(b.sizes.split(","), function (i, g) { e(m).appendTo(f).html("" + g + "") }); else if (a == "style") e.each(b.styles, function (i, g) { e(m).appendTo(f).html(g[1] + g[0] + g[1].replace("<", "
'); c = B } else if (a == "pastetext") { f.html("Paste your content here and click submit.

"); c = B } if (!c && !d) c = S; f.addClass(c); l && f.attr(I, "on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(I, "on"); if (f.hasClass(S) || h === true) f.children().hover(O, P); p[a] = f[0]; return f[0] } function T(a, b) { if (b) { a.$area.attr(n, n); a.disabled = true } else { a.$area.removeAttr(n); delete a.disabled } try { if (l) a.doc.body.contentEditable = !b; else a.doc.designMode = !b ? "on" : "off" } catch (c) {} u(a) } function v(a, b, c, d, h) { D(a); if (!l) { if (d === undefined || d === null) d = a.options.useCSS; a.doc.execCommand("styleWithCSS", 0, d.toString()) } d = true; var f; if (l && b.toLowerCase() == "inserthtml") y(a).pasteHTML(c); else { try { d = a.doc.execCommand(b, 0, c || null) } catch (i) { f = i.description; d = false } d || ("cutcopypaste".indexOf(b) > -1 ? z(a, "For security reasons, your browser does not support the " + b + " command. Try using the keyboard shortcut or context menu instead.", h) : z(a, f ? f : "Error executing the " + b + " command.", h)) } u(a); return d } function w(a) { setTimeout(function () { t(a) ? a.$area.focus() : a.$frame[0].contentWindow.focus(); u(a) }, 0) } function y(a) { if (l) return J(a).createRange(); return J(a).getRangeAt(0) } function J(a) { if (l) return a.doc.selection; return a.$frame[0].contentWindow.getSelection() } function Q(a) { var b = /rgba?\((\d+), (\d+), (\d+)/.exec(a), c = a.split(""); if (b) for (a = (b[1] << 16 | b[2] << 8 | b[3]).toString(16); a.length < 6;) a = "0" + a; return "#" + (a.length == 6 ? a : c[1] + c[1] + c[2] + c[2] + c[3] + c[3]) } function r() { e.each(p, function (a, b) { e(b).hide().unbind(q).removeData(A) }) } function U() { var a = e("link[href$='jquery.cleditor.css']").attr("href"); return a.substr(0, a.length - 19) + "images/" } function K(a) { var b = a.$main, c = a.options; a.$frame && a.$frame.remove(); var d = a.$frame = e('