Vous êtes sur la page 1sur 330

?

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function () {
if (window.CKEDITOR && window.CKEDITOR.dom) return;
if (!window.CKEDITOR) window.CKEDITOR = (function () {
var e = {
timestamp: 'B8DJ5M3',
version: '3.6.2',
revision: '7275',
_: {},
status: 'unloaded',
basePath: (function () {
var h = window.CKEDITOR_BASEPATH || '';
if (!h) {
var i = document.getElementsByTagName('script');
for (var j = 0; j < i.length; j++) {
var k = i[j].src.match(/(^|.*[\\\/])ckeditor(?:_basi
c)?(?:_source)?.js(?:\?.*)?$/i);
if (k) {
h = k[1];
break;
}
}
}
if (h.indexOf(':/') == -1)
if (h.indexOf('/') === 0) h = location.href.match(/^.*?:
\/\/[^\/]*/)[0] + h;
else h = location.href.match(/^[^\?]*\/(?:)/)[0] + h;
if (!h) throw 'The CKEditor installation path could not be a
utomatically detected. Please set the global variable "CKEDITOR_BASEPATH" before
creating editor instances.';
return h;
})(),
getUrl: function (h) {
if (h.indexOf(':/') == -1 && h.indexOf('/') !== 0) h = this.
basePath + h;
if (this.timestamp && h.charAt(h.length - 1) != '/' && !/[&?
]t=/.test(h)) h += (h.indexOf('?') >= 0 ? '&' : '?') + 't=' + this.timestamp;
return h;
}
},
f = window.CKEDITOR_GETURL;
if (f) {
var g = e.getUrl;
e.getUrl = function (h) {
return f.call(e, h) || g.call(e, h);
};
}
return e;
})();
var e = CKEDITOR;
if (!e.event) {
e.event = function () {};
e.event.implementOn = function (f) {
var g = e.event.prototype;
for (var h in g) {
if (f[h] == undefined) f[h] = g[h];
}
};
e.event.prototype = (function () {
var f = function (h) {
var i = h.getPrivate && h.getPrivate() || h._ || (h._ = {});
return i.events || (i.events = {});
},
g = function (h) {
this.name = h;
this.listeners = [];
};
g.prototype = {
getListenerIndex: function (h) {
for (var i = 0, j = this.listeners; i < j.length; i++) {
if (j[i].fn == h) return i;
}
return -1;
}
};
return {
on: function (h, i, j, k, l) {
var m = f(this),
n = m[h] || (m[h] = new g(h));
if (n.getListenerIndex(i) < 0) {
var o = n.listeners;
if (!j) j = this;
if (isNaN(l)) l = 10;
var p = this,
q = function (s, t, u, v) {
var w = {
name: h,
sender: this,
editor: s,
data: t,
listenerData: k,
stop: u,
cancel: v,
removeListener: function () {
p.removeListener(h, i);
}
};
i.call(j, w);
return w.data;
};
q.fn = i;
q.priority = l;
for (var r = o.length - 1; r >= 0; r--) {
if (o[r].priority <= l) {
o.splice(r + 1, 0, q);
return;
}
}
o.unshift(q);
}
},
fire: (function () {
var h = false,
i = function () {
h = true;
},
j = false,
k = function () {
j = true;
};
return function (l, m, n) {
var o = f(this)[l],
p = h,
q = j;
h = j = false;
if (o) {
var r = o.listeners;
if (r.length) {
r = r.slice(0);
for (var s = 0; s < r.length; s++) {
var t = r[s].call(this, n, m, i, k);
if (typeof t != 'undefined') m = t;
if (h || j) break;
}
}
}
var u = j || (typeof m == 'undefined' ? false : m);
h = p;
j = q;
return u;
};
})(),
fireOnce: function (h, i, j) {
var k = this.fire(h, i, j);
delete f(this)[h];
return k;
},
removeListener: function (h, i) {
var j = f(this)[h];
if (j) {
var k = j.getListenerIndex(i);
if (k >= 0) j.listeners.splice(k, 1);
}
},
hasListeners: function (h) {
var i = f(this)[h];
return i && i.listeners.length > 0;
}
};
})();
}
if (!e.editor) {
e.ELEMENT_MODE_NONE = 0;
e.ELEMENT_MODE_REPLACE = 1;
e.ELEMENT_MODE_APPENDTO = 2;
e.editor = function (f, g, h, i) {
var j = this;
j._ = {
instanceConfig: f,
element: g,
data: i
};
j.elementMode = h || 0;
e.event.call(j);
j._init();
};
e.editor.replace = function (f, g) {
var h = f;
if (typeof h != 'object') {
h = document.getElementById(f);
if (h && h.tagName.toLowerCase() in {
style: 1,
script: 1,
base: 1,
link: 1,
meta: 1,
title: 1
}) h = null;
if (!h) {
var i = 0,
j = document.getElementsByName(f);
while ((h = j[i++]) && h.tagName.toLowerCase() != 'textarea'
) {}
}
if (!h) throw '[CKEDITOR.editor.replace] The element with id or
name "' + f + '" was not found.';
}
h.style.visibility = 'hidden';
return new e.editor(g, h, 1);
};
e.editor.appendTo = function (f, g, h) {
var i = f;
if (typeof i != 'object') {
i = document.getElementById(f);
if (!i) throw '[CKEDITOR.editor.appendTo] The element with id "'
+ f + '" was not found.';
}
return new e.editor(g, i, 2, h);
};
e.editor.prototype = {
_init: function () {
var f = e.editor._pending || (e.editor._pending = []);
f.push(this);
},
fire: function (f, g) {
return e.event.prototype.fire.call(this, f, g, this);
},
fireOnce: function (f, g) {
return e.event.prototype.fireOnce.call(this, f, g, this);
}
};
e.event.implementOn(e.editor.prototype, true);
}
if (!e.env) e.env = (function () {
var f = navigator.userAgent.toLowerCase(),
g = window.opera,
h = {
ie: /*@cc_on!@*/ false,
opera: !!g && g.version,
webkit: f.indexOf(' applewebkit/') > -1,
air: f.indexOf(' adobeair/') > -1,
mac: f.indexOf('macintosh') > -1,
quirks: document.compatMode == 'BackCompat',
mobile: f.indexOf('mobile') > -1,
iOS: /(ipad|iphone|ipod)/.test(f),
isCustomDomain: function () {
if (!this.ie) return false;
var k = document.domain,
l = window.location.hostname;
return k != l && k != '[' + l + ']';
},
secure: location.protocol == 'https:'
};
h.gecko = navigator.product == 'Gecko' && !h.webkit && !h.opera;
var i = 0;
if (h.ie) {
i = parseFloat(f.match(/msie (\d+)/)[1]);
h.ie8 = !!document.documentMode;
h.ie8Compat = document.documentMode == 8;
h.ie9Compat = document.documentMode == 9;
h.ie7Compat = i == 7 && !document.documentMode || document.documentM
ode == 7;
h.ie6Compat = i < 7 || h.quirks;
}
if (h.gecko) {
var j = f.match(/rv:([\d\.]+)/);
if (j) {
j = j[1].split('.');
i = j[0] * 10000 + (j[1] || 0) * 100 + parseInt(j[2] || 0, 10);
}
}
if (h.opera) i = parseFloat(g.version());
if (h.air) i = parseFloat(f.match(/ adobeair\/(\d+)/)[1]);
if (h.webkit) i = parseFloat(f.match(/ applewebkit\/(\d+)/)[1]);
h.version = i;
h.isCompatible = h.iOS && i >= 534 || !h.mobile && (h.ie && i >= 6 || h.
gecko && i >= 10801 || h.opera && i >= 9.5 || h.air && i >= 1 || h.webkit && i >
= 522 || false);
h.cssClass = 'cke_browser_' + (h.ie ? 'ie' : h.gecko ? 'gecko' : h.opera
? 'opera' : h.webkit ? 'webkit' : 'unknown');
if (h.quirks) h.cssClass += ' cke_browser_quirks';
if (h.ie) {
h.cssClass += ' cke_browser_ie' + (h.version < 7 ? '6' : h.version >
= 8 ? document.documentMode : '7');
if (h.quirks) h.cssClass += ' cke_browser_iequirks';
}
if (h.gecko && i < 10900) h.cssClass += ' cke_browser_gecko18';
if (h.air) h.cssClass += ' cke_browser_air';
return h;
})();
var f = e.env;
var g = f.ie;
if (e.status == 'unloaded')(function () {
e.event.implementOn(e);
e.loadFullCore = function () {
if (e.status != 'basic_ready') {
e.loadFullCore._load = 1;
return;
}
delete e.loadFullCore;
var i = document.createElement('script');
i.type = 'text/javascript';
i.src = e.basePath + 'ckeditor.js';
document.getElementsByTagName('head')[0].appendChild(i);
};
e.loadFullCoreTimeout = 0;
e.replaceClass = 'ckeditor';
e.replaceByClassEnabled = 1;
var h = function (i, j, k, l) {
if (f.isCompatible) {
if (e.loadFullCore) e.loadFullCore();
var m = k(i, j, l);
e.add(m);
return m;
}
return null;
};
e.replace = function (i, j) {
return h(i, j, e.editor.replace);
};
e.appendTo = function (i, j, k) {
return h(i, j, e.editor.appendTo, k);
};
e.add = function (i) {
var j = this._.pending || (this._.pending = []);
j.push(i);
};
e.replaceAll = function () {
var i = document.getElementsByTagName('textarea');
for (var j = 0; j < i.length; j++) {
var k = null,
l = i[j];
if (!l.name && !l.id) continue;
if (typeof arguments[0] == 'string') {
var m = new RegExp('(?:^|\\s)' + arguments[0] + '(?:$|\\s)')
;
if (!m.test(l.className)) continue;
} else if (typeof arguments[0] == 'function') {
k = {};
if (arguments[0](l, k) === false) continue;
}
this.replace(l, k);
}
};
(function () {
var i = function () {
var j = e.loadFullCore,
k = e.loadFullCoreTimeout;
if (e.replaceByClassEnabled) e.replaceAll(e.replaceClass);
e.status = 'basic_ready';
if (j && j._load) j();
else if (k) setTimeout(function () {
if (e.loadFullCore) e.loadFullCore();
}, k * 1000);
};
if (window.addEventListener) window.addEventListener('load', i, fals
e);
else if (window.attachEvent) window.attachEvent('onload', i);
})();
e.status = 'basic_loaded';
})();
e.dom = {};
var h = e.dom;
(function () {
var i = [];
e.on('reset', function () {
i = [];
});
e.tools = {
arrayCompare: function (j, k) {
if (!j && !k) return true;
if (!j || !k || j.length != k.length) return false;
for (var l = 0; l < j.length; l++) {
if (j[l] != k[l]) return false;
}
return true;
},
clone: function (j) {
var k;
if (j && j instanceof Array) {
k = [];
for (var l = 0; l < j.length; l++) k[l] = this.clone(j[l]);
return k;
}
if (j === null || typeof j != 'object' || j instanceof String ||
j instanceof Number || j instanceof Boolean || j instanceof Date || j instanceo
f RegExp) return j;
k = new j.constructor();
for (var m in j) {
var n = j[m];
k[m] = this.clone(n);
}
return k;
},
capitalize: function (j) {
return j.charAt(0).toUpperCase() + j.substring(1).toLowerCase();
},
extend: function (j) {
var k = arguments.length,
l, m;
if (typeof (l = arguments[k - 1]) == 'boolean') k--;
else if (typeof (l = arguments[k - 2]) == 'boolean') {
m = arguments[k - 1];
k -= 2;
}
for (var n = 1; n < k; n++) {
var o = arguments[n];
for (var p in o) {
if (l === true || j[p] == undefined)
if (!m || p in m) j[p] = o[p];
}
}
return j;
},
prototypedCopy: function (j) {
var k = function () {};
k.prototype = j;
return new k();
},
isArray: function (j) {
return !!j && j instanceof Array;
},
isEmpty: function (j) {
for (var k in j) {
if (j.hasOwnProperty(k)) return false;
}
return true;
},
cssStyleToDomStyle: (function () {
var j = document.createElement('div').style,
k = typeof j.cssFloat != 'undefined' ? 'cssFloat' : typeof j
.styleFloat != 'undefined' ? 'styleFloat' : 'float';
return function (l) {
if (l == 'float') return k;
else return l.replace(/-./g, function (m) {
return m.substr(1).toUpperCase();
});
};
})(),
buildStyleHtml: function (j) {
j = [].concat(j);
var k, l = [];
for (var m = 0; m < j.length; m++) {
k = j[m];
if (/@import|[{}]/.test(k)) l.push('<style>' + k + '</style>
');
else l.push('<link type="text/css" rel=stylesheet href="' +
k + '">');
}
return l.join('');
},
htmlEncode: function (j) {
var k = function (o) {
var p = new h.element('span');
p.setText(o);
return p.getHtml();
},
l = k('\n').toLowerCase() == '<br>' ? function (o) {
return k(o).replace(/<br>/gi, '\n');
} : k,
m = k('>') == '>' ? function (o) {
return l(o).replace(/>/g, '&gt;');
} : l,
n = k(' ') == '&nbsp; ' ? function (o) {
return m(o).replace(/&nbsp;/g, ' ');
} : m;
this.htmlEncode = n;
return this.htmlEncode(j);
},
htmlEncodeAttr: function (j) {
return j.replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/
>/g, '&gt;');
},
getNextNumber: (function () {
var j = 0;
return function () {
return ++j;
};
})(),
getNextId: function () {
return 'cke_' + this.getNextNumber();
},
override: function (j, k) {
return k(j);
},
setTimeout: function (j, k, l, m, n) {
if (!n) n = window;
if (!l) l = n;
return n.setTimeout(function () {
if (m) j.apply(l, [].concat(m));
else j.apply(l);
}, k || 0);
},
trim: (function () {
var j = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;
return function (k) {
return k.replace(j, '');
};
})(),
ltrim: (function () {
var j = /^[ \t\n\r]+/g;
return function (k) {
return k.replace(j, '');
};
})(),
rtrim: (function () {
var j = /[ \t\n\r]+$/g;
return function (k) {
return k.replace(j, '');
};
})(),
indexOf: Array.prototype.indexOf ? function (j, k) {
return j.indexOf(k);
} : function (j, k) {
for (var l = 0, m = j.length; l < m; l++) {
if (j[l] === k) return l;
}
return -1;
},
bind: function (j, k) {
return function () {
return j.apply(k, arguments);
};
},
createClass: function (j) {
var k = j.$,
l = j.base,
m = j.privates || j._,
n = j.proto,
o = j.statics;
if (m) {
var p = k;
k = function () {
var t = this;
var q = t._ || (t._ = {});
for (var r in m) {
var s = m[r];
q[r] = typeof s == 'function' ? e.tools.bind(s, t) :
s;
}
p.apply(t, arguments);
};
}
if (l) {
k.prototype = this.prototypedCopy(l.prototype);
k.prototype['constructor'] = k;
k.prototype.base = function () {
this.base = l.prototype.base;
l.apply(this, arguments);
this.base = arguments.callee;
};
}
if (n) this.extend(k.prototype, n, true);
if (o) this.extend(k, o, true);
return k;
},
addFunction: function (j, k) {
return i.push(function () {
return j.apply(k || this, arguments);
}) - 1;
},
removeFunction: function (j) {
i[j] = null;
},
callFunction: function (j) {
var k = i[j];
return k && k.apply(window, Array.prototype.slice.call(arguments
, 1));
},
cssLength: (function () {
return function (j) {
return j + (!j || isNaN(Number(j)) ? '' : 'px');
};
})(),
convertToPx: (function () {
var j;
return function (k) {
if (!j) {
j = h.element.createFromHtml('<div style="position:absol
ute;left:-9999px;top:-9999px;margin:0px;padding:0px;border:0px;"></div>', e.docu
ment);
e.document.getBody().append(j);
}
if (!/%$/.test(k)) {
j.setStyle('width', k);
return j.$.clientWidth;
}
return k;
};
})(),
repeat: function (j, k) {
return new Array(k + 1).join(j);
},
tryThese: function () {
var j;
for (var k = 0, l = arguments.length; k < l; k++) {
var m = arguments[k];
try {
j = m();
break;
} catch (n) {}
}
return j;
},
genKey: function () {
return Array.prototype.slice.call(arguments).join('-');
}
};
})();
var i = e.tools;
e.dtd = (function () {
var j = i.extend,
k = {
isindex: 1,
fieldset: 1
},
l = {
input: 1,
button: 1,
select: 1,
textarea: 1,
label: 1
},
m = j({
a: 1
}, l),
n = j({
iframe: 1
}, m),
o = {
hr: 1,
ul: 1,
menu: 1,
div: 1,
section: 1,
header: 1,
footer: 1,
nav: 1,
article: 1,
aside: 1,
figure: 1,
dialog: 1,
hgroup: 1,
mark: 1,
time: 1,
meter: 1,
command: 1,
keygen: 1,
output: 1,
progress: 1,
audio: 1,
video: 1,
details: 1,
datagrid: 1,
datalist: 1,
blockquote: 1,
noscript: 1,
table: 1,
center: 1,
address: 1,
dir: 1,
pre: 1,
h5: 1,
dl: 1,
h4: 1,
noframes: 1,
h6: 1,
ol: 1,
h1: 1,
h3: 1,
h2: 1
},
p = {
ins: 1,
del: 1,
script: 1,
style: 1
},
q = j({
b: 1,
acronym: 1,
bdo: 1,
'var': 1,
'#': 1,
abbr: 1,
code: 1,
br: 1,
i: 1,
cite: 1,
kbd: 1,
u: 1,
strike: 1,
s: 1,
tt: 1,
strong: 1,
q: 1,
samp: 1,
em: 1,
dfn: 1,
span: 1,
wbr: 1
}, p),
r = j({
sub: 1,
img: 1,
object: 1,
sup: 1,
basefont: 1,
map: 1,
applet: 1,
font: 1,
big: 1,
small: 1,
mark: 1
}, q),
s = j({
p: 1
}, r),
t = j({
iframe: 1
}, r, l),
u = {
img: 1,
noscript: 1,
br: 1,
kbd: 1,
center: 1,
button: 1,
basefont: 1,
h5: 1,
h4: 1,
samp: 1,
h6: 1,
ol: 1,
h1: 1,
h3: 1,
h2: 1,
form: 1,
font: 1,
'#': 1,
select: 1,
menu: 1,
ins: 1,
abbr: 1,
label: 1,
code: 1,
table: 1,
script: 1,
cite: 1,
input: 1,
iframe: 1,
strong: 1,
textarea: 1,
noframes: 1,
big: 1,
small: 1,
span: 1,
hr: 1,
sub: 1,
bdo: 1,
'var': 1,
div: 1,
section: 1,
header: 1,
footer: 1,
nav: 1,
article: 1,
aside: 1,
figure: 1,
dialog: 1,
hgroup: 1,
mark: 1,
time: 1,
meter: 1,
menu: 1,
command: 1,
keygen: 1,
output: 1,
progress: 1,
audio: 1,
video: 1,
details: 1,
datagrid: 1,
datalist: 1,
object: 1,
sup: 1,
strike: 1,
dir: 1,
map: 1,
dl: 1,
applet: 1,
del: 1,
isindex: 1,
fieldset: 1,
ul: 1,
b: 1,
acronym: 1,
a: 1,
blockquote: 1,
i: 1,
u: 1,
s: 1,
tt: 1,
address: 1,
q: 1,
pre: 1,
p: 1,
em: 1,
dfn: 1
},
v = j({
a: 1
}, t),
w = {
tr: 1
},
x = {
'#': 1
},
y = j({
param: 1
}, u),
z = j({
form: 1
}, k, n, o, s),
A = {
li: 1
},
B = {
style: 1,
script: 1
},
C = {
base: 1,
link: 1,
meta: 1,
title: 1
},
D = j(C, B),
E = {
head: 1,
body: 1
},
F = {
html: 1
},
G = {
address: 1,
blockquote: 1,
center: 1,
dir: 1,
div: 1,
section: 1,
header: 1,
footer: 1,
nav: 1,
article: 1,
aside: 1,
figure: 1,
dialog: 1,
hgroup: 1,
time: 1,
meter: 1,
menu: 1,
command: 1,
keygen: 1,
output: 1,
progress: 1,
audio: 1,
video: 1,
details: 1,
datagrid: 1,
datalist: 1,
dl: 1,
fieldset: 1,
form: 1,
h1: 1,
h2: 1,
h3: 1,
h4: 1,
h5: 1,
h6: 1,
hr: 1,
isindex: 1,
noframes: 1,
ol: 1,
p: 1,
pre: 1,
table: 1,
ul: 1
};
return {
$nonBodyContent: j(F, E, C),
$block: G,
$blockLimit: {
body: 1,
div: 1,
section: 1,
header: 1,
footer: 1,
nav: 1,
article: 1,
aside: 1,
figure: 1,
dialog: 1,
hgroup: 1,
time: 1,
meter: 1,
menu: 1,
command: 1,
keygen: 1,
output: 1,
progress: 1,
audio: 1,
video: 1,
details: 1,
datagrid: 1,
datalist: 1,
td: 1,
th: 1,
caption: 1,
form: 1
},
$inline: v,
$body: j({
script: 1,
style: 1
}, G),
$cdata: {
script: 1,
style: 1
},
$empty: {
area: 1,
base: 1,
br: 1,
col: 1,
hr: 1,
img: 1,
input: 1,
link: 1,
meta: 1,
param: 1,
wbr: 1
},
$listItem: {
dd: 1,
dt: 1,
li: 1
},
$list: {
ul: 1,
ol: 1,
dl: 1
},
$nonEditable: {
applet: 1,
button: 1,
embed: 1,
iframe: 1,
map: 1,
object: 1,
option: 1,
script: 1,
textarea: 1,
param: 1,
audio: 1,
video: 1
},
$captionBlock: {
caption: 1,
legend: 1
},
$removeEmpty: {
abbr: 1,
acronym: 1,
address: 1,
b: 1,
bdo: 1,
big: 1,
cite: 1,
code: 1,
del: 1,
dfn: 1,
em: 1,
font: 1,
i: 1,
ins: 1,
label: 1,
kbd: 1,
q: 1,
s: 1,
samp: 1,
small: 1,
span: 1,
strike: 1,
strong: 1,
sub: 1,
sup: 1,
tt: 1,
u: 1,
'var': 1,
mark: 1
},
$tabIndex: {
a: 1,
area: 1,
button: 1,
input: 1,
object: 1,
select: 1,
textarea: 1
},
$tableContent: {
caption: 1,
col: 1,
colgroup: 1,
tbody: 1,
td: 1,
tfoot: 1,
th: 1,
thead: 1,
tr: 1
},
html: E,
head: D,
style: x,
script: x,
body: z,
base: {},
link: {},
meta: {},
title: x,
col: {},
tr: {
td: 1,
th: 1
},
img: {},
colgroup: {
col: 1
},
noscript: z,
td: z,
br: {},
wbr: {},
th: z,
center: z,
kbd: v,
button: j(s, o),
basefont: {},
h5: v,
h4: v,
samp: v,
h6: v,
ol: A,
h1: v,
h3: v,
option: x,
h2: v,
form: j(k, n, o, s),
select: {
optgroup: 1,
option: 1
},
font: v,
ins: v,
menu: A,
abbr: v,
label: v,
table: {
thead: 1,
col: 1,
tbody: 1,
tr: 1,
colgroup: 1,
caption: 1,
tfoot: 1
},
code: v,
tfoot: w,
cite: v,
li: z,
input: {},
iframe: z,
strong: v,
textarea: x,
noframes: z,
big: v,
small: v,
span: v,
hr: {},
dt: v,
sub: v,
optgroup: {
option: 1
},
param: {},
bdo: v,
'var': v,
div: z,
object: y,
sup: v,
dd: z,
strike: v,
area: {},
dir: A,
map: j({
area: 1,
form: 1,
p: 1
}, k, p, o),
applet: y,
dl: {
dt: 1,
dd: 1
},
del: v,
isindex: {},
fieldset: j({
legend: 1
}, u),
thead: w,
ul: A,
acronym: v,
b: v,
a: t,
blockquote: z,
caption: v,
i: v,
u: v,
tbody: w,
s: v,
address: j(n, s),
tt: v,
legend: v,
q: v,
pre: j(q, m),
p: v,
em: v,
dfn: v,
section: z,
header: z,
footer: z,
nav: z,
article: z,
aside: z,
figure: z,
dialog: z,
hgroup: z,
mark: v,
time: v,
meter: v,
menu: v,
command: v,
keygen: v,
output: v,
progress: y,
audio: y,
video: y,
details: y,
datagrid: y,
datalist: y
};
})();
var j = e.dtd;
h.event = function (k) {
this.$ = k;
};
h.event.prototype = {
getKey: function () {
return this.$.keyCode || this.$.which;
},
getKeystroke: function () {
var l = this;
var k = l.getKey();
if (l.$.ctrlKey || l.$.metaKey) k += 1114112;
if (l.$.shiftKey) k += 2228224;
if (l.$.altKey) k += 4456448;
return k;
},
preventDefault: function (k) {
var l = this.$;
if (l.preventDefault) l.preventDefault();
else l.returnValue = false; if (k) this.stopPropagation();
},
stopPropagation: function () {
var k = this.$;
if (k.stopPropagation) k.stopPropagation();
else k.cancelBubble = true;
},
getTarget: function () {
var k = this.$.target || this.$.srcElement;
return k ? new h.node(k) : null;
}
};
e.CTRL = 1114112;
e.SHIFT = 2228224;
e.ALT = 4456448;
h.domObject = function (k) {
if (k) this.$ = k;
};
h.domObject.prototype = (function () {
var k = function (l, m) {
return function (n) {
if (typeof e != 'undefined') l.fire(m, new h.event(n));
};
};
return {
getPrivate: function () {
var l;
if (!(l = this.getCustomData('_'))) this.setCustomData('_', l =
{});
return l;
},
on: function (l) {
var o = this;
var m = o.getCustomData('_cke_nativeListeners');
if (!m) {
m = {};
o.setCustomData('_cke_nativeListeners', m);
}
if (!m[l]) {
var n = m[l] = k(o, l);
if (o.$.attachEvent) o.$.attachEvent('on' + l, n);
else if (o.$.addEventListener) o.$.addEventListener(l, n, !!
e.event.useCapture);
}
return e.event.prototype.on.apply(o, arguments);
},
removeListener: function (l) {
var o = this;
e.event.prototype.removeListener.apply(o, arguments);
if (!o.hasListeners(l)) {
var m = o.getCustomData('_cke_nativeListeners'),
n = m && m[l];
if (n) {
if (o.$.detachEvent) o.$.detachEvent('on' + l, n);
else if (o.$.removeEventListener) o.$.removeEventListene
r(l, n, false);
delete m[l];
}
}
},
removeAllListeners: function () {
var o = this;
var l = o.getCustomData('_cke_nativeListeners');
for (var m in l) {
var n = l[m];
if (o.$.detachEvent) o.$.detachEvent('on' + m, n);
else if (o.$.removeEventListener) o.$.removeEventListener(m,
n, false);
delete l[m];
}
}
};
})();
(function (k) {
var l = {};
e.on('reset', function () {
l = {};
});
k.equals = function (m) {
return m && m.$ === this.$;
};
k.setCustomData = function (m, n) {
var o = this.getUniqueId(),
p = l[o] || (l[o] = {});
p[m] = n;
return this;
};
k.getCustomData = function (m) {
var n = this.$['data-cke-expando'],
o = n && l[n];
return o && o[m];
};
k.removeCustomData = function (m) {
var n = this.$['data-cke-expando'],
o = n && l[n],
p = o && o[m];
if (typeof p != 'undefined') delete o[m];
return p || null;
};
k.clearCustomData = function () {
this.removeAllListeners();
var m = this.$['data-cke-expando'];
m && delete l[m];
};
k.getUniqueId = function () {
return this.$['data-cke-expando'] || (this.$['data-cke-expando'] = i
.getNextNumber());
};
e.event.implementOn(k);
})(h.domObject.prototype);
h.window = function (k) {
h.domObject.call(this, k);
};
h.window.prototype = new h.domObject();
i.extend(h.window.prototype, {
focus: function () {
if (f.webkit && this.$.parent) this.$.parent.focus();
this.$.focus();
},
getViewPaneSize: function () {
var k = this.$.document,
l = k.compatMode == 'CSS1Compat';
return {
width: (l ? k.documentElement.clientWidth : k.body.clientWidth)
|| 0,
height: (l ? k.documentElement.clientHeight : k.body.clientHeigh
t) || 0
};
},
getScrollPosition: function () {
var k = this.$;
if ('pageXOffset' in k) return {
x: k.pageXOffset || 0,
y: k.pageYOffset || 0
};
else {
var l = k.document;
return {
x: l.documentElement.scrollLeft || l.body.scrollLeft || 0,
y: l.documentElement.scrollTop || l.body.scrollTop || 0
};
}
}
});
h.document = function (k) {
h.domObject.call(this, k);
};
var k = h.document;
k.prototype = new h.domObject();
i.extend(k.prototype, {
appendStyleSheet: function (l) {
if (this.$.createStyleSheet) this.$.createStyleSheet(l);
else {
var m = new h.element('link');
m.setAttributes({
rel: 'stylesheet',
type: 'text/css',
href: l
});
this.getHead().append(m);
}
},
appendStyleText: function (l) {
var o = this;
if (o.$.createStyleSheet) {
var m = o.$.createStyleSheet('');
m.cssText = l;
} else {
var n = new h.element('style', o);
n.append(new h.text(l, o));
o.getHead().append(n);
}
},
createElement: function (l, m) {
var n = new h.element(l, this);
if (m) {
if (m.attributes) n.setAttributes(m.attributes);
if (m.styles) n.setStyles(m.styles);
}
return n;
},
createText: function (l) {
return new h.text(l, this);
},
focus: function () {
this.getWindow().focus();
},
getById: function (l) {
var m = this.$.getElementById(l);
return m ? new h.element(m) : null;
},
getByAddress: function (l, m) {
var n = this.$.documentElement;
for (var o = 0; n && o < l.length; o++) {
var p = l[o];
if (!m) {
n = n.childNodes[p];
continue;
}
var q = -1;
for (var r = 0; r < n.childNodes.length; r++) {
var s = n.childNodes[r];
if (m === true && s.nodeType == 3 && s.previousSibling && s.
previousSibling.nodeType == 3) continue;
q++;
if (q == p) {
n = s;
break;
}
}
}
return n ? new h.node(n) : null;
},
getElementsByTag: function (l, m) {
if (!(g && !(document.documentMode > 8)) && m) l = m + ':' + l;
return new h.nodeList(this.$.getElementsByTagName(l));
},
getHead: function () {
var l = this.$.getElementsByTagName('head')[0];
if (!l) l = this.getDocumentElement().append(new h.element('head'),
true);
else l = new h.element(l);
return (this.getHead = function () {
return l;
})();
},
getBody: function () {
var l = new h.element(this.$.body);
return (this.getBody = function () {
return l;
})();
},
getDocumentElement: function () {
var l = new h.element(this.$.documentElement);
return (this.getDocumentElement = function () {
return l;
})();
},
getWindow: function () {
var l = new h.window(this.$.parentWindow || this.$.defaultView);
return (this.getWindow = function () {
return l;
})();
},
write: function (l) {
var m = this;
m.$.open('text/html', 'replace');
f.isCustomDomain() && (m.$.domain = document.domain);
m.$.write(l);
m.$.close();
}
});
h.node = function (l) {
if (l) {
switch (l.nodeType) {
case 9:
return new k(l);
case 1:
return new h.element(l);
case 3:
return new h.text(l);
}
h.domObject.call(this, l);
}
return this;
};
h.node.prototype = new h.domObject();
e.NODE_ELEMENT = 1;
e.NODE_DOCUMENT = 9;
e.NODE_TEXT = 3;
e.NODE_COMMENT = 8;
e.NODE_DOCUMENT_FRAGMENT = 11;
e.POSITION_IDENTICAL = 0;
e.POSITION_DISCONNECTED = 1;
e.POSITION_FOLLOWING = 2;
e.POSITION_PRECEDING = 4;
e.POSITION_IS_CONTAINED = 8;
e.POSITION_CONTAINS = 16;
i.extend(h.node.prototype, {
appendTo: function (l, m) {
l.append(this, m);
return l;
},
clone: function (l, m) {
var n = this.$.cloneNode(l),
o = function (p) {
if (p.nodeType != 1) return;
if (!m) p.removeAttribute('id', false);
p.removeAttribute('data-cke-expando', false);
if (l) {
var q = p.childNodes;
for (var r = 0; r < q.length; r++) o(q[r]);
}
};
o(n);
return new h.node(n);
},
hasPrevious: function () {
return !!this.$.previousSibling;
},
hasNext: function () {
return !!this.$.nextSibling;
},
insertAfter: function (l) {
l.$.parentNode.insertBefore(this.$, l.$.nextSibling);
return l;
},
insertBefore: function (l) {
l.$.parentNode.insertBefore(this.$, l.$);
return l;
},
insertBeforeMe: function (l) {
this.$.parentNode.insertBefore(l.$, this.$);
return l;
},
getAddress: function (l) {
var m = [],
n = this.getDocument().$.documentElement,
o = this.$;
while (o && o != n) {
var p = o.parentNode;
if (p) m.unshift(this.getIndex.call({
$: o
}, l));
o = p;
}
return m;
},
getDocument: function () {
return new k(this.$.ownerDocument || this.$.parentNode.ownerDocument
);
},
getIndex: function (l) {
var m = this.$,
n = 0;
while (m = m.previousSibling) {
if (l && m.nodeType == 3 && (!m.nodeValue.length || m.previousSi
bling && m.previousSibling.nodeType == 3)) continue;
n++;
}
return n;
},
getNextSourceNode: function (l, m, n) {
if (n && !n.call) {
var o = n;
n = function (r) {
return !r.equals(o);
};
}
var p = !l && this.getFirst && this.getFirst(),
q;
if (!p) {
if (this.type == 1 && n && n(this, true) === false) return null;
p = this.getNext();
}
while (!p && (q = (q || this).getParent())) {
if (n && n(q, true) === false) return null;
p = q.getNext();
}
if (!p) return null;
if (n && n(p) === false) return null;
if (m && m != p.type) return p.getNextSourceNode(false, m, n);
return p;
},
getPreviousSourceNode: function (l, m, n) {
if (n && !n.call) {
var o = n;
n = function (r) {
return !r.equals(o);
};
}
var p = !l && this.getLast && this.getLast(),
q;
if (!p) {
if (this.type == 1 && n && n(this, true) === false) return null;
p = this.getPrevious();
}
while (!p && (q = (q || this).getParent())) {
if (n && n(q, true) === false) return null;
p = q.getPrevious();
}
if (!p) return null;
if (n && n(p) === false) return null;
if (m && p.type != m) return p.getPreviousSourceNode(false, m, n);
return p;
},
getPrevious: function (l) {
var m = this.$,
n;
do {
m = m.previousSibling;
n = m && new h.node(m);
} while (n && l && !l(n));
return n;
},
getNext: function (l) {
var m = this.$,
n;
do {
m = m.nextSibling;
n = m && new h.node(m);
} while (n && l && !l(n));
return n;
},
getParent: function () {
var l = this.$.parentNode;
return l && l.nodeType == 1 ? new h.node(l) : null;
},
getParents: function (l) {
var m = this,
n = [];
do n[l ? 'push' : 'unshift'](m); while (m = m.getParent());
return n;
},
getCommonAncestor: function (l) {
var n = this;
if (l.equals(n)) return n;
if (l.contains && l.contains(n)) return l;
var m = n.contains ? n : n.getParent();
do {
if (m.contains(l)) return m;
} while (m = m.getParent());
return null;
},
getPosition: function (l) {
var m = this.$,
n = l.$;
if (m.compareDocumentPosition) return m.compareDocumentPosition(n);
if (m == n) return 0;
if (this.type == 1 && l.type == 1) {
if (m.contains) {
if (m.contains(n)) return 16 + 4;
if (n.contains(m)) return 8 + 2;
}
if ('sourceIndex' in m) return m.sourceIndex < 0 || n.sourceInde
x < 0 ? 1 : m.sourceIndex < n.sourceIndex ? 4 : 2;
}
var o = this.getAddress(),
p = l.getAddress(),
q = Math.min(o.length, p.length);
for (var r = 0; r <= q - 1; r++) {
if (o[r] != p[r]) {
if (r < q) return o[r] < p[r] ? 4 : 2;
break;
}
}
return o.length < p.length ? 16 + 4 : 8 + 2;
},
getAscendant: function (l, m) {
var n = this.$,
o;
if (!m) n = n.parentNode;
while (n) {
if (n.nodeName && (o = n.nodeName.toLowerCase(), typeof l == 'st
ring' ? o == l : o in l)) return new h.node(n);
n = n.parentNode;
}
return null;
},
hasAscendant: function (l, m) {
var n = this.$;
if (!m) n = n.parentNode;
while (n) {
if (n.nodeName && n.nodeName.toLowerCase() == l) return true;
n = n.parentNode;
}
return false;
},
move: function (l, m) {
l.append(this.remove(), m);
},
remove: function (l) {
var m = this.$,
n = m.parentNode;
if (n) {
if (l)
for (var o; o = m.firstChild;) n.insertBefore(m.removeChild(
o), m);
n.removeChild(m);
}
return this;
},
replace: function (l) {
this.insertBefore(l);
l.remove();
},
trim: function () {
this.ltrim();
this.rtrim();
},
ltrim: function () {
var o = this;
var l;
while (o.getFirst && (l = o.getFirst())) {
if (l.type == 3) {
var m = i.ltrim(l.getText()),
n = l.getLength();
if (!m) {
l.remove();
continue;
} else if (m.length < n) {
l.split(n - m.length);
o.$.removeChild(o.$.firstChild);
}
}
break;
}
},
rtrim: function () {
var o = this;
var l;
while (o.getLast && (l = o.getLast())) {
if (l.type == 3) {
var m = i.rtrim(l.getText()),
n = l.getLength();
if (!m) {
l.remove();
continue;
} else if (m.length < n) {
l.split(m.length);
o.$.lastChild.parentNode.removeChild(o.$.lastChild);
}
}
break;
}
if (!g && !f.opera) {
l = o.$.lastChild;
if (l && l.type == 1 && l.nodeName.toLowerCase() == 'br') l.pare
ntNode.removeChild(l);
}
},
isReadOnly: function () {
var l = this;
if (this.type != 1) l = this.getParent();
if (l && typeof l.$.isContentEditable != 'undefined') return !(l.$.i
sContentEditable || l.data('cke-editable'));
else {
var m = l;
while (m) {
if (m.is('body') || !!m.data('cke-editable')) break;
if (m.getAttribute('contentEditable') == 'false') return tru
e;
else if (m.getAttribute('contentEditable') == 'true') break;
m = m.getParent();
}
return false;
}
}
});
h.nodeList = function (l) {
this.$ = l;
};
h.nodeList.prototype = {
count: function () {
return this.$.length;
},
getItem: function (l) {
var m = this.$[l];
return m ? new h.node(m) : null;
}
};
h.element = function (l, m) {
if (typeof l == 'string') l = (m ? m.$ : document).createElement(l);
h.domObject.call(this, l);
};
var l = h.element;
l.get = function (m) {
return m && (m.$ ? m : new l(m));
};
l.prototype = new h.node();
l.createFromHtml = function (m, n) {
var o = new l('div', n);
o.setHtml(m);
return o.getFirst().remove();
};
l.setMarker = function (m, n, o, p) {
var q = n.getCustomData('list_marker_id') || n.setCustomData('list_marke
r_id', i.getNextNumber()).getCustomData('list_marker_id'),
r = n.getCustomData('list_marker_names') || n.setCustomData('list_ma
rker_names', {}).getCustomData('list_marker_names');
m[q] = n;
r[o] = 1;
return n.setCustomData(o, p);
};
l.clearAllMarkers = function (m) {
for (var n in m) l.clearMarkers(m, m[n], 1);
};
l.clearMarkers = function (m, n, o) {
var p = n.getCustomData('list_marker_names'),
q = n.getCustomData('list_marker_id');
for (var r in p) n.removeCustomData(r);
n.removeCustomData('list_marker_names');
if (o) {
n.removeCustomData('list_marker_id');
delete m[q];
}
};
i.extend(l.prototype, {
type: 1,
addClass: function (m) {
var n = this.$.className;
if (n) {
var o = new RegExp('(?:^|\\s)' + m + '(?:\\s|$)', '');
if (!o.test(n)) n += ' ' + m;
}
this.$.className = n || m;
},
removeClass: function (m) {
var n = this.getAttribute('class');
if (n) {
var o = new RegExp('(?:^|\\s+)' + m + '(?=\\s|$)', 'i');
if (o.test(n)) {
n = n.replace(o, '').replace(/^\s+/, '');
if (n) this.setAttribute('class', n);
else this.removeAttribute('class');
}
}
},
hasClass: function (m) {
var n = new RegExp('(?:^|\\s+)' + m + '(?=\\s|$)', '');
return n.test(this.getAttribute('class'));
},
append: function (m, n) {
var o = this;
if (typeof m == 'string') m = o.getDocument().createElement(m);
if (n) o.$.insertBefore(m.$, o.$.firstChild);
else o.$.appendChild(m.$);
return m;
},
appendHtml: function (m) {
var o = this;
if (!o.$.childNodes.length) o.setHtml(m);
else {
var n = new l('div', o.getDocument());
n.setHtml(m);
n.moveChildren(o);
}
},
appendText: function (m) {
if (this.$.text != undefined) this.$.text += m;
else this.append(new h.text(m));
},
appendBogus: function () {
var o = this;
var m = o.getLast();
while (m && m.type == 3 && !i.rtrim(m.getText())) m = m.getPrevious(
);
if (!m || !m.is || !m.is('br')) {
var n = f.opera ? o.getDocument().createText('') : o.getDocument
().createElement('br');
f.gecko && n.setAttribute('type', '_moz');
o.append(n);
}
},
breakParent: function (m) {
var p = this;
var n = new h.range(p.getDocument());
n.setStartAfter(p);
n.setEndAfter(m);
var o = n.extractContents();
n.insertNode(p.remove());
o.insertAfterNode(p);
},
contains: g || f.webkit ? function (m) {
var n = this.$;
return m.type != 1 ? n.contains(m.getParent().$) : n != m.$ && n.con
tains(m.$);
} : function (m) {
return !!(this.$.compareDocumentPosition(m.$) & 16);
},
focus: (function () {
function m() {
try {
this.$.focus();
} catch (n) {}
};
return function (n) {
if (n) i.setTimeout(m, 100, this);
else m.call(this);
};
})(),
getHtml: function () {
var m = this.$.innerHTML;
return g ? m.replace(/<\?[^>]*>/g, '') : m;
},
getOuterHtml: function () {
var n = this;
if (n.$.outerHTML) return n.$.outerHTML.replace(/<\?[^>]*>/, '');
var m = n.$.ownerDocument.createElement('div');
m.appendChild(n.$.cloneNode(true));
return m.innerHTML;
},
setHtml: function (m) {
return this.$.innerHTML = m;
},
setText: function (m) {
l.prototype.setText = this.$.innerText != undefined ? function (n) {
return this.$.innerText = n;
} : function (n) {
return this.$.textContent = n;
};
return this.setText(m);
},
getAttribute: (function () {
var m = function (n) {
return this.$.getAttribute(n, 2);
};
if (g && (f.ie7Compat || f.ie6Compat)) return function (n) {
var r = this;
switch (n) {
case 'class':
n = 'className';
break;
case 'http-equiv':
n = 'httpEquiv';
break;
case 'name':
return r.$.name;
case 'tabindex':
var o = m.call(r, n);
if (o !== 0 && r.$.tabIndex === 0) o = null;
return o;
break;
case 'checked':
var p = r.$.attributes.getNamedItem(n),
q = p.specified ? p.nodeValue : r.$.checked;
return q ? 'checked' : null;
case 'hspace':
case 'value':
return r.$[n];
case 'style':
return r.$.style.cssText;
}
return m.call(r, n);
};
else return m;
})(),
getChildren: function () {
return new h.nodeList(this.$.childNodes);
},
getComputedStyle: g ? function (m) {
return this.$.currentStyle[i.cssStyleToDomStyle(m)];
} : function (m) {
return this.getWindow().$.getComputedStyle(this.$, '').getPropertyVa
lue(m);
},
getDtd: function () {
var m = j[this.getName()];
this.getDtd = function () {
return m;
};
return m;
},
getElementsByTag: k.prototype.getElementsByTag,
getTabIndex: g ? function () {
var m = this.$.tabIndex;
if (m === 0 && !j.$tabIndex[this.getName()] && parseInt(this.getAttr
ibute('tabindex'), 10) !== 0) m = -1;
return m;
} : f.webkit ? function () {
var m = this.$.tabIndex;
if (m == undefined) {
m = parseInt(this.getAttribute('tabindex'), 10);
if (isNaN(m)) m = -1;
}
return m;
} : function () {
return this.$.tabIndex;
},
getText: function () {
return this.$.textContent || this.$.innerText || '';
},
getWindow: function () {
return this.getDocument().getWindow();
},
getId: function () {
return this.$.id || null;
},
getNameAtt: function () {
return this.$.name || null;
},
getName: function () {
var m = this.$.nodeName.toLowerCase();
if (g && !(document.documentMode > 8)) {
var n = this.$.scopeName;
if (n != 'HTML') m = n.toLowerCase() + ':' + m;
}
return (this.getName = function () {
return m;
})();
},
getValue: function () {
return this.$.value;
},
getFirst: function (m) {
var n = this.$.firstChild,
o = n && new h.node(n);
if (o && m && !m(o)) o = o.getNext(m);
return o;
},
getLast: function (m) {
var n = this.$.lastChild,
o = n && new h.node(n);
if (o && m && !m(o)) o = o.getPrevious(m);
return o;
},
getStyle: function (m) {
return this.$.style[i.cssStyleToDomStyle(m)];
},
is: function () {
var m = this.getName();
for (var n = 0; n < arguments.length; n++) {
if (arguments[n] == m) return true;
}
return false;
},
isEditable: function (m) {
var p = this;
var n = p.getName();
if (p.isReadOnly() || p.getComputedStyle('display') == 'none' || p.g
etComputedStyle('visibility') == 'hidden' || j.$nonEditable[n]) return false;
if (m !== false) {
var o = j[n] || j.span;
return o && o['#'];
}
return true;
},
isIdentical: function (m) {
if (this.getName() != m.getName()) return false;
var n = this.$.attributes,
o = m.$.attributes,
p = n.length,
q = o.length;
for (var r = 0; r < p; r++) {
var s = n[r];
if (s.nodeName == '_moz_dirty') continue;
if ((!g || s.specified && s.nodeName != 'data-cke-expando') && s
.nodeValue != m.getAttribute(s.nodeName)) return false;
}
if (g)
for (r = 0; r < q; r++) {
s = o[r];
if (s.specified && s.nodeName != 'data-cke-expando' && s.nod
eValue != this.getAttribute(s.nodeName)) return false;
}
return true;
},
isVisible: function () {
var p = this;
var m = (p.$.offsetHeight || p.$.offsetWidth) && p.getComputedStyle(
'visibility') != 'hidden',
n, o;
if (m && (f.webkit || f.opera)) {
n = p.getWindow();
if (!n.equals(e.document.getWindow()) && (o = n.$.frameElement))
m = new l(o).isVisible();
}
return !!m;
},
isEmptyInlineRemoveable: function () {
if (!j.$removeEmpty[this.getName()]) return false;
var m = this.getChildren();
for (var n = 0, o = m.count(); n < o; n++) {
var p = m.getItem(n);
if (p.type == 1 && p.data('cke-bookmark')) continue;
if (p.type == 1 && !p.isEmptyInlineRemoveable() || p.type == 3 &
& i.trim(p.getText())) return false;
}
return true;
},
hasAttributes: g && (f.ie7Compat || f.ie6Compat) ? function () {
var m = this.$.attributes;
for (var n = 0; n < m.length; n++) {
var o = m[n];
switch (o.nodeName) {
case 'class':
if (this.getAttribute('class')) return true;
case 'data-cke-expando':
continue;
default:
if (o.specified) return true;
}
}
return false;
} : function () {
var m = this.$.attributes,
n = m.length,
o = {
'data-cke-expando': 1,
_moz_dirty: 1
};
return n > 0 && (n > 2 || !o[m[0].nodeName] || n == 2 && !o[m[1].nod
eName]);
},
hasAttribute: (function () {
function m(n) {
var o = this.$.attributes.getNamedItem(n);
return !!(o && o.specified);
};
return g && f.version < 8 ? function (n) {
if (n == 'name') return !!this.$.name;
return m.call(this, n);
} : m;
})(),
hide: function () {
this.setStyle('display', 'none');
},
moveChildren: function (m, n) {
var o = this.$;
m = m.$;
if (o == m) return;
var p;
if (n)
while (p = o.lastChild) m.insertBefore(o.removeChild(p), m.first
Child);
else
while (p = o.firstChild) m.appendChild(o.removeChild(p));
},
mergeSiblings: (function () {
function m(n, o, p) {
if (o && o.type == 1) {
var q = [];
while (o.data('cke-bookmark') || o.isEmptyInlineRemoveable()
) {
q.push(o);
o = p ? o.getNext() : o.getPrevious();
if (!o || o.type != 1) return;
}
if (n.isIdentical(o)) {
var r = p ? n.getLast() : n.getFirst();
while (q.length) q.shift().move(n, !p);
o.moveChildren(n, !p);
o.remove();
if (r && r.type == 1) r.mergeSiblings();
}
}
};
return function (n) {
var o = this;
if (!(n === false || j.$removeEmpty[o.getName()] || o.is('a')))
return;
m(o, o.getNext(), true);
m(o, o.getPrevious());
};
})(),
show: function () {
this.setStyles({
display: '',
visibility: ''
});
},
setAttribute: (function () {
var m = function (n, o) {
this.$.setAttribute(n, o);
return this;
};
if (g && (f.ie7Compat || f.ie6Compat)) return function (n, o) {
var p = this;
if (n == 'class') p.$.className = o;
else if (n == 'style') p.$.style.cssText = o;
else if (n == 'tabindex') p.$.tabIndex = o;
else if (n == 'checked') p.$.checked = o;
else m.apply(p, arguments);
return p;
};
else if (f.ie8Compat && f.secure) return function (n, o) {
if (n == 'src' && o.match(/^http:\/\//)) try {
m.apply(this, arguments);
} catch (p) {} else m.apply(this, arguments);
return this;
};
else return m;
})(),
setAttributes: function (m) {
for (var n in m) this.setAttribute(n, m[n]);
return this;
},
setValue: function (m) {
this.$.value = m;
return this;
},
removeAttribute: (function () {
var m = function (n) {
this.$.removeAttribute(n);
};
if (g && (f.ie7Compat || f.ie6Compat)) return function (n) {
if (n == 'class') n = 'className';
else if (n == 'tabindex') n = 'tabIndex';
m.call(this, n);
};
else return m;
})(),
removeAttributes: function (m) {
if (i.isArray(m))
for (var n = 0; n < m.length; n++) this.removeAttribute(m[n]);
else
for (var o in m) m.hasOwnProperty(o) && this.removeAttribute(o);
},
removeStyle: function (m) {
var n = this;
n.setStyle(m, '');
if (n.$.style.removeAttribute) n.$.style.removeAttribute(i.cssStyleT
oDomStyle(m));
if (!n.$.style.cssText) n.removeAttribute('style');
},
setStyle: function (m, n) {
this.$.style[i.cssStyleToDomStyle(m)] = n;
return this;
},
setStyles: function (m) {
for (var n in m) this.setStyle(n, m[n]);
return this;
},
setOpacity: function (m) {
if (g) {
m = Math.round(m * 100);
this.setStyle('filter', m >= 100 ? '' : 'progid:DXImageTransform
.Microsoft.Alpha(opacity=' + m + ')');
} else this.setStyle('opacity', m);
},
unselectable: f.gecko ? function () {
this.$.style.MozUserSelect = 'none';
this.on('dragstart', function (m) {
m.data.preventDefault();
});
} : f.webkit ? function () {
this.$.style.KhtmlUserSelect = 'none';
this.on('dragstart', function (m) {
m.data.preventDefault();
});
} : function () {
if (g || f.opera) {
var m = this.$,
n, o = 0;
m.unselectable = 'on';
while (n = m.all[o++]) switch (n.tagName.toLowerCase()) {
case 'iframe':
case 'textarea':
case 'input':
case 'select':
break;
default:
n.unselectable = 'on';
}
}
},
getPositionedAncestor: function () {
var m = this;
while (m.getName() != 'html') {
if (m.getComputedStyle('position') != 'static') return m;
m = m.getParent();
}
return null;
},
getDocumentPosition: function (m) {
var H = this;
var n = 0,
o = 0,
p = H.getDocument(),
q = p.getBody(),
r = p.$.compatMode == 'BackCompat';
if (document.documentElement.getBoundingClientRect) {
var s = H.$.getBoundingClientRect(),
t = p.$,
u = t.documentElement,
v = u.clientTop || q.$.clientTop || 0,
w = u.clientLeft || q.$.clientLeft || 0,
x = true;
if (g) {
var y = p.getDocumentElement().contains(H),
z = p.getBody().contains(H);
x = r && z || !r && y;
}
if (x) {
n = s.left + (!r && u.scrollLeft || q.$.scrollLeft);
n -= w;
o = s.top + (!r && u.scrollTop || q.$.scrollTop);
o -= v;
}
} else {
var A = H,
B = null,
C;
while (A && !(A.getName() == 'body' || A.getName() == 'html')) {
n += A.$.offsetLeft - A.$.scrollLeft;
o += A.$.offsetTop - A.$.scrollTop;
if (!A.equals(H)) {
n += A.$.clientLeft || 0;
o += A.$.clientTop || 0;
}
var D = B;
while (D && !D.equals(A)) {
n -= D.$.scrollLeft;
o -= D.$.scrollTop;
D = D.getParent();
}
B = A;
A = (C = A.$.offsetParent) ? new l(C) : null;
}
} if (m) {
var E = H.getWindow(),
F = m.getWindow();
if (!E.equals(F) && E.$.frameElement) {
var G = new l(E.$.frameElement).getDocumentPosition(m);
n += G.x;
o += G.y;
}
}
if (!document.documentElement.getBoundingClientRect)
if (f.gecko && !r) {
n += H.$.clientLeft ? 1 : 0;
o += H.$.clientTop ? 1 : 0;
}
return {
x: n,
y: o
};
},
scrollIntoView: function (m) {
var s = this;
var n = s.getWindow(),
o = n.getViewPaneSize().height,
p = o * -1;
if (m) p += o;
else {
p += s.$.offsetHeight || 0;
p += parseInt(s.getComputedStyle('marginBottom') || 0, 10) || 0;
}
var q = s.getDocumentPosition();
p += q.y;
p = p < 0 ? 0 : p;
var r = n.getScrollPosition().y;
if (p > r || p < r - o) n.$.scrollTo(0, p);
},
setState: function (m) {
var n = this;
switch (m) {
case 1:
n.addClass('cke_on');
n.removeClass('cke_off');
n.removeClass('cke_disabled');
break;
case 0:
n.addClass('cke_disabled');
n.removeClass('cke_off');
n.removeClass('cke_on');
break;
default:
n.addClass('cke_off');
n.removeClass('cke_on');
n.removeClass('cke_disabled');
break;
}
},
getFrameDocument: function () {
var m = this.$;
try {
m.contentWindow.document;
} catch (n) {
m.src = m.src;
if (g && f.version < 7) window.showModalDialog('javascript:docum
ent.write("<script>window.setTimeout(function(){window.close();},50);</script>")
');
}
return m && new k(m.contentWindow.document);
},
copyAttributes: function (m, n) {
var t = this;
var o = t.$.attributes;
n = n || {};
for (var p = 0; p < o.length; p++) {
var q = o[p],
r = q.nodeName.toLowerCase(),
s;
if (r in n) continue;
if (r == 'checked' && (s = t.getAttribute(r))) m.setAttribute(r,
s);
else if (q.specified || g && q.nodeValue && r == 'value') {
s = t.getAttribute(r);
if (s === null) s = q.nodeValue;
m.setAttribute(r, s);
}
}
if (t.$.style.cssText !== '') m.$.style.cssText = t.$.style.cssText;
},
renameNode: function (m) {
var p = this;
if (p.getName() == m) return;
var n = p.getDocument(),
o = new l(m, n);
p.copyAttributes(o);
p.moveChildren(o);
p.getParent() && p.$.parentNode.replaceChild(o.$, p.$);
o.$['data-cke-expando'] = p.$['data-cke-expando'];
p.$ = o.$;
},
getChild: function (m) {
var n = this.$;
if (!m.slice) n = n.childNodes[m];
else
while (m.length > 0 && n) n = n.childNodes[m.shift()];
return n ? new h.node(n) : null;
},
getChildCount: function () {
return this.$.childNodes.length;
},
disableContextMenu: function () {
this.on('contextmenu', function (m) {
if (!m.data.getTarget().hasClass('cke_enable_context_menu')) m.d
ata.preventDefault();
});
},
getDirection: function (m) {
var n = this;
return m ? n.getComputedStyle('direction') || n.getDirection() || n.
getDocument().$.dir || n.getDocument().getBody().getDirection(1) : n.getStyle('d
irection') || n.getAttribute('dir');
},
data: function (m, n) {
m = 'data-' + m;
if (n === undefined) return this.getAttribute(m);
else if (n === false) this.removeAttribute(m);
else this.setAttribute(m, n);
return null;
}
});
(function () {
var m = {
width: ['border-left-width', 'border-right-width', 'padding-left', '
padding-right'],
height: ['border-top-width', 'border-bottom-width', 'padding-top', '
padding-bottom']
};
function n(o) {
var p = 0;
for (var q = 0, r = m[o].length; q < r; q++) p += parseInt(this.getC
omputedStyle(m[o][q]) || 0, 10) || 0;
return p;
};
l.prototype.setSize = function (o, p, q) {
if (typeof p == 'number') {
if (q && !(g && f.quirks)) p -= n.call(this, o);
this.setStyle(o, p + 'px');
}
};
l.prototype.getSize = function (o, p) {
var q = Math.max(this.$['offset' + i.capitalize(o)], this.$['client'
+ i.capitalize(o)]) || 0;
if (p) q -= n.call(this, o);
return q;
};
})();
e.command = function (m, n) {
this.uiItems = [];
this.exec = function (o) {
if (this.state == 0) return false;
if (this.editorFocus) m.focus();
return n.exec.call(this, m, o) !== false;
};
i.extend(this, n, {
modes: {
wysiwyg: 1
},
editorFocus: 1,
state: 2
});
e.event.call(this);
};
e.command.prototype = {
enable: function () {
var m = this;
if (m.state == 0) m.setState(!m.preserveState || typeof m.previousSt
ate == 'undefined' ? 2 : m.previousState);
},
disable: function () {
this.setState(0);
},
setState: function (m) {
var n = this;
if (n.state == m) return false;
n.previousState = n.state;
n.state = m;
n.fire('state');
return true;
},
toggleState: function () {
var m = this;
if (m.state == 2) m.setState(1);
else if (m.state == 1) m.setState(2);
}
};
e.event.implementOn(e.command.prototype, true);
e.ENTER_P = 1;
e.ENTER_BR = 2;
e.ENTER_DIV = 3;
e.config = {
customConfig: 'config.js',
autoUpdateElement: true,
baseHref: '',
contentsCss: e.basePath + 'contents.css',
contentsLangDirection: 'ui',
contentsLanguage: '',
language: '',
defaultLanguage: 'en',
enterMode: 1,
forceEnterMode: false,
shiftEnterMode: 2,
corePlugins: '',
docType: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
bodyId: '',
bodyClass: '',
fullPage: false,
height: 200,
plugins: 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,co
lorbutton,colordialog,contextmenu,dialogadvtab,div,elementspath,enterkey,entitie
s,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,ifra
me,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebrea
k,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smi
ley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,t
ab,templates,toolbar,undo,wysiwygarea,wsc',
extraPlugins: '',
removePlugins: '',
protectedSource: [],
tabIndex: 0,
theme: 'default',
skin: 'kama',
width: '',
baseFloatZIndex: 10000
};
var m = e.config;
e.focusManager = function (n) {
if (n.focusManager) return n.focusManager;
this.hasFocus = false;
this._ = {
editor: n
};
return this;
};
e.focusManager.prototype = {
focus: function () {
var o = this;
if (o._.timer) clearTimeout(o._.timer);
if (!o.hasFocus) {
if (e.currentInstance) e.currentInstance.focusManager.forceBlur(
);
var n = o._.editor;
n.container.getChild(1).addClass('cke_focus');
o.hasFocus = true;
n.fire('focus');
}
},
blur: function () {
var n = this;
if (n._.timer) clearTimeout(n._.timer);
n._.timer = setTimeout(function () {
delete n._.timer;
n.forceBlur();
}, 100);
},
forceBlur: function () {
if (this.hasFocus) {
var n = this._.editor;
n.container.getChild(1).removeClass('cke_focus');
this.hasFocus = false;
n.fire('blur');
}
}
};
(function () {
var n = {};
e.lang = {
languages: {
af: 1,
ar: 1,
bg: 1,
bn: 1,
bs: 1,
ca: 1,
cs: 1,
cy: 1,
da: 1,
de: 1,
el: 1,
'en-au': 1,
'en-ca': 1,
'en-gb': 1,
en: 1,
eo: 1,
es: 1,
et: 1,
eu: 1,
fa: 1,
fi: 1,
fo: 1,
'fr-ca': 1,
fr: 1,
gl: 1,
gu: 1,
he: 1,
hi: 1,
hr: 1,
hu: 1,
is: 1,
it: 1,
ja: 1,
ka: 1,
km: 1,
ko: 1,
lt: 1,
lv: 1,
mn: 1,
ms: 1,
nb: 1,
nl: 1,
no: 1,
pl: 1,
'pt-br': 1,
pt: 1,
ro: 1,
ru: 1,
sk: 1,
sl: 1,
'sr-latn': 1,
sr: 1,
sv: 1,
th: 1,
tr: 1,
uk: 1,
vi: 1,
'zh-cn': 1,
zh: 1
},
load: function (o, p, q) {
if (typeof e.vbphrase == 'object') q(o, e.vbphrase);
else {
if (!o || !e.lang.languages[o]) o = this.detect(p, o);
if (!this[o]) e.scriptLoader.load(e.getUrl('lang/' + o + '.j
s'), function () {
q(o, this[o]);
}, this);
else q(o, this[o]);
}
},
detect: function (o, p) {
var q = this.languages;
p = p || navigator.userLanguage || navigator.language || o;
var r = p.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),
s = r[1],
t = r[2];
if (q[s + '-' + t]) s = s + '-' + t;
else if (!q[s]) s = null;
e.lang.detect = s ? function () {
return s;
} : function (u) {
return u;
};
return s || o;
}
};
})();
e.scriptLoader = (function () {
var n = {},
o = {};
return {
load: function (p, q, r, s) {
var t = typeof p == 'string';
if (t) p = [p];
if (!r) r = e;
var u = p.length,
v = [],
w = [],
x = function (C) {
if (q)
if (t) q.call(r, C);
else q.call(r, v, w);
};
if (u === 0) {
x(true);
return;
}
var y = function (C, D) {
(D ? v : w).push(C);
if (--u <= 0) {
s && e.document.getDocumentElement().removeStyle('cu
rsor');
x(D);
}
},
z = function (C, D) {
n[C] = 1;
var E = o[C];
delete o[C];
for (var F = 0; F < E.length; F++) E[F](C, D);
},
A = function (C) {
if (n[C]) {
y(C, true);
return;
}
var D = o[C] || (o[C] = []);
D.push(y);
if (D.length > 1) return;
var E = new l('script');
E.setAttributes({
type: 'text/javascript',
src: C
});
if (q)
if (g) E.$.onreadystatechange = function () {
if (E.$.readyState == 'loaded' || E.$.readyState
== 'complete') {
E.$.onreadystatechange = null;
z(C, true);
}
};
else {
E.$.onload = function () {
setTimeout(function () {
z(C, true);
}, 0);
};
E.$.onerror = function () {
z(C, false);
};
}
E.appendTo(e.document.getHead());
};
s && e.document.getDocumentElement().setStyle('cursor', 'wait');
for (var B = 0; B < u; B++) A(p[B]);
}
};
})();
e.resourceManager = function (n, o) {
var p = this;
p.basePath = n;
p.fileName = o;
p.registered = {};
p.loaded = {};
p.externals = {};
p._ = {
waitingList: {}
};
};
e.resourceManager.prototype = {
add: function (n, o) {
if (this.registered[n]) throw '[CKEDITOR.resourceManager.add] The re
source name "' + n + '" is already registered.';
e.fire(n + i.capitalize(this.fileName) + 'Ready', this.registered[n]
= o || {});
},
get: function (n) {
return this.registered[n] || null;
},
getPath: function (n) {
var o = this.externals[n];
return e.getUrl(o && o.dir || this.basePath + n + '/');
},
getFilePath: function (n) {
var o = this.externals[n];
return e.getUrl(this.getPath(n) + (o && typeof o.file == 'string' ?
o.file : this.fileName + '.js'));
},
addExternal: function (n, o, p) {
n = n.split(',');
for (var q = 0; q < n.length; q++) {
var r = n[q];
this.externals[r] = {
dir: o,
file: p
};
}
},
load: function (n, o, p) {
if (!i.isArray(n)) n = n ? [n] : [];
var q = this.loaded,
r = this.registered,
s = [],
t = {},
u = {};
for (var v = 0; v < n.length; v++) {
var w = n[v];
if (!w) continue;
if (!q[w] && !r[w]) {
var x = this.getFilePath(w);
s.push(x);
if (!(x in t)) t[x] = [];
t[x].push(w);
} else u[w] = this.get(w);
}
e.scriptLoader.load(s, function (y, z) {
if (z.length) throw '[CKEDITOR.resourceManager.load] Resource na
me "' + t[z[0]].join(',') + '" was not found at "' + z[0] + '".';
for (var A = 0; A < y.length; A++) {
var B = t[y[A]];
for (var C = 0; C < B.length; C++) {
var D = B[C];
u[D] = this.get(D);
q[D] = 1;
}
}
o.call(p, u);
}, this);
}
};
e.plugins = new e.resourceManager('plugins/', 'plugin');
var n = e.plugins;
n.load = i.override(n.load, function (o) {
return function (p, q, r) {
var s = {},
t = function (u) {
o.call(this, u, function (v) {
i.extend(s, v);
var w = [];
for (var x in v) {
var y = v[x],
z = y && y.requires;
if (z)
for (var A = 0; A < z.length; A++) {
if (!s[z[A]]) w.push(z[A]);
}
}
if (w.length) t.call(this, w);
else {
for (x in s) {
y = s[x];
if (y.onLoad && !y.onLoad._called) {
y.onLoad();
y.onLoad._called = 1;
}
}
if (q) q.call(r || window, s);
}
}, this);
};
t.call(this, p);
};
});
n.setLang = function (o, p, q) {
var r = this.get(o),
s = r.langEntries || (r.langEntries = {}),
t = r.lang || (r.lang = []);
if (i.indexOf(t, p) == -1) t.push(p);
s[p] = q;
};
e.skins = (function () {
var o = {},
p = {},
q = function (r, s, t, u) {
var v = o[s];
if (!r.skin) {
r.skin = v;
if (v.init) v.init(r);
}
var w = function (F) {
for (var G = 0; G < F.length; G++) F[G] = e.getUrl(p[s] + F[
G]);
};
function x(F, G) {
return F.replace(/url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g, funct
ion (H, I, J, K) {
if (/^\/|^\w?:/.test(J)) return H;
else return 'url(' + G + I + J + K + ')';
});
};
t = v[t];
var y = !t || !!t._isLoaded;
if (y) u && u();
else {
var z = t._pending || (t._pending = []);
z.push(u);
if (z.length > 1) return;
var A = !t.css || !t.css.length,
B = !t.js || !t.js.length,
C = function () {
if (A && B) {
t._isLoaded = 1;
for (var F = 0; F < z.length; F++) {
if (z[F]) z[F]();
}
}
};
if (!A) {
var D = t.css;
if (i.isArray(D)) {
w(D);
for (var E = 0; E < D.length; E++) e.document.append
StyleSheet(D[E]);
} else {
D = x(D, e.getUrl(p[s]));
e.document.appendStyleText(D);
}
t.css = D;
A = 1;
}
if (!B) {
w(t.js);
e.scriptLoader.load(t.js, function () {
B = 1;
C();
});
}
C();
}
};
return {
add: function (r, s) {
o[r] = s;
s.skinPath = p[r] || (p[r] = e.getUrl('skins/' + r + '/'));
},
load: function (r, s, t) {
var u = r.skinName,
v = r.skinPath;
if (o[u]) q(r, u, s, t);
else {
p[u] = v;
e.scriptLoader.load(e.getUrl(v + 'skin.js'), function () {
q(r, u, s, t);
});
}
}
};
})();
e.themes = new e.resourceManager('themes/', 'theme');
e.ui = function (o) {
if (o.ui) return o.ui;
this._ = {
handlers: {},
items: {},
editor: o
};
return this;
};
var o = e.ui;
o.prototype = {
add: function (p, q, r) {
this._.items[p] = {
type: q,
command: r.command || null,
args: Array.prototype.slice.call(arguments, 2)
};
},
create: function (p) {
var u = this;
var q = u._.items[p],
r = q && u._.handlers[q.type],
s = q && q.command && u._.editor.getCommand(q.command),
t = r && r.create.apply(u, q.args);
q && (t = i.extend(t, u._.editor.skin[q.type], true));
if (s) s.uiItems.push(t);
return t;
},
addHandler: function (p, q) {
this._.handlers[p] = q;
}
};
e.event.implementOn(o);
(function () {
var p = 0,
q = function () {
var B = 'editor' + (++p + 0);
return e.instances && e.instances[B] ? q() : B;
},
r = {},
s = function (B) {
var C = B.config.customConfig;
if (!C) return false;
C = e.getUrl(C);
var D = r[C] || (r[C] = {});
if (D.fn) {
D.fn.call(B, B.config);
if (e.getUrl(B.config.customConfig) == C || !s(B)) B.fireOnc
e('customConfigLoaded');
} else e.scriptLoader.load(C, function () {
if (e.editorConfig) D.fn = e.editorConfig;
else D.fn = function () {};
s(B);
});
return true;
},
t = function (B, C) {
B.on('customConfigLoaded', function () {
if (C) {
if (C.on)
for (var D in C.on) B.on(D, C.on[D]);
i.extend(B.config, C, true);
delete B.config.on;
}
u(B);
});
if (C && C.customConfig != undefined) B.config.customConfig = C.
customConfig;
if (!s(B)) B.fireOnce('customConfigLoaded');
},
u = function (B) {
var C = B.config.skin.split(','),
D = C[0],
E = e.getUrl(C[1] || 'skins/' + D + '/');
B.skinName = D;
B.skinPath = E;
B.skinClass = 'cke_skin_' + D;
B.tabIndex = B.config.tabIndex || B.element.getAttribute('tabind
ex') || 0;
B.readOnly = !!(B.config.readOnly || B.element.getAttribute('dis
abled'));
B.fireOnce('configLoaded');
x(B);
},
v = function (B) {
e.lang.load(B.config.language, B.config.defaultLanguage, functio
n (C, D) {
B.langCode = C;
B.lang = i.prototypedCopy(D);
if (f.gecko && f.version < 10900 && B.lang.dir == 'rtl') B.l
ang.dir = 'ltr';
B.fire('langLoaded');
var E = B.config;
E.contentsLangDirection == 'ui' && (E.contentsLangDirection
= B.lang.dir);
w(B);
});
},
w = function (B) {
var C = B.config,
D = C.plugins,
E = C.extraPlugins,
F = C.removePlugins;
if (E) {
var G = new RegExp('(?:^|,)(?:' + E.replace(/\s*,\s*/g, '|')
+ ')(?=,|$)', 'g');
D = D.replace(G, '');
D += ',' + E;
}
if (F) {
G = new RegExp('(?:^|,)(?:' + F.replace(/\s*,\s*/g, '|') + '
)(?=,|$)', 'g');
D = D.replace(G, '');
}
f.air && (D += ',adobeair');
n.load(D.split(','), function (H) {
var I = [],
J = [],
K = [];
B.plugins = H;
for (var L in H) {
var M = H[L],
N = M.lang,
O = n.getPath(L),
P = null;
M.path = O;
if (N) {
P = i.indexOf(N, B.langCode) >= 0 ? B.langCode : N[0
];
if (!M.langEntries || !M.langEntries[P]) K.push(e.ge
tUrl(O + 'lang/' + P + '.js'));
else {
i.extend(B.lang, M.langEntries[P]);
P = null;
}
}
J.push(P);
I.push(M);
}
e.scriptLoader.load(K, function () {
var Q = ['beforeInit', 'init', 'afterInit'];
for (var R = 0; R < Q.length; R++)
for (var S = 0; S < I.length; S++) {
var T = I[S];
if (R === 0 && J[S] && T.lang) i.extend(B.lang,
T.langEntries[J[S]]);
if (T[Q[R]]) T[Q[R]](B);
}
B.fire('pluginsLoaded');
y(B);
});
});
},
x = function (B) {
e.skins.load(B, 'editor', function () {
v(B);
});
},
y = function (B) {
var C = B.config.theme;
e.themes.load(C, function () {
var D = B.theme = e.themes.get(C);
D.path = e.themes.getPath(C);
D.build(B);
if (B.config.autoUpdateElement) z(B);
});
},
z = function (B) {
var C = B.element;
if (B.elementMode == 1 && C.is('textarea')) {
var D = C.$.form && new l(C.$.form);
if (D) {
function E() {
B.updateElement();
};
D.on('submit', E);
if (!D.$.submit.nodeName && !D.$.submit.length) D.$.subm
it = i.override(D.$.submit, function (F) {
return function () {
B.updateElement();
if (F.apply) F.apply(this, arguments);
else F();
};
});
B.on('destroy', function () {
D.removeListener('submit', E);
});
}
}
};
function A() {
var B, C = this._.commands,
D = this.mode;
if (!D) return;
for (var E in C) {
B = C[E];
B[B.startDisabled ? 'disable' : this.readOnly && !B.readOnly ? '
disable' : B.modes[D] ? 'enable' : 'disable']();
}
};
e.editor.prototype._init = function () {
var D = this;
var B = l.get(D._.element),
C = D._.instanceConfig;
delete D._.element;
delete D._.instanceConfig;
D._.commands = {};
D._.styles = [];
D.element = B;
D.name = B && D.elementMode == 1 && (B.getId() || B.getNameAtt()) ||
q();
if (D.name in e.instances) throw '[CKEDITOR.editor] The instance "'
+ D.name + '" already exists.';
D.id = i.getNextId();
D.config = i.prototypedCopy(m);
D.ui = new o(D);
D.focusManager = new e.focusManager(D);
e.fire('instanceCreated', null, D);
D.on('mode', A, null, null, 1);
D.on('readOnly', A, null, null, 1);
t(D, C);
};
})();
i.extend(e.editor.prototype, {
addCommand: function (p, q) {
return this._.commands[p] = new e.command(this, q);
},
addCss: function (p) {
this._.styles.push(p);
},
destroy: function (p) {
var q = this;
if (!p) q.updateElement();
q.fire('destroy');
q.theme && q.theme.destroy(q);
e.remove(q);
e.fire('instanceDestroyed', null, q);
},
execCommand: function (p, q) {
var r = this.getCommand(p),
s = {
name: p,
commandData: q,
command: r
};
if (r && r.state != 0)
if (this.fire('beforeCommandExec', s) !== true) {
s.returnValue = r.exec(s.commandData);
if (!r.async && this.fire('afterCommandExec', s) !== true) r
eturn s.returnValue;
}
return false;
},
getCommand: function (p) {
return this._.commands[p];
},
getData: function () {
var r = this;
r.fire('beforeGetData');
var p = r._.data;
if (typeof p != 'string') {
var q = r.element;
if (q && r.elementMode == 1) p = q.is('textarea') ? q.getValue()
: q.getHtml();
else p = '';
}
p = {
dataValue: p
};
r.fire('getData', p);
return p.dataValue;
},
getSnapshot: function () {
var p = this.fire('getSnapshot');
if (typeof p != 'string') {
var q = this.element;
if (q && this.elementMode == 1) p = q.is('textarea') ? q.getValu
e() : q.getHtml();
}
return p;
},
loadSnapshot: function (p) {
this.fire('loadSnapshot', p);
},
setData: function (p, q, r) {
if (q) this.on('dataReady', function (t) {
t.removeListener();
q.call(t.editor);
});
var s = {
dataValue: p
};
!r && this.fire('setData', s);
this._.data = s.dataValue;
!r && this.fire('afterSetData', s);
},
setReadOnly: function (p) {
p = p == undefined || p;
if (this.readOnly != p) {
this.readOnly = p;
this.fire('readOnly');
}
},
insertHtml: function (p) {
this.fire('insertHtml', p);
},
insertText: function (p) {
this.fire('insertText', p);
},
insertElement: function (p) {
this.fire('insertElement', p);
},
checkDirty: function () {
return this.mayBeDirty && this._.previousValue !== this.getSnapshot(
);
},
resetDirty: function () {
if (this.mayBeDirty) this._.previousValue = this.getSnapshot();
},
updateElement: function () {
var r = this;
var p = r.element;
if (p && r.elementMode == 1) {
var q = r.getData();
if (r.config.htmlEncodeOutput) q = i.htmlEncode(q);
if (p.is('textarea')) p.setValue(q);
else p.setHtml(q);
}
}
});
e.on('loaded', function () {
var p = e.editor._pending;
if (p) {
delete e.editor._pending;
for (var q = 0; q < p.length; q++) p[q]._init();
}
});
e.htmlParser = function () {
this._ = {
htmlPartsRegex: new RegExp("<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-
->)|(?:([^\\s>]+)\\s*((?:(?:\"[^\"]*\")|(?:'[^']*')|[^\"'>])*)\\/?>))", 'g')
};
};
(function () {
var p = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+
)))|(?=\s|$))/g,
q = {
checked: 1,
compact: 1,
declare: 1,
defer: 1,
disabled: 1,
ismap: 1,
multiple: 1,
nohref: 1,
noresize: 1,
noshade: 1,
nowrap: 1,
readonly: 1,
selected: 1
};
e.htmlParser.prototype = {
onTagOpen: function () {},
onTagClose: function () {},
onText: function () {},
onCDATA: function () {},
onComment: function () {},
parse: function (r) {
var E = this;
var s, t, u = 0,
v;
while (s = E._.htmlPartsRegex.exec(r)) {
var w = s.index;
if (w > u) {
var x = r.substring(u, w);
if (v) v.push(x);
else E.onText(x);
}
u = E._.htmlPartsRegex.lastIndex;
if (t = s[1]) {
t = t.toLowerCase();
if (v && j.$cdata[t]) {
E.onCDATA(v.join(''));
v = null;
}
if (!v) {
E.onTagClose(t);
continue;
}
}
if (v) {
v.push(s[0]);
continue;
}
if (t = s[3]) {
t = t.toLowerCase();
if (/="/.test(t)) continue;
var y = {},
z, A = s[4],
B = !!(A && A.charAt(A.length - 1) == '/');
if (A)
while (z = p.exec(A)) {
var C = z[1].toLowerCase(),
D = z[2] || z[3] || z[4] || '';
if (!D && q[C]) y[C] = C;
else y[C] = D;
}
E.onTagOpen(t, y, B);
if (!v && j.$cdata[t]) v = [];
continue;
}
if (t = s[2]) E.onComment(t);
}
if (r.length > u) E.onText(r.substring(u, r.length));
}
};
})();
e.htmlParser.comment = function (p) {
this.value = p;
this._ = {
isBlockLike: false
};
};
e.htmlParser.comment.prototype = {
type: 8,
writeHtml: function (p, q) {
var r = this.value;
if (q) {
if (!(r = q.onComment(r, this))) return;
if (typeof r != 'string') {
r.parent = this.parent;
r.writeHtml(p, q);
return;
}
}
p.comment(r);
}
};
(function () {
e.htmlParser.text = function (p) {
this.value = p;
this._ = {
isBlockLike: false
};
};
e.htmlParser.text.prototype = {
type: 3,
writeHtml: function (p, q) {
var r = this.value;
if (q && !(r = q.onText(r, this))) return;
p.text(r);
}
};
})();
(function () {
e.htmlParser.cdata = function (p) {
this.value = p;
};
e.htmlParser.cdata.prototype = {
type: 3,
writeHtml: function (p) {
p.write(this.value);
}
};
})();
e.htmlParser.fragment = function () {
this.children = [];
this.parent = null;
this._ = {
isBlockLike: true,
hasInlineStarted: false
};
};
(function () {
var p = i.extend({
table: 1,
ul: 1,
ol: 1,
dl: 1
}, j.table, j.ul, j.ol, j.dl),
q = g && f.version < 8 ? {
dd: 1,
dt: 1
} : {},
r = {
ol: 1,
ul: 1
},
s = i.extend({}, {
html: 1
}, j.html, j.body, j.head, {
style: 1,
script: 1
});
function t(u) {
return u.name == 'a' && u.attributes.href || j.$removeEmpty[u.name];
};
e.htmlParser.fragment.fromHtml = function (u, v, w) {
var x = new e.htmlParser(),
y = w || new e.htmlParser.fragment(),
z = [],
A = [],
B = y,
C = false,
D = false;
function E(H) {
var I;
if (z.length > 0)
for (var J = 0; J < z.length; J++) {
var K = z[J],
L = K.name,
M = j[L],
N = B.name && j[B.name];
if ((!N || N[L]) && (!H || !M || M[H] || !j[H])) {
if (!I) {
F();
I = 1;
}
K = K.clone();
K.parent = B;
B = K;
z.splice(J, 1);
J--;
} else if (L == B.name) G(B, B.parent, 1), J--;
}
};
function F() {
while (A.length) B.add(A.shift());
};
function G(H, I, J) {
if (H.previous !== undefined) return;
I = I || B || y;
var K = B;
if (v && (!I.type || I.name == 'body')) {
var L, M;
if (H.attributes && (M = H.attributes['data-cke-real-element
-type'])) L = M;
else L = H.name; if (L && !(L in j.$body || L == 'body' || H
.isOrphan)) {
B = I;
x.onTagOpen(v, {});
H.returnPoint = I = B;
}
}
if (H._.isBlockLike && H.name != 'pre' && H.name != 'textarea')
{
var N = H.children.length,
O = H.children[N - 1],
P;
if (O && O.type == 3)
if (!(P = i.rtrim(O.value))) H.children.length = N - 1;
else O.value = P;
}
I.add(H);
if (H.returnPoint) {
B = H.returnPoint;
delete H.returnPoint;
} else B = J ? I : K;
};
x.onTagOpen = function (H, I, J, K) {
var L = new e.htmlParser.element(H, I);
if (L.isUnknown && J) L.isEmpty = true;
L.isOptionalClose = H in q || K;
if (t(L)) {
z.push(L);
return;
} else if (H == 'pre') D = true;
else if (H == 'br' && D) {
B.add(new e.htmlParser.text('\n'));
return;
} else if (H == 'textarea') C = true;
if (H == 'br') {
A.push(L);
return;
}
while (1) {
var M = B.name,
N = M ? j[M] || (B._.isBlockLike ? j.div : j.span) : s;
if (!L.isUnknown && !B.isUnknown && !N[H]) {
if (B.isOptionalClose) x.onTagClose(M);
else if (H in r && M in r) {
var O = B.children,
P = O[O.length - 1];
if (!(P && P.name == 'li')) G(P = new e.htmlParser.e
lement('li'), B);
!L.returnPoint && (L.returnPoint = B);
B = P;
} else if (H in j.$listItem && M != H) x.onTagOpen(H ==
'li' ? 'ul' : 'dl', {}, 0, 1);
else if (M in p && M != H) {
!L.returnPoint && (L.returnPoint = B);
B = B.parent;
} else {
if (M in j.$inline) z.unshift(B);
if (B.parent) G(B, B.parent, 1);
else {
L.isOrphan = 1;
break;
}
}
} else break;
}
E(H);
F();
L.parent = B;
if (L.isEmpty) G(L);
else B = L;
};
x.onTagClose = function (H) {
for (var I = z.length - 1; I >= 0; I--) {
if (H == z[I].name) {
z.splice(I, 1);
return;
}
}
var J = [],
K = [],
L = B;
while (L != y && L.name != H) {
if (!L._.isBlockLike) K.unshift(L);
J.push(L);
L = L.returnPoint || L.parent;
}
if (L != y) {
for (I = 0; I < J.length; I++) {
var M = J[I];
G(M, M.parent);
}
B = L;
if (B.name == 'pre') D = false;
if (B.name == 'textarea') C = false;
if (L._.isBlockLike) F();
G(L, L.parent);
if (L == B) B = B.parent;
z = z.concat(K);
}
if (H == 'body') v = false;
};
x.onText = function (H) {
if ((!B._.hasInlineStarted || A.length) && !D && !C) {
H = i.ltrim(H);
if (H.length === 0) return;
}
F();
E();
if (v && (!B.type || B.name == 'body') && i.trim(H)) this.onTagO
pen(v, {}, 0, 1);
if (!D && !C) H = H.replace(/[\t\r\n ]{2,}|[\t\r\n]/g, ' ');
B.add(new e.htmlParser.text(H));
};
x.onCDATA = function (H) {
B.add(new e.htmlParser.cdata(H));
};
x.onComment = function (H) {
F();
E();
B.add(new e.htmlParser.comment(H));
};
x.parse(u);
F(!g && 1);
while (B != y) G(B, B.parent, 1);
return y;
};
e.htmlParser.fragment.prototype = {
add: function (u, v) {
var x = this;
isNaN(v) && (v = x.children.length);
var w = v > 0 ? x.children[v - 1] : null;
if (w) {
if (u._.isBlockLike && w.type == 3) {
w.value = i.rtrim(w.value);
if (w.value.length === 0) {
x.children.pop();
x.add(u);
return;
}
}
w.next = u;
}
u.previous = w;
u.parent = x;
x.children.splice(v, 0, u);
x._.hasInlineStarted = u.type == 3 || u.type == 1 && !u._.isBloc
kLike;
},
writeHtml: function (u, v) {
var w;
this.filterChildren = function () {
var x = new e.htmlParser.basicWriter();
this.writeChildrenHtml.call(this, x, v, true);
var y = x.getHtml();
this.children = new e.htmlParser.fragment.fromHtml(y).childr
en;
w = 1;
};
!this.name && v && v.onFragment(this);
this.writeChildrenHtml(u, w ? null : v);
},
writeChildrenHtml: function (u, v) {
for (var w = 0; w < this.children.length; w++) this.children[w].
writeHtml(u, v);
}
};
})();
e.htmlParser.element = function (p, q) {
var w = this;
w.name = p;
w.attributes = q || (q = {});
w.children = [];
var r = q['data-cke-real-element-type'] || p || '',
s = r.match(/^cke:(.*)/);
s && (r = s[1]);
var t = j,
u = !!(t.$nonBodyContent[r] || t.$block[r] || t.$listItem[r] || t.$t
ableContent[r] || t.$nonEditable[r] || r == 'br'),
v = !!t.$empty[p];
w.isEmpty = v;
w.isUnknown = !t[p];
w._ = {
isBlockLike: u,
hasInlineStarted: v || !u
};
};
e.htmlParser.cssStyle = function () {
var p, q = arguments[0],
r = {};
p = q instanceof e.htmlParser.element ? q.attributes.style : q;
(p || '').replace(/&quot;/g, '"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*
(?=;|$)/g, function (s, t, u) {
t == 'font-family' && (u = u.replace(/["']/g, ''));
r[t.toLowerCase()] = u;
});
return {
rules: r,
populate: function (s) {
var t = this.toString();
if (t) s instanceof l ? s.setAttribute('style', t) : s instanceo
f e.htmlParser.element ? s.attributes.style = t : s.style = t;
},
'toString': function () {
var s = [];
for (var t in r) r[t] && s.push(t, ':', r[t], ';');
return s.join('');
}
};
};
(function () {
var p = function (q, r) {
q = q[0];
r = r[0];
return q < r ? -1 : q > r ? 1 : 0;
};
e.htmlParser.element.prototype = {
type: 1,
add: e.htmlParser.fragment.prototype.add,
clone: function () {
return new e.htmlParser.element(this.name, this.attributes);
},
writeHtml: function (q, r) {
var s = this.attributes,
t = this,
u = t.name,
v, w, x, y;
t.filterChildren = function () {
if (!y) {
var F = new e.htmlParser.basicWriter();
e.htmlParser.fragment.prototype.writeChildrenHtml.call(t
, F, r);
t.children = new e.htmlParser.fragment.fromHtml(F.getHtm
l(), 0, t.clone()).children;
y = 1;
}
};
if (r) {
for (;;) {
if (!(u = r.onElementName(u))) return;
t.name = u;
if (!(t = r.onElement(t))) return;
t.parent = this.parent;
if (t.name == u) break;
if (t.type != 1) {
t.writeHtml(q, r);
return;
}
u = t.name;
if (!u) {
for (var z = 0, A = this.children.length; z < A; z++
) this.children[z].parent = t.parent;
this.writeChildrenHtml.call(t, q, y ? null : r);
return;
}
}
s = t.attributes;
}
q.openTag(u, s);
var B = [];
for (var C = 0; C < 2; C++)
for (v in s) {
w = v;
x = s[v];
if (C == 1) B.push([v, x]);
else if (r) {
for (;;) {
if (!(w = r.onAttributeName(v))) {
delete s[v];
break;
} else if (w != v) {
delete s[v];
v = w;
continue;
} else break;
}
if (w)
if ((x = r.onAttribute(t, w, x)) === false) dele
te s[w];
else s[w] = x;
}
}
if (q.sortAttributes) B.sort(p);
var D = B.length;
for (C = 0; C < D; C++) {
var E = B[C];
q.attribute(E[0], E[1]);
}
q.openTagClose(u, t.isEmpty);
if (!t.isEmpty) {
this.writeChildrenHtml.call(t, q, y ? null : r);
q.closeTag(u);
}
},
writeChildrenHtml: function (q, r) {
e.htmlParser.fragment.prototype.writeChildrenHtml.apply(this, ar
guments);
}
};
})();
(function () {
e.htmlParser.filter = i.createClass({
$: function (u) {
this._ = {
elementNames: [],
attributeNames: [],
elements: {
$length: 0
},
attributes: {
$length: 0
}
};
if (u) this.addRules(u, 10);
},
proto: {
addRules: function (u, v) {
var w = this;
if (typeof v != 'number') v = 10;
q(w._.elementNames, u.elementNames, v);
q(w._.attributeNames, u.attributeNames, v);
r(w._.elements, u.elements, v);
r(w._.attributes, u.attributes, v);
w._.text = s(w._.text, u.text, v) || w._.text;
w._.comment = s(w._.comment, u.comment, v) || w._.comment;
w._.root = s(w._.root, u.root, v) || w._.root;
},
onElementName: function (u) {
return p(u, this._.elementNames);
},
onAttributeName: function (u) {
return p(u, this._.attributeNames);
},
onText: function (u) {
var v = this._.text;
return v ? v.filter(u) : u;
},
onComment: function (u, v) {
var w = this._.comment;
return w ? w.filter(u, v) : u;
},
onFragment: function (u) {
var v = this._.root;
return v ? v.filter(u) : u;
},
onElement: function (u) {
var z = this;
var v = [z._.elements['^'], z._.elements[u.name], z._.elemen
ts.$],
w, x;
for (var y = 0; y < 3; y++) {
w = v[y];
if (w) {
x = w.filter(u, z);
if (x === false) return null;
if (x && x != u) return z.onNode(x);
if (u.parent && !u.name) break;
}
}
return u;
},
onNode: function (u) {
var v = u.type;
return v == 1 ? this.onElement(u) : v == 3 ? new e.htmlParse
r.text(this.onText(u.value)) : v == 8 ? new e.htmlParser.comment(this.onComment(
u.value)) : null;
},
onAttribute: function (u, v, w) {
var x = this._.attributes[v];
if (x) {
var y = x.filter(w, u, this);
if (y === false) return false;
if (typeof y != 'undefined') return y;
}
return w;
}
}
});
function p(u, v) {
for (var w = 0; u && w < v.length; w++) {
var x = v[w];
u = u.replace(x[0], x[1]);
}
return u;
};
function q(u, v, w) {
if (typeof v == 'function') v = [v];
var x, y, z = u.length,
A = v && v.length;
if (A) {
for (x = 0; x < z && u[x].pri < w; x++) {}
for (y = A - 1; y >= 0; y--) {
var B = v[y];
if (B) {
B.pri = w;
u.splice(x, 0, B);
}
}
}
};
function r(u, v, w) {
if (v)
for (var x in v) {
var y = u[x];
u[x] = s(y, v[x], w);
if (!y) u.$length++;
}
};
function s(u, v, w) {
if (v) {
v.pri = w;
if (u) {
if (!u.splice) {
if (u.pri > w) u = [v, u];
else u = [u, v];
u.filter = t;
} else q(u, v, w);
return u;
} else {
v.filter = v;
return v;
}
}
};
function t(u) {
var v = u.type || u instanceof e.htmlParser.fragment;
for (var w = 0; w < this.length; w++) {
if (v) var x = u.type,
y = u.name;
var z = this[w],
A = z.apply(window, arguments);
if (A === false) return A;
if (v) {
if (A && (A.name != y || A.type != x)) return A;
} else if (typeof A != 'string') return A;
A != undefined && (u = A);
}
return u;
};
})();
e.htmlParser.basicWriter = i.createClass({
$: function () {
this._ = {
output: []
};
},
proto: {
openTag: function (p, q) {
this._.output.push('<', p);
},
openTagClose: function (p, q) {
if (q) this._.output.push(' />');
else this._.output.push('>');
},
attribute: function (p, q) {
if (typeof q == 'string') q = i.htmlEncodeAttr(q);
this._.output.push(' ', p, '="', q, '"');
},
closeTag: function (p) {
this._.output.push('</', p, '>');
},
text: function (p) {
this._.output.push(p);
},
comment: function (p) {
this._.output.push('<!--', p, '-->');
},
write: function (p) {
this._.output.push(p);
},
reset: function () {
this._.output = [];
this._.indent = false;
},
getHtml: function (p) {
var q = this._.output.join('');
if (p) this.reset();
return q;
}
}
});
delete e.loadFullCore;
e.instances = {};
e.document = new k(document);
e.add = function (p) {
e.instances[p.name] = p;
p.on('focus', function () {
if (e.currentInstance != p) {
e.currentInstance = p;
e.fire('currentInstance');
}
});
p.on('blur', function () {
if (e.currentInstance == p) {
e.currentInstance = null;
e.fire('currentInstance');
}
});
};
e.remove = function (p) {
delete e.instances[p.name];
};
e.on('instanceDestroyed', function () {
if (i.isEmpty(this.instances)) e.fire('reset');
});
e.TRISTATE_ON = 1;
e.TRISTATE_OFF = 2;
e.TRISTATE_DISABLED = 0;
h.comment = i.createClass({
base: h.node,
$: function (p, q) {
if (typeof p == 'string') p = (q ? q.$ : document).createComment(p);
this.base(p);
},
proto: {
type: 8,
getOuterHtml: function () {
return '<!--' + this.$.nodeValue + '-->';
}
}
});
(function () {
var p = {
address: 1,
blockquote: 1,
dl: 1,
h1: 1,
h2: 1,
h3: 1,
h4: 1,
h5: 1,
h6: 1,
p: 1,
pre: 1,
li: 1,
dt: 1,
dd: 1,
legend: 1,
caption: 1
},
q = {
body: 1,
div: 1,
table: 1,
tbody: 1,
tr: 1,
td: 1,
th: 1,
form: 1,
fieldset: 1
},
r = function (s) {
var t = s.getChildren();
for (var u = 0, v = t.count(); u < v; u++) {
var w = t.getItem(u);
if (w.type == 1 && j.$block[w.getName()]) return true;
}
return false;
};
h.elementPath = function (s) {
var y = this;
var t = null,
u = null,
v = [],
w = s;
while (w) {
if (w.type == 1) {
if (!y.lastElement) y.lastElement = w;
var x = w.getName();
if (g && w.$.scopeName != 'HTML') x = w.$.scopeName.toLowerC
ase() + ':' + x;
if (!u) {
if (!t && p[x]) t = w;
if (q[x])
if (!t && x == 'div' && !r(w)) t = w;
else u = w;
}
v.push(w);
if (x == 'body') break;
}
w = w.getParent();
}
y.block = t;
y.blockLimit = u;
y.elements = v;
};
})();
h.elementPath.prototype = {
compare: function (p) {
var q = this.elements,
r = p && p.elements;
if (!r || q.length != r.length) return false;
for (var s = 0; s < q.length; s++) {
if (!q[s].equals(r[s])) return false;
}
return true;
},
contains: function (p) {
var q = this.elements;
for (var r = 0; r < q.length; r++) {
if (q[r].getName() in p) return q[r];
}
return null;
}
};
h.text = function (p, q) {
if (typeof p == 'string') p = (q ? q.$ : document).createTextNode(p);
this.$ = p;
};
h.text.prototype = new h.node();
i.extend(h.text.prototype, {
type: 3,
getLength: function () {
return this.$.nodeValue.length;
},
getText: function () {
return this.$.nodeValue;
},
setText: function (p) {
this.$.nodeValue = p;
},
split: function (p) {
var u = this;
if (g && p == u.getLength()) {
var q = u.getDocument().createText('');
q.insertAfter(u);
return q;
}
var r = u.getDocument(),
s = new h.text(u.$.splitText(p), r);
if (f.ie8) {
var t = new h.text('', r);
t.insertAfter(s);
t.remove();
}
return s;
},
substring: function (p, q) {
if (typeof q != 'number') return this.$.nodeValue.substr(p);
else return this.$.nodeValue.substring(p, q);
}
});
h.documentFragment = function (p) {
p = p || e.document;
this.$ = p.$.createDocumentFragment();
};
i.extend(h.documentFragment.prototype, l.prototype, {
type: 11,
insertAfterNode: function (p) {
p = p.$;
p.parentNode.insertBefore(this.$, p.nextSibling);
}
}, true, {
append: 1,
appendBogus: 1,
getFirst: 1,
getLast: 1,
appendTo: 1,
moveChildren: 1,
insertBefore: 1,
insertAfterNode: 1,
replace: 1,
trim: 1,
type: 1,
ltrim: 1,
rtrim: 1,
getDocument: 1,
getChildCount: 1,
getChild: 1,
getChildren: 1
});
(function () {
function p(w, x) {
if (this._.end) return null;
var y, z = this.range,
A, B = this.guard,
C = this.type,
D = w ? 'getPreviousSourceNode' : 'getNextSourceNode';
if (!this._.start) {
this._.start = 1;
z.trim();
if (z.collapsed) {
this.end();
return null;
}
}
if (!w && !this._.guardLTR) {
var E = z.endContainer,
F = E.getChild(z.endOffset);
this._.guardLTR = function (J, K) {
return (!K || !E.equals(J)) && (!F || !J.equals(F)) && (J.ty
pe != 1 || !K || J.getName() != 'body');
};
}
if (w && !this._.guardRTL) {
var G = z.startContainer,
H = z.startOffset > 0 && G.getChild(z.startOffset - 1);
this._.guardRTL = function (J, K) {
return (!K || !G.equals(J)) && (!H || !J.equals(H)) && (J.ty
pe != 1 || !K || J.getName() != 'body');
};
}
var I = w ? this._.guardRTL : this._.guardLTR;
if (B) A = function (J, K) {
if (I(J, K) === false) return false;
return B(J, K);
};
else A = I; if (this.current) y = this.current[D](false, C, A);
else if (w) {
y = z.endContainer;
if (z.endOffset > 0) {
y = y.getChild(z.endOffset - 1);
if (A(y) === false) y = null;
} else y = A(y, true) === false ? null : y.getPreviousSourceNode
(true, C, A);
} else {
y = z.startContainer;
y = y.getChild(z.startOffset);
if (y) {
if (A(y) === false) y = null;
} else y = A(z.startContainer, true) === false ? null : z.startC
ontainer.getNextSourceNode(true, C, A);
}
while (y && !this._.end) {
this.current = y;
if (!this.evaluator || this.evaluator(y) !== false) {
if (!x) return y;
} else if (x && this.evaluator) return false;
y = y[D](false, C, A);
}
this.end();
return this.current = null;
};
function q(w) {
var x, y = null;
while (x = p.call(this, w)) y = x;
return y;
};
h.walker = i.createClass({
$: function (w) {
this.range = w;
this._ = {};
},
proto: {
end: function () {
this._.end = 1;
},
next: function () {
return p.call(this);
},
previous: function () {
return p.call(this, 1);
},
checkForward: function () {
return p.call(this, 0, 1) !== false;
},
checkBackward: function () {
return p.call(this, 1, 1) !== false;
},
lastForward: function () {
return q.call(this);
},
lastBackward: function () {
return q.call(this, 1);
},
reset: function () {
delete this.current;
this._ = {};
}
}
});
var r = {
block: 1,
'list-item': 1,
table: 1,
'table-row-group': 1,
'table-header-group': 1,
'table-footer-group': 1,
'table-row': 1,
'table-column-group': 1,
'table-column': 1,
'table-cell': 1,
'table-caption': 1
};
l.prototype.isBlockBoundary = function (w) {
var x = w ? i.extend({}, j.$block, w || {}) : j.$block;
return this.getComputedStyle('float') == 'none' && r[this.getCompute
dStyle('display')] || x[this.getName()];
};
h.walker.blockBoundary = function (w) {
return function (x, y) {
return !(x.type == 1 && x.isBlockBoundary(w));
};
};
h.walker.listItemBoundary = function () {
return this.blockBoundary({
br: 1
});
};
h.walker.bookmark = function (w, x) {
function y(z) {
return z && z.getName && z.getName() == 'span' && z.data('cke-bo
okmark');
};
return function (z) {
var A, B;
A = z && !z.getName && (B = z.getParent()) && y(B);
A = w ? A : A || y(z);
return !!(x ^ A);
};
};
h.walker.whitespaces = function (w) {
return function (x) {
var y = x && x.type == 3 && !i.trim(x.getText());
return !!(w ^ y);
};
};
h.walker.invisible = function (w) {
var x = h.walker.whitespaces();
return function (y) {
var z = x(y) || y.is && !y.$.offsetHeight;
return !!(w ^ z);
};
};
h.walker.nodeType = function (w, x) {
return function (y) {
return !!(x ^ y.type == w);
};
};
var s = /^[\t\r\n ]*(?:&nbsp;|\xa0)$/,
t = h.walker.whitespaces(),
u = h.walker.bookmark(),
v = function (w) {
return u(w) || t(w) || w.type == 1 && w.getName() in j.$inline &
& !(w.getName() in j.$empty);
};
l.prototype.getBogus = function () {
var w = this;
do w = w.getPreviousSourceNode(); while (v(w));
if (w && (!g ? w.is && w.is('br') : w.getText && s.test(w.getText())
)) return w;
return false;
};
})();
h.range = function (p) {
var q = this;
q.startContainer = null;
q.startOffset = null;
q.endContainer = null;
q.endOffset = null;
q.collapsed = true;
q.document = p;
};
(function () {
var p = function (x) {
x.collapsed = x.startContainer && x.endContainer && x.startConta
iner.equals(x.endContainer) && x.startOffset == x.endOffset;
},
q = function (x, y, z, A) {
x.optimizeBookmark();
var B = x.startContainer,
C = x.endContainer,
D = x.startOffset,
E = x.endOffset,
F, G;
if (C.type == 3) C = C.split(E);
else if (C.getChildCount() > 0)
if (E >= C.getChildCount()) {
C = C.append(x.document.createText(''));
G = true;
} else C = C.getChild(E);
if (B.type == 3) {
B.split(D);
if (B.equals(C)) C = B.getNext();
} else if (!D) {
B = B.getFirst().insertBeforeMe(x.document.createText(''));
F = true;
} else if (D >= B.getChildCount()) {
B = B.append(x.document.createText(''));
F = true;
} else B = B.getChild(D).getPrevious();
var H = B.getParents(),
I = C.getParents(),
J, K, L;
for (J = 0; J < H.length; J++) {
K = H[J];
L = I[J];
if (!K.equals(L)) break;
}
var M = z,
N, O, P, Q;
for (var R = J; R < H.length; R++) {
N = H[R];
if (M && !N.equals(B)) O = M.append(N.clone());
P = N.getNext();
while (P) {
if (P.equals(I[R]) || P.equals(C)) break;
Q = P.getNext();
if (y == 2) M.append(P.clone(true));
else {
P.remove();
if (y == 1) M.append(P);
}
P = Q;
}
if (M) M = O;
}
M = z;
for (var S = J; S < I.length; S++) {
N = I[S];
if (y > 0 && !N.equals(C)) O = M.append(N.clone());
if (!H[S] || N.$.parentNode != H[S].$.parentNode) {
P = N.getPrevious();
while (P) {
if (P.equals(H[S]) || P.equals(B)) break;
Q = P.getPrevious();
if (y == 2) M.$.insertBefore(P.$.cloneNode(true), M.
$.firstChild);
else {
P.remove();
if (y == 1) M.$.insertBefore(P.$, M.$.firstChild
);
}
P = Q;
}
}
if (M) M = O;
}
if (y == 2) {
var T = x.startContainer;
if (T.type == 3) {
T.$.data += T.$.nextSibling.data;
T.$.parentNode.removeChild(T.$.nextSibling);
}
var U = x.endContainer;
if (U.type == 3 && U.$.nextSibling) {
U.$.data += U.$.nextSibling.data;
U.$.parentNode.removeChild(U.$.nextSibling);
}
} else {
if (K && L && (B.$.parentNode != K.$.parentNode || C.$.paren
tNode != L.$.parentNode)) {
var V = L.getIndex();
if (F && L.$.parentNode == B.$.parentNode) V--;
if (A && K.type == 1) {
var W = l.createFromHtml('<span data-cke-bookmark="1
" style="display:none">&nbsp;</span>', x.document);
W.insertAfter(K);
K.mergeSiblings(false);
x.moveToBookmark({
startNode: W
});
} else x.setStart(L.getParent(), V);
}
x.collapse(true);
} if (F) B.remove();
if (G && C.$.parentNode) C.remove();
},
r = {
abbr: 1,
acronym: 1,
b: 1,
bdo: 1,
big: 1,
cite: 1,
code: 1,
del: 1,
dfn: 1,
em: 1,
font: 1,
i: 1,
ins: 1,
label: 1,
kbd: 1,
q: 1,
samp: 1,
small: 1,
span: 1,
strike: 1,
strong: 1,
sub: 1,
sup: 1,
tt: 1,
u: 1,
'var': 1
};
function s(x) {
var y = false,
z = h.walker.bookmark(true);
return function (A) {
if (z(A)) return true;
if (A.type == 3) {
if (A.hasAscendant('pre') || i.trim(A.getText()).length) ret
urn false;
} else if (A.type == 1)
if (!r[A.getName()])
if (!x && !g && A.getName() == 'br' && !y) y = true;
else return false;
return true;
};
};
function t(x) {
return x.type != 3 && x.getName() in j.$removeEmpty || !i.trim(x.get
Text()) || !!x.getParent().data('cke-bookmark');
};
var u = new h.walker.whitespaces(),
v = new h.walker.bookmark();
function w(x) {
return !u(x) && !v(x);
};
h.range.prototype = {
clone: function () {
var y = this;
var x = new h.range(y.document);
x.startContainer = y.startContainer;
x.startOffset = y.startOffset;
x.endContainer = y.endContainer;
x.endOffset = y.endOffset;
x.collapsed = y.collapsed;
return x;
},
collapse: function (x) {
var y = this;
if (x) {
y.endContainer = y.startContainer;
y.endOffset = y.startOffset;
} else {
y.startContainer = y.endContainer;
y.startOffset = y.endOffset;
}
y.collapsed = true;
},
cloneContents: function () {
var x = new h.documentFragment(this.document);
if (!this.collapsed) q(this, 2, x);
return x;
},
deleteContents: function (x) {
if (this.collapsed) return;
q(this, 0, null, x);
},
extractContents: function (x) {
var y = new h.documentFragment(this.document);
if (!this.collapsed) q(this, 1, y, x);
return y;
},
createBookmark: function (x) {
var D = this;
var y, z, A, B, C = D.collapsed;
y = D.document.createElement('span');
y.data('cke-bookmark', 1);
y.setStyle('display', 'none');
y.setHtml('&nbsp;');
if (x) {
A = 'cke_bm_' + i.getNextNumber();
y.setAttribute('id', A + 'S');
}
if (!C) {
z = y.clone();
z.setHtml('&nbsp;');
if (x) z.setAttribute('id', A + 'E');
B = D.clone();
B.collapse();
B.insertNode(z);
}
B = D.clone();
B.collapse(true);
B.insertNode(y);
if (z) {
D.setStartAfter(y);
D.setEndBefore(z);
} else D.moveToPosition(y, 4);
return {
startNode: x ? A + 'S' : y,
endNode: x ? A + 'E' : z,
serializable: x,
collapsed: C
};
},
createBookmark2: function (x) {
var F = this;
var y = F.startContainer,
z = F.endContainer,
A = F.startOffset,
B = F.endOffset,
C = F.collapsed,
D, E;
if (!y || !z) return {
start: 0,
end: 0
};
if (x) {
if (y.type == 1) {
D = y.getChild(A);
if (D && D.type == 3 && A > 0 && D.getPrevious().type ==
3) {
y = D;
A = 0;
}
if (D && D.type == 1) A = D.getIndex(1);
}
while (y.type == 3 && (E = y.getPrevious()) && E.type == 3)
{
y = E;
A += E.getLength();
}
if (!C) {
if (z.type == 1) {
D = z.getChild(B);
if (D && D.type == 3 && B > 0 && D.getPrevious().typ
e == 3) {
z = D;
B = 0;
}
if (D && D.type == 1) B = D.getIndex(1);
}
while (z.type == 3 && (E = z.getPrevious()) && E.type ==
3) {
z = E;
B += E.getLength();
}
}
}
return {
start: y.getAddress(x),
end: C ? null : z.getAddress(x),
startOffset: A,
endOffset: B,
normalized: x,
collapsed: C,
is2: true
};
},
moveToBookmark: function (x) {
var F = this;
if (x.is2) {
var y = F.document.getByAddress(x.start, x.normalized),
z = x.startOffset,
A = x.end && F.document.getByAddress(x.end, x.normalized
),
B = x.endOffset;
F.setStart(y, z);
if (A) F.setEnd(A, B);
else F.collapse(true);
} else {
var C = x.serializable,
D = C ? F.document.getById(x.startNode) : x.startNode,
E = C ? F.document.getById(x.endNode) : x.endNode;
F.setStartBefore(D);
D.remove();
if (E) {
F.setEndBefore(E);
E.remove();
} else F.collapse(true);
}
},
getBoundaryNodes: function () {
var C = this;
var x = C.startContainer,
y = C.endContainer,
z = C.startOffset,
A = C.endOffset,
B;
if (x.type == 1) {
B = x.getChildCount();
if (B > z) x = x.getChild(z);
else if (B < 1) x = x.getPreviousSourceNode();
else {
x = x.$;
while (x.lastChild) x = x.lastChild;
x = new h.node(x);
x = x.getNextSourceNode() || x;
}
}
if (y.type == 1) {
B = y.getChildCount();
if (B > A) y = y.getChild(A).getPreviousSourceNode(true);
else if (B < 1) y = y.getPreviousSourceNode();
else {
y = y.$;
while (y.lastChild) y = y.lastChild;
y = new h.node(y);
}
}
if (x.getPosition(y) & 2) x = y;
return {
startNode: x,
endNode: y
};
},
getCommonAncestor: function (x, y) {
var C = this;
var z = C.startContainer,
A = C.endContainer,
B;
if (z.equals(A)) {
if (x && z.type == 1 && C.startOffset == C.endOffset - 1) B
= z.getChild(C.startOffset);
else B = z;
} else B = z.getCommonAncestor(A);
return y && !B.is ? B.getParent() : B;
},
optimize: function () {
var z = this;
var x = z.startContainer,
y = z.startOffset;
if (x.type != 1)
if (!y) z.setStartBefore(x);
else if (y >= x.getLength()) z.setStartAfter(x);
x = z.endContainer;
y = z.endOffset;
if (x.type != 1)
if (!y) z.setEndBefore(x);
else if (y >= x.getLength()) z.setEndAfter(x);
},
optimizeBookmark: function () {
var z = this;
var x = z.startContainer,
y = z.endContainer;
if (x.is && x.is('span') && x.data('cke-bookmark')) z.setStartAt
(x, 3);
if (y && y.is && y.is('span') && y.data('cke-bookmark')) z.setEn
dAt(y, 4);
},
trim: function (x, y) {
var F = this;
var z = F.startContainer,
A = F.startOffset,
B = F.collapsed;
if ((!x || B) && z && z.type == 3) {
if (!A) {
A = z.getIndex();
z = z.getParent();
} else if (A >= z.getLength()) {
A = z.getIndex() + 1;
z = z.getParent();
} else {
var C = z.split(A);
A = z.getIndex() + 1;
z = z.getParent();
if (F.startContainer.equals(F.endContainer)) F.setEnd(C,
F.endOffset - F.startOffset);
else if (z.equals(F.endContainer)) F.endOffset += 1;
}
F.setStart(z, A);
if (B) {
F.collapse(true);
return;
}
}
var D = F.endContainer,
E = F.endOffset;
if (!(y || B) && D && D.type == 3) {
if (!E) {
E = D.getIndex();
D = D.getParent();
} else if (E >= D.getLength()) {
E = D.getIndex() + 1;
D = D.getParent();
} else {
D.split(E);
E = D.getIndex() + 1;
D = D.getParent();
}
F.setEnd(D, E);
}
},
enlarge: function (x, y) {
switch (x) {
case 1:
if (this.collapsed) return;
var z = this.getCommonAncestor(),
A = this.document.getBody(),
B, C, D, E, F, G = false,
H, I, J = this.startContainer,
K = this.startOffset;
if (J.type == 3) {
if (K) {
J = !i.trim(J.substring(0, K)).length && J;
G = !!J;
}
if (J)
if (!(E = J.getPrevious())) D = J.getParent();
} else {
if (K) E = J.getChild(K - 1) || J.getLast();
if (!E) D = J;
}
while (D || E) {
if (D && !E) {
if (!F && D.equals(z)) F = true;
if (!A.contains(D)) break;
if (!G || D.getComputedStyle('display') != 'inline')
{
G = false;
if (F) B = D;
else this.setStartBefore(D);
}
E = D.getPrevious();
}
while (E) {
H = false;
if (E.type == 3) {
I = E.getText();
if (/[^\s\ufeff]/.test(I)) E = null;
H = /[\s\ufeff]$/.test(I);
} else if ((E.$.offsetWidth > 0 || y && E.is('br'))
&& !E.data('cke-bookmark'))
if (G && j.$removeEmpty[E.getName()]) {
I = E.getText();
if (/[^\s\ufeff]/.test(I)) E = null;
else {
var L = E.$.all || E.$.getElementsByTagN
ame('*');
for (var M = 0, N; N = L[M++];) {
if (!j.$removeEmpty[N.nodeName.toLow
erCase()]) {
E = null;
break;
}
}
} if (E) H = !!I.length;
} else E = null;
if (H)
if (G) {
if (F) B = D;
else if (D) this.setStartBefore(D);
} else G = true;
if (E) {
var O = E.getPrevious();
if (!D && !O) {
D = E;
E = null;
break;
}
E = O;
} else D = null;
}
if (D) D = D.getParent();
}
J = this.endContainer;
K = this.endOffset;
D = E = null;
F = G = false;
if (J.type == 3) {
J = !i.trim(J.substring(K)).length && J;
G = !(J && J.getLength());
if (J)
if (!(E = J.getNext())) D = J.getParent();
} else {
E = J.getChild(K);
if (!E) D = J;
}
while (D || E) {
if (D && !E) {
if (!F && D.equals(z)) F = true;
if (!A.contains(D)) break;
if (!G || D.getComputedStyle('display') != 'inline')
{
G = false;
if (F) C = D;
else if (D) this.setEndAfter(D);
}
E = D.getNext();
}
while (E) {
H = false;
if (E.type == 3) {
I = E.getText();
if (/[^\s\ufeff]/.test(I)) E = null;
H = /^[\s\ufeff]/.test(I);
} else if ((E.$.offsetWidth > 0 || y && E.is('br'))
&& !E.data('cke-bookmark'))
if (G && j.$removeEmpty[E.getName()]) {
I = E.getText();
if (/[^\s\ufeff]/.test(I)) E = null;
else {
L = E.$.all || E.$.getElementsByTagName(
'*');
for (M = 0; N = L[M++];) {
if (!j.$removeEmpty[N.nodeName.toLow
erCase()]) {
E = null;
break;
}
}
} if (E) H = !!I.length;
} else E = null;
if (H)
if (G)
if (F) C = D;
else this.setEndAfter(D);
if (E) {
O = E.getNext();
if (!D && !O) {
D = E;
E = null;
break;
}
E = O;
} else D = null;
}
if (D) D = D.getParent();
}
if (B && C) {
z = B.contains(C) ? C : B;
this.setStartBefore(z);
this.setEndAfter(z);
}
break;
case 2:
case 3:
var P = new h.range(this.document);
A = this.document.getBody();
P.setStartAt(A, 1);
P.setEnd(this.startContainer, this.startOffset);
var Q = new h.walker(P),
R, S, T = h.walker.blockBoundary(x == 3 ? {
br: 1
} : null),
U = function (aa) {
var ab = T(aa);
if (!ab) R = aa;
return ab;
},
V = function (aa) {
var ab = U(aa);
if (!ab && aa.is && aa.is('br')) S = aa;
return ab;
};
Q.guard = U;
D = Q.lastBackward();
R = R || A;
this.setStartAt(R, !R.is('br') && (!D && this.checkStartOfBl
ock() || D && R.contains(D)) ? 1 : 4);
if (x == 3) {
var W = this.clone();
Q = new h.walker(W);
var X = h.walker.whitespaces(),
Y = h.walker.bookmark();
Q.evaluator = function (aa) {
return !X(aa) && !Y(aa);
};
var Z = Q.previous();
if (Z && Z.type == 1 && Z.is('br')) return;
}
P = this.clone();
P.collapse();
P.setEndAt(A, 2);
Q = new h.walker(P);
Q.guard = x == 3 ? V : U;
R = null;
D = Q.lastForward();
R = R || A;
this.setEndAt(R, !D && this.checkEndOfBlock() || D && R.cont
ains(D) ? 2 : 3);
if (S) this.setEndAfter(S);
}
},
shrink: function (x, y) {
if (!this.collapsed) {
x = x || 2;
var z = this.clone(),
A = this.startContainer,
B = this.endContainer,
C = this.startOffset,
D = this.endOffset,
E = this.collapsed,
F = 1,
G = 1;
if (A && A.type == 3)
if (!C) z.setStartBefore(A);
else if (C >= A.getLength()) z.setStartAfter(A);
else {
z.setStartBefore(A);
F = 0;
} if (B && B.type == 3)
if (!D) z.setEndBefore(B);
else if (D >= B.getLength()) z.setEndAfter(B);
else {
z.setEndAfter(B);
G = 0;
}
var H = new h.walker(z),
I = h.walker.bookmark();
H.evaluator = function (M) {
return M.type == (x == 1 ? 1 : 3);
};
var J;
H.guard = function (M, N) {
if (I(M)) return true;
if (x == 1 && M.type == 3) return false;
if (N && M.equals(J)) return false;
if (!N && M.type == 1) J = M;
return true;
};
if (F) {
var K = H[x == 1 ? 'lastForward' : 'next']();
K && this.setStartAt(K, y ? 1 : 3);
}
if (G) {
H.reset();
var L = H[x == 1 ? 'lastBackward' : 'previous']();
L && this.setEndAt(L, y ? 2 : 4);
}
return !!(F || G);
}
},
insertNode: function (x) {
var B = this;
B.optimizeBookmark();
B.trim(false, true);
var y = B.startContainer,
z = B.startOffset,
A = y.getChild(z);
if (A) x.insertBefore(A);
else y.append(x); if (x.getParent().equals(B.endContainer)) B.en
dOffset++;
B.setStartBefore(x);
},
moveToPosition: function (x, y) {
this.setStartAt(x, y);
this.collapse(true);
},
selectNodeContents: function (x) {
this.setStart(x, 0);
this.setEnd(x, x.type == 3 ? x.getLength() : x.getChildCount());
},
setStart: function (x, y) {
var z = this;
if (x.type == 1 && j.$empty[x.getName()]) y = x.getIndex(), x =
x.getParent();
z.startContainer = x;
z.startOffset = y;
if (!z.endContainer) {
z.endContainer = x;
z.endOffset = y;
}
p(z);
},
setEnd: function (x, y) {
var z = this;
if (x.type == 1 && j.$empty[x.getName()]) y = x.getIndex() + 1,
x = x.getParent();
z.endContainer = x;
z.endOffset = y;
if (!z.startContainer) {
z.startContainer = x;
z.startOffset = y;
}
p(z);
},
setStartAfter: function (x) {
this.setStart(x.getParent(), x.getIndex() + 1);
},
setStartBefore: function (x) {
this.setStart(x.getParent(), x.getIndex());
},
setEndAfter: function (x) {
this.setEnd(x.getParent(), x.getIndex() + 1);
},
setEndBefore: function (x) {
this.setEnd(x.getParent(), x.getIndex());
},
setStartAt: function (x, y) {
var z = this;
switch (y) {
case 1:
z.setStart(x, 0);
break;
case 2:
if (x.type == 3) z.setStart(x, x.getLength());
else z.setStart(x, x.getChildCount());
break;
case 3:
z.setStartBefore(x);
break;
case 4:
z.setStartAfter(x);
}
p(z);
},
setEndAt: function (x, y) {
var z = this;
switch (y) {
case 1:
z.setEnd(x, 0);
break;
case 2:
if (x.type == 3) z.setEnd(x, x.getLength());
else z.setEnd(x, x.getChildCount());
break;
case 3:
z.setEndBefore(x);
break;
case 4:
z.setEndAfter(x);
}
p(z);
},
fixBlock: function (x, y) {
var B = this;
var z = B.createBookmark(),
A = B.document.createElement(y);
B.collapse(x);
B.enlarge(2);
B.extractContents().appendTo(A);
A.trim();
if (!g) A.appendBogus();
B.insertNode(A);
B.moveToBookmark(z);
return A;
},
splitBlock: function (x) {
var H = this;
var y = new h.elementPath(H.startContainer),
z = new h.elementPath(H.endContainer),
A = y.blockLimit,
B = z.blockLimit,
C = y.block,
D = z.block,
E = null;
if (!A.equals(B)) return null;
if (x != 'br') {
if (!C) {
C = H.fixBlock(true, x);
D = new h.elementPath(H.endContainer).block;
}
if (!D) D = H.fixBlock(false, x);
}
var F = C && H.checkStartOfBlock(),
G = D && H.checkEndOfBlock();
H.deleteContents();
if (C && C.equals(D))
if (G) {
E = new h.elementPath(H.startContainer);
H.moveToPosition(D, 4);
D = null;
} else if (F) {
E = new h.elementPath(H.startContainer);
H.moveToPosition(C, 3);
C = null;
} else {
D = H.splitElement(C);
if (!g && !C.is('ul', 'ol')) C.appendBogus();
}
return {
previousBlock: C,
nextBlock: D,
wasStartOfBlock: F,
wasEndOfBlock: G,
elementPath: E
};
},
splitElement: function (x) {
var A = this;
if (!A.collapsed) return null;
A.setEndAt(x, 2);
var y = A.extractContents(),
z = x.clone(false);
y.appendTo(z);
z.insertAfter(x);
A.moveToPosition(x, 4);
return z;
},
checkBoundaryOfElement: function (x, y) {
var z = y == 1,
A = this.clone();
A.collapse(z);
A[z ? 'setStartAt' : 'setEndAt'](x, z ? 1 : 2);
var B = new h.walker(A);
B.evaluator = t;
return B[z ? 'checkBackward' : 'checkForward']();
},
checkStartOfBlock: function () {
var D = this;
var x = D.startContainer,
y = D.startOffset;
if (y && x.type == 3) {
var z = i.ltrim(x.substring(0, y));
if (z.length) return false;
}
D.trim();
var A = new h.elementPath(D.startContainer),
B = D.clone();
B.collapse(true);
B.setStartAt(A.block || A.blockLimit, 1);
var C = new h.walker(B);
C.evaluator = s(true);
return C.checkBackward();
},
checkEndOfBlock: function () {
var D = this;
var x = D.endContainer,
y = D.endOffset;
if (x.type == 3) {
var z = i.rtrim(x.substring(y));
if (z.length) return false;
}
D.trim();
var A = new h.elementPath(D.endContainer),
B = D.clone();
B.collapse(false);
B.setEndAt(A.block || A.blockLimit, 2);
var C = new h.walker(B);
C.evaluator = s(false);
return C.checkForward();
},
checkReadOnly: (function () {
function x(y, z) {
while (y) {
if (y.type == 1)
if (y.getAttribute('contentEditable') == 'false' &&
!y.data('cke-editable')) return 0;
else if (y.is('html') || y.getAttribute('contentEdit
able') == 'true' && (y.contains(z) || y.equals(z))) break;
y = y.getParent();
}
return 1;
};
return function () {
var y = this.startContainer,
z = this.endContainer;
return !(x(y, z) && x(z, y));
};
})(),
moveToElementEditablePosition: function (x, y) {
function z(B, C) {
var D;
if (B.type == 1 && B.isEditable(false) && !j.$nonEditable[B.
getName()]) D = B[y ? 'getLast' : 'getFirst'](w);
if (!C && !D) D = B[y ? 'getPrevious' : 'getNext'](w);
return D;
};
var A = 0;
while (x) {
if (x.type == 3) {
this.moveToPosition(x, y ? 4 : 3);
A = 1;
break;
}
if (x.type == 1)
if (x.isEditable()) {
this.moveToPosition(x, y ? 2 : 1);
A = 1;
}
x = z(x, A);
}
return !!A;
},
moveToElementEditStart: function (x) {
return this.moveToElementEditablePosition(x);
},
moveToElementEditEnd: function (x) {
return this.moveToElementEditablePosition(x, true);
},
getEnclosedNode: function () {
var x = this.clone();
x.optimize();
if (x.startContainer.type != 1 || x.endContainer.type != 1) retu
rn null;
var y = new h.walker(x),
z = h.walker.bookmark(true),
A = h.walker.whitespaces(true),
B = function (D) {
return A(D) && z(D);
};
x.evaluator = B;
var C = y.next();
y.reset();
return C && C.equals(y.previous()) ? C : null;
},
getTouchedStartNode: function () {
var x = this.startContainer;
if (this.collapsed || x.type != 1) return x;
return x.getChild(this.startOffset) || x;
},
getTouchedEndNode: function () {
var x = this.endContainer;
if (this.collapsed || x.type != 1) return x;
return x.getChild(this.endOffset - 1) || x;
}
};
})();
e.POSITION_AFTER_START = 1;
e.POSITION_BEFORE_END = 2;
e.POSITION_BEFORE_START = 3;
e.POSITION_AFTER_END = 4;
e.ENLARGE_ELEMENT = 1;
e.ENLARGE_BLOCK_CONTENTS = 2;
e.ENLARGE_LIST_ITEM_CONTENTS = 3;
e.START = 1;
e.END = 2;
e.STARTEND = 3;
e.SHRINK_ELEMENT = 1;
e.SHRINK_TEXT = 2;
(function () {
h.rangeList = function (r) {
if (r instanceof h.rangeList) return r;
if (!r) r = [];
else if (r instanceof h.range) r = [r];
return i.extend(r, p);
};
var p = {
createIterator: function () {
var r = this,
s = h.walker.bookmark(),
t = function (w) {
return !(w.is && w.is('tr'));
},
u = [],
v;
return {
getNextRange: function (w) {
v = v == undefined ? 0 : v + 1;
var x = r[v];
if (x && r.length > 1) {
if (!v)
for (var y = r.length - 1; y >= 0; y--) u.unshif
t(r[y].createBookmark(true));
if (w) {
var z = 0;
while (r[v + z + 1]) {
var A = x.document,
B = 0,
C = A.getById(u[z].endNode),
D = A.getById(u[z + 1].startNode),
E;
while (1) {
E = C.getNextSourceNode(false);
if (!D.equals(E)) {
if (s(E) || E.type == 1 && E.isBlock
Boundary()) {
C = E;
continue;
}
} else B = 1;
break;
}
if (!B) break;
z++;
}
}
x.moveToBookmark(u.shift());
while (z--) {
E = r[++v];
E.moveToBookmark(u.shift());
x.setEnd(E.endContainer, E.endOffset);
}
}
return x;
}
};
},
createBookmarks: function (r) {
var w = this;
var s = [],
t;
for (var u = 0; u < w.length; u++) {
s.push(t = w[u].createBookmark(r, true));
for (var v = u + 1; v < w.length; v++) {
w[v] = q(t, w[v]);
w[v] = q(t, w[v], true);
}
}
return s;
},
createBookmarks2: function (r) {
var s = [];
for (var t = 0; t < this.length; t++) s.push(this[t].createBookm
ark2(r));
return s;
},
moveToBookmarks: function (r) {
for (var s = 0; s < this.length; s++) this[s].moveToBookmark(r[s
]);
}
};
function q(r, s, t) {
var u = r.serializable,
v = s[t ? 'endContainer' : 'startContainer'],
w = t ? 'endOffset' : 'startOffset',
x = u ? s.document.getById(r.startNode) : r.startNode,
y = u ? s.document.getById(r.endNode) : r.endNode;
if (v.equals(x.getPrevious())) {
s.startOffset = s.startOffset - v.getLength() - y.getPrevious().
getLength();
v = y.getNext();
} else if (v.equals(y.getPrevious())) {
s.startOffset = s.startOffset - v.getLength();
v = y.getNext();
}
v.equals(x.getParent()) && s[w]++;
v.equals(y.getParent()) && s[w]++;
s[t ? 'endContainer' : 'startContainer'] = v;
return s;
};
})();
(function () {
if (f.webkit) {
f.hc = false;
return;
}
var p = l.createFromHtml('<div style="width:0px;height:0px;position:abso
lute;left:-10000px;border: 1px solid;border-color: red blue;"></div>', e.documen
t);
p.appendTo(e.document.getHead());
try {
f.hc = p.getComputedStyle('border-top-color') == p.getComputedStyle(
'border-right-color');
} catch (q) {
f.hc = false;
}
if (f.hc) f.cssClass += ' cke_hc';
p.remove();
})();
n.load(m.corePlugins.split(','), function () {
e.status = 'loaded';
e.fire('loaded');
var p = e._.pending;
if (p) {
delete e._.pending;
for (var q = 0; q < p.length; q++) e.add(p[q]);
}
});
if (g) try {
document.execCommand('BackgroundImageCache', false, true);
} catch (p) {}
e.skins.add('kama', (function () {
var q = 'cke_ui_color';
return {
editor: {
css: ['editor.css']
},
dialog: {
css: ['dialog.css']
},
richcombo: {
canGroup: false
},
templates: {
css: ['templates.css']
},
margins: [0, 0, 0, 0],
init: function (r) {
if (r.config.width && !isNaN(r.config.width)) r.config.width -=
12;
var s = [],
t = /\$color/g,
u = '/* UI Color Support */.cke_skin_kama .cke_menuitem .cke
_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !impo
rtant;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .ck
e_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_
icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !impor
tant;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuit
em a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{\tbackgro
und-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover
.cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_ski
n_kama .cke_menuitem a.cke_disabled:active .cke_label{\tbackground-color: transp
arent !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wr
apper,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,.cke_s
kin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper{\tbackground-colo
r: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menu
item a.cke_disabled .cke_icon_wrapper{\tbackground-color: $color !important;\tbo
rder-color: $color !important;}.cke_skin_kama .cke_menuseparator{\tbackground-co
lor: $color !important;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke
_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{\tbackground-color: $col
or !important;}';
if (f.webkit) {
u = u.split('}').slice(0, -1);
for (var v = 0; v < u.length; v++) u[v] = u[v].split('{');
}
function w(z) {
var A = z.getById(q);
if (!A) {
A = z.getHead().append('style');
A.setAttribute('id', q);
A.setAttribute('type', 'text/css');
}
return A;
};
function x(z, A, B) {
var C, D, E;
for (var F = 0; F < z.length; F++) {
if (f.webkit)
for (D = 0; D < A.length; D++) {
E = A[D][1];
for (C = 0; C < B.length; C++) E = E.replace(B[C
][0], B[C][1]);
z[F].$.sheet.addRule(A[D][0], E);
} else {
E = A;
for (C = 0; C < B.length; C++) E = E.replace(B[C
][0], B[C][1]);
if (g) z[F].$.styleSheet.cssText += E;
else z[F].$.innerHTML += E;
}
}
};
var y = /\$color/g;
i.extend(r, {
uiColor: null,
getUiColor: function () {
return this.uiColor;
},
setUiColor: function (z) {
var A, B = w(e.document),
C = '.' + r.id,
D = [C + ' .cke_wrapper', C + '_dialog .cke_dialog_c
ontents', C + '_dialog a.cke_dialog_tab', C + '_dialog .cke_dialog_footer'].join
(','),
E = 'background-color: $color !important;';
if (f.webkit) A = [
[D, E]
];
else A = D + '{' + E + '}';
return (this.setUiColor = function (F) {
var G = [
[y, F]
];
r.uiColor = F;
x([B], A, G);
x(s, u, G);
})(z);
}
});
r.on('menuShow', function (z) {
var A = z.data[0],
B = A.element.getElementsByTag('iframe').getItem(0).getF
rameDocument();
if (!B.getById('cke_ui_color')) {
var C = w(B);
s.push(C);
var D = r.getUiColor();
if (D) x([C], u, [
[y, D]
]);
}
});
if (r.config.uiColor) r.setUiColor(r.config.uiColor);
}
};
})());
(function () {
e.dialog ? q() : e.on('dialogPluginReady', q);
function q() {
e.dialog.on('resize', function (r) {
var s = r.data,
t = s.width,
u = s.height,
v = s.dialog,
w = v.parts.contents;
if (s.skin != 'kama') return;
w.setStyles({
width: t + 'px',
height: u + 'px'
});
});
};
})();
n.add('basicstyles', {
requires: ['styles', 'button'],
init: function (q) {
var r = function (u, v, w, x) {
var y = new e.style(x);
q.attachStyleStateChange(y, function (z) {
!q.readOnly && q.getCommand(w).setState(z);
});
q.addCommand(w, new e.styleCommand(y));
q.ui.addButton(u, {
label: v,
command: w
});
},
s = q.config,
t = q.lang;
r('Bold', t.bold, 'bold', s.coreStyles_bold);
r('Italic', t.italic, 'italic', s.coreStyles_italic);
r('Underline', t.underline, 'underline', s.coreStyles_underline);
r('Strike', t.strike, 'strike', s.coreStyles_strike);
r('Subscript', t.subscript, 'subscript', s.coreStyles_subscript);
r('Superscript', t.superscript, 'superscript', s.coreStyles_superscr
ipt);
}
});
m.coreStyles_bold = {
element: 'strong',
overrides: 'b'
};
m.coreStyles_italic = {
element: 'em',
overrides: 'i'
};
m.coreStyles_underline = {
element: 'u'
};
m.coreStyles_strike = {
element: 'strike'
};
m.coreStyles_subscript = {
element: 'sub'
};
m.coreStyles_superscript = {
element: 'sup'
};
n.add('button', {
beforeInit: function (q) {
q.ui.addHandler('button', o.button.handler);
}
});
e.UI_BUTTON = 'button';
o.button = function (q) {
i.extend(this, q, {
title: q.label,
className: q.className || q.command && 'cke_button_' + q.command ||
'',
click: q.click || (function (r) {
r.execCommand(q.command);
})
});
this._ = {};
};
o.button.handler = {
create: function (q) {
return new o.button(q);
}
};
(function () {
o.button.prototype = {
render: function (q, r) {
var s = f,
t = this._.id = i.getNextId(),
u = '',
v = this.command,
w;
this._.editor = q;
var x = {
id: t,
button: this,
editor: q,
focus: function () {
var D = e.document.getById(t);
D.focus();
},
execute: function () {
if (g && f.version < 7) i.setTimeout(function () {
this.button.click(q);
}, 0, this);
else this.button.click(q);
}
},
y = i.addFunction(function (D) {
if (x.onkey) {
D = new h.event(D);
return x.onkey(x, D.getKeystroke()) !== false;
}
}),
z = i.addFunction(function (D) {
var E;
if (x.onfocus) E = x.onfocus(x, new h.event(D)) !== fals
e;
if (f.gecko && f.version < 10900) D.preventBubble();
return E;
});
x.clickFn = w = i.addFunction(x.execute, x);
if (this.modes) {
var A = {};
function B() {
var D = q.mode;
if (D) {
var E = this.modes[D] ? A[D] != undefined ? A[D] : 2
: 0;
this.setState(q.readOnly && !this.readOnly ? 0 : E);
}
};
q.on('beforeModeUnload', function () {
if (q.mode && this._.state != 0) A[q.mode] = this._.stat
e;
}, this);
q.on('mode', B, this);
!this.readOnly && q.on('readOnly', B, this);
} else if (v) {
v = q.getCommand(v);
if (v) {
v.on('state', function () {
this.setState(v.state);
}, this);
u += 'cke_' + (v.state == 1 ? 'on' : v.state == 0 ? 'dis
abled' : 'off');
}
}
if (!v) u += 'cke_off';
if (this.className) u += ' ' + this.className;
r.push('<span class="cke_button' + (this.icon && this.icon.index
Of('.png') == -1 ? ' cke_noalphafix' : '') + '">', '<a id="', t, '" class="', u,
'"', s.gecko && s.version >= 10900 && !s.hc ? '' : '" href="javascript:void(\''
+ (this.title || '').replace("'", '') + "')\"", ' title="', this.title, '" tabi
ndex="-1" hidefocus="true" role="button" aria-labelledby="' + t + '_label"' + (t
his.hasArrow ? ' aria-haspopup="true"' : ''));
if (s.opera || s.gecko && s.mac) r.push(' onkeypress="return fal
se;"');
if (s.gecko) r.push(' onblur="this.style.cssText = this.style.cs
sText;"');
r.push(' onkeydown="return CKEDITOR.tools.callFunction(', y, ',
event);" onfocus="return CKEDITOR.tools.callFunction(', z, ', event);" ' + (g ?
'onclick="return false;" onmouseup' : 'onclick') + '="CKEDITOR.tools.callFunctio
n(', w, ', this); return false;"><span class="cke_icon"');
if (this.icon) {
var C = (this.iconOffset || 0) * -16;
r.push(' style="background-image:url(', e.getUrl(this.icon),
');background-position:0 ' + C + 'px;"');
}
r.push('>&nbsp;</span><span id="', t, '_label" class="cke_label"
>', this.label, '</span>');
if (this.hasArrow) r.push('<span class="cke_buttonarrow">' + (f.
hc ? '&#9660;' : '&nbsp;') + '</span>');
r.push('</a>', '</span>');
if (this.onRender) this.onRender();
return x;
},
setState: function (q) {
if (this._.state == q) return false;
this._.state = q;
var r = e.document.getById(this._.id);
if (r) {
r.setState(q);
q == 0 ? r.setAttribute('aria-disabled', true) : r.removeAtt
ribute('aria-disabled');
q == 1 ? r.setAttribute('aria-pressed', true) : r.removeAttr
ibute('aria-pressed');
return true;
} else return false;
}
};
})();
o.prototype.addButton = function (q, r) {
this.add(q, 'button', r);
};
(function () {
var q = function (C, D) {
var E = C.document,
F = E.getBody(),
G = 0,
H = function () {
G = 1;
};
F.on(D, H);
(f.version > 7 ? E.$ : E.$.selection.createRange()).execCommand(
D);
F.removeListener(D, H);
return G;
},
r = g ? function (C, D) {
return q(C, D);
} : function (C, D) {
try {
return C.document.$.execCommand(D, false, null);
} catch (E) {
return false;
}
},
s = function (C) {
var D = this;
D.type = C;
D.canUndo = D.type == 'cut';
D.startDisabled = true;
};
s.prototype = {
exec: function (C, D) {
this.type == 'cut' && x(C);
var E = r(C, this.type);
if (!E) alert(C.lang.clipboard[this.type + 'Error']);
return E;
}
};
var t = {
canUndo: false,
exec: g ? function (C) {
C.focus();
if (!C.document.getBody().fire('beforepaste') && !q(C, 'past
e')) {
C.fire('pasteDialog');
return false;
}
} : function (C) {
try {
if (!C.document.getBody().fire('beforepaste') && !C.docu
ment.$.execCommand('Paste', false, null)) throw 0;
} catch (D) {
setTimeout(function () {
C.fire('pasteDialog');
}, 0);
return false;
}
}
},
u = function (C) {
if (this.mode != 'wysiwyg') return;
switch (C.data.keyCode) {
case 1114112 + 86:
case 2228224 + 45:
var D = this.document.getBody();
if (!g && D.fire('beforepaste')) C.cancel();
else if (f.opera || f.gecko && f.version < 10900) D.fire('pa
ste');
return;
case 1114112 + 88:
case 2228224 + 46:
var E = this;
this.fire('saveSnapshot');
setTimeout(function () {
E.fire('saveSnapshot');
}, 0);
}
};
function v(C) {
C.cancel();
};
function w(C, D, E) {
var F = this.document;
if (F.getById('cke_pastebin')) return;
if (D == 'text' && C.data && C.data.$.clipboardData) {
var G = C.data.$.clipboardData.getData('text/plain');
if (G) {
C.data.preventDefault();
E(G);
return;
}
}
var H = this.getSelection(),
I = new h.range(F),
J = new l(D == 'text' ? 'textarea' : f.webkit ? 'body' : 'div',
F);
J.setAttribute('id', 'cke_pastebin');
f.webkit && J.append(F.createText('\xa0'));
F.getBody().append(J);
J.setStyles({
position: 'absolute',
top: H.getStartElement().getDocumentPosition().y + 'px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
J.setStyle(this.config.contentsLangDirection == 'ltr' ? 'left' : 'ri
ght', '-1000px');
var K = H.createBookmarks();
this.on('selectionChange', v, null, null, 0);
if (D == 'text') J.$.focus();
else {
I.setStartAt(J, 1);
I.setEndAt(J, 2);
I.select(true);
}
var L = this;
window.setTimeout(function () {
D == 'text' && f.gecko && L.focusGrabber.focus();
J.remove();
L.removeListener('selectionChange', v);
var M;
J = f.webkit && (M = J.getFirst()) && M.is && M.hasClass('Apple-
style-span') ? M : J;
H.selectBookmarks(K);
E(J['get' + (D == 'text' ? 'Value' : 'Html')]());
}, 0);
};
function x(C) {
if (!g || f.quirks) return;
var D = C.getSelection(),
E;
if (D.getType() == 3 && (E = D.getSelectedElement())) {
var F = D.getRanges()[0],
G = C.document.createText('');
G.insertBefore(E);
F.setStartBefore(G);
F.setEndAfter(E);
D.selectRanges([F]);
setTimeout(function () {
if (E.getParent()) {
G.remove();
D.selectElement(E);
}
}, 0);
}
};
var y;
function z(C, D) {
g && (y = 1);
var E = 2;
try {
E = D.document.$.queryCommandEnabled(C) ? 2 : 0;
} catch (F) {}
y = 0;
return E;
};
var A;
function B() {
var D = this;
if (D.mode != 'wysiwyg') return;
D.getCommand('cut').setState(A ? 0 : z('Cut', D));
D.getCommand('copy').setState(z('Copy', D));
var C = A ? 0 : f.webkit ? 2 : z('Paste', D);
D.fire('pasteState', C);
};
n.add('clipboard', {
requires: ['dialog', 'htmldataprocessor'],
init: function (C) {
C.on('paste', function (E) {
var F = E.data;
if (F.html) C.insertHtml(F.html);
else if (F.text) C.insertText(F.text);
setTimeout(function () {
C.fire('afterPaste');
}, 0);
}, null, null, 1000);
C.on('pasteDialog', function (E) {
setTimeout(function () {
C.openDialog('paste');
}, 0);
});
C.on('pasteState', function (E) {
C.getCommand('paste').setState(E.data);
});
function D(E, F, G, H) {
var I = C.lang[F];
C.addCommand(F, G);
C.ui.addButton(E, {
label: I,
command: F
});
if (C.addMenuItems) C.addMenuItem(F, {
label: I,
command: F,
group: 'clipboard',
order: H
});
};
D('Cut', 'cut', new s('cut'), 1);
D('Copy', 'copy', new s('copy'), 4);
D('Paste', 'paste', t, 8);
e.dialog.add('paste', e.getUrl(this.path + 'dialogs/paste.js'));
C.on('key', u, C);
C.on('contentDom', function () {
var E = C.document.getBody();
E.on(f.webkit ? 'paste' : 'beforepaste', function (F) {
if (y) return;
var G = {
mode: 'html'
};
C.fire('beforePaste', G);
w.call(C, F, G.mode, function (H) {
if (!(H = i.trim(H.replace(/<span[^>]+data-cke-bookm
ark[^<]*?<\/span>/ig, '')))) return;
var I = {};
I[G.mode] = H;
C.fire('paste', I);
});
});
E.on('contextmenu', function () {
y = 1;
setTimeout(function () {
y = 0;
}, 10);
});
E.on('beforecut', function () {
!y && x(C);
});
E.on('mouseup', function () {
setTimeout(function () {
B.call(C);
}, 0);
}, C);
E.on('keyup', B, C);
});
C.on('selectionChange', function (E) {
A = E.data.selection.getRanges()[0].checkReadOnly();
B.call(C);
});
if (C.contextMenu) C.contextMenu.addListener(function (E, F) {
var G = F.getRanges()[0].checkReadOnly();
return {
cut: !G && z('Cut', C),
copy: z('Copy', C),
paste: !G && (f.webkit ? 2 : z('Paste', C))
};
});
}
});
})();
n.add('colorbutton', {
requires: ['panelbutton', 'floatpanel', 'styles'],
init: function (q) {
var r = q.config,
s = q.lang.colorButton,
t;
if (!f.hc) {
u('TextColor', 'fore', s.textColorTitle);
u('BGColor', 'back', s.bgColorTitle);
}
function u(x, y, z) {
var A = i.getNextId() + '_colorBox';
q.ui.add(x, 'panelbutton', {
label: z,
title: z,
className: 'cke_button_' + x.toLowerCase(),
modes: {
wysiwyg: 1
},
panel: {
css: q.skin.editor.css,
attributes: {
role: 'listbox',
'aria-label': s.panelTitle
}
},
onBlock: function (B, C) {
C.autoSize = true;
C.element.addClass('cke_colorblock');
C.element.setHtml(v(B, y, A));
C.element.getDocument().getBody().setStyle('overflow', '
hidden');
o.fire('ready', this);
var D = C.keys,
E = q.lang.dir == 'rtl';
D[E ? 37 : 39] = 'next';
D[40] = 'next';
D[9] = 'next';
D[E ? 39 : 37] = 'prev';
D[38] = 'prev';
D[2228224 + 9] = 'prev';
D[32] = 'click';
},
onOpen: function () {
var B = q.getSelection(),
C = B && B.getStartElement(),
D = new h.elementPath(C),
E;
C = D.block || D.blockLimit || q.document.getBody();
do E = C && C.getComputedStyle(y == 'back' ? 'background
-color' : 'color') || 'transparent'; while (y == 'back' && E == 'transparent' &&
C && (C = C.getParent()));
if (!E || E == 'transparent') E = '#ffffff';
this._.panel._.iframe.getFrameDocument().getById(A).setS
tyle('background-color', E);
}
});
};
function v(x, y, z) {
var A = [],
B = r.colorButton_colors.split(','),
C = B.length + (r.colorButton_enableMore ? 2 : 1),
D = i.addFunction(function (J, K) {
if (J == '?') {
var L = arguments.callee;
function M(O) {
this.removeListener('ok', M);
this.removeListener('cancel', M);
O.name == 'ok' && L(this.getContentElement('pick
er', 'selectedColor').getValue(), K);
};
q.openDialog('colordialog', function () {
this.on('ok', M);
this.on('cancel', M);
});
return;
}
q.focus();
x.hide(false);
q.fire('saveSnapshot');
new e.style(r['colorButton_' + K + 'Style'], {
color: 'inherit'
}).remove(q.document);
if (J) {
var N = r['colorButton_' + K + 'Style'];
N.childRule = K == 'back' ? function (O) {
return w(O);
} : function (O) {
return !(O.is('a') || O.getElementsByTag('a').co
unt()) || w(O);
};
new e.style(N, {
color: J
}).apply(q.document);
}
q.fire('saveSnapshot');
});
A.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true tit
le="', s.auto, '" onclick="CKEDITOR.tools.callFunction(', D, ",null,'", y, "');r
eturn false;\" href=\"javascript:void('", s.auto, '\')" role="option" aria-posin
set="1" aria-setsize="', C, '"><table role="presentation" cellspacing=0 cellpadd
ing=0 width="100%"><tr><td><span class="cke_colorbox" id="', z, '"></span></td><
td colspan=7 align=center>', s.auto, '</td></tr></table></a><table role="present
ation" cellspacing=0 cellpadding=0 width="100%">');
for (var E = 0; E < B.length; E++) {
if (E % 8 === 0) A.push('</tr><tr>');
var F = B[E].split('/'),
G = F[0],
H = F[1] || G;
if (!F[1]) G = '#' + G.replace(/^(.)(.)(.)$/, '$1$1$2$2$3$3'
);
var I = q.lang.colors[H] || H;
A.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=t
rue title="', I, '" onclick="CKEDITOR.tools.callFunction(', D, ",'", G, "','", y
, "'); return false;\" href=\"javascript:void('", I, '\')" role="option" aria-po
sinset="', E + 2, '" aria-setsize="', C, '"><span class="cke_colorbox" style="ba
ckground-color:#', H, '"></span></a></td>');
}
if (r.colorButton_enableMore === undefined || r.colorButton_enab
leMore) A.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _ck
e_focus=1 hidefocus=true title="', s.more, '" onclick="CKEDITOR.tools.callFuncti
on(', D, ",'?','", y, "');return false;\" href=\"javascript:void('", s.more, "')
\"", ' role="option" aria-posinset="', C, '" aria-setsize="', C, '">', s.more, '
</a></td>');
A.push('</tr></table>');
return A.join('');
};
function w(x) {
return x.getAttribute('contentEditable') == 'false' || x.getAttr
ibute('data-nostyle');
};
}
});
m.colorButton_colors = '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969
,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,00800
0,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,
FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';
m.colorButton_foreStyle = {
element: 'span',
styles: {
color: '#(color)'
},
overrides: [{
element: 'font',
attributes: {
color: null
}
}]
};
m.colorButton_backStyle = {
element: 'span',
styles: {
'background-color': '#(color)'
}
};
n.colordialog = {
init: function (q) {
q.addCommand('colordialog', new e.dialogCommand('colordialog'));
e.dialog.add('colordialog', this.path + 'dialogs/colordialog.js');
}
};
n.add('colordialog', n.colordialog);
(function () {
n.add('div', {
requires: ['editingblock', 'domiterator', 'styles'],
init: function (q) {
var r = q.lang.div;
q.addCommand('creatediv', new e.dialogCommand('creatediv'));
q.addCommand('editdiv', new e.dialogCommand('editdiv'));
q.addCommand('removediv', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getRanges(),
v, w = t.createBookmarks(),
x, y = [];
function z(B) {
var C = new h.elementPath(B),
D = C.blockLimit,
E = D.is('div') && D;
if (E && !E.data('cke-div-added')) {
y.push(E);
E.data('cke-div-added');
}
};
for (var A = 0; A < u.length; A++) {
v = u[A];
if (v.collapsed) z(t.getStartElement());
else {
x = new h.walker(v);
x.evaluator = z;
x.lastForward();
}
}
for (A = 0; A < y.length; A++) y[A].remove(true);
t.selectBookmarks(w);
}
});
q.ui.addButton('CreateDiv', {
label: r.toolbar,
command: 'creatediv'
});
if (q.addMenuItems) {
q.addMenuItems({
editdiv: {
label: r.edit,
command: 'editdiv',
group: 'div',
order: 1
},
removediv: {
label: r.remove,
command: 'removediv',
group: 'div',
order: 5
}
});
if (q.contextMenu) q.contextMenu.addListener(function (s, t)
{
if (!s || s.isReadOnly()) return null;
var u = new h.elementPath(s),
v = u.blockLimit;
if (v && v.getAscendant('div', true)) return {
editdiv: 2,
removediv: 2
};
return null;
});
}
e.dialog.add('creatediv', this.path + 'dialogs/div.js');
e.dialog.add('editdiv', this.path + 'dialogs/div.js');
}
});
})();
(function () {
n.add('enterkey', {
requires: ['keystrokes', 'indent'],
init: function (x) {
x.addCommand('enter', {
modes: {
wysiwyg: 1
},
editorFocus: false,
exec: function (z) {
v(z);
}
});
x.addCommand('shiftEnter', {
modes: {
wysiwyg: 1
},
editorFocus: false,
exec: function (z) {
u(z);
}
});
var y = x.keystrokeHandler.keystrokes;
y[13] = 'enter';
y[2228224 + 13] = 'shiftEnter';
}
});
n.enterkey = {
enterBlock: function (x, y, z, A) {
z = z || w(x);
if (!z) return;
var B = z.document,
C = z.checkStartOfBlock(),
D = z.checkEndOfBlock(),
E = new h.elementPath(z.startContainer),
F = E.block;
if (C && D) {
if (F && (F.is('li') || F.getParent().is('li'))) {
x.execCommand('outdent');
return;
}
if (F && F.getParent().is('blockquote')) {
F.breakParent(F.getParent());
if (!F.getPrevious().getFirst(h.walker.invisible(1))) F.
getPrevious().remove();
if (!F.getNext().getFirst(h.walker.invisible(1))) F.getN
ext().remove();
z.moveToElementEditStart(F);
z.select();
return;
}
} else if (F && F.is('pre')) {
if (!D) {
r(x, y, z, A);
return;
}
} else if (F && j.$captionBlock[F.getName()]) {
r(x, y, z, A);
return;
}
var G = y == 3 ? 'div' : 'p',
H = z.splitBlock(G);
if (!H) return;
var I = H.previousBlock,
J = H.nextBlock,
K = H.wasStartOfBlock,
L = H.wasEndOfBlock,
M;
if (J) {
M = J.getParent();
if (M.is('li')) {
J.breakParent(M);
J.move(J.getNext(), 1);
}
} else if (I && (M = I.getParent()) && M.is('li')) {
I.breakParent(M);
M = I.getNext();
z.moveToElementEditStart(M);
I.move(I.getPrevious());
}
if (!K && !L) {
if (J.is('li') && (M = J.getFirst(h.walker.invisible(true)))
&& M.is && M.is('ul', 'ol'))(g ? B.createText('\xa0') : B.createElement('br')).
insertBefore(M);
if (J) z.moveToElementEditStart(J);
} else {
var N, O;
if (I) {
if (I.is('li') || !(t.test(I.getName()) || I.is('pre')))
N = I.clone();
} else if (J) N = J.clone();
if (!N) {
if (M && M.is('li')) N = M;
else {
N = B.createElement(G);
if (I && (O = I.getDirection())) N.setAttribute('dir
', O);
}
} else if (A && !N.is('li')) N.renameNode(G);
var P = H.elementPath;
if (P)
for (var Q = 0, R = P.elements.length; Q < R; Q++) {
var S = P.elements[Q];
if (S.equals(P.block) || S.equals(P.blockLimit)) bre
ak;
if (j.$removeEmpty[S.getName()]) {
S = S.clone();
N.moveChildren(S);
N.append(S);
}
}
if (!g) N.appendBogus();
if (!N.getParent()) z.insertNode(N);
N.is('li') && N.removeAttribute('value');
if (g && K && (!L || !I.getChildCount())) {
z.moveToElementEditStart(L ? I : N);
z.select();
}
z.moveToElementEditStart(K && !L ? J : N);
} if (!g)
if (J) {
var T = B.createElement('span');
T.setHtml('&nbsp;');
z.insertNode(T);
T.scrollIntoView();
z.deleteContents();
} else N.scrollIntoView();
z.select();
},
enterBr: function (x, y, z, A) {
z = z || w(x);
if (!z) return;
var B = z.document,
C = y == 3 ? 'div' : 'p',
D = z.checkEndOfBlock(),
E = new h.elementPath(x.getSelection().getStartElement()),
F = E.block,
G = F && E.block.getName(),
H = false;
if (!A && G == 'li') {
s(x, y, z, A);
return;
}
var I = (f.webkit || f.opera) && E.lastElement && E.lastElement.
getAscendant('a', true);
if (I && z.checkBoundaryOfElement(I, 2) && I.getName() == 'a' &&
I.getAttribute('href') && I.getChildCount()) z.setEndAfter(I);
if (!A && D && t.test(G)) {
var J, K;
if (K = F.getDirection()) {
J = B.createElement('div');
J.setAttribute('dir', K);
J.insertAfter(F);
z.setStart(J, 0);
} else {
B.createElement('br').insertAfter(F);
if (f.gecko) B.createText('').insertAfter(F);
z.setStartAt(F.getNext(), g ? 3 : 1);
}
} else {
var L;
H = G == 'pre';
if (H && !f.gecko) L = B.createText(g ? '\r' : '\n');
else L = B.createElement('br');
z.deleteContents();
z.insertNode(L);
if (g) z.setStartAt(L, 4);
else {
B.createText('\ufeff').insertAfter(L);
if (D) L.getParent().appendBogus();
L.getNext().$.nodeValue = '';
z.setStartAt(L.getNext(), 1);
var M = null;
if (!f.gecko) {
M = B.createElement('span');
M.setHtml('&nbsp;');
} else M = B.createElement('br');
M.insertBefore(L.getNext());
M.scrollIntoView();
M.remove();
}
}
z.collapse(true);
z.select(H);
}
};
var q = n.enterkey,
r = q.enterBr,
s = q.enterBlock,
t = /^h[1-6]$/;
function u(x) {
if (x.mode != 'wysiwyg') return false;
return v(x, x.config.shiftEnterMode, 1);
};
function v(x, y, z) {
z = x.config.forceEnterMode || z;
if (x.mode != 'wysiwyg') return false;
if (!y) y = x.config.enterMode;
setTimeout(function () {
x.fire('saveSnapshot');
if (y == 2) r(x, y, null, z);
else s(x, y, null, z);
x.fire('saveSnapshot');
}, 0);
return true;
};
function w(x) {
var y = x.getSelection().getRanges(true);
for (var z = y.length - 1; z > 0; z--) y[z].deleteContents();
return y[0];
};
})();
(function () {
var q = 'nbsp,gt,lt,amp',
r = 'quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laqu
o,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,
raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,olin
e,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr
,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowas
t,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,s
ub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang
,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndas
h,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,e
uro',
s = 'Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacut
e,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml
,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,a
uml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,nti
lde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn
,yuml,OElig,oelig,Scaron,scaron,Yuml',
t = 'Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda
,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,de
lta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigm
a,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv';
function u(v, w) {
var x = {},
y = [],
z = {
nbsp: '\xa0',
shy: '',
gt: '>',
lt: '<',
amp: '&'
};
v = v.replace(/\b(nbsp|shy|gt|lt|amp)(?:,|$)/g, function (E, F) {
var G = w ? '&' + F + ';' : z[F],
H = w ? z[F] : '&' + F + ';';
x[G] = H;
y.push(G);
return '';
});
if (!w && v) {
v = v.split(',');
var A = document.createElement('div'),
B;
A.innerHTML = '&' + v.join(';&') + ';';
B = A.innerHTML;
A = null;
for (var C = 0; C < B.length; C++) {
var D = B.charAt(C);
x[D] = '&' + v[C] + ';';
y.push(D);
}
}
x.regex = y.join(w ? '|' : '');
return x;
};
n.add('entities', {
afterInit: function (v) {
var w = v.config,
x = v.dataProcessor,
y = x && x.htmlFilter;
if (y) {
var z = '';
if (w.basicEntities !== false) z += q;
if (w.entities) {
z += ',' + r;
if (w.entities_latin) z += ',' + s;
if (w.entities_greek) z += ',' + t;
if (w.entities_additional) z += ',' + w.entities_additio
nal;
}
var A = u(z),
B = A.regex ? '[' + A.regex + ']' : 'a^';
delete A.regex;
if (w.entities && w.entities_processNumerical) B = '[^ -~]|'
+ B;
B = new RegExp(B, 'g');
function C(G) {
return w.entities_processNumerical == 'force' || !A[G] ?
'&#' + G.charCodeAt(0) + ';' : A[G];
};
var D = u([q, 'shy'].join(','), true),
E = new RegExp(D.regex, 'g');
function F(G) {
return D[G];
};
y.addRules({
text: function (G) {
return G.replace(E, F).replace(B, C);
}
});
}
}
});
})();
m.basicEntities = true;
m.entities = true;
m.entities_latin = true;
m.entities_greek = true;
m.entities_additional = '#39';
(function () {
function q(r, s, t, u, v, w, x) {
var y = r.config,
z = v.split(';'),
A = [],
B = {};
for (var C = 0; C < z.length; C++) {
var D = z[C];
if (D) {
D = D.split('/');
var E = {},
F = z[C] = D[0];
E[t] = A[C] = D[1] || F;
B[F] = new e.style(x, E);
B[F]._.definition.name = F;
} else z.splice(C--, 1);
}
r.ui.addRichCombo(s, {
label: u.label,
title: u.panelTitle,
className: 'cke_' + (t == 'size' ? 'fontSize' : 'font'),
panel: {
css: r.skin.editor.css.concat(y.contentsCss),
multiSelect: false,
attributes: {
'aria-label': u.panelTitle
}
},
init: function () {
this.startGroup(u.panelTitle);
for (var G = 0; G < z.length; G++) {
var H = z[G];
this.add(H, B[H].buildPreview(), H);
}
},
onClick: function (G) {
r.focus();
r.fire('saveSnapshot');
var H = B[G];
if (this.getValue() == G) H.remove(r.document);
else H.apply(r.document);
r.fire('saveSnapshot');
},
onRender: function () {
r.on('selectionChange', function (G) {
var H = this.getValue(),
I = G.data.path,
J = I.elements;
for (var K = 0, L; K < J.length; K++) {
L = J[K];
for (var M in B) {
if (B[M].checkElementRemovable(L, true)) {
if (M != H) this.setValue(M);
return;
}
}
}
this.setValue('', w);
}, this);
}
});
};
n.add('font', {
requires: ['richcombo', 'styles'],
init: function (r) {
var s = r.config;
q(r, 'Font', 'family', r.lang.font, s.font_names, s.font_default
Label, s.font_style);
q(r, 'FontSize', 'size', r.lang.fontSize, s.fontSize_sizes, s.fo
ntSize_defaultLabel, s.fontSize_style);
}
});
})();
m.font_names = 'Arial/Arial, Helvetica, sans-serif;Comic Sans MS/Comic Sans
MS, cursive;Courier New/Courier New, Courier, monospace;Georgia/Georgia, serif;L
ucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;Tahoma/Tahoma,
Geneva, sans-serif;Times New Roman/Times New Roman, Times, serif;Trebuchet MS/T
rebuchet MS, Helvetica, sans-serif;Verdana/Verdana, Geneva, sans-serif';
m.font_defaultLabel = '';
m.font_style = {
element: 'span',
styles: {
'font-family': '#(family)'
},
overrides: [{
element: 'font',
attributes: {
face: null
}
}]
};
m.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/1
8px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';
m.fontSize_defaultLabel = '';
m.fontSize_style = {
element: 'span',
styles: {
'font-size': '#(size)'
},
overrides: [{
element: 'font',
attributes: {
size: null
}
}]
};
n.add('format', {
requires: ['richcombo', 'styles'],
init: function (q) {
var r = q.config,
s = q.lang.format,
t = r.format_tags.split(';'),
u = {};
for (var v = 0; v < t.length; v++) {
var w = t[v];
u[w] = new e.style(r['format_' + w]);
u[w]._.enterMode = q.config.enterMode;
}
q.ui.addRichCombo('Format', {
label: s.label,
title: s.panelTitle,
className: 'cke_format',
panel: {
css: q.skin.editor.css.concat(r.contentsCss),
multiSelect: false,
attributes: {
'aria-label': s.panelTitle
}
},
init: function () {
this.startGroup(s.panelTitle);
for (var x in u) {
var y = s['tag_' + x];
this.add(x, u[x].buildPreview(y), y);
}
},
onClick: function (x) {
q.focus();
q.fire('saveSnapshot');
var y = u[x],
z = new h.elementPath(q.getSelection().getStartElement()
);
y[y.checkActive(z) ? 'remove' : 'apply'](q.document);
setTimeout(function () {
q.fire('saveSnapshot');
}, 0);
},
onRender: function () {
q.on('selectionChange', function (x) {
var y = this.getValue(),
z = x.data.path;
for (var A in u) {
if (u[A].checkActive(z)) {
if (A != y) this.setValue(A, q.lang.format['tag_
' + A]);
return;
}
}
this.setValue('');
}, this);
}
});
}
});
m.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
m.format_p = {
element: 'p'
};
m.format_div = {
element: 'div'
};
m.format_pre = {
element: 'pre'
};
m.format_address = {
element: 'address'
};
m.format_h1 = {
element: 'h1'
};
m.format_h2 = {
element: 'h2'
};
m.format_h3 = {
element: 'h3'
};
m.format_h4 = {
element: 'h4'
};
m.format_h5 = {
element: 'h5'
};
m.format_h6 = {
element: 'h6'
};
n.add('forms', {
init: function (q) {
var r = q.lang;
q.addCss('form{border: 1px dotted #FF0000;padding: 2px;}\n');
q.addCss('img.cke_hidden{background-image: url(' + e.getUrl(this.pat
h + 'images/hiddenfield.gif') + ');' + 'background-position: center center;' + '
background-repeat: no-repeat;' + 'border: 1px solid #a9a9a9;' + 'width: 16px !im
portant;' + 'height: 16px !important;' + '}');
var s = function (u, v, w) {
q.addCommand(v, new e.dialogCommand(v));
q.ui.addButton(u, {
label: r.common[u.charAt(0).toLowerCase() + u.slice(1)],
command: v
});
e.dialog.add(v, w);
},
t = this.path + 'dialogs/';
s('Form', 'form', t + 'form.js');
s('Checkbox', 'checkbox', t + 'checkbox.js');
s('Radio', 'radio', t + 'radio.js');
s('TextField', 'textfield', t + 'textfield.js');
s('Textarea', 'textarea', t + 'textarea.js');
s('Select', 'select', t + 'select.js');
s('Button', 'button', t + 'button.js');
s('ImageButton', 'imagebutton', n.getPath('image') + 'dialogs/image.
js');
s('HiddenField', 'hiddenfield', t + 'hiddenfield.js');
if (q.addMenuItems) q.addMenuItems({
form: {
label: r.form.menu,
command: 'form',
group: 'form'
},
checkbox: {
label: r.checkboxAndRadio.checkboxTitle,
command: 'checkbox',
group: 'checkbox'
},
radio: {
label: r.checkboxAndRadio.radioTitle,
command: 'radio',
group: 'radio'
},
textfield: {
label: r.textfield.title,
command: 'textfield',
group: 'textfield'
},
hiddenfield: {
label: r.hidden.title,
command: 'hiddenfield',
group: 'hiddenfield'
},
imagebutton: {
label: r.image.titleButton,
command: 'imagebutton',
group: 'imagebutton'
},
button: {
label: r.button.title,
command: 'button',
group: 'button'
},
select: {
label: r.select.title,
command: 'select',
group: 'select'
},
textarea: {
label: r.textarea.title,
command: 'textarea',
group: 'textarea'
}
});
if (q.contextMenu) {
q.contextMenu.addListener(function (u) {
if (u && u.hasAscendant('form', true) && !u.isReadOnly()) re
turn {
form: 2
};
});
q.contextMenu.addListener(function (u) {
if (u && !u.isReadOnly()) {
var v = u.getName();
if (v == 'select') return {
select: 2
};
if (v == 'textarea') return {
textarea: 2
};
if (v == 'input') switch (u.getAttribute('type')) {
case 'button':
case 'submit':
case 'reset':
return {
button: 2
};
case 'checkbox':
return {
checkbox: 2
};
case 'radio':
return {
radio: 2
};
case 'image':
return {
imagebutton: 2
};
default:
return {
textfield: 2
};
}
if (v == 'img' && u.data('cke-real-element-type') == 'hi
ddenfield') return {
hiddenfield: 2
};
}
});
}
q.on('doubleclick', function (u) {
var v = u.data.element;
if (v.is('form')) u.data.dialog = 'form';
else if (v.is('select')) u.data.dialog = 'select';
else if (v.is('textarea')) u.data.dialog = 'textarea';
else if (v.is('img') && v.data('cke-real-element-type') == 'hidd
enfield') u.data.dialog = 'hiddenfield';
else if (v.is('input')) switch (v.getAttribute('type')) {
case 'button':
case 'submit':
case 'reset':
u.data.dialog = 'button';
break;
case 'checkbox':
u.data.dialog = 'checkbox';
break;
case 'radio':
u.data.dialog = 'radio';
break;
case 'image':
u.data.dialog = 'imagebutton';
break;
default:
u.data.dialog = 'textfield';
break;
}
});
},
afterInit: function (q) {
var r = q.dataProcessor,
s = r && r.htmlFilter,
t = r && r.dataFilter;
if (g) s && s.addRules({
elements: {
input: function (u) {
var v = u.attributes,
w = v.type;
if (!w) v.type = 'text';
if (w == 'checkbox' || w == 'radio') v.value == 'on' &&
delete v.value;
}
}
});
if (t) t.addRules({
elements: {
input: function (u) {
if (u.attributes.type == 'hidden') return q.createFakePa
rserElement(u, 'cke_hidden', 'hiddenfield');
}
}
});
},
requires: ['image', 'fakeobjects']
});
if (g) l.prototype.hasAttribute = i.override(l.prototype.hasAttribute, funct
ion (q) {
return function (r) {
var u = this;
var s = u.$.attributes.getNamedItem(r);
if (u.getName() == 'input') switch (r) {
case 'class':
return u.$.className.length > 0;
case 'checked':
return !!u.$.checked;
case 'value':
var t = u.getAttribute('type');
return t == 'checkbox' || t == 'radio' ? u.$.value != 'on' : u.$
.value;
}
return q.apply(u, arguments);
};
});
(function () {
var q = {
canUndo: false,
exec: function (s) {
var t = s.document.createElement('hr'),
u = new h.range(s.document);
s.insertElement(t);
u.moveToPosition(t, 4);
var v = t.getNext();
if (!v || v.type == 1 && !v.isEditable()) u.fixBlock(true, s
.config.enterMode == 3 ? 'div' : 'p');
u.select();
}
},
r = 'horizontalrule';
n.add(r, {
init: function (s) {
s.addCommand(r, q);
s.ui.addButton('HorizontalRule', {
label: s.lang.horizontalrule,
command: r
});
}
});
})();
(function () {
var q = /^[\t\r\n ]*(?:&nbsp;|\xa0)$/,
r = '{cke_protected}';
function s(X) {
var Y = X.children.length,
Z = X.children[Y - 1];
while (Z && Z.type == 3 && !i.trim(Z.value)) Z = X.children[--Y];
return Z;
};
function t(X, Y) {
var Z = X.children,
aa = s(X);
if (aa) {
if ((Y || !g) && aa.type == 1 && aa.name == 'br') Z.pop();
if (aa.type == 3 && q.test(aa.value)) Z.pop();
}
};
function u(X, Y, Z) {
if (!Y && (!Z || typeof Z == 'function' && Z(X) === false)) return f
alse;
if (Y && g && (document.documentMode > 7 || X.name in j.tr || X.name
in j.$listItem)) return false;
var aa = s(X);
return !aa || aa && (aa.type == 1 && aa.name == 'br' || X.name == 'f
orm' && aa.name == 'input');
};
function v(X, Y) {
return function (Z) {
t(Z, !X);
if (u(Z, !X, Y))
if (X || g) Z.add(new e.htmlParser.text('\xa0'));
else Z.add(new e.htmlParser.element('br', {}));
};
};
var w = j,
x = ['caption', 'colgroup', 'col', 'thead', 'tfoot', 'tbody'],
y = i.extend({}, w.$block, w.$listItem, w.$tableContent);
for (var z in y) {
if (!('br' in w[z])) delete y[z];
}
delete y.pre;
var A = {
elements: {},
attributeNames: [
[/^on/, 'data-cke-pa-on']
]
},
B = {
elements: {}
};
for (z in y) B.elements[z] = v();
var C = {
elementNames: [
[/^cke:/, ''],
[/^\?xml:namespace$/, '']
],
attributeNames: [
[/^data-cke-(saved|pa)-/, ''],
[/^data-cke-.*/, ''],
['hidefocus', '']
],
elements: {
$: function (X) {
var Y = X.attributes;
if (Y) {
if (Y['data-cke-temp']) return false;
var Z = ['name', 'href', 'src'],
aa;
for (var ab = 0; ab < Z.length; ab++) {
aa = 'data-cke-saved-' + Z[ab];
aa in Y && delete Y[Z[ab]];
}
}
return X;
},
table: function (X) {
var Y = X.children;
Y.sort(function (Z, aa) {
return Z.type == 1 && aa.type == Z.type ? i.indexOf(x, Z
.name) > i.indexOf(x, aa.name) ? 1 : -1 : 0;
});
},
embed: function (X) {
var Y = X.parent;
if (Y && Y.name == 'object') {
var Z = Y.attributes.width,
aa = Y.attributes.height;
Z && (X.attributes.width = Z);
aa && (X.attributes.height = aa);
}
},
param: function (X) {
X.children = [];
X.isEmpty = true;
return X;
},
a: function (X) {
if (!(X.children.length || X.attributes.name || X.attributes
['data-cke-saved-name'])) return false;
},
span: function (X) {
if (X.attributes['class'] == 'Apple-style-span') delete X.na
me;
},
pre: function (X) {
g && t(X);
},
html: function (X) {
delete X.attributes.contenteditable;
delete X.attributes['class'];
},
body: function (X) {
delete X.attributes.spellcheck;
delete X.attributes.contenteditable;
},
style: function (X) {
var Y = X.children[0];
Y && Y.value && (Y.value = i.trim(Y.value));
if (!X.attributes.type) X.attributes.type = 'text/css';
},
title: function (X) {
var Y = X.children[0];
Y && (Y.value = X.attributes['data-cke-title'] || '');
}
},
attributes: {
'class': function (X, Y) {
return i.ltrim(X.replace(/(?:^|\s+)cke_[^\s]*/g, '')) || fal
se;
}
}
};
if (g) C.attributes.style = function (X, Y) {
return X.replace(/(^|;)([^\:]+)/g, function (Z) {
return Z.toLowerCase();
});
};
function D(X) {
var Y = X.attributes;
if (Y.contenteditable != 'false') Y['data-cke-editable'] = Y.content
editable ? 'true' : 1;
Y.contenteditable = 'false';
};
function E(X) {
var Y = X.attributes;
switch (Y['data-cke-editable']) {
case 'true':
Y.contenteditable = 'true';
break;
case '1':
delete Y.contenteditable;
break;
}
};
for (z in {
input: 1,
textarea: 1
}) {
A.elements[z] = D;
C.elements[z] = E;
}
var F = /<(a|area|img|input)\b([^>]*)>/gi,
G = /\b(on\w+|href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^
"'>]+))/gi,
H = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)
[^>]*>)/gi,
I = /<cke:encoded>([^<]*)<\/cke:encoded>/gi,
J = /(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,
K = /(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,
L = /<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;
function M(X) {
return X.replace(F, function (Y, Z, aa) {
return '<' + Z + aa.replace(G, function (ab, ac) {
if (!/^on/.test(ac) && aa.indexOf('data-cke-saved-' + ac) ==
-1) return ' data-cke-saved-' + ab + ' ' + ab;
return ab;
}) + '>';
});
};
function N(X) {
return X.replace(H, function (Y) {
return '<cke:encoded>' + encodeURIComponent(Y) + '</cke:encoded>
';
});
};
function O(X) {
return X.replace(I, function (Y, Z) {
return decodeURIComponent(Z);
});
};
function P(X) {
return X.replace(J, '$1cke:$2');
};
function Q(X) {
return X.replace(K, '$1$2');
};
function R(X) {
return X.replace(L, '<cke:$1$2></cke:$1>');
};
function S(X) {
return X.replace(/(<pre\b[^>]*>)(\r\n|\n)/g, '$1$2$2');
};
function T(X) {
return X.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g, function (Y)
{
return '<!--' + r + '{C}' + encodeURIComponent(Y).replace(/--/g,
'%2D%2D') + '-->';
});
};
function U(X) {
return X.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g, functio
n (Y, Z) {
return decodeURIComponent(Z);
});
};
function V(X, Y) {
var Z = Y._.dataStore;
return X.replace(/<!--\{cke_protected\}([\s\S]+?)-->/g, function (aa
, ab) {
return decodeURIComponent(ab);
}).replace(/\{cke_protected_(\d+)\}/g, function (aa, ab) {
return Z && Z[ab] || '';
});
};
function W(X, Y) {
var Z = [],
aa = Y.config.protectedSource,
ab = Y._.dataStore || (Y._.dataStore = {
id: 1
}),
ac = /<\!--\{cke_temp(comment)?\}(\d*?)-->/g,
ad = [/<script[\s\S]*?<\/script>/gi, /<noscript[\s\S]*?<\/noscri
pt>/gi].concat(aa);
X = X.replace(/<!--[\s\S]*?-->/g, function (af) {
return '<!--{cke_tempcomment}' + (Z.push(af) - 1) + '-->';
});
for (var ae = 0; ae < ad.length; ae++) X = X.replace(ad[ae], functio
n (af) {
af = af.replace(ac, function (ag, ah, ai) {
return Z[ai];
});
return /cke_temp(comment)?/.test(af) ? af : '<!--{cke_temp}' + (
Z.push(af) - 1) + '-->';
});
X = X.replace(ac, function (af, ag, ah) {
return '<!--' + r + (ag ? '{C}' : '') + encodeURIComponent(Z[ah]
).replace(/--/g, '%2D%2D') + '-->';
});
return X.replace(/(['"]).*?\1/g, function (af) {
return af.replace(/<!--\{cke_protected\}([\s\S]+?)-->/g, functio
n (ag, ah) {
ab[ab.id] = decodeURIComponent(ah);
return '{cke_protected_' + (0 + ab.id++) + '}';
});
});
};
n.add('htmldataprocessor', {
requires: ['htmlwriter'],
init: function (X) {
var Y = X.dataProcessor = new e.htmlDataProcessor(X);
Y.writer.forceSimpleAmpersand = X.config.forceSimpleAmpersand;
Y.dataFilter.addRules(A);
Y.dataFilter.addRules(B);
Y.htmlFilter.addRules(C);
var Z = {
elements: {}
};
for (z in y) Z.elements[z] = v(true, X.config.fillEmptyBlocks);
Y.htmlFilter.addRules(Z);
},
onLoad: function () {
!('fillEmptyBlocks' in m) && (m.fillEmptyBlocks = 1);
}
});
e.htmlDataProcessor = function (X) {
var Y = this;
Y.editor = X;
Y.writer = new e.htmlWriter();
Y.dataFilter = new e.htmlParser.filter();
Y.htmlFilter = new e.htmlParser.filter();
};
e.htmlDataProcessor.prototype = {
toHtml: function (X, Y) {
X = W(X, this.editor);
X = M(X);
X = N(X);
X = P(X);
X = R(X);
X = S(X);
var Z = new l('div');
Z.setHtml('a' + X);
X = Z.getHtml().substr(1);
X = Q(X);
X = O(X);
X = U(X);
var aa = e.htmlParser.fragment.fromHtml(X, Y),
ab = new e.htmlParser.basicWriter();
aa.writeHtml(ab, this.dataFilter);
X = ab.getHtml(true);
X = T(X);
return X;
},
toDataFormat: function (X, Y) {
var Z = this.writer,
aa = e.htmlParser.fragment.fromHtml(X, Y);
Z.reset();
aa.writeHtml(Z, this.htmlFilter);
var ab = Z.getHtml(true);
ab = U(ab);
ab = V(ab, this.editor);
return ab;
}
};
})();
(function () {
n.add('iframe', {
requires: ['dialog', 'fakeobjects'],
init: function (q) {
var r = 'iframe',
s = q.lang.iframe;
e.dialog.add(r, this.path + 'dialogs/iframe.js');
q.addCommand(r, new e.dialogCommand(r));
q.addCss('img.cke_iframe{background-image: url(' + e.getUrl(this
.path + 'images/placeholder.png') + ');' + 'background-position: center center;'
+ 'background-repeat: no-repeat;' + 'border: 1px solid #a9a9a9;' + 'width: 80px
;' + 'height: 80px;' + '}');
q.ui.addButton('Iframe', {
label: s.toolbar,
command: r
});
q.on('doubleclick', function (t) {
var u = t.data.element;
if (u.is('img') && u.data('cke-real-element-type') == 'ifram
e') t.data.dialog = 'iframe';
});
if (q.addMenuItems) q.addMenuItems({
iframe: {
label: s.title,
command: 'iframe',
group: 'image'
}
});
if (q.contextMenu) q.contextMenu.addListener(function (t, u) {
if (t && t.is('img') && t.data('cke-real-element-type') == '
iframe') return {
iframe: 2
};
});
},
afterInit: function (q) {
var r = q.dataProcessor,
s = r && r.dataFilter;
if (s) s.addRules({
elements: {
iframe: function (t) {
return q.createFakeParserElement(t, 'cke_iframe', 'i
frame', true);
}
}
});
}
});
})();
n.add('image', {
init: function (q) {
var r = 'image';
e.dialog.add(r, this.path + 'dialogs/image.js');
q.addCommand(r, new e.dialogCommand(r));
q.ui.addButton('Image', {
label: q.lang.common.image,
command: r
});
q.on('doubleclick', function (s) {
var t = s.data.element;
if (t.is('img') && !t.data('cke-realelement') && !t.isReadOnly()
) s.data.dialog = 'image';
});
if (q.addMenuItems) q.addMenuItems({
image: {
label: q.lang.image.menu,
command: 'image',
group: 'image'
}
});
if (q.contextMenu) q.contextMenu.addListener(function (s, t) {
if (!s || !s.is('img') || s.data('cke-realelement') || s.isReadO
nly()) return null;
return {
image: 2
};
});
}
});
m.image_removeLinkByEmptyURL = true;
(function () {
var q = {
ol: 1,
ul: 1
},
r = h.walker.whitespaces(true),
s = h.walker.bookmark(false, true);
function t(x) {
var F = this;
if (x.editor.readOnly) return null;
var y = x.editor,
z = x.data.path,
A = z && z.contains(q),
B = z.block || z.blockLimit;
if (A) return F.setState(2);
if (!F.useIndentClasses && F.name == 'indent') return F.setState(2);
if (!B) return F.setState(0);
if (F.useIndentClasses) {
var C = B.$.className.match(F.classNameRegex),
D = 0;
if (C) {
C = C[1];
D = F.indentClassMap[C];
}
if (F.name == 'outdent' && !D || F.name == 'indent' && D == y.co
nfig.indentClasses.length) return F.setState(0);
return F.setState(2);
} else {
var E = parseInt(B.getStyle(v(B)), 10);
if (isNaN(E)) E = 0;
if (E <= 0) return F.setState(0);
return F.setState(2);
}
};
function u(x, y) {
var A = this;
A.name = y;
A.useIndentClasses = x.config.indentClasses && x.config.indentClasse
s.length > 0;
if (A.useIndentClasses) {
A.classNameRegex = new RegExp('(?:^|\\s+)(' + x.config.indentCla
sses.join('|') + ')(?=$|\\s)');
A.indentClassMap = {};
for (var z = 0; z < x.config.indentClasses.length; z++) A.indent
ClassMap[x.config.indentClasses[z]] = z + 1;
}
A.startDisabled = y == 'outdent';
};
function v(x, y) {
return (y || x.getComputedStyle('direction')) == 'ltr' ? 'margin-lef
t' : 'margin-right';
};
function w(x) {
return x.type == 1 && x.is('li');
};
u.prototype = {
exec: function (x) {
var y = this,
z = {};
function A(Q) {
var R = G.startContainer,
S = G.endContainer;
while (R && !R.getParent().equals(Q)) R = R.getParent();
while (S && !S.getParent().equals(Q)) S = S.getParent();
if (!R || !S) return;
var T = R,
U = [],
V = false;
while (!V) {
if (T.equals(S)) V = true;
U.push(T);
T = T.getNext();
}
if (U.length < 1) return;
var W = Q.getParents(true);
for (var X = 0; X < W.length; X++) {
if (W[X].getName && q[W[X].getName()]) {
Q = W[X];
break;
}
}
var Y = y.name == 'indent' ? 1 : -1,
Z = U[0],
aa = U[U.length - 1],
ab = n.list.listToArray(Q, z),
ac = ab[aa.getCustomData('listarray_index')].indent;
for (X = Z.getCustomData('listarray_index'); X <= aa.getCust
omData('listarray_index'); X++) {
ab[X].indent += Y;
var ad = ab[X].parent;
ab[X].parent = new l(ad.getName(), ad.getDocument());
}
for (X = aa.getCustomData('listarray_index') + 1; X < ab.len
gth && ab[X].indent > ac; X++) ab[X].indent += Y;
var ae = n.list.arrayToList(ab, z, null, x.config.enterMode,
Q.getDirection());
if (y.name == 'outdent') {
var af;
if ((af = Q.getParent()) && af.is('li')) {
var ag = ae.listNode.getChildren(),
ah = [],
ai = ag.count(),
aj;
for (X = ai - 1; X >= 0; X--) {
if ((aj = ag.getItem(X)) && aj.is && aj.is('li')
) ah.push(aj);
}
}
}
if (ae) ae.listNode.replace(Q);
if (ah && ah.length)
for (X = 0; X < ah.length; X++) {
var ak = ah[X],
al = ak;
while ((al = al.getNext()) && al.is && al.getName()
in q) {
if (g && !ak.getFirst(function (am) {
return r(am) && s(am);
})) ak.append(G.document.createText('\xa0'));
ak.append(al);
}
ak.insertAfter(af);
}
};
function B() {
var Q = G.createIterator(),
R = x.config.enterMode;
Q.enforceRealBlocks = true;
Q.enlargeBr = R != 2;
var S;
while (S = Q.getNextParagraph(R == 1 ? 'p' : 'div')) C(S);
};
function C(Q, R) {
if (Q.getCustomData('indent_processed')) return false;
if (y.useIndentClasses) {
var S = Q.$.className.match(y.classNameRegex),
T = 0;
if (S) {
S = S[1];
T = y.indentClassMap[S];
}
if (y.name == 'outdent') T--;
else T++; if (T < 0) return false;
T = Math.min(T, x.config.indentClasses.length);
T = Math.max(T, 0);
Q.$.className = i.ltrim(Q.$.className.replace(y.classNam
eRegex, ''));
if (T > 0) Q.addClass(x.config.indentClasses[T - 1]);
} else {
var U = v(Q, R),
V = parseInt(Q.getStyle(U), 10);
if (isNaN(V)) V = 0;
var W = x.config.indentOffset || 40;
V += (y.name == 'indent' ? 1 : -1) * W;
if (V < 0) return false;
V = Math.max(V, 0);
V = Math.ceil(V / W) * W;
Q.setStyle(U, V ? V + (x.config.indentUnit || 'px') : ''
);
if (Q.getAttribute('style') === '') Q.removeAttribute('s
tyle');
}
l.setMarker(z, Q, 'indent_processed', 1);
return true;
};
var D = x.getSelection(),
E = D.createBookmarks(1),
F = D && D.getRanges(1),
G, H = F.createIterator();
while (G = H.getNextRange()) {
var I = G.getCommonAncestor(),
J = I;
while (J && !(J.type == 1 && q[J.getName()])) J = J.getParen
t();
if (!J) {
var K = G.getEnclosedNode();
if (K && K.type == 1 && K.getName() in q) {
G.setStartAt(K, 1);
G.setEndAt(K, 2);
J = K;
}
}
if (J && G.startContainer.type == 1 && G.startContainer.getN
ame() in q) {
var L = new h.walker(G);
L.evaluator = w;
G.startContainer = L.next();
}
if (J && G.endContainer.type == 1 && G.endContainer.getName(
) in q) {
L = new h.walker(G);
L.evaluator = w;
G.endContainer = L.previous();
}
if (J) {
var M = J.getFirst(w),
N = !!M.getNext(w),
O = G.startContainer,
P = M.equals(O) || M.contains(O);
if (!(P && (y.name == 'indent' || y.useIndentClasses ||
parseInt(J.getStyle(v(J)), 10)) && C(J, !N && M.getDirection()))) A(J);
} else B();
}
l.clearAllMarkers(z);
x.forceNextSelectionCheck();
D.selectBookmarks(E);
}
};
n.add('indent', {
init: function (x) {
var y = x.addCommand('indent', new u(x, 'indent')),
z = x.addCommand('outdent', new u(x, 'outdent'));
x.ui.addButton('Indent', {
label: x.lang.indent,
command: 'indent'
});
x.ui.addButton('Outdent', {
label: x.lang.outdent,
command: 'outdent'
});
x.on('selectionChange', i.bind(t, y));
x.on('selectionChange', i.bind(t, z));
if (f.ie6Compat || f.ie7Compat) x.addCss('ul,ol{\tmargin-left: 0
px;\tpadding-left: 40px;}');
x.on('dirChanged', function (A) {
var B = new h.range(x.document);
B.setStartBefore(A.data.node);
B.setEndAfter(A.data.node);
var C = new h.walker(B),
D;
while (D = C.next()) {
if (D.type == 1) {
if (!D.equals(A.data.node) && D.getDirection()) {
B.setStartAfter(D);
C = new h.walker(B);
continue;
}
var E = x.config.indentClasses;
if (E) {
var F = A.data.dir == 'ltr' ? ['_rtl', ''] : [''
, '_rtl'];
for (var G = 0; G < E.length; G++) {
if (D.hasClass(E[G] + F[0])) {
D.removeClass(E[G] + F[0]);
D.addClass(E[G] + F[1]);
}
}
}
var H = D.getStyle('margin-right'),
I = D.getStyle('margin-left');
H ? D.setStyle('margin-left', H) : D.removeStyle('ma
rgin-left');
I ? D.setStyle('margin-right', I) : D.removeStyle('m
argin-right');
}
}
});
},
requires: ['domiterator', 'list']
});
})();
(function () {
function q(v, w) {
var x = w.block || w.blockLimit;
if (!x || x.getName() == 'body') return 2;
return r(x, v.config.useComputedState) == this.value ? 1 : 2;
};
function r(v, w) {
w = w === undefined || w;
var x;
if (w) x = v.getComputedStyle('text-align');
else {
while (!v.hasAttribute || !(v.hasAttribute('align') || v.getStyl
e('text-align'))) {
var y = v.getParent();
if (!y) break;
v = y;
}
x = v.getStyle('text-align') || v.getAttribute('align') || '';
}
x && (x = x.replace(/-moz-|-webkit-|start|auto/i, ''));
!x && w && (x = v.getComputedStyle('direction') == 'rtl' ? 'right' :
'left');
return x;
};
function s(v) {
if (v.editor.readOnly) return;
var w = v.editor.getCommand(this.name);
w.state = q.call(this, v.editor, v.data.path);
w.fire('state');
};
function t(v, w, x) {
var z = this;
z.name = w;
z.value = x;
var y = v.config.justifyClasses;
if (y) {
switch (x) {
case 'left':
z.cssClassName = y[0];
break;
case 'center':
z.cssClassName = y[1];
break;
case 'right':
z.cssClassName = y[2];
break;
case 'justify':
z.cssClassName = y[3];
break;
}
z.cssClassRegex = new RegExp('(?:^|\\s+)(?:' + y.join('|') + ')(
?=$|\\s)');
}
};
function u(v) {
var w = v.editor,
x = new h.range(w.document);
x.setStartBefore(v.data.node);
x.setEndAfter(v.data.node);
var y = new h.walker(x),
z;
while (z = y.next()) {
if (z.type == 1) {
if (!z.equals(v.data.node) && z.getDirection()) {
x.setStartAfter(z);
y = new h.walker(x);
continue;
}
var A = w.config.justifyClasses;
if (A)
if (z.hasClass(A[0])) {
z.removeClass(A[0]);
z.addClass(A[2]);
} else if (z.hasClass(A[2])) {
z.removeClass(A[2]);
z.addClass(A[0]);
}
var B = 'text-align',
C = z.getStyle(B);
if (C == 'left') z.setStyle(B, 'right');
else if (C == 'right') z.setStyle(B, 'left');
}
}
};
t.prototype = {
exec: function (v) {
var H = this;
var w = v.getSelection(),
x = v.config.enterMode;
if (!w) return;
var y = w.createBookmarks(),
z = w.getRanges(true),
A = H.cssClassName,
B, C, D = v.config.useComputedState;
D = D === undefined || D;
for (var E = z.length - 1; E >= 0; E--) {
B = z[E].createIterator();
B.enlargeBr = x != 2;
while (C = B.getNextParagraph(x == 1 ? 'p' : 'div')) {
C.removeAttribute('align');
C.removeStyle('text-align');
var F = A && (C.$.className = i.ltrim(C.$.className.repl
ace(H.cssClassRegex, ''))),
G = H.state == 2 && (!D || r(C, true) != H.value);
if (A) {
if (G) C.addClass(A);
else if (!F) C.removeAttribute('class');
} else if (G) C.setStyle('text-align', H.value);
}
}
v.focus();
v.forceNextSelectionCheck();
w.selectBookmarks(y);
}
};
n.add('justify', {
init: function (v) {
var w = new t(v, 'justifyleft', 'left'),
x = new t(v, 'justifycenter', 'center'),
y = new t(v, 'justifyright', 'right'),
z = new t(v, 'justifyblock', 'justify');
v.addCommand('justifyleft', w);
v.addCommand('justifycenter', x);
v.addCommand('justifyright', y);
v.addCommand('justifyblock', z);
v.ui.addButton('JustifyLeft', {
label: v.lang.justify.left,
command: 'justifyleft'
});
v.ui.addButton('JustifyCenter', {
label: v.lang.justify.center,
command: 'justifycenter'
});
v.ui.addButton('JustifyRight', {
label: v.lang.justify.right,
command: 'justifyright'
});
v.ui.addButton('JustifyBlock', {
label: v.lang.justify.block,
command: 'justifyblock'
});
v.on('selectionChange', i.bind(s, w));
v.on('selectionChange', i.bind(s, y));
v.on('selectionChange', i.bind(s, x));
v.on('selectionChange', i.bind(s, z));
v.on('dirChanged', u);
},
requires: ['domiterator']
});
})();
n.add('keystrokes', {
beforeInit: function (q) {
q.keystrokeHandler = new e.keystrokeHandler(q);
q.specialKeys = {};
},
init: function (q) {
var r = q.config.keystrokes,
s = q.config.blockedKeystrokes,
t = q.keystrokeHandler.keystrokes,
u = q.keystrokeHandler.blockedKeystrokes;
for (var v = 0; v < r.length; v++) t[r[v][0]] = r[v][1];
for (v = 0; v < s.length; v++) u[s[v]] = 1;
}
});
e.keystrokeHandler = function (q) {
var r = this;
if (q.keystrokeHandler) return q.keystrokeHandler;
r.keystrokes = {};
r.blockedKeystrokes = {};
r._ = {
editor: q
};
return r;
};
(function () {
var q, r = function (t) {
t = t.data;
var u = t.getKeystroke(),
v = this.keystrokes[u],
w = this._.editor;
q = w.fire('key', {
keyCode: u
}) === true;
if (!q) {
if (v) {
var x = {
from: 'keystrokeHandler'
};
q = w.execCommand(v, x) !== false;
}
if (!q) {
var y = w.specialKeys[u];
q = y && y(w) === true;
if (!q) q = !!this.blockedKeystrokes[u];
}
}
if (q) t.preventDefault(true);
return !q;
},
s = function (t) {
if (q) {
q = false;
t.data.preventDefault(true);
}
};
e.keystrokeHandler.prototype = {
attach: function (t) {
t.on('keydown', r, this);
if (f.opera || f.gecko && f.mac) t.on('keypress', s, this);
}
};
})();
m.blockedKeystrokes = [1114112 + 66, 1114112 + 73, 1114112 + 85];
m.keystrokes = [
[4456448 + 121, 'toolbarFocus'],
[4456448 + 122, 'elementsPathFocus'],
[2228224 + 121, 'contextMenu'],
[1114112 + 2228224 + 121, 'contextMenu'],
[1114112 + 90, 'undo'],
[1114112 + 89, 'redo'],
[1114112 + 2228224 + 90, 'redo'],
[1114112 + 76, 'link'],
[1114112 + 66, 'bold'],
[1114112 + 73, 'italic'],
[1114112 + 85, 'underline'],
[4456448 + (g || f.webkit ? 189 : 109), 'toolbarCollapse'],
[4456448 + 48, 'a11yHelp']
];
(function () {
var q = {
ol: 1,
ul: 1
},
r = /^[\n\r\t ]*$/,
s = h.walker.whitespaces(),
t = h.walker.bookmark(),
u = function (K) {
return !(s(K) || t(K));
};
function v(K) {
var L, M, N;
if (L = K.getDirection()) {
M = K.getParent();
while (M && !(N = M.getDirection())) M = M.getParent();
if (L == N) K.removeAttribute('dir');
}
};
n.list = {
listToArray: function (K, L, M, N, O) {
if (!q[K.getName()]) return [];
if (!N) N = 0;
if (!M) M = [];
for (var P = 0, Q = K.getChildCount(); P < Q; P++) {
var R = K.getChild(P);
if (R.type == 1 && R.getName() in j.$list) n.list.listToArra
y(R, L, M, N + 1);
if (R.$.nodeName.toLowerCase() != 'li') continue;
var S = {
parent: K,
indent: N,
element: R,
contents: []
};
if (!O) {
S.grandparent = K.getParent();
if (S.grandparent && S.grandparent.$.nodeName.toLowerCas
e() == 'li') S.grandparent = S.grandparent.getParent();
} else S.grandparent = O; if (L) l.setMarker(L, R, 'listarra
y_index', M.length);
M.push(S);
for (var T = 0, U = R.getChildCount(), V; T < U; T++) {
V = R.getChild(T);
if (V.type == 1 && q[V.getName()]) n.list.listToArray(V,
L, M, N + 1, S.grandparent);
else S.contents.push(V);
}
}
return M;
},
arrayToList: function (K, L, M, N, O) {
if (!M) M = 0;
if (!K || K.length < M + 1) return null;
var P = K[M].parent.getDocument(),
Q = new h.documentFragment(P),
R = null,
S = M,
T = Math.max(K[M].indent, 0),
U = null,
V, W = N == 1 ? 'p' : 'div';
while (1) {
var X = K[S];
V = X.element.getDirection(1);
if (X.indent == T) {
if (!R || K[S].parent.getName() != R.getName()) {
R = K[S].parent.clone(false, 1);
O && R.setAttribute('dir', O);
Q.append(R);
}
U = R.append(X.element.clone(0, 1));
if (V != R.getDirection(1)) U.setAttribute('dir', V);
for (var Y = 0; Y < X.contents.length; Y++) U.append(X.c
ontents[Y].clone(1, 1));
S++;
} else if (X.indent == Math.max(T, 0) + 1) {
var Z = K[S - 1].element.getDirection(1),
aa = n.list.arrayToList(K, null, S, N, Z != V ? V :
null);
if (!U.getChildCount() && g && !(P.$.documentMode > 7))
U.append(P.createText('\xa0'));
U.append(aa.listNode);
S = aa.nextIndex;
} else if (X.indent == -1 && !M && X.grandparent) {
if (q[X.grandparent.getName()]) U = X.element.clone(fals
e, true);
else if (O || X.element.hasAttributes() || N != 2) {
U = P.createElement(W);
X.element.copyAttributes(U, {
type: 1,
value: 1
});
if (!O && N == 2 && !U.hasAttributes()) U = new h.do
cumentFragment(P);
} else U = new h.documentFragment(P); if (U.type == 1)
if (X.grandparent.getDirection(1) != V) U.setAttribu
te('dir', V);
for (Y = 0; Y < X.contents.length; Y++) U.append(X.conte
nts[Y].clone(1, 1));
if (U.type == 11 && S != K.length - 1) {
var ab = U.getLast();
if (ab && ab.type == 1 && ab.getAttribute('type') ==
'_moz') ab.remove();
if (!(ab = U.getLast(u) && ab.type == 1 && ab.getNam
e() in j.$block)) U.append(P.createElement('br'));
}
if (U.type == 1 && U.getName() == W && U.$.firstChild) {
U.trim();
var ac = U.getFirst();
if (ac.type == 1 && ac.isBlockBoundary()) {
var ad = new h.documentFragment(P);
U.moveChildren(ad);
U = ad;
}
}
var ae = U.$.nodeName.toLowerCase();
if (!g && (ae == 'div' || ae == 'p')) U.appendBogus();
Q.append(U);
R = null;
S++;
} else return null; if (K.length <= S || Math.max(K[S].inden
t, 0) < T) break;
}
if (L) {
var af = Q.getFirst(),
ag = K[0].parent;
while (af) {
if (af.type == 1) {
l.clearMarkers(L, af);
if (af.getName() in j.$listItem) v(af);
}
af = af.getNextSourceNode();
}
}
return {
listNode: Q,
nextIndex: S
};
}
};
function w(K) {
if (K.editor.readOnly) return null;
var L = K.data.path,
M = L.blockLimit,
N = L.elements,
O, P;
for (P = 0; P < N.length && (O = N[P]) && !O.equals(M); P++) {
if (q[N[P].getName()]) return this.setState(this.type == N[P].ge
tName() ? 1 : 2);
}
return this.setState(2);
};
function x(K, L, M, N) {
var O = n.list.listToArray(L.root, M),
P = [];
for (var Q = 0; Q < L.contents.length; Q++) {
var R = L.contents[Q];
R = R.getAscendant('li', true);
if (!R || R.getCustomData('list_item_processed')) continue;
P.push(R);
l.setMarker(M, R, 'list_item_processed', true);
}
var S = L.root,
T = S.getDocument().createElement(this.type);
S.copyAttributes(T, {
start: 1,
type: 1
});
T.removeStyle('list-style-type');
for (Q = 0; Q < P.length; Q++) {
var U = P[Q].getCustomData('listarray_index');
O[U].parent = T;
}
var V = n.list.arrayToList(O, M, null, K.config.enterMode),
W, X = V.listNode.getChildCount();
for (Q = 0; Q < X && (W = V.listNode.getChild(Q)); Q++) {
if (W.getName() == this.type) N.push(W);
}
V.listNode.replace(L.root);
};
var y = /^h[1-6]$/;
function z(K, L, M) {
var N = L.contents,
O = L.root.getDocument(),
P = [];
if (N.length == 1 && N[0].equals(L.root)) {
var Q = O.createElement('div');
N[0].moveChildren && N[0].moveChildren(Q);
N[0].append(Q);
N[0] = Q;
}
var R = L.contents[0].getParent();
for (var S = 0; S < N.length; S++) R = R.getCommonAncestor(N[S].getP
arent());
var T = K.config.useComputedState,
U, V;
T = T === undefined || T;
for (S = 0; S < N.length; S++) {
var W = N[S],
X;
while (X = W.getParent()) {
if (X.equals(R)) {
P.push(W);
if (!V && W.getDirection()) V = 1;
var Y = W.getDirection(T);
if (U !== null)
if (U && U != Y) U = null;
else U = Y;
break;
}
W = X;
}
}
if (P.length < 1) return;
var Z = P[P.length - 1].getNext(),
aa = O.createElement(this.type);
M.push(aa);
var ab, ac;
while (P.length) {
ab = P.shift();
ac = O.createElement('li');
if (ab.is('pre') || y.test(ab.getName())) ab.appendTo(ac);
else {
ab.copyAttributes(ac);
if (U && ab.getDirection()) {
ac.removeStyle('direction');
ac.removeAttribute('dir');
}
ab.moveChildren(ac);
ab.remove();
}
ac.appendTo(aa);
}
if (U && V) aa.setAttribute('dir', U);
if (Z) aa.insertBefore(Z);
else aa.appendTo(R);
};
function A(K, L, M) {
var N = n.list.listToArray(L.root, M),
O = [];
for (var P = 0; P < L.contents.length; P++) {
var Q = L.contents[P];
Q = Q.getAscendant('li', true);
if (!Q || Q.getCustomData('list_item_processed')) continue;
O.push(Q);
l.setMarker(M, Q, 'list_item_processed', true);
}
var R = null;
for (P = 0; P < O.length; P++) {
var S = O[P].getCustomData('listarray_index');
N[S].indent = -1;
R = S;
}
for (P = R + 1; P < N.length; P++) {
if (N[P].indent > N[P - 1].indent + 1) {
var T = N[P - 1].indent + 1 - N[P].indent,
U = N[P].indent;
while (N[P] && N[P].indent >= U) {
N[P].indent += T;
P++;
}
P--;
}
}
var V = n.list.arrayToList(N, M, null, K.config.enterMode, L.root.ge
tAttribute('dir')),
W = V.listNode,
X, Y;
function Z(aa) {
if ((X = W[aa ? 'getFirst' : 'getLast']()) && !(X.is && X.isBloc
kBoundary()) && (Y = L.root[aa ? 'getPrevious' : 'getNext'](h.walker.whitespaces
(true))) && !(Y.is && Y.isBlockBoundary({
br: 1
}))) K.document.createElement('br')[aa ? 'insertBefore' : 'inser
tAfter'](X);
};
Z(true);
Z();
W.replace(L.root);
};
function B(K, L) {
this.name = K;
this.type = L;
};
function C(K) {
var L = K.getDirection();
if (L) {
for (var M = 0, N = K.getChildren(), O; O = N.getItem(M), M < N.
count(); M++) {
if (O.type == 1 && O.is('li') && !O.getDirection()) O.setAtt
ribute('dir', L);
}
K.removeAttribute('dir');
}
};
B.prototype = {
exec: function (K) {
var L = K.document,
M = K.config,
N = K.getSelection(),
O = N && N.getRanges(true);
if (!O || O.length < 1) return;
if (this.state == 2) {
var P = L.getBody();
if (!P.getFirst(u)) {
M.enterMode == 2 ? P.appendBogus() : O[0].fixBlock(1, M.
enterMode == 1 ? 'p' : 'div');
N.selectRanges(O);
} else {
var Q = O.length == 1 && O[0],
R = Q && Q.getEnclosedNode();
if (R && R.is && this.type == R.getName()) this.setState
(1);
}
}
var S = N.createBookmarks(true),
T = [],
U = {},
V = O.createIterator(),
W = 0;
while ((Q = V.getNextRange()) && ++W) {
var X = Q.getBoundaryNodes(),
Y = X.startNode,
Z = X.endNode;
if (Y.type == 1 && Y.getName() == 'td') Q.setStartAt(X.start
Node, 1);
if (Z.type == 1 && Z.getName() == 'td') Q.setEndAt(X.endNode
, 2);
var aa = Q.createIterator(),
ab;
aa.forceBrBreak = this.state == 2;
while (ab = aa.getNextParagraph()) {
if (ab.getCustomData('list_block')) continue;
else l.setMarker(U, ab, 'list_block', 1);
var ac = new h.elementPath(ab),
ad = ac.elements,
ae = ad.length,
af = null,
ag = 0,
ah = ac.blockLimit,
ai;
for (var aj = ae - 1; aj >= 0 && (ai = ad[aj]); aj--) {
if (q[ai.getName()] && ah.contains(ai)) {
ah.removeCustomData('list_group_object_' + W);
var ak = ai.getCustomData('list_group_object');
if (ak) ak.contents.push(ab);
else {
ak = {
root: ai,
contents: [ab]
};
T.push(ak);
l.setMarker(U, ai, 'list_group_object', ak);
}
ag = 1;
break;
}
}
if (ag) continue;
var al = ah;
if (al.getCustomData('list_group_object_' + W)) al.getCu
stomData('list_group_object_' + W).contents.push(ab);
else {
ak = {
root: al,
contents: [ab]
};
l.setMarker(U, al, 'list_group_object_' + W, ak);
T.push(ak);
}
}
}
var am = [];
while (T.length > 0) {
ak = T.shift();
if (this.state == 2) {
if (q[ak.root.getName()]) x.call(this, K, ak, U, am);
else z.call(this, K, ak, am);
} else if (this.state == 1 && q[ak.root.getName()]) A.call(t
his, K, ak, U);
}
for (aj = 0; aj < am.length; aj++) {
af = am[aj];
var an, ao = this;
(an = function (ap) {
var aq = af[ap ? 'getPrevious' : 'getNext'](h.walker.whi
tespaces(true));
if (aq && aq.getName && aq.getName() == ao.type) {
if (aq.getDirection(1) != af.getDirection(1)) C(af.g
etDirection() ? af : aq);
aq.remove();
aq.moveChildren(af, ap);
}
})();
an(1);
}
l.clearAllMarkers(U);
N.selectBookmarks(S);
K.focus();
}
};
var D = j,
E = /[\t\r\n ]*(?:&nbsp;|\xa0)$/;
function F(K, L) {
var M, N = K.children,
O = N.length;
for (var P = 0; P < O; P++) {
M = N[P];
if (M.name && M.name in L) return P;
}
return O;
};
function G(K) {
return function (L) {
var M = L.children,
N = F(L, D.$list),
O = M[N],
P = O && O.previous,
Q;
if (P && (P.name && P.name == 'br' || P.value && (Q = P.value.ma
tch(E)))) {
var R = P;
if (!(Q && Q.index) && R == M[0]) M[0] = K || g ? new e.html
Parser.text('\xa0') : new e.htmlParser.element('br', {});
else if (R.name == 'br') M.splice(N - 1, 1);
else R.value = R.value.replace(E, '');
}
};
};
var H = {
elements: {}
};
for (var I in D.$listItem) H.elements[I] = G();
var J = {
elements: {}
};
for (I in D.$listItem) J.elements[I] = G(true);
n.add('list', {
init: function (K) {
var L = K.addCommand('numberedlist', new B('numberedlist', 'ol')
),
M = K.addCommand('bulletedlist', new B('bulletedlist', 'ul')
);
K.ui.addButton('NumberedList', {
label: K.lang.numberedlist,
command: 'numberedlist'
});
K.ui.addButton('BulletedList', {
label: K.lang.bulletedlist,
command: 'bulletedlist'
});
K.on('selectionChange', i.bind(w, L));
K.on('selectionChange', i.bind(w, M));
},
afterInit: function (K) {
var L = K.dataProcessor;
if (L) {
L.dataFilter.addRules(H);
L.htmlFilter.addRules(J);
}
},
requires: ['domiterator']
});
})();
(function () {
n.liststyle = {
requires: ['dialog'],
init: function (q) {
q.addCommand('numberedListStyle', new e.dialogCommand('numberedL
istStyle'));
e.dialog.add('numberedListStyle', this.path + 'dialogs/liststyle
.js');
q.addCommand('bulletedListStyle', new e.dialogCommand('bulletedL
istStyle'));
e.dialog.add('bulletedListStyle', this.path + 'dialogs/liststyle
.js');
if (q.addMenuItems) {
q.addMenuGroup('list', 108);
q.addMenuItems({
numberedlist: {
label: q.lang.list.numberedTitle,
group: 'list',
command: 'numberedListStyle'
},
bulletedlist: {
label: q.lang.list.bulletedTitle,
group: 'list',
command: 'bulletedListStyle'
}
});
}
if (q.contextMenu) q.contextMenu.addListener(function (r, s) {
if (!r || r.isReadOnly()) return null;
while (r) {
var t = r.getName();
if (t == 'ol') return {
numberedlist: 2
};
else if (t == 'ul') return {
bulletedlist: 2
};
r = r.getParent();
}
return null;
});
}
};
n.add('liststyle', n.liststyle);
})();
(function () {
function q(w) {
if (!w || w.type != 1 || w.getName() != 'form') return [];
var x = [],
y = ['style', 'className'];
for (var z = 0; z < y.length; z++) {
var A = y[z],
B = w.$.elements.namedItem(A);
if (B) {
var C = new l(B);
x.push([C, C.nextSibling]);
C.remove();
}
}
return x;
};
function r(w, x) {
if (!w || w.type != 1 || w.getName() != 'form') return;
if (x.length > 0)
for (var y = x.length - 1; y >= 0; y--) {
var z = x[y][0],
A = x[y][1];
if (A) z.insertBefore(A);
else z.appendTo(w);
}
};
function s(w, x) {
var y = q(w),
z = {},
A = w.$;
if (!x) {
z['class'] = A.className || '';
A.className = '';
}
z.inline = A.style.cssText || '';
if (!x) A.style.cssText = 'position: static; overflow: visible';
r(y);
return z;
};
function t(w, x) {
var y = q(w),
z = w.$;
if ('class' in x) z.className = x['class'];
if ('inline' in x) z.style.cssText = x.inline;
r(y);
};
function u(w) {
var x = e.instances;
for (var y in x) {
var z = x[y];
if (z.mode == 'wysiwyg' && !z.readOnly) {
var A = z.document.getBody();
A.setAttribute('contentEditable', false);
A.setAttribute('contentEditable', true);
}
}
if (w.focusManager.hasFocus) {
w.toolbox.focus();
w.focus();
}
};
function v(w) {
if (!g || f.version > 6) return null;
var x = l.createFromHtml('<iframe frameborder="0" tabindex="-1" src=
"javascript:void((function(){document.open();' + (f.isCustomDomain() ? "document
.domain='" + this.getDocument().$.domain + "';" : '') + 'document.close();' + '}
)())"' + ' style="display:block;position:absolute;z-index:-1;' + 'progid:DXImage
Transform.Microsoft.Alpha(opacity=0);' + '"></iframe>');
return w.append(x, true);
};
n.add('maximize', {
init: function (w) {
var x = w.lang,
y = e.document,
z = y.getWindow(),
A, B, C, D;
function E() {
var G = z.getViewPaneSize();
D && D.setStyles({
width: G.width + 'px',
height: G.height + 'px'
});
w.resize(G.width, G.height, null, true);
};
var F = 2;
w.addCommand('maximize', {
modes: {
wysiwyg: !f.iOS,
source: !f.iOS
},
readOnly: 1,
editorFocus: false,
exec: function () {
var G = w.container.getChild(1),
H = w.getThemeSpace('contents');
if (w.mode == 'wysiwyg') {
var I = w.getSelection();
A = I && I.getRanges();
B = z.getScrollPosition();
} else {
var J = w.textarea.$;
A = !g && [J.selectionStart, J.selectionEnd];
B = [J.scrollLeft, J.scrollTop];
} if (this.state == 2) {
z.on('resize', E);
C = z.getScrollPosition();
var K = w.container;
while (K = K.getParent()) {
K.setCustomData('maximize_saved_styles', s(K));
K.setStyle('z-index', w.config.baseFloatZIndex -
1);
}
H.setCustomData('maximize_saved_styles', s(H, true))
;
G.setCustomData('maximize_saved_styles', s(G, true))
;
var L = {
overflow: f.webkit ? '' : 'hidden',
width: 0,
height: 0
};
y.getDocumentElement().setStyles(L);
!f.gecko && y.getDocumentElement().setStyle('positio
n', 'fixed');
!(f.gecko && f.quirks) && y.getBody().setStyles(L);
g ? setTimeout(function () {
z.$.scrollTo(0, 0);
}, 0) : z.$.scrollTo(0, 0);
G.setStyle('position', f.gecko && f.quirks ? 'fixed'
: 'absolute');
G.$.offsetLeft;
G.setStyles({
'z-index': w.config.baseFloatZIndex - 1,
left: '0px',
top: '0px'
});
D = v(G);
G.addClass('cke_maximized');
E();
var M = G.getDocumentPosition();
G.setStyles({
left: -1 * M.x + 'px',
top: -1 * M.y + 'px'
});
f.gecko && u(w);
} else if (this.state == 1) {
z.removeListener('resize', E);
var N = [H, G];
for (var O = 0; O < N.length; O++) {
t(N[O], N[O].getCustomData('maximize_saved_style
s'));
N[O].removeCustomData('maximize_saved_styles');
}
K = w.container;
while (K = K.getParent()) {
t(K, K.getCustomData('maximize_saved_styles'));
K.removeCustomData('maximize_saved_styles');
}
g ? setTimeout(function () {
z.$.scrollTo(C.x, C.y);
}, 0) : z.$.scrollTo(C.x, C.y);
G.removeClass('cke_maximized');
if (f.webkit) {
G.setStyle('display', 'inline');
setTimeout(function () {
G.setStyle('display', 'block');
}, 0);
}
if (D) {
D.remove();
D = null;
}
w.fire('resize');
}
this.toggleState();
var P = this.uiItems[0];
if (P) {
var Q = this.state == 2 ? x.maximize : x.minimize,
R = w.element.getDocument().getById(P._.id);
R.getChild(1).setHtml(Q);
R.setAttribute('title', Q);
R.setAttribute('href', 'javascript:void("' + Q + '")
;');
}
if (w.mode == 'wysiwyg') {
if (A) {
f.gecko && u(w);
w.getSelection().selectRanges(A);
var S = w.getSelection().getStartElement();
S && S.scrollIntoView(true);
} else z.$.scrollTo(B.x, B.y);
} else {
if (A) {
J.selectionStart = A[0];
J.selectionEnd = A[1];
}
J.scrollLeft = B[0];
J.scrollTop = B[1];
}
A = B = null;
F = this.state;
},
canUndo: false
});
w.ui.addButton('Maximize', {
label: x.maximize,
command: 'maximize'
});
w.on('mode', function () {
var G = w.getCommand('maximize');
G.setState(G.state == 0 ? 0 : F);
}, null, null, 100);
}
});
})();
(function () {
function q(r) {
r.data.mode = 'html';
};
n.add('pastefromword', {
init: function (r) {
var s = 0,
t = function (u) {
u && u.removeListener();
r.removeListener('beforePaste', q);
s && setTimeout(function () {
s = 0;
}, 0);
};
r.addCommand('pastefromword', {
canUndo: false,
exec: function () {
s = 1;
r.on('beforePaste', q);
if (r.execCommand('paste', 'html') === false) {
r.on('dialogShow', function (u) {
u.removeListener();
u.data.on('cancel', t);
});
r.on('dialogHide', function (u) {
u.data.removeListener('cancel', t);
});
}
r.on('afterPaste', t);
}
});
r.ui.addButton('PasteFromWord', {
label: r.lang.pastefromword.toolbar,
command: 'pastefromword'
});
r.on('pasteState', function (u) {
r.getCommand('pastefromword').setState(u.data);
});
r.on('paste', function (u) {
var v = u.data,
w;
if ((w = v.html) && (s || /(class=\"?Mso|style=\"[^\"]*\bmso
\-|w:WordDocument)/.test(w))) {
var x = this.loadFilterRules(function () {
if (x) r.fire('paste', v);
else if (!r.config.pasteFromWordPromptCleanup || s |
| confirm(r.lang.pastefromword.confirmCleanup)) v.html = e.cleanWord(w, r);
});
x && u.cancel();
}
}, this);
},
loadFilterRules: function (r) {
var s = e.cleanWord;
if (s) r();
else {
var t = e.getUrl(m.pasteFromWordCleanupFile || this.path + '
filter/default.js');
e.scriptLoader.load(t, r, null, true);
}
return !s;
},
requires: ['clipboard']
});
})();
(function () {
var q = {
exec: function (r) {
var s = i.tryThese(function () {
var t = window.clipboardData.getData('Text');
if (!t) throw 0;
return t;
});
if (!s) {
r.openDialog('pastetext');
return false;
} else r.fire('paste', {
text: s
});
return true;
}
};
n.add('pastetext', {
init: function (r) {
var s = 'pastetext',
t = r.addCommand(s, q);
r.ui.addButton('PasteText', {
label: r.lang.pasteText.button,
command: s
});
e.dialog.add(s, e.getUrl(this.path + 'dialogs/pastetext.js'));
if (r.config.forcePasteAsPlainText) {
r.on('beforeCommandExec', function (u) {
var v = u.data.commandData;
if (u.data.name == 'paste' && v != 'html') {
r.execCommand('pastetext');
u.cancel();
}
}, null, null, 0);
r.on('beforePaste', function (u) {
u.data.mode = 'text';
});
}
r.on('pasteState', function (u) {
r.getCommand('pastetext').setState(u.data);
});
},
requires: ['clipboard']
});
})();
n.add('popup');
i.extend(e.editor.prototype, {
popup: function (q, r, s, t) {
r = r || '80%';
s = s || '70%';
if (typeof r == 'string' && r.length > 1 && r.substr(r.length - 1, 1
) == '%') r = parseInt(window.screen.width * parseInt(r, 10) / 100, 10);
if (typeof s == 'string' && s.length > 1 && s.substr(s.length - 1, 1
) == '%') s = parseInt(window.screen.height * parseInt(s, 10) / 100, 10);
if (r < 640) r = 640;
if (s < 420) s = 420;
var u = parseInt((window.screen.height - s) / 2, 10),
v = parseInt((window.screen.width - r) / 2, 10);
t = (t || 'location=no,menubar=no,toolbar=no,dependent=yes,minimizab
le=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes') + ',width=' + r
+ ',height=' + s + ',top=' + u + ',left=' + v;
var w = window.open('', null, t, true);
if (!w) return false;
try {
w.moveTo(v, u);
w.resizeTo(r, s);
w.focus();
w.location.href = q;
} catch (x) {
w = window.open(q, null, t, true);
}
return true;
}
});
n.add('resize', {
init: function (q) {
var r = q.config,
s = q.element.getDirection(1);
!r.resize_dir && (r.resize_dir = 'both');
r.resize_maxWidth == undefined && (r.resize_maxWidth = 3000);
r.resize_maxHeight == undefined && (r.resize_maxHeight = 3000);
r.resize_minWidth == undefined && (r.resize_minWidth = 750);
r.resize_minHeight == undefined && (r.resize_minHeight = 250);
if (r.resize_enabled !== false) {
var t = null,
u, v, w = (r.resize_dir == 'both' || r.resize_dir == 'horizo
ntal') && r.resize_minWidth != r.resize_maxWidth,
x = (r.resize_dir == 'both' || r.resize_dir == 'vertical') &
& r.resize_minHeight != r.resize_maxHeight;
function y(B) {
var C = B.data.$.screenX - u.x,
D = B.data.$.screenY - u.y,
E = v.width,
F = v.height,
G = E + C * (s == 'rtl' ? -1 : 1),
H = F + D;
if (w) E = Math.max(r.resize_minWidth, Math.min(G, r.resize_
maxWidth));
if (x) F = Math.max(r.resize_minHeight, Math.min(H, r.resize
_maxHeight));
q.resize(w ? E : null, x ? F : null);
};
function z(B) {
e.document.removeListener('mousemove', y);
e.document.removeListener('mouseup', z);
if (q.document) {
q.document.removeListener('mousemove', y);
q.document.removeListener('mouseup', z);
}
};
var A = i.addFunction(function (B) {
if (!t) t = q.getResizable();
v = {
width: t.$.offsetWidth || 0,
height: t.$.offsetHeight || 0
};
u = {
x: B.screenX,
y: B.screenY
};
r.resize_minWidth > v.width && (r.resize_minWidth = v.width)
;
r.resize_minHeight > v.height && (r.resize_minHeight = v.hei
ght);
e.document.on('mousemove', y);
e.document.on('mouseup', z);
if (q.document) {
q.document.on('mousemove', y);
q.document.on('mouseup', z);
}
});
q.on('destroy', function () {
i.removeFunction(A);
});
q.on('themeSpace', function (B) {
if (B.data.space == 'bottom') {
var C = '';
if (w && !x) C = ' cke_resizer_horizontal';
if (!w && x) C = ' cke_resizer_vertical';
var D = '<div class="cke_resizer' + C + ' cke_resizer_'
+ s + '"' + ' title="' + i.htmlEncode(q.lang.resize) + '"' + ' onmousedown="CKED
ITOR.tools.callFunction(' + A + ', event)"' + '></div>';
s == 'ltr' && C == 'ltr' ? B.data.html += D : B.data.htm
l = D + B.data.html;
}
}, q, null, 100);
}
}
});
(function () {
var q = 'scaytcheck',
r = '';
function s(x, y) {
var z = 0,
A;
for (A in y) {
if (y[A] == x) {
z = 1;
break;
}
}
return z;
};
var t = function () {
var x = this,
y = function () {
var C = x.config,
D = {};
D.srcNodeRef = x.document.getWindow().$.frameElement;
D.assocApp = 'CKEDITOR.' + e.version + '@' + e.revision;
D.customerid = C.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4
-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';
D.customDictionaryIds = C.scayt_customDictionaryIds || '';
D.userDictionaryName = C.scayt_userDictionaryName || '';
D.sLang = C.scayt_sLang || 'en_US';
D.onLoad = function () {
if (!(g && f.version < 8)) this.addStyle(this.selectorCs
s(), 'padding-bottom: 2px !important;');
if (x.focusManager.hasFocus && !u.isControlRestored(x))
this.focus();
};
D.onBeforeChange = function () {
if (u.getScayt(x) && !x.checkDirty()) setTimeout(functio
n () {
x.resetDirty();
}, 0);
};
var E = window.scayt_custom_params;
if (typeof E == 'object')
for (var F in E) D[F] = E[F];
if (u.getControlId(x)) D.id = u.getControlId(x);
var G = new window.scayt(D);
G.afterMarkupRemove.push(function (I) {
new l(I, G.document).mergeSiblings();
});
var H = u.instances[x.name];
if (H) {
G.sLang = H.sLang;
G.option(H.option());
G.paused = H.paused;
}
u.instances[x.name] = G;
try {
G.setDisabled(u.isPaused(x) === false);
} catch (I) {}
x.fire('showScaytState');
};
x.on('contentDom', y);
x.on('contentDomUnload', function () {
var C = e.document.getElementsByTag('script'),
D = /^dojoIoScript(\d+)$/i,
E = /^https?:\/\/svc\.webspellchecker\.net\/spellcheck\/scri
pt\/ssrv\.cgi/i;
for (var F = 0; F < C.count(); F++) {
var G = C.getItem(F),
H = G.getId(),
I = G.getAttribute('src');
if (H && I && H.match(D) && I.match(E)) G.remove();
}
});
x.on('beforeCommandExec', function (C) {
if ((C.data.name == 'source' || C.data.name == 'newpage') && x.m
ode == 'wysiwyg') {
var D = u.getScayt(x);
if (D) {
u.setPaused(x, !D.disabled);
u.setControlId(x, D.id);
D.destroy(true);
delete u.instances[x.name];
}
} else if (C.data.name == 'source' && x.mode == 'source') u.mark
ControlRestore(x);
});
x.on('afterCommandExec', function (C) {
if (!u.isScaytEnabled(x)) return;
if (x.mode == 'wysiwyg' && (C.data.name == 'undo' || C.data.name
== 'redo')) window.setTimeout(function () {
u.getScayt(x).refresh();
}, 10);
});
x.on('destroy', function (C) {
var D = C.editor,
E = u.getScayt(D);
if (!E) return;
delete u.instances[D.name];
u.setControlId(D, E.id);
E.destroy(true);
});
x.on('afterSetData', function () {
if (u.isScaytEnabled(x)) window.setTimeout(function () {
var C = u.getScayt(x);
C && C.refresh();
}, 10);
});
x.on('insertElement', function () {
var C = u.getScayt(x);
if (u.isScaytEnabled(x)) {
if (g) x.getSelection().unlock(true);
window.setTimeout(function () {
C.focus();
C.refresh();
}, 10);
}
}, this, null, 50);
x.on('insertHtml', function () {
var C = u.getScayt(x);
if (u.isScaytEnabled(x)) {
if (g) x.getSelection().unlock(true);
window.setTimeout(function () {
C.focus();
C.refresh();
}, 10);
}
}, this, null, 50);
x.on('scaytDialog', function (C) {
C.data.djConfig = window.djConfig;
C.data.scayt_control = u.getScayt(x);
C.data.tab = r;
C.data.scayt = window.scayt;
});
var z = x.dataProcessor,
A = z && z.htmlFilter;
if (A) A.addRules({
elements: {
span: function (C) {
if (C.attributes['data-scayt_word'] && C.attributes['dat
a-scaytid']) {
delete C.name;
return C;
}
}
}
});
var B = n.undo.Image.prototype;
B.equals = i.override(B.equals, function (C) {
return function (D) {
var I = this;
var E = I.contents,
F = D.contents,
G = u.getScayt(I.editor);
if (G && u.isScaytReady(I.editor)) {
I.contents = G.reset(E) || '';
D.contents = G.reset(F) || '';
}
var H = C.apply(I, arguments);
I.contents = E;
D.contents = F;
return H;
};
});
if (x.document) y();
};
n.scayt = {
engineLoaded: false,
instances: {},
controlInfo: {},
setControlInfo: function (x, y) {
if (x && x.name && typeof this.controlInfo[x.name] != 'object')
this.controlInfo[x.name] = {};
for (var z in y) this.controlInfo[x.name][z] = y[z];
},
isControlRestored: function (x) {
if (x && x.name && this.controlInfo[x.name]) return this.control
Info[x.name].restored;
return false;
},
markControlRestore: function (x) {
this.setControlInfo(x, {
restored: true
});
},
setControlId: function (x, y) {
this.setControlInfo(x, {
id: y
});
},
getControlId: function (x) {
if (x && x.name && this.controlInfo[x.name] && this.controlInfo[
x.name].id) return this.controlInfo[x.name].id;
return null;
},
setPaused: function (x, y) {
this.setControlInfo(x, {
paused: y
});
},
isPaused: function (x) {
if (x && x.name && this.controlInfo[x.name]) return this.control
Info[x.name].paused;
return undefined;
},
getScayt: function (x) {
return this.instances[x.name];
},
isScaytReady: function (x) {
return this.engineLoaded === true && 'undefined' !== typeof wind
ow.scayt && this.getScayt(x);
},
isScaytEnabled: function (x) {
var y = this.getScayt(x);
return y ? y.disabled === false : false;
},
getUiTabs: function (x) {
var y = [],
z = x.config.scayt_uiTabs || '1,1,1';
z = z.split(',');
z[3] = '1';
for (var A = 0; A < 4; A++) y[A] = typeof window.scayt != 'undef
ined' && typeof window.scayt.uiTags != 'undefined' ? parseInt(z[A], 10) && windo
w.scayt.uiTags[A] : parseInt(z[A], 10);
return y;
},
loadEngine: function (x) {
if (f.gecko && f.version < 10900 || f.opera || f.air) return x.f
ire('showScaytState');
if (this.engineLoaded === true) return t.apply(x);
else if (this.engineLoaded == -1) return e.on('scaytReady', func
tion () {
t.apply(x);
});
e.on('scaytReady', t, x);
e.on('scaytReady', function () {
this.engineLoaded = true;
}, this, null, 0);
this.engineLoaded = -1;
var y = document.location.protocol;
y = y.search(/https?:/) != -1 ? y : 'http:';
var z = 'svc.webspellchecker.net/scayt26/loader__base.js',
A = x.config.scayt_srcUrl || y + '//' + z,
B = u.parseUrl(A).path + '/';
if (window.scayt == undefined) {
e._djScaytConfig = {
baseUrl: B,
addOnLoad: [
function () {
e.fireOnce('scaytReady');
}
],
isDebug: false
};
e.document.getHead().append(e.document.createElement('script
', {
attributes: {
type: 'text/javascript',
async: 'true',
src: A
}
}));
} else e.fireOnce('scaytReady');
return null;
},
parseUrl: function (x) {
var y;
if (x.match && (y = x.match(/(.*)[\/\\](.*?\.\w+)$/))) return {
path: y[1],
file: y[2]
};
else return x;
}
};
var u = n.scayt,
v = function (x, y, z, A, B, C, D) {
x.addCommand(A, B);
x.addMenuItem(A, {
label: z,
command: A,
group: C,
order: D
});
},
w = {
preserveState: true,
editorFocus: false,
canUndo: false,
exec: function (x) {
if (u.isScaytReady(x)) {
var y = u.isScaytEnabled(x);
this.setState(y ? 2 : 1);
var z = u.getScayt(x);
z.focus();
z.setDisabled(y);
} else if (!x.config.scayt_autoStartup && u.engineLoaded >=
0) {
this.setState(0);
u.loadEngine(x);
}
}
};
n.add('scayt', {
requires: ['menubutton'],
beforeInit: function (x) {
var y = x.config.scayt_contextMenuItemsOrder || 'suggest|moresug
gest|control',
z = '';
y = y.split('|');
if (y && y.length)
for (var A = 0; A < y.length; A++) z += 'scayt_' + y[A] + (y
.length != parseInt(A, 10) + 1 ? ',' : '');
x.config.menu_groups = z + ',' + x.config.menu_groups;
},
init: function (x) {
var y = x.dataProcessor && x.dataProcessor.dataFilter,
z = {
elements: {
span: function (I) {
var J = I.attributes;
if (J && J['data-scaytid']) delete I.name;
}
}
};
y && y.addRules(z);
var A = {},
B = {},
C = x.addCommand(q, w);
e.dialog.add(q, e.getUrl(this.path + 'dialogs/options.js'));
var D = u.getUiTabs(x),
E = 'scaytButton';
x.addMenuGroup(E);
var F = {},
G = x.lang.scayt;
F.scaytToggle = {
label: G.enable,
command: q,
group: E
};
if (D[0] == 1) F.scaytOptions = {
label: G.options,
group: E,
onClick: function () {
r = 'options';
x.openDialog(q);
}
};
if (D[1] == 1) F.scaytLangs = {
label: G.langs,
group: E,
onClick: function () {
r = 'langs';
x.openDialog(q);
}
};
if (D[2] == 1) F.scaytDict = {
label: G.dictionariesTab,
group: E,
onClick: function () {
r = 'dictionaries';
x.openDialog(q);
}
};
F.scaytAbout = {
label: x.lang.scayt.about,
group: E,
onClick: function () {
r = 'about';
x.openDialog(q);
}
};
x.addMenuItems(F);
x.ui.add('Scayt', 'menubutton', {
label: G.title,
title: f.opera ? G.opera_title : G.title,
className: 'cke_button_scayt',
modes: {
wysiwyg: 1
},
onRender: function () {
C.on('state', function () {
this.setState(C.state);
}, this);
},
onMenu: function () {
var I = u.isScaytEnabled(x);
x.getMenuItem('scaytToggle').label = G[I ? 'disable' : '
enable'];
var J = u.getUiTabs(x);
return {
scaytToggle: 2,
scaytOptions: I && J[0] ? 2 : 0,
scaytLangs: I && J[1] ? 2 : 0,
scaytDict: I && J[2] ? 2 : 0,
scaytAbout: I && J[3] ? 2 : 0
};
}
});
if (x.contextMenu && x.addMenuItems) x.contextMenu.addListener(f
unction (I, J) {
if (!u.isScaytEnabled(x) || J.getRanges()[0].checkReadOnly()
) return null;
var K = u.getScayt(x),
L = K.getScaytNode();
if (!L) return null;
var M = K.getWord(L);
if (!M) return null;
var N = K.getLang(),
O = {},
P = window.scayt.getSuggestion(M, N);
if (!P || !P.length) return null;
for (var Q in A) {
delete x._.menuItems[Q];
delete x._.commands[Q];
}
for (Q in B) {
delete x._.menuItems[Q];
delete x._.commands[Q];
}
A = {};
B = {};
var R = x.config.scayt_moreSuggestions || 'on',
S = false,
T = x.config.scayt_maxSuggestions;
typeof T != 'number' && (T = 5);
!T && (T = P.length);
var U = x.config.scayt_contextCommands || 'all';
U = U.split('|');
for (var V = 0, W = P.length; V < W; V += 1) {
var X = 'scayt_suggestion_' + P[V].replace(' ', '_'),
Y = (function (ac, ad) {
return {
exec: function () {
K.replace(ac, ad);
}
};
})(L, P[V]);
if (V < T) {
v(x, 'button_' + X, P[V], X, Y, 'scayt_suggest', V +
1);
O[X] = 2;
B[X] = 2;
} else if (R == 'on') {
v(x, 'button_' + X, P[V], X, Y, 'scayt_moresuggest',
V + 1);
A[X] = 2;
S = true;
}
}
if (S) {
x.addMenuItem('scayt_moresuggest', {
label: G.moreSuggestions,
group: 'scayt_moresuggest',
order: 10,
getItems: function () {
return A;
}
});
B.scayt_moresuggest = 2;
}
if (s('all', U) || s('ignore', U)) {
var Z = {
exec: function () {
K.ignore(L);
}
};
v(x, 'ignore', G.ignore, 'scayt_ignore', Z, 'scayt_contr
ol', 1);
B.scayt_ignore = 2;
}
if (s('all', U) || s('ignoreall', U)) {
var aa = {
exec: function () {
K.ignoreAll(L);
}
};
v(x, 'ignore_all', G.ignoreAll, 'scayt_ignore_all', aa,
'scayt_control', 2);
B.scayt_ignore_all = 2;
}
if (s('all', U) || s('add', U)) {
var ab = {
exec: function () {
window.scayt.addWordToUserDictionary(L);
}
};
v(x, 'add_word', G.addWord, 'scayt_add_word', ab, 'scayt
_control', 3);
B.scayt_add_word = 2;
}
if (K.fireOnContextMenu) K.fireOnContextMenu(x);
return B;
});
var H = function () {
x.removeListener('showScaytState', H);
if (!f.opera && !f.air) C.setState(u.isScaytEnabled(x) ? 1 :
2);
else C.setState(0);
};
x.on('showScaytState', H);
if (f.opera || f.air) x.on('instanceReady', function () {
H();
});
if (x.config.scayt_autoStartup) x.on('instanceReady', function (
) {
u.loadEngine(x);
});
},
afterInit: function (x) {
var y, z = function (A) {
if (A.hasAttribute('data-scaytid')) return false;
};
if (x._.elementsPath && (y = x._.elementsPath.filters)) y.push(z
);
x.addRemoveFormatFilter && x.addRemoveFormatFilter(z);
}
});
})();
(function () {
n.add('stylescombo', {
requires: ['richcombo', 'styles'],
init: function (r) {
var s = r.config,
t = r.lang.stylesCombo,
u = {},
v = [],
w;
function x(y) {
r.getStylesSet(function (z) {
if (!v.length) {
var A, B;
for (var C = 0, D = z.length; C < D; C++) {
var E = z[C];
B = E.name;
A = u[B] = new e.style(E);
A._name = B;
A._.enterMode = s.enterMode;
v.push(A);
}
v.sort(q);
}
y && y();
});
};
r.ui.addRichCombo('Styles', {
label: t.label,
title: t.panelTitle,
className: 'cke_styles',
panel: {
css: r.skin.editor.css.concat(s.contentsCss),
multiSelect: true,
attributes: {
'aria-label': t.panelTitle
}
},
init: function () {
w = this;
x(function () {
var y, z, A, B, C, D;
for (C = 0, D = v.length; C < D; C++) {
y = v[C];
z = y._name;
B = y.type;
if (B != A) {
w.startGroup(t['panelTitle' + String(B)]);
A = B;
}
w.add(z, y.type == 3 ? z : y.buildPreview(), z);
}
w.commit();
});
},
onClick: function (y) {
r.focus();
r.fire('saveSnapshot');
var z = u[y],
A = r.getSelection(),
B = new h.elementPath(A.getStartElement());
z[z.checkActive(B) ? 'remove' : 'apply'](r.document);
r.fire('saveSnapshot');
},
onRender: function () {
r.on('selectionChange', function (y) {
var z = this.getValue(),
A = y.data.path,
B = A.elements;
for (var C = 0, D = B.length, E; C < D; C++) {
E = B[C];
for (var F in u) {
if (u[F].checkElementRemovable(E, true)) {
if (F != z) this.setValue(F);
return;
}
}
}
this.setValue('');
}, this);
},
onOpen: function () {
var F = this;
if (g || f.webkit) r.focus();
var y = r.getSelection(),
z = y.getSelectedElement(),
A = new h.elementPath(z || y.getStartElement()),
B = [0, 0, 0, 0];
F.showAll();
F.unmarkAll();
for (var C in u) {
var D = u[C],
E = D.type;
if (D.checkActive(A)) F.mark(C);
else if (E == 3 && !D.checkApplicable(A)) {
F.hideItem(C);
B[E]--;
}
B[E]++;
}
if (!B[1]) F.hideGroup(t['panelTitle' + String(1)]);
if (!B[2]) F.hideGroup(t['panelTitle' + String(2)]);
if (!B[3]) F.hideGroup(t['panelTitle' + String(3)]);
},
reset: function () {
if (w) {
delete w._.panel;
delete w._.list;
w._.committed = 0;
w._.items = {};
w._.state = 2;
}
u = {};
v = [];
x();
}
});
r.on('instanceReady', function () {
x();
});
}
});
function q(r, s) {
var t = r.type,
u = s.type;
return t == u ? 0 : t == 3 ? -1 : u == 3 ? 1 : u == 1 ? 1 : -1;
};
})();
(function () {
var q = /^(?:td|th)$/;
function r(K) {
var L = K.createBookmarks(),
M = K.getRanges(),
N = [],
O = {};
function P(X) {
if (N.length > 0) return;
if (X.type == 1 && q.test(X.getName()) && !X.getCustomData('sele
cted_cell')) {
l.setMarker(O, X, 'selected_cell', true);
N.push(X);
}
};
for (var Q = 0; Q < M.length; Q++) {
var R = M[Q];
if (R.collapsed) {
var S = R.getCommonAncestor(),
T = S.getAscendant('td', true) || S.getAscendant('th', t
rue);
if (T) N.push(T);
} else {
var U = new h.walker(R),
V;
U.guard = P;
while (V = U.next()) {
var W = V.getAscendant('td') || V.getAscendant('th');
if (W && !W.getCustomData('selected_cell')) {
l.setMarker(O, W, 'selected_cell', true);
N.push(W);
}
}
}
}
l.clearAllMarkers(O);
K.selectBookmarks(L);
return N;
};
function s(K) {
var L = 0,
M = K.length - 1,
N = {},
O, P, Q;
while (O = K[L++]) l.setMarker(N, O, 'delete_cell', true);
L = 0;
while (O = K[L++]) {
if ((P = O.getPrevious()) && !P.getCustomData('delete_cell') ||
(P = O.getNext()) && !P.getCustomData('delete_cell')) {
l.clearAllMarkers(N);
return P;
}
}
l.clearAllMarkers(N);
Q = K[0].getParent();
if (Q = Q.getPrevious()) return Q.getLast();
Q = K[M].getParent();
if (Q = Q.getNext()) return Q.getChild(0);
return null;
};
function t(K, L) {
var M = r(K),
N = M[0],
O = N.getAscendant('table'),
P = N.getDocument(),
Q = M[0].getParent(),
R = Q.$.rowIndex,
S = M[M.length - 1],
T = S.getParent().$.rowIndex + S.$.rowSpan - 1,
U = new l(O.$.rows[T]),
V = L ? R : T,
W = L ? Q : U,
X = i.buildTableMap(O),
Y = X[V],
Z = L ? X[V - 1] : X[V + 1],
aa = X[0].length,
ab = P.createElement('tr');
for (var ac = 0; Y[ac] && ac < aa; ac++) {
var ad;
if (Y[ac].rowSpan > 1 && Z && Y[ac] == Z[ac]) {
ad = Y[ac];
ad.rowSpan += 1;
} else {
ad = new l(Y[ac]).clone();
ad.removeAttribute('rowSpan');
!g && ad.appendBogus();
ab.append(ad);
ad = ad.$;
}
ac += ad.colSpan - 1;
}
L ? ab.insertBefore(W) : ab.insertAfter(W);
};
function u(K) {
if (K instanceof h.selection) {
var L = r(K),
M = L[0],
N = M.getAscendant('table'),
O = i.buildTableMap(N),
P = L[0].getParent(),
Q = P.$.rowIndex,
R = L[L.length - 1],
S = R.getParent().$.rowIndex + R.$.rowSpan - 1,
T = [];
for (var U = Q; U <= S; U++) {
var V = O[U],
W = new l(N.$.rows[U]);
for (var X = 0; X < V.length; X++) {
var Y = new l(V[X]),
Z = Y.getParent().$.rowIndex;
if (Y.$.rowSpan == 1) Y.remove();
else {
Y.$.rowSpan -= 1;
if (Z == U) {
var aa = O[U + 1];
aa[X - 1] ? Y.insertAfter(new l(aa[X - 1])) : ne
w l(N.$.rows[U + 1]).append(Y, 1);
}
}
X += Y.$.colSpan - 1;
}
T.push(W);
}
var ab = N.$.rows,
ac = new l(ab[S + 1] || (Q > 0 ? ab[Q - 1] : null) || N.$.pa
rentNode);
for (U = T.length; U >= 0; U--) u(T[U]);
return ac;
} else if (K instanceof l) {
N = K.getAscendant('table');
if (N.$.rows.length == 1) N.remove();
else K.remove();
}
return null;
};
function v(K, L) {
var M = K.getParent(),
N = M.$.cells,
O = 0;
for (var P = 0; P < N.length; P++) {
var Q = N[P];
O += L ? 1 : Q.colSpan;
if (Q == K.$) break;
}
return O - 1;
};
function w(K, L) {
var M = L ? Infinity : 0;
for (var N = 0; N < K.length; N++) {
var O = v(K[N], L);
if (L ? O < M : O > M) M = O;
}
return M;
};
function x(K, L) {
var M = r(K),
N = M[0],
O = N.getAscendant('table'),
P = w(M, 1),
Q = w(M),
R = L ? P : Q,
S = i.buildTableMap(O),
T = [],
U = [],
V = S.length;
for (var W = 0; W < V; W++) {
T.push(S[W][R]);
var X = L ? S[W][R - 1] : S[W][R + 1];
X && U.push(X);
}
for (W = 0; W < V; W++) {
var Y;
if (T[W].colSpan > 1 && U.length && U[W] == T[W]) {
Y = T[W];
Y.colSpan += 1;
} else {
Y = new l(T[W]).clone();
Y.removeAttribute('colSpan');
!g && Y.appendBogus();
Y[L ? 'insertBefore' : 'insertAfter'].call(Y, new l(T[W]));
Y = Y.$;
}
W += Y.rowSpan - 1;
}
};
function y(K) {
var L = r(K),
M = L[0],
N = L[L.length - 1],
O = M.getAscendant('table'),
P = i.buildTableMap(O),
Q, R, S = [];
for (var T = 0, U = P.length; T < U; T++)
for (var V = 0, W = P[T].length; V < W; V++) {
if (P[T][V] == M.$) Q = V;
if (P[T][V] == N.$) R = V;
}
for (T = Q; T <= R; T++)
for (V = 0; V < P.length; V++) {
var X = P[V],
Y = new l(O.$.rows[V]),
Z = new l(X[T]);
if (Z.$) {
if (Z.$.colSpan == 1) Z.remove();
else Z.$.colSpan -= 1;
V += Z.$.rowSpan - 1;
if (!Y.$.cells.length) S.push(Y);
}
}
var aa = O.$.rows[0] && O.$.rows[0].cells,
ab = new l(aa[Q] || (Q ? aa[Q - 1] : O.$.parentNode));
if (S.length == U) O.remove();
return ab;
};
function z(K) {
var L = [],
M = K[0] && K[0].getAscendant('table'),
N, O, P, Q;
for (N = 0, O = K.length; N < O; N++) L.push(K[N].$.cellIndex);
L.sort();
for (N = 1, O = L.length; N < O; N++) {
if (L[N] - L[N - 1] > 1) {
P = L[N - 1] + 1;
break;
}
}
if (!P) P = L[0] > 0 ? L[0] - 1 : L[L.length - 1] + 1;
var R = M.$.rows;
for (N = 0, O = R.length; N < O; N++) {
Q = R[N].cells[P];
if (Q) break;
}
return Q ? new l(Q) : M.getPrevious();
};
function A(K, L) {
var M = K.getStartElement(),
N = M.getAscendant('td', 1) || M.getAscendant('th', 1);
if (!N) return;
var O = N.clone();
if (!g) O.appendBogus();
if (L) O.insertBefore(N);
else O.insertAfter(N);
};
function B(K) {
if (K instanceof h.selection) {
var L = r(K),
M = L[0] && L[0].getAscendant('table'),
N = s(L);
for (var O = L.length - 1; O >= 0; O--) B(L[O]);
if (N) D(N, true);
else if (M) M.remove();
} else if (K instanceof l) {
var P = K.getParent();
if (P.getChildCount() == 1) P.remove();
else K.remove();
}
};
function C(K) {
var L = K.getBogus();
L && L.remove();
K.trim();
};
function D(K, L) {
var M = new h.range(K.getDocument());
if (!M['moveToElementEdit' + (L ? 'End' : 'Start')](K)) {
M.selectNodeContents(K);
M.collapse(L ? false : true);
}
M.select(true);
};
function E(K, L, M) {
var N = K[L];
if (typeof M == 'undefined') return N;
for (var O = 0; N && O < N.length; O++) {
if (M.is && N[O] == M.$) return O;
else if (O == M) return new l(N[O]);
}
return M.is ? -1 : null;
};
function F(K, L, M) {
var N = [];
for (var O = 0; O < K.length; O++) {
var P = K[O];
if (typeof M == 'undefined') N.push(P[L]);
else if (M.is && P[L] == M.$) return O;
else if (O == M) return new l(P[L]);
}
return typeof M == 'undefined' ? N : M.is ? -1 : null;
};
function G(K, L, M) {
var N = r(K),
O;
if ((L ? N.length != 1 : N.length < 2) || (O = K.getCommonAncestor()
) && O.type == 1 && O.is('table')) return false;
var P, Q = N[0],
R = Q.getAscendant('table'),
S = i.buildTableMap(R),
T = S.length,
U = S[0].length,
V = Q.getParent().$.rowIndex,
W = E(S, V, Q);
if (L) {
var X;
try {
var Y = parseInt(Q.getAttribute('rowspan'), 10) || 1,
Z = parseInt(Q.getAttribute('colspan'), 10) || 1;
X = S[L == 'up' ? V - Y : L == 'down' ? V + Y : V][L == 'lef
t' ? W - Z : L == 'right' ? W + Z : W];
} catch (ar) {
return false;
}
if (!X || Q.$ == X) return false;
N[L == 'up' || L == 'left' ? 'unshift' : 'push'](new l(X));
}
var aa = Q.getDocument(),
ab = V,
ac = 0,
ad = 0,
ae = !M && new h.documentFragment(aa),
af = 0;
for (var ag = 0; ag < N.length; ag++) {
P = N[ag];
var ah = P.getParent(),
ai = P.getFirst(),
aj = P.$.colSpan,
ak = P.$.rowSpan,
al = ah.$.rowIndex,
am = E(S, al, P);
af += aj * ak;
ad = Math.max(ad, am - W + aj);
ac = Math.max(ac, al - V + ak);
if (!M) {
if (C(P), P.getChildren().count()) {
if (al != ab && ai && !(ai.isBlockBoundary && ai.isBlock
Boundary({
br: 1
}))) {
var an = ae.getLast(h.walker.whitespaces(true));
if (an && !(an.is && an.is('br'))) ae.append('br');
}
P.moveChildren(ae);
}
ag ? P.remove() : P.setHtml('');
}
ab = al;
}
if (!M) {
ae.moveChildren(Q);
if (!g) Q.appendBogus();
if (ad >= U) Q.removeAttribute('rowSpan');
else Q.$.rowSpan = ac; if (ac >= T) Q.removeAttribute('colSpan')
;
else Q.$.colSpan = ad;
var ao = new h.nodeList(R.$.rows),
ap = ao.count();
for (ag = ap - 1; ag >= 0; ag--) {
var aq = ao.getItem(ag);
if (!aq.$.cells.length) {
aq.remove();
ap++;
continue;
}
}
return Q;
} else return ac * ad == af;
};
function H(K, L) {
var M = r(K);
if (M.length > 1) return false;
else if (L) return true;
var N = M[0],
O = N.getParent(),
P = O.getAscendant('table'),
Q = i.buildTableMap(P),
R = O.$.rowIndex,
S = E(Q, R, N),
T = N.$.rowSpan,
U, V, W, X;
if (T > 1) {
V = Math.ceil(T / 2);
W = Math.floor(T / 2);
X = R + V;
var Y = new l(P.$.rows[X]),
Z = E(Q, X),
aa;
U = N.clone();
for (var ab = 0; ab < Z.length; ab++) {
aa = Z[ab];
if (aa.parentNode == Y.$ && ab > S) {
U.insertBefore(new l(aa));
break;
} else aa = null;
}
if (!aa) Y.append(U, true);
} else {
W = V = 1;
Y = O.clone();
Y.insertAfter(O);
Y.append(U = N.clone());
var ac = E(Q, R);
for (var ad = 0; ad < ac.length; ad++) ac[ad].rowSpan++;
} if (!g) U.appendBogus();
N.$.rowSpan = V;
U.$.rowSpan = W;
if (V == 1) N.removeAttribute('rowSpan');
if (W == 1) U.removeAttribute('rowSpan');
return U;
};
function I(K, L) {
var M = r(K);
if (M.length > 1) return false;
else if (L) return true;
var N = M[0],
O = N.getParent(),
P = O.getAscendant('table'),
Q = i.buildTableMap(P),
R = O.$.rowIndex,
S = E(Q, R, N),
T = N.$.colSpan,
U, V, W;
if (T > 1) {
V = Math.ceil(T / 2);
W = Math.floor(T / 2);
} else {
W = V = 1;
var X = F(Q, S);
for (var Y = 0; Y < X.length; Y++) X[Y].colSpan++;
}
U = N.clone();
U.insertAfter(N);
if (!g) U.appendBogus();
N.$.colSpan = V;
U.$.colSpan = W;
if (V == 1) N.removeAttribute('colSpan');
if (W == 1) U.removeAttribute('colSpan');
return U;
};
var J = {
thead: 1,
tbody: 1,
tfoot: 1,
td: 1,
tr: 1,
th: 1
};
n.tabletools = {
init: function (K) {
var L = K.lang.table;
K.addCommand('cellProperties', new e.dialogCommand('cellProperti
es'));
e.dialog.add('cellProperties', this.path + 'dialogs/tableCell.js
');
K.addCommand('tableDelete', {
exec: function (M) {
var N = M.getSelection(),
O = N && N.getStartElement(),
P = O && O.getAscendant('table', 1);
if (!P) return;
var Q = P.getParent();
if (Q.getChildCount() == 1 && !Q.is('body', 'td', 'th'))
P = Q;
var R = new h.range(M.document);
R.moveToPosition(P, 3);
P.remove();
R.select();
}
});
K.addCommand('rowDelete', {
exec: function (M) {
var N = M.getSelection();
D(u(N));
}
});
K.addCommand('rowInsertBefore', {
exec: function (M) {
var N = M.getSelection();
t(N, true);
}
});
K.addCommand('rowInsertAfter', {
exec: function (M) {
var N = M.getSelection();
t(N);
}
});
K.addCommand('columnDelete', {
exec: function (M) {
var N = M.getSelection(),
O = y(N);
O && D(O, true);
}
});
K.addCommand('columnInsertBefore', {
exec: function (M) {
var N = M.getSelection();
x(N, true);
}
});
K.addCommand('columnInsertAfter', {
exec: function (M) {
var N = M.getSelection();
x(N);
}
});
K.addCommand('cellDelete', {
exec: function (M) {
var N = M.getSelection();
B(N);
}
});
K.addCommand('cellMerge', {
exec: function (M) {
D(G(M.getSelection()), true);
}
});
K.addCommand('cellMergeRight', {
exec: function (M) {
D(G(M.getSelection(), 'right'), true);
}
});
K.addCommand('cellMergeDown', {
exec: function (M) {
D(G(M.getSelection(), 'down'), true);
}
});
K.addCommand('cellVerticalSplit', {
exec: function (M) {
D(H(M.getSelection()));
}
});
K.addCommand('cellHorizontalSplit', {
exec: function (M) {
D(I(M.getSelection()));
}
});
K.addCommand('cellInsertBefore', {
exec: function (M) {
var N = M.getSelection();
A(N, true);
}
});
K.addCommand('cellInsertAfter', {
exec: function (M) {
var N = M.getSelection();
A(N);
}
});
if (K.addMenuItems) K.addMenuItems({
tablecell: {
label: L.cell.menu,
group: 'tablecell',
order: 1,
getItems: function () {
var M = K.getSelection(),
N = r(M);
return {
tablecell_insertBefore: 2,
tablecell_insertAfter: 2,
tablecell_delete: 2,
tablecell_merge: G(M, null, true) ? 2 : 0,
tablecell_merge_right: G(M, 'right', true) ? 2 :
0,
tablecell_merge_down: G(M, 'down', true) ? 2 : 0
,
tablecell_split_vertical: H(M, true) ? 2 : 0,
tablecell_split_horizontal: I(M, true) ? 2 : 0,
tablecell_properties: N.length > 0 ? 2 : 0
};
}
},
tablecell_insertBefore: {
label: L.cell.insertBefore,
group: 'tablecell',
command: 'cellInsertBefore',
order: 5
},
tablecell_insertAfter: {
label: L.cell.insertAfter,
group: 'tablecell',
command: 'cellInsertAfter',
order: 10
},
tablecell_delete: {
label: L.cell.deleteCell,
group: 'tablecell',
command: 'cellDelete',
order: 15
},
tablecell_merge: {
label: L.cell.merge,
group: 'tablecell',
command: 'cellMerge',
order: 16
},
tablecell_merge_right: {
label: L.cell.mergeRight,
group: 'tablecell',
command: 'cellMergeRight',
order: 17
},
tablecell_merge_down: {
label: L.cell.mergeDown,
group: 'tablecell',
command: 'cellMergeDown',
order: 18
},
tablecell_split_horizontal: {
label: L.cell.splitHorizontal,
group: 'tablecell',
command: 'cellHorizontalSplit',
order: 19
},
tablecell_split_vertical: {
label: L.cell.splitVertical,
group: 'tablecell',
command: 'cellVerticalSplit',
order: 20
},
tablecell_properties: {
label: L.cell.title,
group: 'tablecellproperties',
command: 'cellProperties',
order: 21
},
tablerow: {
label: L.row.menu,
group: 'tablerow',
order: 1,
getItems: function () {
return {
tablerow_insertBefore: 2,
tablerow_insertAfter: 2,
tablerow_delete: 2
};
}
},
tablerow_insertBefore: {
label: L.row.insertBefore,
group: 'tablerow',
command: 'rowInsertBefore',
order: 5
},
tablerow_insertAfter: {
label: L.row.insertAfter,
group: 'tablerow',
command: 'rowInsertAfter',
order: 10
},
tablerow_delete: {
label: L.row.deleteRow,
group: 'tablerow',
command: 'rowDelete',
order: 15
},
tablecolumn: {
label: L.column.menu,
group: 'tablecolumn',
order: 1,
getItems: function () {
return {
tablecolumn_insertBefore: 2,
tablecolumn_insertAfter: 2,
tablecolumn_delete: 2
};
}
},
tablecolumn_insertBefore: {
label: L.column.insertBefore,
group: 'tablecolumn',
command: 'columnInsertBefore',
order: 5
},
tablecolumn_insertAfter: {
label: L.column.insertAfter,
group: 'tablecolumn',
command: 'columnInsertAfter',
order: 10
},
tablecolumn_delete: {
label: L.column.deleteColumn,
group: 'tablecolumn',
command: 'columnDelete',
order: 15
}
});
if (K.contextMenu) K.contextMenu.addListener(function (M, N) {
if (!M || M.isReadOnly()) return null;
while (M) {
if (M.getName() in J) return {
tablecell: 2,
tablerow: 2,
tablecolumn: 2
};
M = M.getParent();
}
return null;
});
},
getSelectedCells: r
};
n.add('tabletools', n.tabletools);
})();
i.buildTableMap = function (q) {
var r = q.$.rows,
s = -1,
t = [];
for (var u = 0; u < r.length; u++) {
s++;
!t[s] && (t[s] = []);
var v = -1;
for (var w = 0; w < r[u].cells.length; w++) {
var x = r[u].cells[w];
v++;
while (t[s][v]) v++;
var y = isNaN(x.colSpan) ? 1 : x.colSpan,
z = isNaN(x.rowSpan) ? 1 : x.rowSpan;
for (var A = 0; A < z; A++) {
if (!t[s + A]) t[s + A] = [];
for (var B = 0; B < y; B++) t[s + A][v + B] = r[u].cells[w];
}
v += y - 1;
}
}
return t;
};
(function () {
var q = {
editorFocus: false,
modes: {
wysiwyg: 1,
source: 1
}
},
r = {
exec: function (u) {
u.container.focusNext(true, u.tabIndex);
}
},
s = {
exec: function (u) {
u.container.focusPrevious(true, u.tabIndex);
}
};
function t(u) {
return {
editorFocus: false,
canUndo: false,
modes: {
wysiwyg: 1
},
exec: function (v) {
if (v.focusManager.hasFocus) {
var w = v.getSelection(),
x = w.getCommonAncestor(),
y;
if (y = x.getAscendant('td', true) || x.getAscendant('th
', true)) {
var z = new h.range(v.document),
A = i.tryThese(function () {
var H = y.getParent(),
I = H.$.cells[y.$.cellIndex + (u ? -1 :
1)];
I.parentNode.parentNode;
return I;
}, function () {
var H = y.getParent(),
I = H.getAscendant('table'),
J = I.$.rows[H.$.rowIndex + (u ? -1 : 1)
];
return J.cells[u ? J.cells.length - 1 : 0];
});
if (!(A || u)) {
var B = y.getAscendant('table').$,
C = y.getParent().$.cells,
D = new l(B.insertRow(-1), v.document);
for (var E = 0, F = C.length; E < F; E++) {
var G = D.append(new l(C[E], v.document).clo
ne(false, false));
!g && G.appendBogus();
}
z.moveToElementEditStart(D);
} else if (A) {
A = new l(A);
z.moveToElementEditStart(A);
if (!(z.checkStartOfBlock() && z.checkEndOfBlock
())) z.selectNodeContents(A);
} else return true;
z.select(true);
return true;
}
}
return false;
}
};
};
n.add('tab', {
requires: ['keystrokes'],
init: function (u) {
var v = u.config.enableTabKeyTools !== false,
w = u.config.tabSpaces || 0,
x = '';
while (w--) x += '\xa0';
if (x) u.on('key', function (y) {
if (y.data.keyCode == 9) {
u.insertHtml(x);
y.cancel();
}
});
if (v) u.on('key', function (y) {
if (y.data.keyCode == 9 && u.execCommand('selectNextCell') |
| y.data.keyCode == 2228224 + 9 && u.execCommand('selectPreviousCell')) y.cancel
();
});
if (f.webkit || f.gecko) u.on('key', function (y) {
var z = y.data.keyCode;
if (z == 9 && !x) {
y.cancel();
u.execCommand('blur');
}
if (z == 2228224 + 9) {
u.execCommand('blurBack');
y.cancel();
}
});
u.addCommand('blur', i.extend(r, q));
u.addCommand('blurBack', i.extend(s, q));
u.addCommand('selectNextCell', t());
u.addCommand('selectPreviousCell', t(true));
}
});
})();
l.prototype.focusNext = function (q, r) {
var A = this;
var s = A.$,
t = r === undefined ? A.getTabIndex() : r,
u, v, w, x, y, z;
if (t <= 0) {
y = A.getNextSourceNode(q, 1);
while (y) {
if (y.isVisible() && y.getTabIndex() === 0) {
w = y;
break;
}
y = y.getNextSourceNode(false, 1);
}
} else {
y = A.getDocument().getBody().getFirst();
while (y = y.getNextSourceNode(false, 1)) {
if (!u)
if (!v && y.equals(A)) {
v = true;
if (q) {
if (!(y = y.getNextSourceNode(true, 1))) break;
u = 1;
}
} else if (v && !A.contains(y)) u = 1;
if (!y.isVisible() || (z = y.getTabIndex()) < 0) continue;
if (u && z == t) {
w = y;
break;
}
if (z > t && (!w || !x || z < x)) {
w = y;
x = z;
} else if (!w && z === 0) {
w = y;
x = z;
}
}
} if (w) w.focus();
};
l.prototype.focusPrevious = function (q, r) {
var A = this;
var s = A.$,
t = r === undefined ? A.getTabIndex() : r,
u, v, w, x = 0,
y, z = A.getDocument().getBody().getLast();
while (z = z.getPreviousSourceNode(false, 1)) {
if (!u)
if (!v && z.equals(A)) {
v = true;
if (q) {
if (!(z = z.getPreviousSourceNode(true, 1))) break;
u = 1;
}
} else if (v && !A.contains(z)) u = 1;
if (!z.isVisible() || (y = z.getTabIndex()) < 0) continue;
if (t <= 0) {
if (u && y === 0) {
w = z;
break;
}
if (y > x) {
w = z;
x = y;
}
} else {
if (u && y == t) {
w = z;
break;
}
if (y < t && (!w || y > x)) {
w = z;
x = y;
}
}
}
if (w) w.focus();
};
(function () {
n.add('templates', {
requires: ['dialog'],
init: function (s) {
e.dialog.add('templates', e.getUrl(this.path + 'dialogs/template
s.js'));
s.addCommand('templates', new e.dialogCommand('templates'));
s.ui.addButton('Templates', {
label: s.lang.templates.button,
command: 'templates'
});
}
});
var q = {},
r = {};
e.addTemplates = function (s, t) {
q[s] = t;
};
e.getTemplates = function (s) {
return q[s];
};
e.loadTemplates = function (s, t) {
var u = [];
for (var v = 0, w = s.length; v < w; v++) {
if (!r[s[v]]) {
u.push(s[v]);
r[s[v]] = 1;
}
}
if (u.length) e.scriptLoader.load(u, t);
else setTimeout(t, 0);
};
})();
m.templates_files = [e.getUrl('plugins/templates/templates/default.js')];
m.templates_replaceContent = true;
(function () {
var q = function () {
this.toolbars = [];
this.focusCommandExecuted = false;
};
q.prototype.focus = function () {
for (var s = 0, t; t = this.toolbars[s++];)
for (var u = 0, v; v = t.items[u++];) {
if (v.focus) {
v.focus();
return;
}
}
};
var r = {
toolbarFocus: {
modes: {
wysiwyg: 1,
source: 1
},
readOnly: 1,
exec: function (s) {
if (s.toolbox) {
s.toolbox.focusCommandExecuted = true;
if (g || f.air) setTimeout(function () {
s.toolbox.focus();
}, 100);
else s.toolbox.focus();
}
}
}
};
n.add('toolbar', {
init: function (s) {
var t, u = function (v, w) {
var x, y, z = s.lang.dir == 'rtl',
A = s.config.toolbarGroupCycling;
A = A === undefined || A;
switch (w) {
case 9:
case 2228224 + 9:
while (!y || !y.items.length) {
y = w == 9 ? (y ? y.next : v.toolbar.next) || s.tool
box.toolbars[0] : (y ? y.previous : v.toolbar.previous) || s.toolbox.toolbars[s.
toolbox.toolbars.length - 1];
if (y.items.length) {
v = y.items[t ? y.items.length - 1 : 0];
while (v && !v.focus) {
v = t ? v.previous : v.next;
if (!v) y = 0;
}
}
}
if (v) v.focus();
return false;
case z ? 37:
39:
case 40:
x = v;
do {
x = x.next;
if (!x && A) x = v.toolbar.items[0];
} while (x && !x.focus);
if (x) x.focus();
else u(v, 9);
return false;
case z ? 39:
37:
case 38:
x = v;
do {
x = x.previous;
if (!x && A) x = v.toolbar.items[v.toolbar.items.len
gth - 1];
} while (x && !x.focus);
if (x) x.focus();
else {
t = 1;
u(v, 2228224 + 9);
t = 0;
}
return false;
case 27:
s.focus();
return false;
case 13:
case 32:
v.execute();
return false;
}
return true;
};
s.on('themeSpace', function (v) {
if (v.data.space == s.config.toolbarLocation) {
s.toolbox = new q();
var w = i.getNextId(),
x = ['<div class="cke_toolbox" role="group" aria-lab
elledby="', w, '" onmousedown="return false;"'],
y = s.config.toolbarStartupExpanded !== false,
z;
x.push(y ? '>' : ' style="display:none">');
x.push('<span id="', w, '" class="cke_voice_label">', s.
lang.toolbars, '</span>');
var A = s.toolbox.toolbars,
B = s.config.toolbar instanceof Array ? s.config.too
lbar : s.config['toolbar_' + s.config.toolbar];
for (var C = 0; C < B.length; C++) {
var D, E = 0,
F, G = B[C],
H;
if (!G) continue;
if (z) {
x.push('</div>');
z = 0;
}
if (G === '/') {
x.push('<div class="cke_break"></div>');
continue;
}
H = G.items || G;
for (var I = 0; I < H.length; I++) {
var J, K = H[I],
L;
J = s.ui.create(K);
if (J) {
L = J.canGroup !== false;
if (!E) {
D = i.getNextId();
E = {
id: D,
items: []
};
F = G.name && (s.lang.toolbarGroups[G.na
me] || G.name);
x.push('<span id="', D, '" class="cke_to
olbar"', F ? ' aria-labelledby="' + D + '_label"' : '', ' role="toolbar">');
F && x.push('<span id="', D, '_label" cl
ass="cke_voice_label">', F, '</span>');
x.push('<span class="cke_toolbar_start">
</span>');
var M = A.push(E) - 1;
if (M > 0) {
E.previous = A[M - 1];
E.previous.next = E;
}
}
if (L) {
if (!z) {
x.push('<span class="cke_toolgroup"
role="presentation">');
z = 1;
}
} else if (z) {
x.push('</span>');
z = 0;
}
var N = J.render(s, x);
M = E.items.push(N) - 1;
if (M > 0) {
N.previous = E.items[M - 1];
N.previous.next = N;
}
N.toolbar = E;
N.onkey = u;
N.onfocus = function () {
if (!s.toolbox.focusCommandExecuted) s.f
ocus();
};
}
}
if (z) {
x.push('</span>');
z = 0;
}
if (E) x.push('<span class="cke_toolbar_end"></span>
</span>');
}
x.push('</div>');
if (s.config.toolbarCanCollapse) {
var O = i.addFunction(function () {
s.execCommand('toolbarCollapse');
});
s.on('destroy', function () {
i.removeFunction(O);
});
var P = i.getNextId();
s.addCommand('toolbarCollapse', {
readOnly: 1,
exec: function (Q) {
var R = e.document.getById(P),
S = R.getPrevious(),
T = Q.getThemeSpace('contents'),
U = S.getParent(),
V = parseInt(T.$.style.height, 10),
W = U.$.offsetHeight,
X = !S.isVisible();
if (!X) {
S.hide();
R.addClass('cke_toolbox_collapser_min');
R.setAttribute('title', Q.lang.toolbarEx
pand);
} else {
S.show();
R.removeClass('cke_toolbox_collapser_min
');
R.setAttribute('title', Q.lang.toolbarCo
llapse);
}
R.getFirst().setText(X ? '?' : '?');
var Y = U.$.offsetHeight - W;
T.setStyle('height', V - Y + 'px');
Q.fire('resize');
},
modes: {
wysiwyg: 1,
source: 1
}
});
x.push('<a title="' + (y ? s.lang.toolbarCollapse :
s.lang.toolbarExpand) + '" id="' + P + '" tabIndex="-1" class="cke_toolbox_colla
pser');
if (!y) x.push(' cke_toolbox_collapser_min');
x.push('" onclick="CKEDITOR.tools.callFunction(' + O
+ ')">', '<span>&#9650;</span>', '</a>');
}
v.data.html += x.join('');
}
});
s.on('destroy', function () {
var v, w = 0,
x, y, z;
v = this.toolbox.toolbars;
for (; w < v.length; w++) {
y = v[w].items;
for (x = 0; x < y.length; x++) {
z = y[x];
if (z.clickFn) i.removeFunction(z.clickFn);
if (z.keyDownFn) i.removeFunction(z.keyDownFn);
}
}
});
s.addCommand('toolbarFocus', r.toolbarFocus);
s.ui.add('-', e.UI_SEPARATOR, {});
s.ui.addHandler(e.UI_SEPARATOR, {
create: function () {
return {
render: function (v, w) {
w.push('<span class="cke_separator" role="separa
tor"></span>');
return {};
}
};
}
});
}
});
})();
e.UI_SEPARATOR = 'separator';
m.toolbarLocation = 'top';
m.toolbar_Basic = [
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Un
link', '-', 'About']
];
m.toolbar_Full = [{
name: 'document',
items: ['Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print'
, '-', 'Templates']
}, {
name: 'clipboard',
items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo
', 'Redo']
}, {
name: 'editing',
items: ['Find', 'Replace', '-', 'SelectAll', '-', 'SpellChecker', 'Scayt
']
}, {
name: 'forms',
items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select',
'Button', 'ImageButton', 'HiddenField']
}, '/', {
name: 'basicstyles',
items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscri
pt', '-', 'RemoveFormat']
}, {
name: 'paragraph',
items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', '
Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', '
JustifyBlock', '-', 'BidiLtr', 'BidiRtl']
}, {
name: 'links',
items: ['Link', 'Unlink', 'Anchor']
}, {
name: 'insert',
items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialC
har', 'PageBreak', 'Iframe']
}, '/', {
name: 'styles',
items: ['Styles', 'Format', 'Font', 'FontSize']
}, {
name: 'colors',
items: ['TextColor', 'BGColor']
}, {
name: 'tools',
items: ['Maximize', 'ShowBlocks', '-', 'About']
}];
m.toolbar = 'Full';
m.toolbarCanCollapse = true;
(function () {
var q = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:
<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,
r = h.walker.whitespaces(true);
function s(G) {
return G.isBlockBoundary() && j.$empty[G.getName()];
};
function t(G) {
return function (H) {
if (this.mode == 'wysiwyg') {
this.focus();
this.fire('saveSnapshot');
G.call(this, H.data);
i.setTimeout(function () {
this.fire('saveSnapshot');
}, 0, this);
}
};
};
function u(G) {
var Q = this;
if (Q.dataProcessor) G = Q.dataProcessor.toHtml(G);
if (!G) return;
var H = Q.getSelection(),
I = H.getRanges()[0];
if (I.checkReadOnly()) return;
if (f.opera) {
var J = new h.elementPath(I.startContainer);
if (J.block) {
var K = e.htmlParser.fragment.fromHtml(G, false).children;
for (var L = 0, M = K.length; L < M; L++) {
if (K[L]._.isBlockLike) {
I.splitBlock(Q.enterMode == 3 ? 'div' : 'p');
I.insertNode(I.document.createText(''));
I.select();
break;
}
}
}
}
if (g) {
var N = H.isLocked;
if (N) H.unlock();
var O = H.getNative();
if (O.type == 'Control') O.clear();
else if (H.getType() == 2) {
I = H.getRanges()[0];
var P = I && I.endContainer;
if (P && P.type == 1 && P.getAttribute('contenteditable') ==
'false' && I.checkBoundaryOfElement(P, 2)) {
I.setEndAfter(I.endContainer);
I.deleteContents();
}
}
O.createRange().pasteHTML(G);
if (N) Q.getSelection().lock();
} else Q.document.$.execCommand('inserthtml', false, G); if (f.webki
t) {
H = Q.getSelection();
H.scrollIntoView();
}
};
function v(G) {
var H = this.getSelection(),
I = H.getStartElement().hasAscendant('pre', true) ? 2 : this.con
fig.enterMode,
J = I == 2,
K = i.htmlEncode(G.replace(/\r\n|\r/g, '\n'));
K = K.replace(/^[ \t]+|[ \t]+$/g, function (Q, R, S) {
if (Q.length == 1) return '&nbsp;';
else if (!R) return i.repeat('&nbsp;', Q.length - 1) + ' ';
else return ' ' + i.repeat('&nbsp;', Q.length - 1);
});
K = K.replace(/[ \t]{2,}/g, function (Q) {
return i.repeat('&nbsp;', Q.length - 1) + ' ';
});
var L = I == 1 ? 'p' : 'div';
if (!J) K = K.replace(/(\n{2})([\s\S]*?)(?:$|\1)/g, function (Q, R,
S) {
return '<' + L + '>' + S + '</' + L + '>';
});
K = K.replace(/\n/g, '<br>');
if (!(J || g)) K = K.replace(new RegExp('<br>(?=</' + L + '>)'), fun
ction (Q) {
return i.repeat(Q, 2);
});
if (f.gecko || f.webkit) {
var M = new h.elementPath(H.getStartElement()),
N = [];
for (var O = 0; O < M.elements.length; O++) {
var P = M.elements[O].getName();
if (P in j.$inline) N.unshift(M.elements[O].getOuterHtml().m
atch(/^<.*?>/));
else if (P in j.$block) break;
}
K = N.join('') + K;
}
u.call(this, K);
};
function w(G) {
var H = this.getSelection(),
I = H.getRanges(),
J = G.getName(),
K = j.$block[J],
L = H.isLocked;
if (L) H.unlock();
var M, N, O, P;
for (var Q = I.length - 1; Q >= 0; Q--) {
M = I[Q];
if (!M.checkReadOnly()) {
M.deleteContents(1);
N = !Q && G || G.clone(1);
var R, S;
if (K)
while ((R = M.getCommonAncestor(0, 1)) && (S = j[R.getNa
me()]) && !(S && S[J])) {
if (R.getName() in j.span) M.splitElement(R);
else if (M.checkStartOfBlock() && M.checkEndOfBlock(
)) {
M.setStartBefore(R);
M.collapse(true);
R.remove();
} else M.splitBlock();
}
M.insertNode(N);
if (!O) O = N;
}
}
if (O) {
M.moveToPosition(O, 4);
if (K) {
var T = O.getNext(r),
U = T && T.type == 1 && T.getName();
if (U && j.$block[U] && j[U]['#']) M.moveToElementEditStart(
T);
}
}
H.selectRanges([M]);
if (L) this.getSelection().lock();
};
function x(G) {
if (!G.checkDirty()) setTimeout(function () {
G.resetDirty();
}, 0);
};
var y = h.walker.whitespaces(true),
z = h.walker.bookmark(false, true);
function A(G) {
return y(G) && z(G);
};
function B(G) {
return G.type == 3 && i.trim(G.getText()).match(/^(?:&nbsp;|\xa0)$/)
;
};
function C(G) {
if (G.isLocked) {
G.unlock();
setTimeout(function () {
G.lock();
}, 0);
}
};
function D(G) {
return G.getOuterHtml().match(q);
};
y = h.walker.whitespaces(true);
function E(G) {
var H = G.window,
I = G.document,
J = G.document.getBody(),
K = J.getFirst(),
L = J.getChildren().count();
if (!L || L == 1 && K.type == 1 && K.hasAttribute('_moz_editor_bogus
_node')) {
x(G);
var M = G.element.getDocument(),
N = M.getDocumentElement(),
O = N.$.scrollTop,
P = N.$.scrollLeft,
Q = I.$.createEvent('KeyEvents');
Q.initKeyEvent('keypress', true, true, H.$, false, false, false,
false, 0, 32);
I.$.dispatchEvent(Q);
if (O != N.$.scrollTop || P != N.$.scrollLeft) M.getWindow().$.s
crollTo(P, O);
L && J.getFirst().remove();
I.getBody().appendBogus();
var R = new h.range(I);
R.setStartAt(J, 1);
R.select();
}
};
function F(G) {
var H = G.editor,
I = G.data.path,
J = I.blockLimit,
K = G.data.selection,
L = K.getRanges()[0],
M = H.document.getBody(),
N = H.config.enterMode;
if (f.gecko) {
E(H);
var O = I.block || I.blockLimit,
P = O && O.getLast(A);
if (O && O.isBlockBoundary() && !(P && P.type == 1 && P.isBlockB
oundary()) && !O.is('pre') && !O.getBogus()) O.appendBogus();
}
if (H.config.autoParagraph !== false && N != 2 && L.collapsed && J.g
etName() == 'body' && !I.block) {
var Q = L.fixBlock(true, H.config.enterMode == 3 ? 'div' : 'p');
if (g) {
var R = Q.getFirst(A);
R && B(R) && R.remove();
}
if (D(Q)) {
var S = Q.getNext(y);
if (S && S.type == 1 && !s(S)) {
L.moveToElementEditStart(S);
Q.remove();
} else {
S = Q.getPrevious(y);
if (S && S.type == 1 && !s(S)) {
L.moveToElementEditEnd(S);
Q.remove();
}
}
}
L.select();
G.cancel();
}
var T = new h.range(H.document);
T.moveToElementEditEnd(H.document.getBody());
var U = new h.elementPath(T.startContainer);
if (!U.blockLimit.is('body')) {
var V;
if (N != 2) V = M.append(H.document.createElement(N == 1 ? 'p' :
'div'));
else V = M; if (!g) V.appendBogus();
}
};
n.add('wysiwygarea', {
requires: ['editingblock'],
init: function (G) {
var H = G.config.enterMode != 2 && G.config.autoParagraph !== fa
lse ? G.config.enterMode == 3 ? 'div' : 'p' : false,
I = G.lang.editorTitle.replace('%1', G.name),
J;
G.on('editingBlockReady', function () {
var P, Q, R, S, T, U, V = f.isCustomDomain(),
W = function (Z) {
if (Q) Q.remove();
var aa = 'document.open();' + (V ? 'document.domain=
"' + document.domain + '";' : '') + 'document.close();';
aa = f.air ? 'javascript:void(0)' : g ? 'javascript:
void(function(){' + encodeURIComponent(aa) + '}())' : '';
Q = l.createFromHtml('<iframe style="width:100%;heig
ht:100%" frameBorder="0" title="' + I + '"' + ' src="' + aa + '"' + ' tabIndex="
' + (f.webkit ? -1 : G.tabIndex) + '"' + ' allowTransparency="true"' + '></ifram
e>');
if (document.location.protocol == 'chrome:') e.event
.useCapture = true;
Q.on('load', function (ab) {
T = 1;
ab.removeListener();
var ac = Q.getFrameDocument();
ac.write(Z);
f.air && Y(ac.getWindow().$);
});
if (document.location.protocol == 'chrome:') e.event
.useCapture = false;
P.append(Q);
};
J = i.addFunction(Y);
var X = '<script id="cke_actscrpt" type="text/javascript" da
ta-cke-temp="1">' + (V ? 'document.domain="' + document.domain + '";' : '') + 'w
indow.parent.CKEDITOR.tools.callFunction( ' + J + ', window );' + '</script>';
function Y(Z) {
if (!T) return;
T = 0;
G.fire('ariaWidget', Q);
var aa = Z.document,
ab = aa.body,
ac = aa.getElementById('cke_actscrpt');
ac && ac.parentNode.removeChild(ac);
ab.spellcheck = !G.config.disableNativeSpellChecker;
var ad = !G.readOnly;
if (g) {
ab.hideFocus = true;
ab.disabled = true;
ab.contentEditable = ad;
ab.removeAttribute('disabled');
} else setTimeout(function () {
if (f.gecko && f.version >= 10900 || f.opera) aa.$.b
ody.contentEditable = ad;
else if (f.webkit) aa.$.body.parentNode.contentEdita
ble = ad;
else aa.$.designMode = ad ? 'off' : 'on';
}, 0);
ad && f.gecko && i.setTimeout(E, 0, null, G);
Z = G.window = new h.window(Z);
aa = G.document = new k(aa);
ad && aa.on('dblclick', function (aj) {
var ak = aj.data.getTarget(),
al = {
element: ak,
dialog: ''
};
G.fire('doubleclick', al);
al.dialog && G.openDialog(al.dialog);
});
g && aa.on('click', function (aj) {
var ak = aj.data.getTarget();
if (ak.is('input')) {
var al = ak.getAttribute('type');
if (al == 'submit' || al == 'reset') aj.data.pre
ventDefault();
}
});
if (!(g || f.opera)) aa.on('mousedown', function (aj) {
var ak = aj.data.getTarget();
if (ak.is('img', 'hr', 'input', 'textarea', 'select'
)) G.getSelection().selectElement(ak);
});
if (f.gecko) aa.on('mouseup', function (aj) {
if (aj.data.$.button == 2) {
var ak = aj.data.getTarget();
if (!ak.getOuterHtml().replace(q, '')) {
var al = new h.range(aa);
al.moveToElementEditStart(ak);
al.select(true);
}
}
});
aa.on('click', function (aj) {
aj = aj.data;
if (aj.getTarget().is('a') && aj.$.button != 2) aj.p
reventDefault();
});
if (f.webkit) {
aa.on('mousedown', function () {
ag = 1;
});
aa.on('click', function (aj) {
if (aj.data.getTarget().is('input', 'select')) a
j.data.preventDefault();
});
aa.on('mouseup', function (aj) {
if (aj.data.getTarget().is('input', 'textarea'))
aj.data.preventDefault();
});
}
if (ad && g && aa.$.compatMode == 'CSS1Compat' || f.geck
o || f.opera) {
var ae = aa.getDocumentElement();
ae.on('mousedown', function (aj) {
if (aj.data.getTarget().equals(ae)) {
if (f.gecko && f.version >= 10900) N();
O.focus();
}
});
}
var af = g ? Q : Z;
af.on('blur', function () {
G.focusManager.blur();
});
var ag;
af.on('focus', function () {
var aj = G.document;
if (ad && f.gecko && f.version >= 10900) N();
else if (f.opera) aj.getBody().focus();
else if (f.webkit)
if (!ag) {
G.document.getDocumentElement().focus();
ag = 1;
}
G.focusManager.focus();
});
var ah = G.keystrokeHandler;
ah.blockedKeystrokes[8] = !ad;
ah.attach(aa);
aa.getDocumentElement().addClass(aa.$.compatMode);
ad && aa.on('keydown', function (aj) {
var ak = aj.data.getKeystroke();
if (ak in {
8: 1,
46: 1
}) {
var al = G.getSelection(),
am = al.getSelectedElement(),
an = al.getRanges()[0];
if (am) {
G.fire('saveSnapshot');
an.moveToPosition(am, 3);
am.remove();
an.select();
G.fire('saveSnapshot');
aj.data.preventDefault();
return;
}
}
});
if (g && aa.$.compatMode == 'CSS1Compat') {
var ai = {
33: 1,
34: 1
};
aa.on('keydown', function (aj) {
if (aj.data.getKeystroke() in ai) setTimeout(fun
ction () {
G.getSelection().scrollIntoView();
}, 0);
});
}
if (g && G.config.enterMode != 1) aa.on('selectionchange
', function () {
if (aa.getBody() && G.getSelection() && G.getSelecti
on().getRanges()) {
var aj = aa.getBody();
range = G.getSelection().getRanges()[0];
} else return; if (aj.getHtml().match(/^<p>&nbsp;<\/
p>$/i) && range.startContainer.equals(aj)) setTimeout(function () {
if (G.getSelection() && G.getSelection().getRang
es()) {
range = G.getSelection().getRanges()[0];
if (!range.startContainer.equals('body')) {
aj.getFirst().remove(1);
range.moveToElementEditEnd(aj);
range.select(1);
}
}
}, 0);
});
if (G.contextMenu) G.contextMenu.addTarget(aa, G.config.
browserContextMenuOnCtrl !== false);
setTimeout(function () {
G.fire('contentDom');
if (U) {
G.mode = 'wysiwyg';
G.fire('mode', {
previousMode: G._.previousMode
});
U = false;
}
R = false;
if (S) {
G.focus();
S = false;
}
setTimeout(function () {
G.fire('dataReady');
}, 0);
try {
G.document.$.execCommand('enableInlineTableEditi
ng', false, !G.config.disableNativeTableHandles);
} catch (aj) {}
if (G.config.disableObjectResizing) try {
G.document.$.execCommand('enableObjectResizing',
false, false);
} catch (ak) {
G.document.getBody().on(g ? 'resizestart' : 'res
ize', function (al) {
al.data.preventDefault();
});
}
if (g) setTimeout(function () {
if (G.document) {
var al = G.document.$.body;
al.runtimeStyle.marginBottom = '0px';
al.runtimeStyle.marginBottom = '';
}
}, 1000);
}, 0);
};
G.addMode('wysiwyg', {
load: function (Z, aa, ab) {
P = Z;
if (g && f.quirks) Z.setStyle('position', 'relative'
);
G.mayBeDirty = true;
U = true;
if (ab) this.loadSnapshotData(aa);
else this.loadData(aa);
},
loadData: function (Z) {
R = true;
G._.dataStore = {
id: 1
};
var aa = G.config,
ab = aa.fullPage,
ac = aa.docType,
ad = '<style type="text/css" data-cke-temp="1">'
+ G._.styles.join('\n') + '</style>';
!ab && (ad = i.buildStyleHtml(G.config.contentsCss)
+ ad);
var ae = aa.baseHref ? '<base href="' + aa.baseHref
+ '" data-cke-temp="1" />' : '';
if (ab) Z = Z.replace(/<!DOCTYPE[^>]*>/i, function (
af) {
G.docType = ac = af;
return '';
}).replace(/<\?xml\s[^\?]*\?>/i, function (af) {
G.xmlDeclaration = af;
return '';
});
if (G.dataProcessor) Z = G.dataProcessor.toHtml(Z, H
);
if (ab) {
if (!/<body[\s|>]/.test(Z)) Z = '<body>' + Z;
if (!/<html[\s|>]/.test(Z)) Z = '<html>' + Z + '
</html>';
if (!/<head[\s|>]/.test(Z)) Z = Z.replace(/<html
[^>]*>/, '$&<head><title></title></head>');
else if (!/<title[\s|>]/.test(Z)) Z = Z.replace(
/<head[^>]*>/, '$&<title></title>');
ae && (Z = Z.replace(/<head>/, '$&' + ae));
Z = Z.replace(/<\/head\s*>/, ad + '$&');
Z = ac + Z;
} else Z = aa.docType + '<html dir="' + aa.contentsL
angDirection + '"' + ' lang="' + (aa.contentsLanguage || G.langCode) + '">' + '<
head>' + '<title>' + I + '</title>' + ae + ad + '</head>' + '<body' + (aa.bodyId
? ' id="' + aa.bodyId + '"' : '') + (aa.bodyClass ? ' class="' + aa.bodyClass +
'"' : '') + '>' + Z + '</html>'; if (f.gecko) Z = Z.replace(/<br \/>(?=\s*<\/(:
?html|body)>)/, '$&<br type="_moz" />');
Z += X;
this.onDispose();
W(Z);
},
getData: function () {
var Z = G.config,
aa = Z.fullPage,
ab = aa && G.docType,
ac = aa && G.xmlDeclaration,
ad = Q.getFrameDocument(),
ae = aa ? ad.getDocumentElement().getOuterHtml()
: ad.getBody().getHtml();
if (f.gecko) ae = ae.replace(/<br>(?=\s*(:?$|<\/body
>))/, '');
if (G.dataProcessor) ae = G.dataProcessor.toDataForm
at(ae, H);
if (Z.ignoreEmptyParagraph) ae = ae.replace(q, funct
ion (af, ag) {
return ag;
});
if (ac) ae = ac + '\n' + ae;
if (ab) ae = ab + '\n' + ae;
return ae;
},
getSnapshotData: function () {
return Q.getFrameDocument().getBody().getHtml();
},
loadSnapshotData: function (Z) {
Q.getFrameDocument().getBody().setHtml(Z);
},
onDispose: function () {
if (!G.document) return;
G.document.getDocumentElement().clearCustomData();
G.document.getBody().clearCustomData();
G.window.clearCustomData();
G.document.clearCustomData();
Q.clearCustomData();
Q.remove();
},
unload: function (Z) {
this.onDispose();
G.window = G.document = Q = P = S = null;
G.fire('contentDomUnload');
},
focus: function () {
var Z = G.window;
if (R) S = true;
else if (Z) {
f.air ? setTimeout(function () {
Z.focus();
}, 0) : Z.focus();
G.selectionChange();
}
}
});
G.on('insertHtml', t(u), null, null, 20);
G.on('insertElement', t(w), null, null, 20);
G.on('insertText', t(v), null, null, 20);
G.on('selectionChange', function (Z) {
if (G.readOnly) return;
var aa = G.getSelection();
if (aa && !aa.isLocked) {
var ab = G.checkDirty();
G.fire('saveSnapshot', {
contentOnly: 1
});
F.call(this, Z);
G.fire('updateSnapshot');
!ab && G.resetDirty();
}
}, null, null, 1);
});
var K;
G.on('contentDom', function () {
var P = G.document.getElementsByTag('title').getItem(0);
P.data('cke-title', G.document.$.title);
G.document.$.title = I;
});
G.on('readOnly', function () {
if (G.mode == 'wysiwyg') {
var P = G.getMode();
P.loadData(P.getData());
}
});
if (e.document.$.documentMode >= 8) {
G.addCss('html.CSS1Compat [contenteditable=false]{ min-heigh
t:0 !important;}');
var L = [];
for (var M in j.$removeEmpty) L.push('html.CSS1Compat ' + M
+ '[contenteditable=false]');
G.addCss(L.join(',') + '{ display:inline-block;}');
} else if (f.gecko) {
G.addCss('html { height: 100% !important; }');
G.addCss('img:-moz-broken { -moz-force-broken-image-icon : 1
;\twidth : 24px; height : 24px; }');
}
G.addCss('html {\t_overflow-y: scroll; cursor: text;\t*cursor:au
to;}');
G.addCss('img, input, textarea { cursor: default;}');
function N(P) {
if (G.readOnly) return;
i.tryThese(function () {
G.document.$.designMode = 'on';
setTimeout(function () {
G.document.$.designMode = 'off';
if (e.currentInstance == G) G.document.getBody().foc
us();
}, 50);
}, function () {
G.document.$.designMode = 'off';
var Q = G.document.getBody();
Q.setAttribute('contentEditable', false);
Q.setAttribute('contentEditable', true);
!P && N(1);
});
};
if (f.gecko || g || f.opera) {
var O;
G.on('uiReady', function () {
O = G.container.append(l.createFromHtml('<span tabindex=
"-1" style="position:absolute;" role="presentation"></span>'));
O.on('focus', function () {
G.focus();
});
G.focusGrabber = O;
});
G.on('destroy', function () {
i.removeFunction(J);
O.clearCustomData();
delete G.focusGrabber;
});
}
G.on('insertElement', function (P) {
var Q = P.data;
if (Q.type == 1 && (Q.is('input') || Q.is('textarea'))) {
var R = Q.getAttribute('contenteditable') == 'false';
if (!R) {
Q.data('cke-editable', Q.hasAttribute('contenteditab
le') ? 'true' : '1');
Q.setAttribute('contenteditable', false);
}
}
});
}
});
if (f.gecko)(function () {
var G = document.body;
if (!G) window.addEventListener('load', arguments.callee, false);
else {
var H = G.getAttribute('onpageshow');
G.setAttribute('onpageshow', (H ? H + ';' : '') + 'event.persist
ed && (function(){' + 'var allInstances = CKEDITOR.instances, editor, doc;' + 'f
or ( var i in allInstances )' + '{' + '\teditor = allInstances[ i ];' + '\tdoc =
editor.document;' + '\tif ( doc )' + '\t{' + '\t\tdoc.$.designMode = "off";' +
'\t\tdoc.$.designMode = "on";' + '\t}' + '}' + '})();');
}
})();
})();
m.disableObjectResizing = false;
m.disableNativeTableHandles = true;
m.disableNativeSpellChecker = true;
m.ignoreEmptyParagraph = true;
n.add('wsc', {
requires: ['dialog'],
init: function (q) {
var r = 'checkspell',
s = q.addCommand(r, new e.dialogCommand(r));
s.modes = {
wysiwyg: !f.opera && !f.air && document.domain == window.locatio
n.hostname
};
q.ui.addButton('SpellChecker', {
label: q.lang.spellCheck.toolbar,
command: r
});
e.dialog.add(r, this.path + 'dialogs/wsc.js');
}
});
m.wsc_customerId = m.wsc_customerId || '1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1
-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk';
m.wsc_customLoaderScript = m.wsc_customLoaderScript || null;
e.DIALOG_RESIZE_NONE = 0;
e.DIALOG_RESIZE_WIDTH = 1;
e.DIALOG_RESIZE_HEIGHT = 2;
e.DIALOG_RESIZE_BOTH = 3;
(function () {
var q = i.cssLength;
function r(W) {
return !!this._.tabs[W][0].$.offsetHeight;
};
function s() {
var aa = this;
var W = aa._.currentTabId,
X = aa._.tabIdList.length,
Y = i.indexOf(aa._.tabIdList, W) + X;
for (var Z = Y - 1; Z > Y - X; Z--) {
if (r.call(aa, aa._.tabIdList[Z % X])) return aa._.tabIdList[Z %
X];
}
return null;
};
function t() {
var aa = this;
var W = aa._.currentTabId,
X = aa._.tabIdList.length,
Y = i.indexOf(aa._.tabIdList, W);
for (var Z = Y + 1; Z < Y + X; Z++) {
if (r.call(aa, aa._.tabIdList[Z % X])) return aa._.tabIdList[Z %
X];
}
return null;
};
function u(W, X) {
var Y = W.$.getElementsByTagName('input');
for (var Z = 0, aa = Y.length; Z < aa; Z++) {
var ab = new l(Y[Z]);
if (ab.getAttribute('type').toLowerCase() == 'text')
if (X) {
ab.setAttribute('value', ab.getCustomData('fake_value')
|| '');
ab.removeCustomData('fake_value');
} else {
ab.setCustomData('fake_value', ab.getAttribute('value'))
;
ab.setAttribute('value', '');
}
}
};
function v(W, X) {
var Z = this;
var Y = Z.getInputElement();
if (Y) W ? Y.removeAttribute('aria-invalid') : Y.setAttribute('aria-
invalid', true);
if (!W)
if (Z.select) Z.select();
else Z.focus();
X && alert(X);
Z.fire('validated', {
valid: W,
msg: X
});
};
function w() {
var W = this.getInputElement();
W && W.removeAttribute('aria-invalid');
};
e.dialog = function (W, X) {
var Y = e.dialog._.dialogDefinitions[X],
Z = i.clone(y),
aa = W.config.dialog_buttonsOrder || 'OS',
ab = W.lang.dir;
if (aa == 'OS' && f.mac || aa == 'rtl' && ab == 'ltr' || aa == 'ltr'
&& ab == 'rtl') Z.buttons.reverse();
Y = i.extend(Y(W), Z);
Y = i.clone(Y);
Y = new C(this, Y);
var ac = e.document,
ad = W.theme.buildDialog(W);
this._ = {
editor: W,
element: ad.element,
name: X,
contentSize: {
width: 0,
height: 0
},
size: {
width: 0,
height: 0
},
contents: {},
buttons: {},
accessKeyMap: {},
tabs: {},
tabIdList: [],
currentTabId: null,
currentTabIndex: null,
pageCount: 0,
lastTab: null,
tabBarMode: false,
focusList: [],
currentFocusIndex: 0,
hasFocus: false
};
this.parts = ad.parts;
i.setTimeout(function () {
W.fire('ariaWidget', this.parts.contents);
}, 0, this);
var ae = {
position: f.ie6Compat ? 'absolute' : 'fixed',
top: 0,
visibility: 'hidden'
};
ae[ab == 'rtl' ? 'right' : 'left'] = 0;
this.parts.dialog.setStyles(ae);
e.event.call(this);
this.definition = Y = e.fire('dialogDefinition', {
name: X,
definition: Y
}, W).definition;
var af = {};
if (!('removeDialogTabs' in W._) && W.config.removeDialogTabs) {
var ag = W.config.removeDialogTabs.split(';');
for (i = 0; i < ag.length; i++) {
var ah = ag[i].split(':');
if (ah.length == 2) {
var ai = ah[0];
if (!af[ai]) af[ai] = [];
af[ai].push(ah[1]);
}
}
W._.removeDialogTabs = af;
}
if (W._.removeDialogTabs && (af = W._.removeDialogTabs[X]))
for (i = 0; i < af.length; i++) Y.removeContents(af[i]);
if (Y.onLoad) this.on('load', Y.onLoad);
if (Y.onShow) this.on('show', Y.onShow);
if (Y.onHide) this.on('hide', Y.onHide);
if (Y.onOk) this.on('ok', function (av) {
W.fire('saveSnapshot');
setTimeout(function () {
W.fire('saveSnapshot');
}, 0);
if (Y.onOk.call(this, av) === false) av.data.hide = false;
});
if (Y.onCancel) this.on('cancel', function (av) {
if (Y.onCancel.call(this, av) === false) av.data.hide = false;
});
var aj = this,
ak = function (av) {
var aw = aj._.contents,
ax = false;
for (var ay in aw)
for (var az in aw[ay]) {
ax = av.call(this, aw[ay][az]);
if (ax) return;
}
};
this.on('ok', function (av) {
ak(function (aw) {
if (aw.validate) {
var ax = aw.validate(this),
ay = typeof ax == 'string' || ax === false;
if (ay) {
av.data.hide = false;
av.stop();
}
v.call(aw, !ay, typeof ax == 'string' ? ax : undefined);
return ay;
}
});
}, this, null, 0);
this.on('cancel', function (av) {
ak(function (aw) {
if (aw.isChanged()) {
if (!confirm(W.lang.common.confirmCancel)) av.data.hide
= false;
return true;
}
});
}, this, null, 0);
this.parts.close.on('click', function (av) {
if (this.fire('cancel', {
hide: true
}).hide !== false) this.hide();
av.data.preventDefault();
}, this);
function al() {
var av = aj._.focusList;
av.sort(function (ay, az) {
if (ay.tabIndex != az.tabIndex) return az.tabIndex - ay.tabI
ndex;
else return ay.focusIndex - az.focusIndex;
});
var aw = av.length;
for (var ax = 0; ax < aw; ax++) av[ax].focusIndex = ax;
};
function am(av) {
var aw = aj._.focusList,
ax = av ? 1 : -1;
if (aw.length < 1) return;
var ay = aj._.currentFocusIndex;
try {
aw[ay].getInputElement().$.blur();
} catch (aB) {}
var az = (ay + ax + aw.length) % aw.length,
aA = az;
while (!aw[aA].isFocusable()) {
aA = (aA + ax + aw.length) % aw.length;
if (aA == az) break;
}
aw[aA].focus();
if (aw[aA].type == 'text') aw[aA].select();
};
this.changeFocus = am;
var an;
function ao(av) {
var aA = this;
if (aj != e.dialog._.currentTop) return;
var aw = av.data.getKeystroke(),
ax = W.lang.dir == 'rtl';
an = 0;
if (aw == 9 || aw == 2228224 + 9) {
var ay = aw == 2228224 + 9;
if (aj._.tabBarMode) {
var az = ay ? s.call(aj) : t.call(aj);
aj.selectPage(az);
aj._.tabs[az][0].focus();
} else am(!ay);
an = 1;
} else if (aw == 4456448 + 121 && !aj._.tabBarMode && aj.getPage
Count() > 1) {
aj._.tabBarMode = true;
aj._.tabs[aj._.currentTabId][0].focus();
an = 1;
} else if ((aw == 37 || aw == 39) && aj._.tabBarMode) {
az = aw == (ax ? 39 : 37) ? s.call(aj) : t.call(aj);
aj.selectPage(az);
aj._.tabs[az][0].focus();
an = 1;
} else if ((aw == 13 || aw == 32) && aj._.tabBarMode) {
aA.selectPage(aA._.currentTabId);
aA._.tabBarMode = false;
aA._.currentFocusIndex = -1;
am(true);
an = 1;
}
if (an) {
av.stop();
av.data.preventDefault();
}
};
function ap(av) {
an && av.data.preventDefault();
};
var aq = this._.element;
this.on('show', function () {
aq.on('keydown', ao, this, null, 0);
if (f.opera || f.gecko && f.mac) aq.on('keypress', ap, this);
});
this.on('hide', function () {
aq.removeListener('keydown', ao);
if (f.opera || f.gecko && f.mac) aq.removeListener('keypress', a
p);
ak(function (av) {
w.apply(av);
});
});
this.on('iframeAdded', function (av) {
var aw = new k(av.data.iframe.$.contentWindow.document);
aw.on('keydown', ao, this, null, 0);
});
this.on('show', function () {
var az = this;
al();
if (W.config.dialog_startupFocusTab && aj._.pageCount > 1) {
aj._.tabBarMode = true;
aj._.tabs[aj._.currentTabId][0].focus();
} else if (!az._.hasFocus) {
az._.currentFocusIndex = -1;
if (Y.onFocus) {
var av = Y.onFocus.call(az);
av && av.focus();
} else am(true); if (az._.editor.mode == 'wysiwyg' && g) {
var aw = W.document.$.selection,
ax = aw.createRange();
if (ax)
if (ax.parentElement && ax.parentElement().ownerDocu
ment == W.document.$ || ax.item && ax.item(0).ownerDocument == W.document.$) {
var ay = document.body.createTextRange();
ay.moveToElementText(az.getElement().getFirst().
$);
ay.collapse(true);
ay.select();
}
}
}
}, this, null, 4294967295);
if (f.ie6Compat) this.on('load', function (av) {
var aw = this.getElement(),
ax = aw.getFirst();
ax.remove();
ax.appendTo(aw);
}, this);
E(this);
F(this);
new h.text(Y.title, e.document).appendTo(this.parts.title);
for (var ar = 0; ar < Y.contents.length; ar++) {
var as = Y.contents[ar];
as && this.addPage(as);
}
this.parts.tabs.on('click', function (av) {
var ay = this;
var aw = av.data.getTarget();
if (aw.hasClass('cke_dialog_tab')) {
var ax = aw.$.id;
ay.selectPage(ax.substring(4, ax.lastIndexOf('_')));
if (ay._.tabBarMode) {
ay._.tabBarMode = false;
ay._.currentFocusIndex = -1;
am(true);
}
av.data.preventDefault();
}
}, this);
var at = [],
au = e.dialog._.uiElementBuilders.hbox.build(this, {
type: 'hbox',
className: 'cke_dialog_footer_buttons',
widths: [],
children: Y.buttons
}, at).getChild();
this.parts.footer.setHtml(at.join(''));
for (ar = 0; ar < au.length; ar++) this._.buttons[au[ar].id] = au[ar
];
};
function x(W, X, Y) {
this.element = X;
this.focusIndex = Y;
this.tabIndex = 0;
this.isFocusable = function () {
return !X.getAttribute('disabled') && X.isVisible();
};
this.focus = function () {
W._.currentFocusIndex = this.focusIndex;
this.element.focus();
};
X.on('keydown', function (Z) {
if (Z.data.getKeystroke() in {
32: 1,
13: 1
}) this.fire('click');
});
X.on('focus', function () {
this.fire('mouseover');
});
X.on('blur', function () {
this.fire('mouseout');
});
};
e.dialog.prototype = {
destroy: function () {
this.hide();
this._.element.remove();
},
resize: (function () {
return function (W, X) {
var Y = this;
if (Y._.contentSize && Y._.contentSize.width == W && Y._.con
tentSize.height == X) return;
e.dialog.fire('resize', {
dialog: Y,
skin: Y._.editor.skinName,
width: W,
height: X
}, Y._.editor);
Y.fire('resize', {
skin: Y._.editor.skinName,
width: W,
height: X
}, Y._.editor);
if (Y._.editor.lang.dir == 'rtl' && Y._.position) Y._.positi
on.x = e.document.getWindow().getViewPaneSize().width - Y._.contentSize.width -
parseInt(Y._.element.getFirst().getStyle('right'), 10);
Y._.contentSize = {
width: W,
height: X
};
};
})(),
getSize: function () {
var W = this._.element.getFirst();
return {
width: W.$.offsetWidth || 0,
height: W.$.offsetHeight || 0
};
},
move: (function () {
var W;
return function (X, Y, Z) {
var ag = this;
var aa = ag._.element.getFirst(),
ab = ag._.editor.lang.dir == 'rtl';
if (W === undefined) W = aa.getComputedStyle('position') ==
'fixed';
if (W && ag._.position && ag._.position.x == X && ag._.posit
ion.y == Y) return;
ag._.position = {
x: X,
y: Y
};
if (!W) {
var ac = e.document.getWindow().getScrollPosition();
X += ac.x;
Y += ac.y;
}
if (ab) {
var ad = ag.getSize(),
ae = e.document.getWindow().getViewPaneSize();
X = ae.width - ad.width - X;
}
var af = {
top: (Y > 0 ? Y : 0) + 'px'
};
af[ab ? 'right' : 'left'] = (X > 0 ? X : 0) + 'px';
aa.setStyles(af);
Z && (ag._.moved = 1);
};
})(),
getPosition: function () {
return i.extend({}, this._.position);
},
show: function () {
var W = this._.element,
X = this.definition;
if (!(W.getParent() && W.getParent().equals(e.document.getBody()
))) W.appendTo(e.document.getBody());
else W.setStyle('display', 'block'); if (f.gecko && f.version <
10900) {
var Y = this.parts.dialog;
Y.setStyle('position', 'absolute');
setTimeout(function () {
Y.setStyle('position', 'fixed');
}, 0);
}
this.resize(this._.contentSize && this._.contentSize.width || X.
width || X.minWidth, this._.contentSize && this._.contentSize.height || X.height
|| X.minHeight);
this.reset();
this.selectPage(this.definition.contents[0].id);
if (e.dialog._.currentZIndex === null) e.dialog._.currentZIndex
= this._.editor.config.baseFloatZIndex;
this._.element.getFirst().setStyle('z-index', e.dialog._.current
ZIndex += 10);
if (e.dialog._.currentTop === null) {
e.dialog._.currentTop = this;
this._.parentDialog = null;
K(this._.editor);
W.on('keydown', O);
W.on(f.opera ? 'keypress' : 'keyup', P);
for (var Z in {
keyup: 1,
keydown: 1,
keypress: 1
}) W.on(Z, V);
} else {
this._.parentDialog = e.dialog._.currentTop;
var aa = this._.parentDialog.getElement().getFirst();
aa.$.style.zIndex -= Math.floor(this._.editor.config.baseFlo
atZIndex / 2);
e.dialog._.currentTop = this;
}
Q(this, this, '\x1b', null, function () {
this.getButton('cancel') && this.getButton('cancel').click()
;
});
this._.hasFocus = false;
i.setTimeout(function () {
this.layout();
this.parts.dialog.setStyle('visibility', '');
this.fireOnce('load', {});
o.fire('ready', this);
this.fire('show', {});
this._.editor.fire('dialogShow', this);
this.foreach(function (ab) {
ab.setInitValue && ab.setInitValue();
});
}, 100, this);
},
layout: function () {
var Y = this;
var W = e.document.getWindow().getViewPaneSize(),
X = Y.getSize();
Y.move(Y._.moved ? Y._.position.x : (W.width - X.width) / 2, Y._
.moved ? Y._.position.y : (W.height - X.height) / 2);
},
foreach: function (W) {
var Z = this;
for (var X in Z._.contents)
for (var Y in Z._.contents[X]) W.call(Z, Z._.contents[X][Y])
;
return Z;
},
reset: (function () {
var W = function (X) {
if (X.reset) X.reset(1);
};
return function () {
this.foreach(W);
return this;
};
})(),
setupContent: function () {
var W = arguments;
this.foreach(function (X) {
if (X.setup) X.setup.apply(X, W);
});
},
commitContent: function () {
var W = arguments;
this.foreach(function (X) {
if (g && this._.currentFocusIndex == X.focusIndex) X.getInpu
tElement().$.blur();
if (X.commit) X.commit.apply(X, W);
});
},
hide: function () {
if (!this.parts.dialog.isVisible()) return;
this.fire('hide', {});
this._.editor.fire('dialogHide', this);
var W = this._.element;
W.setStyle('display', 'none');
this.parts.dialog.setStyle('visibility', 'hidden');
R(this);
while (e.dialog._.currentTop != this) e.dialog._.currentTop.hide
();
if (!this._.parentDialog) L();
else {
var X = this._.parentDialog.getElement().getFirst();
X.setStyle('z-index', parseInt(X.$.style.zIndex, 10) + Math.
floor(this._.editor.config.baseFloatZIndex / 2));
}
e.dialog._.currentTop = this._.parentDialog;
if (!this._.parentDialog) {
e.dialog._.currentZIndex = null;
W.removeListener('keydown', O);
W.removeListener(f.opera ? 'keypress' : 'keyup', P);
for (var Y in {
keyup: 1,
keydown: 1,
keypress: 1
}) W.removeListener(Y, V);
var Z = this._.editor;
Z.focus();
if (Z.mode == 'wysiwyg' && g) {
var aa = Z.getSelection();
aa && aa.unlock(true);
}
} else e.dialog._.currentZIndex -= 10;
delete this._.parentDialog;
this.foreach(function (ab) {
ab.resetInitValue && ab.resetInitValue();
});
},
addPage: function (W) {
var ai = this;
var X = [],
Y = W.label ? ' title="' + i.htmlEncode(W.label) + '"' : '',
Z = W.elements,
aa = e.dialog._.uiElementBuilders.vbox.build(ai, {
type: 'vbox',
className: 'cke_dialog_page_contents',
children: W.elements,
expand: !!W.expand,
padding: W.padding,
style: W.style || 'width: 100%;height:100%'
}, X),
ab = l.createFromHtml(X.join(''));
ab.setAttribute('role', 'tabpanel');
var ac = f,
ad = 'cke_' + W.id + '_' + i.getNextNumber(),
ae = l.createFromHtml(['<a class="cke_dialog_tab"', ai._.pag
eCount > 0 ? ' cke_last' : 'cke_first', Y, !!W.hidden ? ' style="display:none"'
: '', ' id="', ad, '"', ac.gecko && ac.version >= 10900 && !ac.hc ? '' : ' href=
"javascript:void(0)"', ' tabIndex="-1"', ' hidefocus="true"', ' role="tab">', W.
label, '</a>'].join(''));
ab.setAttribute('aria-labelledby', ad);
ai._.tabs[W.id] = [ae, ab];
ai._.tabIdList.push(W.id);
!W.hidden && ai._.pageCount++;
ai._.lastTab = ae;
ai.updateStyle();
var af = ai._.contents[W.id] = {},
ag, ah = aa.getChild();
while (ag = ah.shift()) {
af[ag.id] = ag;
if (typeof ag.getChild == 'function') ah.push.apply(ah, ag.g
etChild());
}
ab.setAttribute('name', W.id);
ab.appendTo(ai.parts.contents);
ae.unselectable();
ai.parts.tabs.append(ae);
if (W.accessKey) {
Q(ai, ai, 'CTRL+' + W.accessKey, T, S);
ai._.accessKeyMap['CTRL+' + W.accessKey] = W.id;
}
},
selectPage: function (W) {
if (this._.currentTabId == W) return;
if (this.fire('selectPage', {
page: W,
currentPage: this._.currentTabId
}) === true) return;
for (var X in this._.tabs) {
var Y = this._.tabs[X][0],
Z = this._.tabs[X][1];
if (X != W) {
Y.removeClass('cke_dialog_tab_selected');
Z.hide();
}
Z.setAttribute('aria-hidden', X != W);
}
var aa = this._.tabs[W];
aa[0].addClass('cke_dialog_tab_selected');
if (f.ie6Compat || f.ie7Compat) {
u(aa[1]);
aa[1].show();
setTimeout(function () {
u(aa[1], 1);
}, 0);
} else aa[1].show();
this._.currentTabId = W;
this._.currentTabIndex = i.indexOf(this._.tabIdList, W);
},
updateStyle: function () {
this.parts.dialog[(this._.pageCount === 1 ? 'add' : 'remove') +
'Class']('cke_single_page');
},
hidePage: function (W) {
var Y = this;
var X = Y._.tabs[W] && Y._.tabs[W][0];
if (!X || Y._.pageCount == 1 || !X.isVisible()) return;
else if (W == Y._.currentTabId) Y.selectPage(s.call(Y));
X.hide();
Y._.pageCount--;
Y.updateStyle();
},
showPage: function (W) {
var Y = this;
var X = Y._.tabs[W] && Y._.tabs[W][0];
if (!X) return;
X.show();
Y._.pageCount++;
Y.updateStyle();
},
getElement: function () {
return this._.element;
},
getName: function () {
return this._.name;
},
getContentElement: function (W, X) {
var Y = this._.contents[W];
return Y && Y[X];
},
getValueOf: function (W, X) {
return this.getContentElement(W, X).getValue();
},
setValueOf: function (W, X, Y) {
return this.getContentElement(W, X).setValue(Y);
},
getButton: function (W) {
return this._.buttons[W];
},
click: function (W) {
return this._.buttons[W].click();
},
disableButton: function (W) {
return this._.buttons[W].disable();
},
enableButton: function (W) {
return this._.buttons[W].enable();
},
getPageCount: function () {
return this._.pageCount;
},
getParentEditor: function () {
return this._.editor;
},
getSelectedElement: function () {
return this.getParentEditor().getSelection().getSelectedElement(
);
},
addFocusable: function (W, X) {
var Z = this;
if (typeof X == 'undefined') {
X = Z._.focusList.length;
Z._.focusList.push(new x(Z, W, X));
} else {
Z._.focusList.splice(X, 0, new x(Z, W, X));
for (var Y = X + 1; Y < Z._.focusList.length; Y++) Z._.focus
List[Y].focusIndex++;
}
}
};
i.extend(e.dialog, {
add: function (W, X) {
if (!this._.dialogDefinitions[W] || typeof X == 'function') this
._.dialogDefinitions[W] = X;
},
exists: function (W) {
return !!this._.dialogDefinitions[W];
},
getCurrent: function () {
return e.dialog._.currentTop;
},
okButton: (function () {
var W = function (X, Y) {
Y = Y || {};
return i.extend({
id: 'ok',
type: 'button',
label: X.lang.common.ok,
'class': 'cke_dialog_ui_button_ok',
onClick: function (Z) {
var aa = Z.data.dialog;
if (aa.fire('ok', {
hide: true
}).hide !== false) aa.hide();
}
}, Y, true);
};
W.type = 'button';
W.override = function (X) {
return i.extend(function (Y) {
return W(Y, X);
}, {
type: 'button'
}, true);
};
return W;
})(),
cancelButton: (function () {
var W = function (X, Y) {
Y = Y || {};
return i.extend({
id: 'cancel',
type: 'button',
label: X.lang.common.cancel,
'class': 'cke_dialog_ui_button_cancel',
onClick: function (Z) {
var aa = Z.data.dialog;
if (aa.fire('cancel', {
hide: true
}).hide !== false) aa.hide();
}
}, Y, true);
};
W.type = 'button';
W.override = function (X) {
return i.extend(function (Y) {
return W(Y, X);
}, {
type: 'button'
}, true);
};
return W;
})(),
addUIElement: function (W, X) {
this._.uiElementBuilders[W] = X;
}
});
e.dialog._ = {
uiElementBuilders: {},
dialogDefinitions: {},
currentTop: null,
currentZIndex: null
};
e.event.implementOn(e.dialog);
e.event.implementOn(e.dialog.prototype, true);
var y = {
resizable: 3,
minWidth: 600,
minHeight: 400,
buttons: [e.dialog.okButton, e.dialog.cancelButton]
},
z = function (W, X, Y) {
for (var Z = 0, aa; aa = W[Z]; Z++) {
if (aa.id == X) return aa;
if (Y && aa[Y]) {
var ab = z(aa[Y], X, Y);
if (ab) return ab;
}
}
return null;
},
A = function (W, X, Y, Z, aa) {
if (Y) {
for (var ab = 0, ac; ac = W[ab]; ab++) {
if (ac.id == Y) {
W.splice(ab, 0, X);
return X;
}
if (Z && ac[Z]) {
var ad = A(ac[Z], X, Y, Z, true);
if (ad) return ad;
}
}
if (aa) return null;
}
W.push(X);
return X;
},
B = function (W, X, Y) {
for (var Z = 0, aa; aa = W[Z]; Z++) {
if (aa.id == X) return W.splice(Z, 1);
if (Y && aa[Y]) {
var ab = B(aa[Y], X, Y);
if (ab) return ab;
}
}
return null;
},
C = function (W, X) {
this.dialog = W;
var Y = X.contents;
for (var Z = 0, aa; aa = Y[Z]; Z++) Y[Z] = aa && new D(W, aa);
i.extend(this, X);
};
C.prototype = {
getContents: function (W) {
return z(this.contents, W);
},
getButton: function (W) {
return z(this.buttons, W);
},
addContents: function (W, X) {
return A(this.contents, W, X);
},
addButton: function (W, X) {
return A(this.buttons, W, X);
},
removeContents: function (W) {
B(this.contents, W);
},
removeButton: function (W) {
B(this.buttons, W);
}
};
function D(W, X) {
this._ = {
dialog: W
};
i.extend(this, X);
};
D.prototype = {
get: function (W) {
return z(this.elements, W, 'children');
},
add: function (W, X) {
return A(this.elements, W, X, 'children');
},
remove: function (W) {
B(this.elements, W, 'children');
}
};
function E(W) {
var X = null,
Y = null,
Z = W.getElement().getFirst(),
aa = W.getParentEditor(),
ab = aa.config.dialog_magnetDistance,
ac = aa.skin.margins || [0, 0, 0, 0];
if (typeof ab == 'undefined') ab = 20;
function ad(af) {
var ag = W.getSize(),
ah = e.document.getWindow().getViewPaneSize(),
ai = af.data.$.screenX,
aj = af.data.$.screenY,
ak = ai - X.x,
al = aj - X.y,
am, an;
X = {
x: ai,
y: aj
};
Y.x += ak;
Y.y += al;
if (Y.x + ac[3] < ab) am = -ac[3];
else if (Y.x - ac[1] > ah.width - ag.width - ab) am = ah.width -
ag.width + (aa.lang.dir == 'rtl' ? 0 : ac[1]);
else am = Y.x; if (Y.y + ac[0] < ab) an = -ac[0];
else if (Y.y - ac[2] > ah.height - ag.height - ab) an = ah.heigh
t - ag.height + ac[2];
else an = Y.y;
W.move(am, an, 1);
af.data.preventDefault();
};
function ae(af) {
e.document.removeListener('mousemove', ad);
e.document.removeListener('mouseup', ae);
if (f.ie6Compat) {
var ag = I.getChild(0).getFrameDocument();
ag.removeListener('mousemove', ad);
ag.removeListener('mouseup', ae);
}
};
W.parts.title.on('mousedown', function (af) {
X = {
x: af.data.$.screenX,
y: af.data.$.screenY
};
e.document.on('mousemove', ad);
e.document.on('mouseup', ae);
Y = W.getPosition();
if (f.ie6Compat) {
var ag = I.getChild(0).getFrameDocument();
ag.on('mousemove', ad);
ag.on('mouseup', ae);
}
af.data.preventDefault();
}, W);
};
function F(W) {
var X = W.definition,
Y = X.resizable;
if (Y == 0) return;
var Z = W.getParentEditor(),
aa, ab, ac, ad, ae, af, ag = i.addFunction(function (aj) {
ae = W.getSize();
var ak = W.parts.contents,
al = ak.$.getElementsByTagName('iframe').length;
if (al) {
af = l.createFromHtml('<div class="cke_dialog_resize_cov
er" style="height: 100%; position: absolute; width: 100%;"></div>');
ak.append(af);
}
ab = ae.height - W.parts.contents.getSize('height', !(f.geck
o || f.opera || g && f.quirks));
aa = ae.width - W.parts.contents.getSize('width', 1);
ad = {
x: aj.screenX,
y: aj.screenY
};
ac = e.document.getWindow().getViewPaneSize();
e.document.on('mousemove', ah);
e.document.on('mouseup', ai);
if (f.ie6Compat) {
var am = I.getChild(0).getFrameDocument();
am.on('mousemove', ah);
am.on('mouseup', ai);
}
aj.preventDefault && aj.preventDefault();
});
W.on('load', function () {
var aj = '';
if (Y == 1) aj = ' cke_resizer_horizontal';
else if (Y == 2) aj = ' cke_resizer_vertical';
var ak = l.createFromHtml('<div class="cke_resizer' + aj + ' cke
_resizer_' + Z.lang.dir + '"' + ' title="' + i.htmlEncode(Z.lang.resize) + '"' +
' onmousedown="CKEDITOR.tools.callFunction(' + ag + ', event )"></div>');
W.parts.footer.append(ak, 1);
});
Z.on('destroy', function () {
i.removeFunction(ag);
});
function ah(aj) {
var ak = Z.lang.dir == 'rtl',
al = (aj.data.$.screenX - ad.x) * (ak ? -1 : 1),
am = aj.data.$.screenY - ad.y,
an = ae.width,
ao = ae.height,
ap = an + al * (W._.moved ? 1 : 2),
aq = ao + am * (W._.moved ? 1 : 2),
ar = W._.element.getFirst(),
as = ak && ar.getComputedStyle('right'),
at = W.getPosition();
if (at.y + aq > ac.height) aq = ac.height - at.y;
if ((ak ? as : at.x) + ap > ac.width) ap = ac.width - (ak ? as :
at.x);
if (Y == 1 || Y == 3) an = Math.max(X.minWidth || 0, ap - aa);
if (Y == 2 || Y == 3) ao = Math.max(X.minHeight || 0, aq - ab);
W.resize(an, ao);
if (!W._.moved) W.layout();
aj.data.preventDefault();
};
function ai() {
e.document.removeListener('mouseup', ai);
e.document.removeListener('mousemove', ah);
if (af) {
af.remove();
af = null;
}
if (f.ie6Compat) {
var aj = I.getChild(0).getFrameDocument();
aj.removeListener('mouseup', ai);
aj.removeListener('mousemove', ah);
}
};
};
var G, H = {},
I;
function J(W) {
W.data.preventDefault(1);
};
function K(W) {
var X = e.document.getWindow(),
Y = W.config,
Z = Y.dialog_backgroundCoverColor || 'white',
aa = Y.dialog_backgroundCoverOpacity,
ab = Y.baseFloatZIndex,
ac = i.genKey(Z, aa, ab),
ad = H[ac];
if (!ad) {
var ae = ['<div tabIndex="-1" style="position: ', f.ie6Compat ?
'absolute' : 'fixed', '; z-index: ', ab, '; top: 0px; left: 0px; ', !f.ie6Compat
? 'background-color: ' + Z : '', '" class="cke_dialog_background_cover">'];
if (f.ie6Compat) {
var af = f.isCustomDomain(),
ag = "<html><body style=\\'background-color:" + Z + ";\\
'></body></html>";
ae.push('<iframe hidefocus="true" frameborder="0" id="cke_di
alog_background_iframe" src="javascript:');
ae.push('void((function(){document.open();' + (af ? "documen
t.domain='" + document.domain + "';" : '') + "document.write( '" + ag + "' );" +
'document.close();' + '})())');
ae.push('" style="position:absolute;left:0;top:0;width:100%;
height: 100%;progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>');
}
ae.push('</div>');
ad = l.createFromHtml(ae.join(''));
ad.setOpacity(aa != undefined ? aa : 0.5);
ad.on('keydown', J);
ad.on('keypress', J);
ad.on('keyup', J);
ad.appendTo(e.document.getBody());
H[ac] = ad;
} else ad.show();
I = ad;
var ah = function () {
var ak = X.getViewPaneSize();
ad.setStyles({
width: ak.width + 'px',
height: ak.height + 'px'
});
},
ai = function () {
var ak = X.getScrollPosition(),
al = e.dialog._.currentTop;
ad.setStyles({
left: ak.x + 'px',
top: ak.y + 'px'
});
if (al)
do {
var am = al.getPosition();
al.move(am.x, am.y);
} while (al = al._.parentDialog)
};
G = ah;
X.on('resize', ah);
ah();
if (!(f.mac && f.webkit)) ad.focus();
if (f.ie6Compat) {
var aj = function () {
ai();
arguments.callee.prevScrollHandler.apply(this, arguments);
};
X.$.setTimeout(function () {
aj.prevScrollHandler = window.onscroll || (function () {});
window.onscroll = aj;
}, 0);
ai();
}
};
function L() {
if (!I) return;
var W = e.document.getWindow();
I.hide();
W.removeListener('resize', G);
if (f.ie6Compat) W.$.setTimeout(function () {
var X = window.onscroll && window.onscroll.prevScrollHandler;
window.onscroll = X || null;
}, 0);
G = null;
};
function M() {
for (var W in H) H[W].remove();
H = {};
};
var N = {},
O = function (W) {
var X = W.data.$.ctrlKey || W.data.$.metaKey,
Y = W.data.$.altKey,
Z = W.data.$.shiftKey,
aa = String.fromCharCode(W.data.$.keyCode),
ab = N[(X ? 'CTRL+' : '') + (Y ? 'ALT+' : '') + (Z ? 'SHIFT+
' : '') + aa];
if (!ab || !ab.length) return;
ab = ab[ab.length - 1];
ab.keydown && ab.keydown.call(ab.uiElement, ab.dialog, ab.key);
W.data.preventDefault();
},
P = function (W) {
var X = W.data.$.ctrlKey || W.data.$.metaKey,
Y = W.data.$.altKey,
Z = W.data.$.shiftKey,
aa = String.fromCharCode(W.data.$.keyCode),
ab = N[(X ? 'CTRL+' : '') + (Y ? 'ALT+' : '') + (Z ? 'SHIFT+
' : '') + aa];
if (!ab || !ab.length) return;
ab = ab[ab.length - 1];
if (ab.keyup) {
ab.keyup.call(ab.uiElement, ab.dialog, ab.key);
W.data.preventDefault();
}
},
Q = function (W, X, Y, Z, aa) {
var ab = N[Y] || (N[Y] = []);
ab.push({
uiElement: W,
dialog: X,
key: Y,
keyup: aa || W.accessKeyUp,
keydown: Z || W.accessKeyDown
});
},
R = function (W) {
for (var X in N) {
var Y = N[X];
for (var Z = Y.length - 1; Z >= 0; Z--) {
if (Y[Z].dialog == W || Y[Z].uiElement == W) Y.splice(Z,
1);
}
if (Y.length === 0) delete N[X];
}
},
S = function (W, X) {
if (W._.accessKeyMap[X]) W.selectPage(W._.accessKeyMap[X]);
},
T = function (W, X) {},
U = {
27: 1,
13: 1
},
V = function (W) {
if (W.data.getKeystroke() in U) W.data.stopPropagation();
};
(function () {
o.dialog = {
uiElement: function (W, X, Y, Z, aa, ab, ac) {
if (arguments.length < 4) return;
var ad = (Z.call ? Z(X) : Z) || 'div',
ae = ['<', ad, ' '],
af = (aa && aa.call ? aa(X) : aa) || {},
ag = (ab && ab.call ? ab(X) : ab) || {},
ah = (ac && ac.call ? ac.call(this, W, X) : ac) || '',
ai = this.domId = ag.id || i.getNextId() + '_uiElement',
aj = this.id = X.id,
ak;
ag.id = ai;
var al = {};
if (X.type) al['cke_dialog_ui_' + X.type] = 1;
if (X.className) al[X.className] = 1;
if (X.disabled) al.cke_disabled = 1;
var am = ag['class'] && ag['class'].split ? ag['class'].spli
t(' ') : [];
for (ak = 0; ak < am.length; ak++) {
if (am[ak]) al[am[ak]] = 1;
}
var an = [];
for (ak in al) an.push(ak);
ag['class'] = an.join(' ');
if (X.title) ag.title = X.title;
var ao = (X.style || '').split(';');
if (X.align) {
var ap = X.align;
af['margin-left'] = ap == 'left' ? 0 : 'auto';
af['margin-right'] = ap == 'right' ? 0 : 'auto';
}
for (ak in af) ao.push(ak + ':' + af[ak]);
if (X.hidden) ao.push('display:none');
for (ak = ao.length - 1; ak >= 0; ak--) {
if (ao[ak] === '') ao.splice(ak, 1);
}
if (ao.length > 0) ag.style = (ag.style ? ag.style + '; ' :
'') + ao.join('; ');
for (ak in ag) ae.push(ak + '="' + i.htmlEncode(ag[ak]) + '"
');
ae.push('>', ah, '</', ad, '>');
Y.push(ae.join(''));
(this._ || (this._ = {})).dialog = W;
if (typeof X.isChanged == 'boolean') this.isChanged = functi
on () {
return X.isChanged;
};
if (typeof X.isChanged == 'function') this.isChanged = X.isC
hanged;
if (typeof X.setValue == 'function') this.setValue = i.overr
ide(this.setValue, function (ar) {
return function (as) {
ar.call(this, X.setValue.call(this, as));
};
});
if (typeof X.getValue == 'function') this.getValue = i.overr
ide(this.getValue, function (ar) {
return function () {
return X.getValue.call(this, ar.call(this));
};
});
e.event.implementOn(this);
this.registerEvents(X);
if (this.accessKeyUp && this.accessKeyDown && X.accessKey) Q
(this, W, 'CTRL+' + X.accessKey);
var aq = this;
W.on('load', function () {
var ar = aq.getInputElement();
if (ar) {
var as = aq.type in {
checkbox: 1,
ratio: 1
} && g && f.version < 8 ? 'cke_dialog_ui_focused' :
'';
ar.on('focus', function () {
W._.tabBarMode = false;
W._.hasFocus = true;
aq.fire('focus');
as && this.addClass(as);
});
ar.on('blur', function () {
aq.fire('blur');
as && this.removeClass(as);
});
}
});
if (this.keyboardFocusable) {
this.tabIndex = X.tabIndex || 0;
this.focusIndex = W._.focusList.push(this) - 1;
this.on('focus', function () {
W._.currentFocusIndex = aq.focusIndex;
});
}
i.extend(this, X);
},
hbox: function (W, X, Y, Z, aa) {
if (arguments.length < 4) return;
this._ || (this._ = {});
var ab = this._.children = X,
ac = aa && aa.widths || null,
ad = aa && aa.height || null,
ae = {},
af, ag = function () {
var ai = ['<tbody><tr class="cke_dialog_ui_hbox">'];
for (af = 0; af < Y.length; af++) {
var aj = 'cke_dialog_ui_hbox_child',
ak = [];
if (af === 0) aj = 'cke_dialog_ui_hbox_first';
if (af == Y.length - 1) aj = 'cke_dialog_ui_hbox
_last';
ai.push('<td class="', aj, '" role="presentation
" ');
if (ac) {
if (ac[af]) ak.push('width:' + q(ac[af]));
} else ak.push('width:' + Math.floor(100 / Y.len
gth) + '%'); if (ad) ak.push('height:' + q(ad));
if (aa && aa.padding != undefined) ak.push('padd
ing:' + q(aa.padding));
if (g && f.quirks && ab[af].align) ak.push('text
-align:' + ab[af].align);
if (ak.length > 0) ai.push('style="' + ak.join('
; ') + '" ');
ai.push('>', Y[af], '</td>');
}
ai.push('</tr></tbody>');
return ai.join('');
},
ah = {
role: 'presentation'
};
aa && aa.align && (ah.align = aa.align);
o.dialog.uiElement.call(this, W, aa || {
type: 'hbox'
}, Z, 'table', ae, ah, ag);
},
vbox: function (W, X, Y, Z, aa) {
if (arguments.length < 3) return;
this._ || (this._ = {});
var ab = this._.children = X,
ac = aa && aa.width || null,
ad = aa && aa.heights || null,
ae = function () {
var af = ['<table role="presentation" cellspacing="0
" border="0" '];
af.push('style="');
if (aa && aa.expand) af.push('height:100%;');
af.push('width:' + q(ac || '100%'), ';');
af.push('"');
af.push('align="', i.htmlEncode(aa && aa.align || (W
.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right')), '" ');
af.push('><tbody>');
for (var ag = 0; ag < Y.length; ag++) {
var ah = [];
af.push('<tr><td role="presentation" ');
if (ac) ah.push('width:' + q(ac || '100%'));
if (ad) ah.push('height:' + q(ad[ag]));
else if (aa && aa.expand) ah.push('height:' + Ma
th.floor(100 / Y.length) + '%');
if (aa && aa.padding != undefined) ah.push('padd
ing:' + q(aa.padding));
if (g && f.quirks && ab[ag].align) ah.push('text
-align:' + ab[ag].align);
if (ah.length > 0) af.push('style="', ah.join(';
'), '" ');
af.push(' class="cke_dialog_ui_vbox_child">', Y[
ag], '</td></tr>');
}
af.push('</tbody></table>');
return af.join('');
};
o.dialog.uiElement.call(this, W, aa || {
type: 'vbox'
}, Z, 'div', null, {
role: 'presentation'
}, ae);
}
};
})();
o.dialog.uiElement.prototype = {
getElement: function () {
return e.document.getById(this.domId);
},
getInputElement: function () {
return this.getElement();
},
getDialog: function () {
return this._.dialog;
},
setValue: function (W, X) {
this.getInputElement().setValue(W);
!X && this.fire('change', {
value: W
});
return this;
},
getValue: function () {
return this.getInputElement().getValue();
},
isChanged: function () {
return false;
},
selectParentTab: function () {
var Z = this;
var W = Z.getInputElement(),
X = W,
Y;
while ((X = X.getParent()) && X.$.className.search('cke_dialog_p
age_contents') == -1) {}
if (!X) return Z;
Y = X.getAttribute('name');
if (Z._.dialog._.currentTabId != Y) Z._.dialog.selectPage(Y);
return Z;
},
focus: function () {
this.selectParentTab().getInputElement().focus();
return this;
},
registerEvents: function (W) {
var X = /^on([A-Z]\w+)/,
Y, Z = function (ab, ac, ad, ae) {
ac.on('load', function () {
ab.getInputElement().on(ad, ae, ab);
});
};
for (var aa in W) {
if (!(Y = aa.match(X))) continue;
if (this.eventProcessors[aa]) this.eventProcessors[aa].call(
this, this._.dialog, W[aa]);
else Z(this, this._.dialog, Y[1].toLowerCase(), W[aa]);
}
return this;
},
eventProcessors: {
onLoad: function (W, X) {
W.on('load', X, this);
},
onShow: function (W, X) {
W.on('show', X, this);
},
onHide: function (W, X) {
W.on('hide', X, this);
}
},
accessKeyDown: function (W, X) {
this.focus();
},
accessKeyUp: function (W, X) {},
disable: function () {
var W = this.getElement(),
X = this.getInputElement();
X.setAttribute('disabled', 'true');
W.addClass('cke_disabled');
},
enable: function () {
var W = this.getElement(),
X = this.getInputElement();
X.removeAttribute('disabled');
W.removeClass('cke_disabled');
},
isEnabled: function () {
return !this.getElement().hasClass('cke_disabled');
},
isVisible: function () {
return this.getInputElement().isVisible();
},
isFocusable: function () {
if (!this.isEnabled() || !this.isVisible()) return false;
return true;
}
};
o.dialog.hbox.prototype = i.extend(new o.dialog.uiElement(), {
getChild: function (W) {
var X = this;
if (arguments.length < 1) return X._.children.concat();
if (!W.splice) W = [W];
if (W.length < 2) return X._.children[W[0]];
else return X._.children[W[0]] && X._.children[W[0]].getChild ?
X._.children[W[0]].getChild(W.slice(1, W.length)) : null;
}
}, true);
o.dialog.vbox.prototype = new o.dialog.hbox();
(function () {
var W = {
build: function (X, Y, Z) {
var aa = Y.children,
ab, ac = [],
ad = [];
for (var ae = 0; ae < aa.length && (ab = aa[ae]); ae++) {
var af = [];
ac.push(af);
ad.push(e.dialog._.uiElementBuilders[ab.type].build(X, a
b, af));
}
return new o.dialog[Y.type](X, ad, ac, Z, Y);
}
};
e.dialog.addUIElement('hbox', W);
e.dialog.addUIElement('vbox', W);
})();
e.dialogCommand = function (W) {
this.dialogName = W;
};
e.dialogCommand.prototype = {
exec: function (W) {
f.opera ? i.setTimeout(function () {
W.openDialog(this.dialogName);
}, 0, this) : W.openDialog(this.dialogName);
},
canUndo: false,
editorFocus: g || f.webkit
};
(function () {
var W = /^([a]|[^a])+$/,
X = /^\d*$/,
Y = /^\d*(?:\.\d+)?$/,
Z = /^(((\d*(\.\d+))|(\d*))(px|\%)?)?$/,
aa = /^(((\d*(\.\d+))|(\d*))(px|em|ex|in|cm|mm|pt|pc|\%)?)?$/i,
ab = /^(\s*[\w-]+\s*:\s*[^:;]+(?:;|$))*$/;
e.VALIDATE_OR = 1;
e.VALIDATE_AND = 2;
e.dialog.validate = {
functions: function () {
var ac = arguments;
return function () {
var ad = this && this.getValue ? this.getValue() : ac[0]
,
ae = undefined,
af = 2,
ag = [],
ah;
for (ah = 0; ah < ac.length; ah++) {
if (typeof ac[ah] == 'function') ag.push(ac[ah]);
else break;
}
if (ah < ac.length && typeof ac[ah] == 'string') {
ae = ac[ah];
ah++;
}
if (ah < ac.length && typeof ac[ah] == 'number') af = ac
[ah];
var ai = af == 2 ? true : false;
for (ah = 0; ah < ag.length; ah++) {
if (af == 2) ai = ai && ag[ah](ad);
else ai = ai || ag[ah](ad);
}
return !ai ? ae : true;
};
},
regex: function (ac, ad) {
return function () {
var ae = this && this.getValue ? this.getValue() : argum
ents[0];
return !ac.test(ae) ? ad : true;
};
},
notEmpty: function (ac) {
return this.regex(W, ac);
},
integer: function (ac) {
return this.regex(X, ac);
},
number: function (ac) {
return this.regex(Y, ac);
},
cssLength: function (ac) {
return this.functions(function (ad) {
return aa.test(i.trim(ad));
}, ac);
},
htmlLength: function (ac) {
return this.functions(function (ad) {
return Z.test(i.trim(ad));
}, ac);
},
inlineStyle: function (ac) {
return this.functions(function (ad) {
return ab.test(i.trim(ad));
}, ac);
},
equals: function (ac, ad) {
return this.functions(function (ae) {
return ae == ac;
}, ad);
},
notEqual: function (ac, ad) {
return this.functions(function (ae) {
return ae != ac;
}, ad);
}
};
e.on('instanceDestroyed', function (ac) {
if (i.isEmpty(e.instances)) {
var ad;
while (ad = e.dialog._.currentTop) ad.hide();
M();
}
var ae = ac.editor._.storedDialogs;
for (var af in ae) ae[af].destroy();
});
})();
i.extend(e.editor.prototype, {
openDialog: function (W, X) {
if (this.mode == 'wysiwyg' && g) {
var Y = this.getSelection();
Y && Y.lock();
}
var Z = e.dialog._.dialogDefinitions[W],
aa = this.skin.dialog;
if (e.dialog._.currentTop === null) K(this);
if (typeof Z == 'function' && aa._isLoaded) {
var ab = this._.storedDialogs || (this._.storedDialogs = {})
,
ac = ab[W] || (ab[W] = new e.dialog(this, W));
X && X.call(ac, ac);
ac.show();
return ac;
} else if (Z == 'failed') {
L();
throw new Error('[CKEDITOR.dialog.openDialog] Dialog "' + W
+ '" failed when loading definition.');
}
var ad = this;
function ae(ag) {
var ah = e.dialog._.dialogDefinitions[W],
ai = ad.skin.dialog;
if (!ai._isLoaded || af && typeof ag == 'undefined') return;
if (typeof ah != 'function') e.dialog._.dialogDefinitions[W]
= 'failed';
ad.openDialog(W, X);
};
if (typeof Z == 'string') {
var af = 1;
e.scriptLoader.load(e.getUrl(Z), ae, null, 0, 1);
}
e.skins.load(this, 'dialog', ae);
return null;
}
});
})();
n.add('dialog', {
requires: ['dialogui']
});
n.add('styles', {
requires: ['selection'],
init: function (q) {
q.on('contentDom', function () {
q.document.setCustomData('cke_includeReadonly', !q.config.disabl
eReadonlyStyling);
});
}
});
e.editor.prototype.attachStyleStateChange = function (q, r) {
var s = this._.styleStateChangeCallbacks;
if (!s) {
s = this._.styleStateChangeCallbacks = [];
this.on('selectionChange', function (t) {
for (var u = 0; u < s.length; u++) {
var v = s[u],
w = v.style.checkActive(t.data.path) ? 1 : 2;
v.fn.call(this, w);
}
});
}
s.push({
style: q,
fn: r
});
};
e.STYLE_BLOCK = 1;
e.STYLE_INLINE = 2;
e.STYLE_OBJECT = 3;
(function () {
var q = {
address: 1,
div: 1,
h1: 1,
h2: 1,
h3: 1,
h4: 1,
h5: 1,
h6: 1,
p: 1,
pre: 1,
section: 1,
header: 1,
footer: 1,
nav: 1,
article: 1,
aside: 1,
figure: 1,
dialog: 1,
hgroup: 1,
time: 1,
meter: 1,
menu: 1,
command: 1,
keygen: 1,
output: 1,
progress: 1,
details: 1,
datagrid: 1,
datalist: 1
},
r = {
a: 1,
embed: 1,
hr: 1,
img: 1,
li: 1,
object: 1,
ol: 1,
table: 1,
td: 1,
tr: 1,
th: 1,
ul: 1,
dl: 1,
dt: 1,
dd: 1,
form: 1,
audio: 1,
video: 1
},
s = /\s*(?:;\s*|$)/,
t = /#\((.+?)\)/g,
u = h.walker.bookmark(0, 1),
v = h.walker.whitespaces(1);
e.style = function (X, Y) {
var aa = this;
if (Y) {
X = i.clone(X);
P(X.attributes, Y);
P(X.styles, Y);
}
var Z = aa.element = X.element ? typeof X.element == 'string' ? X.el
ement.toLowerCase() : X.element : '*';
aa.type = q[Z] ? 1 : r[Z] ? 3 : 2;
if (typeof aa.element == 'object') aa.type = 3;
aa._ = {
definition: X
};
};
e.style.prototype = {
apply: function (X) {
W.call(this, X, false);
},
remove: function (X) {
W.call(this, X, true);
},
applyToRange: function (X) {
var Y = this;
return (Y.applyToRange = Y.type == 2 ? x : Y.type == 1 ? B : Y.t
ype == 3 ? z : null).call(Y, X);
},
removeFromRange: function (X) {
var Y = this;
return (Y.removeFromRange = Y.type == 2 ? y : Y.type == 1 ? C :
Y.type == 3 ? A : null).call(Y, X);
},
applyToObject: function (X) {
O(X, this);
},
checkActive: function (X) {
var ac = this;
switch (ac.type) {
case 1:
return ac.checkElementRemovable(X.block || X.blockLimit, tru
e);
case 3:
case 2:
var Y = X.elements;
for (var Z = 0, aa; Z < Y.length; Z++) {
aa = Y[Z];
if (ac.type == 2 && (aa == X.block || aa == X.blockLimit
)) continue;
if (ac.type == 3) {
var ab = aa.getName();
if (!(typeof ac.element == 'string' ? ab == ac.eleme
nt : ab in ac.element)) continue;
}
if (ac.checkElementRemovable(aa, true)) return true;
}
}
return false;
},
checkApplicable: function (X) {
switch (this.type) {
case 2:
case 1:
break;
case 3:
return X.lastElement.getAscendant(this.element, true);
}
return true;
},
checkElementRemovable: function (X, Y) {
var ai = this;
var Z = ai._.definition;
if (!X || !Z.ignoreReadonly && X.isReadOnly()) return false;
var aa, ab = X.getName();
if (typeof ai.element == 'string' ? ab == ai.element : ab in ai.
element) {
if (!Y && !X.hasAttributes()) return true;
aa = Q(Z);
if (aa._length) {
for (var ac in aa) {
if (ac == '_length') continue;
var ad = X.getAttribute(ac) || '';
if (ac == 'style' ? V(aa[ac], T(ad, false)) : aa[ac]
== ad) {
if (!Y) return true;
} else if (Y) return false;
}
if (Y) return true;
} else return true;
}
var ae = R(ai)[X.getName()];
if (ae) {
if (!(aa = ae.attributes)) return true;
for (var af = 0; af < aa.length; af++) {
ac = aa[af][0];
var ag = X.getAttribute(ac);
if (ag) {
var ah = aa[af][1];
if (ah === null || typeof ah == 'string' && ag == ah
|| ah.test(ag)) return true;
}
}
}
return false;
},
buildPreview: function (X) {
var Y = this._.definition,
Z = [],
aa = Y.element;
if (aa == 'bdo') aa = 'span';
Z = ['<', aa];
var ab = Y.attributes;
if (ab)
for (var ac in ab) Z.push(' ', ac, '="', ab[ac], '"');
var ad = e.style.getStyleText(Y);
if (ad) Z.push(' style="', ad, '"');
Z.push('>', X || Y.name, '</', aa, '>');
return Z.join('');
}
};
e.style.getStyleText = function (X) {
var Y = X._ST;
if (Y) return Y;
Y = X.styles;
var Z = X.attributes && X.attributes.style || '',
aa = '';
if (Z.length) Z = Z.replace(s, ';');
for (var ab in Y) {
var ac = Y[ab],
ad = (ab + ':' + ac).replace(s, ';');
if (ac == 'inherit') aa += ad;
else Z += ad;
}
if (Z.length) Z = T(Z);
Z += aa;
return X._ST = Z;
};
function w(X) {
var Y, Z;
while (X = X.getParent()) {
if (X.getName() == 'body') break;
if (X.getAttribute('data-nostyle')) Y = X;
else if (!Z) {
var aa = X.getAttribute('contentEditable');
if (aa == 'false') Y = X;
else if (aa == 'true') Z = 1;
}
}
return Y;
};
function x(X) {
var aC = this;
var Y = X.document;
if (X.collapsed) {
var Z = N(aC, Y);
X.insertNode(Z);
X.moveToPosition(Z, 2);
return;
}
var aa = aC.element,
ab = aC._.definition,
ac, ad = ab.ignoreReadonly,
ae = ad || ab.includeReadonly;
if (ae == undefined) ae = Y.getCustomData('cke_includeReadonly');
var af = j[aa] || (ac = true, j.span);
X.enlarge(1, 1);
X.trim();
var ag = X.createBookmark(),
ah = ag.startNode,
ai = ag.endNode,
aj = ah,
ak;
if (!ad) {
var al = w(ah),
am = w(ai);
if (al) aj = al.getNextSourceNode(true);
if (am) ai = am;
}
if (aj.getPosition(ai) == 2) aj = 0;
while (aj) {
var an = false;
if (aj.equals(ai)) {
aj = null;
an = true;
} else {
var ao = aj.type,
ap = ao == 1 ? aj.getName() : null,
aq = ap && aj.getAttribute('contentEditable') == 'false'
,
ar = ap && aj.getAttribute('data-nostyle');
if (ap && aj.data('cke-bookmark')) {
aj = aj.getNextSourceNode(true);
continue;
}
if (!ap || af[ap] && !ar && (!aq || ae) && (aj.getPosition(a
i) | 4 | 0 | 8) == 4 + 0 + 8 && (!ab.childRule || ab.childRule(aj))) {
var as = aj.getParent();
if (as && ((as.getDtd() || j.span)[aa] || ac) && (!ab.pa
rentRule || ab.parentRule(as))) {
if (!ak && (!ap || !j.$removeEmpty[ap] || (aj.getPos
ition(ai) | 4 | 0 | 8) == 4 + 0 + 8)) {
ak = new h.range(Y);
ak.setStartBefore(aj);
}
if (ao == 3 || aq || ao == 1 && !aj.getChildCount())
{
var at = aj,
au;
while ((an = !at.getNext(u)) && (au = at.getPare
nt(), af[au.getName()]) && (au.getPosition(ah) | 2 | 0 | 8) == 2 + 0 + 8 && (!ab
.childRule || ab.childRule(au))) at = au;
ak.setEndAfter(at);
}
} else an = true;
} else an = true;
aj = aj.getNextSourceNode(ar || aq);
} if (an && ak && !ak.collapsed) {
var av = N(aC, Y),
aw = av.hasAttributes(),
ax = ak.getCommonAncestor(),
ay = {
styles: {},
attrs: {},
blockedStyles: {},
blockedAttrs: {}
},
az, aA, aB;
while (av && ax) {
if (ax.getName() == aa) {
for (az in ab.attributes) {
if (ay.blockedAttrs[az] || !(aB = ax.getAttribut
e(aA))) continue;
if (av.getAttribute(az) == aB) ay.attrs[az] = 1;
else ay.blockedAttrs[az] = 1;
}
for (aA in ab.styles) {
if (ay.blockedStyles[aA] || !(aB = ax.getStyle(a
A))) continue;
if (av.getStyle(aA) == aB) ay.styles[aA] = 1;
else ay.blockedStyles[aA] = 1;
}
}
ax = ax.getParent();
}
for (az in ay.attrs) av.removeAttribute(az);
for (aA in ay.styles) av.removeStyle(aA);
if (aw && !av.hasAttributes()) av = null;
if (av) {
ak.extractContents().appendTo(av);
K(aC, av);
ak.insertNode(av);
av.mergeSiblings();
if (!g) av.$.normalize();
} else {
av = new l('span');
ak.extractContents().appendTo(av);
ak.insertNode(av);
K(aC, av);
av.remove(true);
}
ak = null;
}
}
X.moveToBookmark(ag);
X.shrink(2);
};
function y(X) {
X.enlarge(1, 1);
var Y = X.createBookmark(),
Z = Y.startNode;
if (X.collapsed) {
var aa = new h.elementPath(Z.getParent()),
ab;
for (var ac = 0, ad; ac < aa.elements.length && (ad = aa.element
s[ac]); ac++) {
if (ad == aa.block || ad == aa.blockLimit) break;
if (this.checkElementRemovable(ad)) {
var ae;
if (X.collapsed && (X.checkBoundaryOfElement(ad, 2) || (
ae = X.checkBoundaryOfElement(ad, 1)))) {
ab = ad;
ab.match = ae ? 'start' : 'end';
} else {
ad.mergeSiblings();
if (ad.getName() == this.element) J(this, ad);
else L(ad, R(this)[ad.getName()]);
}
}
}
if (ab) {
var af = Z;
for (ac = 0; true; ac++) {
var ag = aa.elements[ac];
if (ag.equals(ab)) break;
else if (ag.match) continue;
else ag = ag.clone();
ag.append(af);
af = ag;
}
af[ab.match == 'start' ? 'insertBefore' : 'insertAfter'](ab)
;
}
} else {
var ah = Y.endNode,
ai = this;
function aj() {
var am = new h.elementPath(Z.getParent()),
an = new h.elementPath(ah.getParent()),
ao = null,
ap = null;
for (var aq = 0; aq < am.elements.length; aq++) {
var ar = am.elements[aq];
if (ar == am.block || ar == am.blockLimit) break;
if (ai.checkElementRemovable(ar)) ao = ar;
}
for (aq = 0; aq < an.elements.length; aq++) {
ar = an.elements[aq];
if (ar == an.block || ar == an.blockLimit) break;
if (ai.checkElementRemovable(ar)) ap = ar;
}
if (ap) ah.breakParent(ap);
if (ao) Z.breakParent(ao);
};
aj();
var ak = Z;
while (!ak.equals(ah)) {
var al = ak.getNextSourceNode();
if (ak.type == 1 && this.checkElementRemovable(ak)) {
if (ak.getName() == this.element) J(this, ak);
else L(ak, R(this)[ak.getName()]); if (al.type == 1 && a
l.contains(Z)) {
aj();
al = Z.getNext();
}
}
ak = al;
}
}
X.moveToBookmark(Y);
};
function z(X) {
var Y = X.getCommonAncestor(true, true),
Z = Y.getAscendant(this.element, true);
Z && !Z.isReadOnly() && O(Z, this);
};
function A(X) {
var Y = X.getCommonAncestor(true, true),
Z = Y.getAscendant(this.element, true);
if (!Z) return;
var aa = this,
ab = aa._.definition,
ac = ab.attributes;
if (ac)
for (var ad in ac) Z.removeAttribute(ad, ac[ad]);
if (ab.styles)
for (var ae in ab.styles) {
if (!ab.styles.hasOwnProperty(ae)) continue;
Z.removeStyle(ae);
}
};
function B(X) {
var Y = X.createBookmark(true),
Z = X.createIterator();
Z.enforceRealBlocks = true;
if (this._.enterMode) Z.enlargeBr = this._.enterMode != 2;
var aa, ab = X.document,
ac;
while (aa = Z.getNextParagraph()) {
if (!aa.isReadOnly()) {
var ad = N(this, ab, aa);
D(aa, ad);
}
}
X.moveToBookmark(Y);
};
function C(X) {
var ac = this;
var Y = X.createBookmark(1),
Z = X.createIterator();
Z.enforceRealBlocks = true;
Z.enlargeBr = ac._.enterMode != 2;
var aa;
while (aa = Z.getNextParagraph()) {
if (ac.checkElementRemovable(aa))
if (aa.is('pre')) {
var ab = ac._.enterMode == 2 ? null : X.document.createE
lement(ac._.enterMode == 1 ? 'p' : 'div');
ab && aa.copyAttributes(ab);
D(aa, ab);
} else J(ac, aa, 1);
}
X.moveToBookmark(Y);
};
function D(X, Y) {
var Z = !Y;
if (Z) {
Y = X.getDocument().createElement('div');
X.copyAttributes(Y);
}
var aa = Y && Y.is('pre'),
ab = X.is('pre'),
ac = aa && !ab,
ad = !aa && ab;
if (ac) Y = I(X, Y);
else if (ad) Y = H(Z ? [X.getHtml()] : F(X), Y);
else X.moveChildren(Y);
Y.replace(X);
if (aa) E(Y);
else if (Z) M(Y);
};
function E(X) {
var Y;
if (!((Y = X.getPrevious(v)) && Y.is && Y.is('pre'))) return;
var Z = G(Y.getHtml(), /\n$/, '') + '\n\n' + G(X.getHtml(), /^\n/, '
');
if (g) X.$.outerHTML = '<pre>' + Z + '</pre>';
else X.setHtml(Z);
Y.remove();
};
function F(X) {
var Y = /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(
?!$)/gi,
Z = X.getName(),
aa = G(X.getOuterHtml(), Y, function (ac, ad, ae) {
return ad + '</pre>' + ae + '<pre>';
}),
ab = [];
aa.replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi, function (ac, ad) {
ab.push(ad);
});
return ab;
};
function G(X, Y, Z) {
var aa = '',
ab = '';
X = X.replace(/(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+d
ata-cke-bookmark.*?\/span>$)/gi, function (ac, ad, ae) {
ad && (aa = ad);
ae && (ab = ae);
return '';
});
return aa + X.replace(Y, Z) + ab;
};
function H(X, Y) {
var Z;
if (X.length > 1) Z = new h.documentFragment(Y.getDocument());
for (var aa = 0; aa < X.length; aa++) {
var ab = X[aa];
ab = ab.replace(/(\r\n|\r)/g, '\n');
ab = G(ab, /^[ \t]*\n/, '');
ab = G(ab, /\n$/, '');
ab = G(ab, /^[ \t]+|[ \t]+$/g, function (ad, ae, af) {
if (ad.length == 1) return '&nbsp;';
else if (!ae) return i.repeat('&nbsp;', ad.length - 1) + ' '
;
else return ' ' + i.repeat('&nbsp;', ad.length - 1);
});
ab = ab.replace(/\n/g, '<br>');
ab = ab.replace(/[ \t]{2,}/g, function (ad) {
return i.repeat('&nbsp;', ad.length - 1) + ' ';
});
if (Z) {
var ac = Y.clone();
ac.setHtml(ab);
Z.append(ac);
} else Y.setHtml(ab);
}
return Z || Y;
};
function I(X, Y) {
var Z = X.getBogus();
Z && Z.remove();
var aa = X.getHtml();
aa = G(aa, /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '');
aa = aa.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi, '$1');
aa = aa.replace(/([ \t\n\r]+|&nbsp;)/g, ' ');
aa = aa.replace(/<br\b[^>]*>/gi, '\n');
if (g) {
var ab = X.getDocument().createElement('div');
ab.append(Y);
Y.$.outerHTML = '<pre>' + aa + '</pre>';
Y.copyAttributes(ab.getFirst());
Y = ab.getFirst().remove();
} else Y.setHtml(aa);
return Y;
};
function J(X, Y) {
var Z = X._.definition,
aa = i.extend({}, Z.attributes, R(X)[Y.getName()]),
ab = Z.styles,
ac = i.isEmpty(aa) && i.isEmpty(ab);
for (var ad in aa) {
if ((ad == 'class' || X._.definition.fullMatch) && Y.getAttribut
e(ad) != S(ad, aa[ad])) continue;
ac = Y.hasAttribute(ad);
Y.removeAttribute(ad);
}
for (var ae in ab) {
if (X._.definition.fullMatch && Y.getStyle(ae) != S(ae, ab[ae],
true)) continue;
ac = ac || !!Y.getStyle(ae);
Y.removeStyle(ae);
}
if (ac)!j.$block[Y.getName()] || X._.enterMode == 2 && !Y.hasAttribu
tes() ? M(Y) : Y.renameNode(X._.enterMode == 1 ? 'p' : 'div');
};
function K(X, Y) {
var Z = X._.definition,
aa = Z.attributes,
ab = Z.styles,
ac = R(X),
ad = Y.getElementsByTag(X.element);
for (var ae = ad.count(); --ae >= 0;) J(X, ad.getItem(ae));
for (var af in ac) {
if (af != X.element) {
ad = Y.getElementsByTag(af);
for (ae = ad.count() - 1; ae >= 0; ae--) {
var ag = ad.getItem(ae);
L(ag, ac[af]);
}
}
}
};
function L(X, Y) {
var Z = Y && Y.attributes;
if (Z)
for (var aa = 0; aa < Z.length; aa++) {
var ab = Z[aa][0],
ac;
if (ac = X.getAttribute(ab)) {
var ad = Z[aa][1];
if (ad === null || ad.test && ad.test(ac) || typeof ad =
= 'string' && ac == ad) X.removeAttribute(ab);
}
}
M(X);
};
function M(X) {
if (!X.hasAttributes())
if (j.$block[X.getName()]) {
var Y = X.getPrevious(v),
Z = X.getNext(v);
if (Y && (Y.type == 3 || !Y.isBlockBoundary({
br: 1
}))) X.append('br', 1);
if (Z && (Z.type == 3 || !Z.isBlockBoundary({
br: 1
}))) X.append('br');
X.remove(true);
} else {
var aa = X.getFirst(),
ab = X.getLast();
X.remove(true);
if (aa) {
aa.type == 1 && aa.mergeSiblings();
if (ab && !aa.equals(ab) && ab.type == 1) ab.mergeSiblin
gs();
}
}
};
function N(X, Y, Z) {
var aa, ab = X._.definition,
ac = X.element;
if (ac == '*') ac = 'span';
aa = new l(ac, Y);
if (Z) Z.copyAttributes(aa);
aa = O(aa, X);
if (Y.getCustomData('doc_processing_style') && aa.hasAttribute('id')
) aa.removeAttribute('id');
else Y.setCustomData('doc_processing_style', 1);
return aa;
};
function O(X, Y) {
var Z = Y._.definition,
aa = Z.attributes,
ab = e.style.getStyleText(Z);
if (aa)
for (var ac in aa) X.setAttribute(ac, aa[ac]);
if (ab) X.setAttribute('style', ab);
return X;
};
function P(X, Y) {
for (var Z in X) X[Z] = X[Z].replace(t, function (aa, ab) {
return Y[ab];
});
};
function Q(X) {
var Y = X._AC;
if (Y) return Y;
Y = {};
var Z = 0,
aa = X.attributes;
if (aa)
for (var ab in aa) {
Z++;
Y[ab] = aa[ab];
}
var ac = e.style.getStyleText(X);
if (ac) {
if (!Y.style) Z++;
Y.style = ac;
}
Y._length = Z;
return X._AC = Y;
};
function R(X) {
if (X._.overrides) return X._.overrides;
var Y = X._.overrides = {},
Z = X._.definition.overrides;
if (Z) {
if (!i.isArray(Z)) Z = [Z];
for (var aa = 0; aa < Z.length; aa++) {
var ab = Z[aa],
ac, ad, ae;
if (typeof ab == 'string') ac = ab.toLowerCase();
else {
ac = ab.element ? ab.element.toLowerCase() : X.element;
ae = ab.attributes;
}
ad = Y[ac] || (Y[ac] = {});
if (ae) {
var af = ad.attributes = ad.attributes || [];
for (var ag in ae) af.push([ag.toLowerCase(), ae[ag]]);
}
}
}
return Y;
};
function S(X, Y, Z) {
var aa = new l('span');
aa[Z ? 'setStyle' : 'setAttribute'](X, Y);
return aa[Z ? 'getStyle' : 'getAttribute'](X);
};
function T(X, Y) {
var Z;
if (Y !== false) {
var aa = new l('span');
aa.setAttribute('style', X);
Z = aa.getAttribute('style') || '';
} else Z = X;
Z = Z.replace(/(font-family:)(.*?)(?=;|$)/, function (ab, ac, ad) {
var ae = ad.split(',');
for (var af = 0; af < ae.length; af++) ae[af] = i.trim(ae[af].re
place(/["']/g, ''));
return ac + ae.join(',');
});
return Z.replace(/\s*([;:])\s*/, '$1').replace(/([^\s;])$/, '$1;').r
eplace(/,\s+/g, ',').replace(/\"/g, '').toLowerCase();
};
function U(X) {
var Y = {};
X.replace(/&quot;/g, '"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;
|$)/g, function (Z, aa, ab) {
Y[aa] = ab;
});
return Y;
};
function V(X, Y) {
typeof X == 'string' && (X = U(X));
typeof Y == 'string' && (Y = U(Y));
for (var Z in X) {
if (!(Z in Y && (Y[Z] == X[Z] || X[Z] == 'inherit' || Y[Z] == 'i
nherit'))) return false;
}
return true;
};
function W(X, Y) {
var Z = X.getSelection(),
aa = Z.createBookmarks(1),
ab = Z.getRanges(),
ac = Y ? this.removeFromRange : this.applyToRange,
ad, ae = ab.createIterator();
while (ad = ae.getNextRange()) ac.call(this, ad);
if (aa.length == 1 && aa[0].collapsed) {
Z.selectRanges(ab);
X.getById(aa[0].startNode).remove();
} else Z.selectBookmarks(aa);
X.removeCustomData('doc_processing_style');
};
})();
e.styleCommand = function (q) {
this.style = q;
};
e.styleCommand.prototype.exec = function (q) {
var s = this;
q.focus();
var r = q.document;
if (r)
if (s.state == 2) s.style.apply(r);
else if (s.state == 1) s.style.remove(r);
return !!r;
};
e.stylesSet = new e.resourceManager('', 'stylesSet');
e.addStylesSet = i.bind(e.stylesSet.add, e.stylesSet);
e.loadStylesSet = function (q, r, s) {
e.stylesSet.addExternal(q, r, '');
e.stylesSet.load(q, s);
};
e.editor.prototype.getStylesSet = function (q) {
if (!this._.stylesDefinitions) {
var r = this,
s = r.config.stylesCombo_stylesSet || r.config.stylesSet || 'def
ault';
if (s instanceof Array) {
r._.stylesDefinitions = s;
q(s);
return;
}
var t = s.split(':'),
u = t[0],
v = t[1],
w = n.registered.styles.path;
e.stylesSet.addExternal(u, v ? t.slice(1).join(':') : w + 'styles/'
+ u + '.js', '');
e.stylesSet.load(u, function (x) {
r._.stylesDefinitions = x[u];
q(r._.stylesDefinitions);
});
} else q(this._.stylesDefinitions);
};
n.add('domiterator');
(function () {
function q(w) {
var x = this;
if (arguments.length < 1) return;
x.range = w;
x.forceBrBreak = 0;
x.enlargeBr = 1;
x.enforceRealBlocks = 0;
x._ || (x._ = {});
};
var r = /^[\r\n\t ]+$/,
s = h.walker.bookmark(false, true),
t = h.walker.whitespaces(true),
u = function (w) {
return s(w) && t(w);
};
function v(w, x, y) {
var z = w.getNextSourceNode(x, null, y);
while (!s(z)) z = z.getNextSourceNode(x, null, y);
return z;
};
q.prototype = {
getNextParagraph: function (w) {
var W = this;
var x, y, z, A, B, C;
if (!W._.lastNode) {
y = W.range.clone();
y.shrink(1, true);
A = y.endContainer.hasAscendant('pre', true) || y.startConta
iner.hasAscendant('pre', true);
y.enlarge(W.forceBrBreak && !A || !W.enlargeBr ? 3 : 2);
var D = new h.walker(y),
E = h.walker.bookmark(true, true);
D.evaluator = E;
W._.nextNode = D.next();
D = new h.walker(y);
D.evaluator = E;
var F = D.previous();
W._.lastNode = F.getNextSourceNode(true);
if (W._.lastNode && W._.lastNode.type == 3 && !i.trim(W._.la
stNode.getText()) && W._.lastNode.getParent().isBlockBoundary()) {
var G = new h.range(y.document);
G.moveToPosition(W._.lastNode, 4);
if (G.checkEndOfBlock()) {
var H = new h.elementPath(G.endContainer),
I = H.block || H.blockLimit;
W._.lastNode = I.getNextSourceNode(true);
}
}
if (!W._.lastNode) {
W._.lastNode = W._.docEndMarker = y.document.createText(
'');
W._.lastNode.insertAfter(F);
}
y = null;
}
var J = W._.nextNode;
F = W._.lastNode;
W._.nextNode = null;
while (J) {
var K = 0,
L = J.hasAscendant('pre'),
M = J.type != 1,
N = 0;
if (!M) {
var O = J.getName();
if (J.isBlockBoundary(W.forceBrBreak && !L && {
br: 1
})) {
if (O == 'br') M = 1;
else if (!y && !J.getChildCount() && O != 'hr') {
x = J;
z = J.equals(F);
break;
}
if (y) {
y.setEndAt(J, 3);
if (O != 'br') W._.nextNode = J;
}
K = 1;
} else {
if (J.getFirst()) {
if (!y) {
y = new h.range(W.range.document);
y.setStartAt(J, 3);
}
J = J.getFirst();
continue;
}
M = 1;
}
} else if (J.type == 3)
if (r.test(J.getText())) M = 0;
if (M && !y) {
y = new h.range(W.range.document);
y.setStartAt(J, 3);
}
z = (!K || M) && J.equals(F);
if (y && !K)
while (!J.getNext(u) && !z) {
var P = J.getParent();
if (P.isBlockBoundary(W.forceBrBreak && !L && {
br: 1
})) {
K = 1;
M = 0;
z = z || P.equals(F);
y.setEndAt(P, 2);
break;
}
J = P;
M = 1;
z = J.equals(F);
N = 1;
}
if (M) y.setEndAt(J, 4);
J = v(J, N, F);
z = !J;
if (z || K && y) break;
}
if (!x) {
if (!y) {
W._.docEndMarker && W._.docEndMarker.remove();
W._.nextNode = null;
return null;
}
var Q = new h.elementPath(y.startContainer),
R = Q.blockLimit,
S = {
div: 1,
th: 1,
td: 1
};
x = Q.block;
if (!x && !W.enforceRealBlocks && S[R.getName()] && y.checkS
tartOfBlock() && y.checkEndOfBlock()) x = R;
else if (!x || W.enforceRealBlocks && x.getName() == 'li') {
x = W.range.document.createElement(w || 'p');
y.extractContents().appendTo(x);
x.trim();
y.insertNode(x);
B = C = true;
} else if (x.getName() != 'li') {
if (!y.checkStartOfBlock() || !y.checkEndOfBlock()) {
x = x.clone(false);
y.extractContents().appendTo(x);
x.trim();
var T = y.splitBlock();
B = !T.wasStartOfBlock;
C = !T.wasEndOfBlock;
y.insertNode(x);
}
} else if (!z) W._.nextNode = x.equals(F) ? null : v(y.getBo
undaryNodes().endNode, 1, F);
}
if (B) {
var U = x.getPrevious();
if (U && U.type == 1)
if (U.getName() == 'br') U.remove();
else if (U.getLast() && U.getLast().$.nodeName.toLowerCa
se() == 'br') U.getLast().remove();
}
if (C) {
var V = x.getLast();
if (V && V.type == 1 && V.getName() == 'br')
if (g || V.getPrevious(s) || V.getNext(s)) V.remove();
}
if (!W._.nextNode) W._.nextNode = z || x.equals(F) ? null : v(x,
1, F);
return x;
}
};
h.range.prototype.createIterator = function () {
return new q(this);
};
})();
n.add('panelbutton', {
requires: ['button'],
onLoad: function () {
function q(r) {
var t = this;
var s = t._;
if (s.state == 0) return;
t.createPanel(r);
if (s.on) {
s.panel.hide();
return;
}
s.panel.showBlock(t._.id, t.document.getById(t._.id), 4);
};
o.panelButton = i.createClass({
base: o.button,
$: function (r) {
var t = this;
var s = r.panel;
delete r.panel;
t.base(r);
t.document = s && s.parent && s.parent.getDocument() || e.do
cument;
s.block = {
attributes: s.attributes
};
t.hasArrow = true;
t.click = q;
t._ = {
panelDefinition: s
};
},
statics: {
handler: {
create: function (r) {
return new o.panelButton(r);
}
}
},
proto: {
createPanel: function (r) {
var s = this._;
if (s.panel) return;
var t = this._.panelDefinition || {},
u = this._.panelDefinition.block,
v = t.parent || e.document.getBody(),
w = this._.panel = new o.floatPanel(r, v, t),
x = w.addBlock(s.id, u),
y = this;
w.onShow = function () {
if (y.className) this.element.getFirst().addClass(y.
className + '_panel');
y.setState(1);
s.on = 1;
if (y.onOpen) y.onOpen();
};
w.onHide = function (z) {
if (y.className) this.element.getFirst().removeClass
(y.className + '_panel');
y.setState(y.modes && y.modes[r.mode] ? 2 : 0);
s.on = 0;
if (!z && y.onClose) y.onClose();
};
w.onEscape = function () {
w.hide();
y.document.getById(s.id).focus();
};
if (this.onBlock) this.onBlock(w, x);
x.onHide = function () {
s.on = 0;
y.setState(2);
};
}
}
});
},
beforeInit: function (q) {
q.ui.addHandler('panelbutton', o.panelButton.handler);
}
});
e.UI_PANELBUTTON = 'panelbutton';
n.add('floatpanel', {
requires: ['panel']
});
(function () {
var q = {},
r = false;
function s(t, u, v, w, x) {
var y = i.genKey(u.getUniqueId(), v.getUniqueId(), t.skinName, t.lan
g.dir, t.uiColor || '', w.css || '', x || ''),
z = q[y];
if (!z) {
z = q[y] = new o.panel(u, w);
z.element = v.append(l.createFromHtml(z.renderHtml(t), u));
z.element.setStyles({
display: 'none',
position: 'absolute'
});
}
return z;
};
o.floatPanel = i.createClass({
$: function (t, u, v, w) {
v.forceIFrame = 1;
var x = u.getDocument(),
y = s(t, x, u, v, w || 0),
z = y.element,
A = z.getFirst().getFirst();
this.element = z;
this._ = {
editor: t,
panel: y,
parentElement: u,
definition: v,
document: x,
iframe: A,
children: [],
dir: t.lang.dir
};
t.on('mode', function () {
this.hide();
}, this);
},
proto: {
addBlock: function (t, u) {
return this._.panel.addBlock(t, u);
},
addListBlock: function (t, u) {
return this._.panel.addListBlock(t, u);
},
getBlock: function (t) {
return this._.panel.getBlock(t);
},
showBlock: function (t, u, v, w, x) {
var y = this._.panel,
z = y.showBlock(t);
this.allowBlur(false);
r = 1;
this._.returnFocus = this._.editor.focusManager.hasFocus ? t
his._.editor : new l(e.document.$.activeElement);
var A = this.element,
B = this._.iframe,
C = this._.definition,
D = u.getDocumentPosition(A.getDocument()),
E = this._.dir == 'rtl',
F = D.x + (w || 0),
G = D.y + (x || 0);
if (E && (v == 1 || v == 4)) F += u.$.offsetWidth;
else if (!E && (v == 2 || v == 3)) F += u.$.offsetWidth - 1;
if (v == 3 || v == 4) G += u.$.offsetHeight - 1;
this._.panel._.offsetParentId = u.getId();
A.setStyles({
top: G + 'px',
left: 0,
display: ''
});
A.setOpacity(0);
A.getFirst().removeStyle('width');
if (!this._.blurSet) {
var H = g ? B : new h.window(B.$.contentWindow);
e.event.useCapture = true;
H.on('blur', function (I) {
var K = this;
if (!K.allowBlur()) return;
var J = I.data.getTarget();
if (J.getName && J.getName() != 'iframe') return;
if (K.visible && !K._.activeChild && !r) {
delete K._.returnFocus;
K.hide();
}
}, this);
H.on('focus', function () {
this._.focused = true;
this.hideChild();
this.allowBlur(true);
}, this);
e.event.useCapture = false;
this._.blurSet = 1;
}
y.onEscape = i.bind(function (I) {
if (this.onEscape && this.onEscape(I) === false) return
false;
}, this);
i.setTimeout(function () {
if (E) F -= A.$.offsetWidth;
var I = i.bind(function () {
var J = A.getFirst();
if (z.autoSize) {
var K = z.element.$;
if (f.gecko || f.opera) K = K.parentNode;
if (g) K = K.document.body;
var L = K.scrollWidth;
if (g && f.quirks && L > 0) L += (J.$.offsetWidt
h || 0) - (J.$.clientWidth || 0) + 3;
L += 4;
J.setStyle('width', L + 'px');
z.element.addClass('cke_frameLoaded');
var M = z.element.$.scrollHeight;
if (g && f.quirks && M > 0) M += (J.$.offsetHeig
ht || 0) - (J.$.clientHeight || 0) + 3;
J.setStyle('height', M + 'px');
y._.currentBlock.element.setStyle('display', 'no
ne').removeStyle('display');
} else J.removeStyle('height');
var N = y.element,
O = N.getWindow(),
P = O.getScrollPosition(),
Q = O.getViewPaneSize(),
R = {
height: N.$.offsetHeight,
width: N.$.offsetWidth
};
if (E ? F < 0 : F + R.width > Q.width + P.x) F += R.
width * (E ? 1 : -1);
if (G + R.height > Q.height + P.y) G -= R.height;
if (g) {
var S = new l(A.$.offsetParent),
T = S;
if (T.getName() == 'html') T = T.getDocument().g
etBody();
if (T.getComputedStyle('direction') == 'rtl')
if (f.ie8Compat) F -= A.getDocument().getDoc
umentElement().$.scrollLeft * 2;
else F -= S.$.scrollWidth - S.$.clientWidth;
}
var U = A.getFirst(),
V;
if (V = U.getCustomData('activePanel')) V.onHide &&
V.onHide.call(this, 1);
U.setCustomData('activePanel', this);
A.setStyles({
top: G + 'px',
left: F + 'px'
});
A.setOpacity(1);
}, this);
y.isLoaded ? I() : y.onLoad = I;
i.setTimeout(function () {
B.$.contentWindow.focus();
this.allowBlur(true);
}, 0, this);
}, f.air ? 200 : 0, this);
this.visible = 1;
if (this.onShow) this.onShow.call(this);
r = 0;
},
hide: function (t) {
var v = this;
if (v.visible && (!v.onHide || v.onHide.call(v) !== true)) {
v.hideChild();
f.gecko && v._.iframe.getFrameDocument().$.activeElement
.blur();
v.element.setStyle('display', 'none');
v.visible = 0;
v.element.getFirst().removeCustomData('activePanel');
var u = t !== false && v._.returnFocus;
if (u) {
if (f.webkit && u.type) u.getWindow().$.focus();
u.focus();
}
}
},
allowBlur: function (t) {
var u = this._.panel;
if (t != undefined) u.allowBlur = t;
return u.allowBlur;
},
showAsChild: function (t, u, v, w, x, y) {
if (this._.activeChild == t && t._.panel._.offsetParentId ==
v.getId()) return;
this.hideChild();
t.onHide = i.bind(function () {
i.setTimeout(function () {
if (!this._.focused) this.hide();
}, 0, this);
}, this);
this._.activeChild = t;
this._.focused = false;
t.showBlock(u, v, w, x, y);
if (f.ie7Compat || f.ie8 && f.ie6Compat) setTimeout(function
() {
t.element.getChild(0).$.style.cssText += '';
}, 100);
},
hideChild: function () {
var t = this._.activeChild;
if (t) {
delete t.onHide;
delete t._.returnFocus;
delete this._.activeChild;
t.hide();
}
}
}
});
e.on('instanceDestroyed', function () {
var t = i.isEmpty(e.instances);
for (var u in q) {
var v = q[u];
if (t) v.destroy();
else v.element.hide();
}
t && (q = {});
});
})();
n.add('menu', {
beforeInit: function (q) {
var r = q.config.menu_groups.split(','),
s = q._.menuGroups = {},
t = q._.menuItems = {};
for (var u = 0; u < r.length; u++) s[r[u]] = u + 1;
q.addMenuGroup = function (v, w) {
s[v] = w || 100;
};
q.addMenuItem = function (v, w) {
if (s[w.group]) t[v] = new e.menuItem(this, v, w);
};
q.addMenuItems = function (v) {
for (var w in v) this.addMenuItem(w, v[w]);
};
q.getMenuItem = function (v) {
return t[v];
};
q.removeMenuItem = function (v) {
delete t[v];
};
},
requires: ['floatpanel']
});
(function () {
e.menu = i.createClass({
$: function (r, s) {
var v = this;
s = v._.definition = s || {};
v.id = i.getNextId();
v.editor = r;
v.items = [];
v._.listeners = [];
v._.level = s.level || 1;
var t = i.extend({}, s.panel, {
css: r.skin.editor.css,
level: v._.level - 1,
block: {}
}),
u = t.block.attributes = t.attributes || {};
!u.role && (u.role = 'menu');
v._.panelDefinition = t;
},
_: {
onShow: function () {
var z = this;
var r = z.editor.getSelection();
if (g) r && r.lock();
var s = r && r.getStartElement(),
t = z._.listeners,
u = [];
z.removeAll();
for (var v = 0; v < t.length; v++) {
var w = t[v](s, r);
if (w)
for (var x in w) {
var y = z.editor.getMenuItem(x);
if (y && (!y.command || z.editor.getCommand(y.co
mmand).state)) {
y.state = w[x];
z.add(y);
}
}
}
},
onClick: function (r) {
this.hide(false);
if (r.onClick) r.onClick();
else if (r.command) this.editor.execCommand(r.command);
},
onEscape: function (r) {
var s = this.parent;
if (s) {
s._.panel.hideChild();
var t = s._.panel._.panel._.currentBlock,
u = t._.focusIndex;
t._.markItem(u);
} else if (r == 27) this.hide();
return false;
},
onHide: function () {
if (g) {
var r = this.editor.getSelection();
r && r.unlock();
}
this.onHide && this.onHide();
},
showSubMenu: function (r) {
var z = this;
var s = z._.subMenu,
t = z.items[r],
u = t.getItems && t.getItems();
if (!u) {
z._.panel.hideChild();
return;
}
var v = z._.panel.getBlock(z.id);
v._.focusIndex = r;
if (s) s.removeAll();
else {
s = z._.subMenu = new e.menu(z.editor, i.extend({}, z._.
definition, {
level: z._.level + 1
}, true));
s.parent = z;
s._.onClick = i.bind(z._.onClick, z);
}
for (var w in u) {
var x = z.editor.getMenuItem(w);
if (x) {
x.state = u[w];
s.add(x);
}
}
var y = z._.panel.getBlock(z.id).element.getDocument().getBy
Id(z.id + String(r));
s.show(y, 2);
}
},
proto: {
add: function (r) {
if (!r.order) r.order = this.items.length;
this.items.push(r);
},
removeAll: function () {
this.items = [];
},
show: function (r, s, t, u) {
if (!this.parent) {
this._.onShow();
if (!this.items.length) return;
}
s = s || (this.editor.lang.dir == 'rtl' ? 2 : 1);
var v = this.items,
w = this.editor,
x = this._.panel,
y = this._.element;
if (!x) {
x = this._.panel = new o.floatPanel(this.editor, e.docum
ent.getBody(), this._.panelDefinition, this._.level);
x.onEscape = i.bind(function (J) {
if (this._.onEscape(J) === false) return false;
}, this);
x.onHide = i.bind(function () {
this._.onHide && this._.onHide();
}, this);
var z = x.addBlock(this.id, this._.panelDefinition.block
);
z.autoSize = true;
var A = z.keys;
A[40] = 'next';
A[9] = 'next';
A[38] = 'prev';
A[2228224 + 9] = 'prev';
A[w.lang.dir == 'rtl' ? 37 : 39] = g ? 'mouseup' : 'clic
k';
A[32] = g ? 'mouseup' : 'click';
g && (A[13] = 'mouseup');
y = this._.element = z.element;
y.addClass(w.skinClass);
var B = y.getDocument();
B.getBody().setStyle('overflow', 'hidden');
B.getElementsByTag('html').getItem(0).setStyle('overflow
', 'hidden');
this._.itemOverFn = i.addFunction(function (J) {
var K = this;
clearTimeout(K._.showSubTimeout);
K._.showSubTimeout = i.setTimeout(K._.showSubMenu, w
.config.menu_subMenuDelay || 400, K, [J]);
}, this);
this._.itemOutFn = i.addFunction(function (J) {
clearTimeout(this._.showSubTimeout);
}, this);
this._.itemClickFn = i.addFunction(function (J) {
var L = this;
var K = L.items[J];
if (K.state == 0) {
L.hide();
return;
}
if (K.getItems) L._.showSubMenu(J);
else L._.onClick(K);
}, this);
}
q(v);
var C = w.container.getChild(1),
D = C.hasClass('cke_mixed_dir_content') ? ' cke_mixed_di
r_content' : '',
E = ['<div class="cke_menu' + D + '" role="presentation"
>'],
F = v.length,
G = F && v[0].group;
for (var H = 0; H < F; H++) {
var I = v[H];
if (G != I.group) {
E.push('<div class="cke_menuseparator" role="separat
or"></div>');
G = I.group;
}
I.render(this, H, E);
}
E.push('</div>');
y.setHtml(E.join(''));
o.fire('ready', this);
if (this.parent) this.parent._.panel.showAsChild(x, this.id,
r, s, t, u);
else x.showBlock(this.id, r, s, t, u);
w.fire('menuShow', [x]);
},
addListener: function (r) {
this._.listeners.push(r);
},
hide: function (r) {
var s = this;
s._.onHide && s._.onHide();
s._.panel && s._.panel.hide(r);
}
}
});
function q(r) {
r.sort(function (s, t) {
if (s.group < t.group) return -1;
else if (s.group > t.group) return 1;
return s.order < t.order ? -1 : s.order > t.order ? 1 : 0;
});
};
e.menuItem = i.createClass({
$: function (r, s, t) {
var u = this;
i.extend(u, t, {
order: 0,
className: 'cke_button_' + s
});
u.group = r._.menuGroups[u.group];
u.editor = r;
u.name = s;
},
proto: {
render: function (r, s, t) {
var A = this;
var u = r.id + String(s),
v = typeof A.state == 'undefined' ? 2 : A.state,
w = ' cke_' + (v == 1 ? 'on' : v == 0 ? 'disabled' : 'of
f'),
x = A.label;
if (A.className) w += ' ' + A.className;
var y = A.getItems;
t.push('<span class="cke_menuitem' + (A.icon && A.icon.index
Of('.png') == -1 ? ' cke_noalphafix' : '') + '">' + '<a id="', u, '" class="', w
, '" href="javascript:void(\'', (A.label || '').replace("'", ''), '\')" title="'
, A.label, '" tabindex="-1"_cke_focus=1 hidefocus="true" role="menuitem"' + (y ?
'aria-haspopup="true"' : '') + (v == 0 ? 'aria-disabled="true"' : '') + (v == 1
? 'aria-pressed="true"' : ''));
if (f.opera || f.gecko && f.mac) t.push(' onkeypress="return
false;"');
if (f.gecko) t.push(' onblur="this.style.cssText = this.styl
e.cssText;"');
var z = (A.iconOffset || 0) * -16;
t.push(' onmouseover="CKEDITOR.tools.callFunction(', r._.ite
mOverFn, ',', s, ');" onmouseout="CKEDITOR.tools.callFunction(', r._.itemOutFn,
',', s, ');" ' + (g ? 'onclick="return false;" onmouseup' : 'onclick') + '="CKED
ITOR.tools.callFunction(', r._.itemClickFn, ',', s, '); return false;"><span cla
ss="cke_icon_wrapper"><span class="cke_icon"' + (A.icon ? ' style="background-im
age:url(' + e.getUrl(A.icon) + ');background-position:0 ' + z + 'px;"' : '') + '
></span></span>' + '<span class="cke_label">');
if (y) t.push('<span class="cke_menuarrow">', '<span>&#', A.
editor.lang.dir == 'rtl' ? '9668' : '9658', ';</span>', '</span>');
t.push(x, '</span></a></span>');
}
}
});
})();
m.menu_groups = 'clipboard,form,tablecell,tablecellproperties,tablerow,table
column,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imageb
utton,button,select,textarea,div';
(function () {
var q;
n.add('editingblock', {
init: function (r) {
if (!r.config.editingBlock) return;
r.on('themeSpace', function (s) {
if (s.data.space == 'contents') s.data.html += '<br>';
});
r.on('themeLoaded', function () {
r.fireOnce('editingBlockReady');
});
r.on('uiReady', function () {
r.setMode(r.config.startupMode);
});
r.on('afterSetData', function () {
if (!q) {
function s() {
q = true;
r.getMode().loadData(r.getData());
q = false;
};
if (r.mode) s();
else r.on('mode', function () {
if (r.mode) {
s();
r.removeListener('mode', arguments.callee);
}
});
}
});
r.on('beforeGetData', function () {
if (!q && r.mode) {
q = true;
r.setData(r.getMode().getData(), null, 1);
q = false;
}
});
r.on('getSnapshot', function (s) {
if (r.mode) s.data = r.getMode().getSnapshotData();
});
r.on('loadSnapshot', function (s) {
if (r.mode) r.getMode().loadSnapshotData(s.data);
});
r.on('mode', function (s) {
s.removeListener();
f.webkit && r.container.on('focus', function () {
r.focus();
});
if (r.config.startupFocus) r.focus();
setTimeout(function () {
r.fireOnce('instanceReady');
e.fire('instanceReady', null, r);
}, 0);
});
r.on('destroy', function () {
var s = this;
if (s.mode) s._.modes[s.mode].unload(s.getThemeSpace('conten
ts'));
});
}
});
e.editor.prototype.mode = '';
e.editor.prototype.addMode = function (r, s) {
s.name = r;
(this._.modes || (this._.modes = {}))[r] = s;
};
e.editor.prototype.setMode = function (r) {
this.fire('beforeSetMode', {
newMode: r
});
var s, t = this.getThemeSpace('contents'),
u = this.checkDirty();
if (this.mode) {
if (r == this.mode) return;
this._.previousMode = this.mode;
this.fire('beforeModeUnload');
var v = this.getMode();
s = v.getData();
v.unload(t);
this.mode = '';
}
t.setHtml('');
var w = this.getMode(r);
if (!w) throw '[CKEDITOR.editor.setMode] Unknown mode "' + r + '".';
if (!u) this.on('mode', function () {
this.resetDirty();
this.removeListener('mode', arguments.callee);
});
w.load(t, typeof s != 'string' ? this.getData() : s);
};
e.editor.prototype.getMode = function (r) {
return this._.modes && this._.modes[r || this.mode];
};
e.editor.prototype.focus = function () {
this.forceNextSelectionCheck();
var r = this.getMode();
if (r) r.focus();
};
})();
m.startupMode = 'wysiwyg';
m.editingBlock = true;
(function () {
function q() {
var F = this;
try {
var C = F.getSelection();
if (!C || !C.document.getWindow().$) return;
var D = C.getStartElement(),
E = new h.elementPath(D);
if (!E.compare(F._.selectionPreviousPath)) {
F._.selectionPreviousPath = E;
F.fire('selectionChange', {
selection: C,
path: E,
element: D
});
}
} catch (G) {}
};
var r, s;
function t() {
s = true;
if (r) return;
u.call(this);
r = i.setTimeout(u, 200, this);
};
function u() {
r = null;
if (s) {
i.setTimeout(q, 0, this);
s = false;
}
};
function v(C) {
function D(H) {
return H && H.type == 1 && H.getName() in j.$removeEmpty;
};
function E(H) {
var I = C.document.getBody();
return !H.is('body') && I.getChildCount() == 1;
};
var F = C.startContainer,
G = C.startOffset;
if (F.type == 3) return false;
return !i.trim(F.getHtml()) ? D(F) || E(F) : D(F.getChild(G - 1)) ||
D(F.getChild(G));
};
var w = {
modes: {
wysiwyg: 1,
source: 1
},
readOnly: g || f.webkit,
exec: function (C) {
switch (C.mode) {
case 'wysiwyg':
C.document.$.execCommand('SelectAll', false, null);
C.forceNextSelectionCheck();
C.selectionChange();
break;
case 'source':
var D = C.textarea.$;
if (g) D.createTextRange().execCommand('SelectAll');
else {
D.selectionStart = 0;
D.selectionEnd = D.value.length;
}
D.focus();
}
},
canUndo: false
};
function x(C) {
A(C);
var D = C.createText('?');
C.setCustomData('cke-fillingChar', D);
return D;
};
function y(C) {
return C && C.getCustomData('cke-fillingChar');
};
function z(C) {
var D = C && y(C);
if (D)
if (D.getCustomData('ready')) A(C);
else D.setCustomData('ready', 1);
};
function A(C) {
var D = C && C.removeCustomData('cke-fillingChar');
if (D) {
D.setText(D.getText().replace(/\u200B/g, ''));
D = 0;
}
};
n.add('selection', {
init: function (C) {
if (f.webkit) {
C.on('selectionChange', function () {
z(C.document);
});
C.on('beforeSetMode', function () {
A(C.document);
});
C.on('key', function (H) {
switch (H.data.keyCode) {
case 13:
case 2228224 + 13:
case 37:
case 39:
case 8:
A(C.document);
}
}, null, null, 10);
var D, E;
function F() {
var H = C.document,
I = y(H);
if (I) {
var J = H.$.defaultView.getSelection();
if (J.type == 'Caret' && J.anchorNode == I.$) E = 1;
D = I.getText();
I.setText(D.replace(/\u200B/g, ''));
}
};
function G() {
var H = C.document,
I = y(H);
if (I) {
I.setText(D);
if (E) {
H.$.defaultView.getSelection().setPosition(I.$,
I.getLength());
E = 0;
}
}
};
C.on('beforeUndoImage', F);
C.on('afterUndoImage', G);
C.on('beforeGetData', F, null, null, 0);
C.on('getData', G);
}
C.on('contentDom', function () {
var H = C.document,
I = H.getBody(),
J = H.getDocumentElement();
if (g) {
var K, L, M = 1;
I.on('focusin', function (Q) {
if (Q.data.$.srcElement.nodeName != 'BODY') return;
if (K) {
if (M) {
try {
K.select();
} catch (S) {}
var R = H.getCustomData('cke_locked_selectio
n');
if (R) {
R.unlock();
R.lock();
}
}
K = null;
}
});
I.on('focus', function () {
L = 1;
P();
});
I.on('beforedeactivate', function (Q) {
if (Q.data.$.toElement) return;
L = 0;
M = 1;
});
if (g && f.version < 8) C.on('blur', function (Q) {
try {
C.document && C.document.$.selection.empty();
} catch (R) {}
});
J.on('mousedown', function () {
M = 0;
});
J.on('mouseup', function () {
M = 1;
});
if (g && (f.ie7Compat || f.version < 8 || f.quirks)) J.o
n('click', function (Q) {
if (Q.data.getTarget().getName() == 'html') C.getSel
ection().getRanges()[0].select();
});
var N;
I.on('mousedown', function (Q) {
if (Q.data.$.button == 2) {
var R = C.document.$.selection;
if (R.type == 'None') N = C.window.getScrollPosi
tion();
}
O();
});
I.on('mouseup', function (Q) {
if (Q.data.$.button == 2 && N) {
C.document.$.documentElement.scrollLeft = N.x;
C.document.$.documentElement.scrollTop = N.y;
}
N = null;
L = 1;
setTimeout(function () {
P(true);
}, 0);
});
I.on('keydown', O);
I.on('keyup', function () {
L = 1;
P();
});
H.on('selectionchange', P);
function O() {
L = 0;
};
function P(Q) {
if (L) {
var R = C.document,
S = C.getSelection(),
T = S && S.getNative();
if (Q && T && T.type == 'None')
if (!R.$.queryCommandEnabled('InsertImage'))
{
i.setTimeout(P, 50, this, true);
return;
}
var U;
if (T && T.type && T.type != 'Control' && (U = T
.createRange()) && (U = U.parentElement()) && (U = U.nodeName) && U.toLowerCase(
) in {
input: 1,
textarea: 1
}) return;
K = T && S.getRanges()[0];
t.call(C);
}
};
} else {
H.on('mouseup', t, C);
H.on('keyup', t, C);
H.on('selectionchange', t, C);
}
});
C.on('contentDomUnload', C.forceNextSelectionCheck, C);
C.addCommand('selectAll', w);
C.ui.addButton('SelectAll', {
label: C.lang.selectAll,
command: 'selectAll'
});
C.selectionChange = t;
f.ie9Compat && C.on('destroy', function () {
var H = C.getSelection();
H && H.getNative().clear();
}, null, null, 9);
}
});
e.editor.prototype.getSelection = function () {
return this.document && this.document.getSelection();
};
e.editor.prototype.forceNextSelectionCheck = function () {
delete this._.selectionPreviousPath;
};
k.prototype.getSelection = function () {
var C = new h.selection(this);
return !C || C.isInvalid ? null : C;
};
e.SELECTION_NONE = 1;
e.SELECTION_TEXT = 2;
e.SELECTION_ELEMENT = 3;
h.selection = function (C) {
var F = this;
var D = C.getCustomData('cke_locked_selection');
if (D) return D;
F.document = C;
F.isLocked = 0;
F._ = {
cache: {}
};
if (g) {
var E = F.getNative().createRange();
if (!E || E.item && E.item(0).ownerDocument != F.document.$ || E
.parentElement && E.parentElement().ownerDocument != F.document.$) F.isInvalid =
true;
}
return F;
};
var B = {
img: 1,
hr: 1,
li: 1,
table: 1,
tr: 1,
td: 1,
th: 1,
embed: 1,
object: 1,
ol: 1,
ul: 1,
a: 1,
input: 1,
form: 1,
select: 1,
textarea: 1,
button: 1,
fieldset: 1,
thead: 1,
tfoot: 1
};
h.selection.prototype = {
getNative: g ? function () {
return this._.cache.nativeSel || (this._.cache.nativeSel = this.
document.$.selection);
} : function () {
return this._.cache.nativeSel || (this._.cache.nativeSel = this.
document.getWindow().$.getSelection());
},
getType: g ? function () {
var C = this._.cache;
if (C.type) return C.type;
var D = 1;
try {
var E = this.getNative(),
F = E.type;
if (F == 'Text') D = 2;
if (F == 'Control') D = 3;
if (E.createRange().parentElement) D = 2;
} catch (G) {}
return C.type = D;
} : function () {
var C = this._.cache;
if (C.type) return C.type;
var D = 2,
E = this.getNative();
if (!E) D = 1;
else if (E.rangeCount == 1) {
var F = E.getRangeAt(0),
G = F.startContainer;
if (G == F.endContainer && G.nodeType == 1 && F.endOffset -
F.startOffset == 1 && B[G.childNodes[F.startOffset].nodeName.toLowerCase()]) D =
3;
}
return C.type = D;
},
getRanges: (function () {
var C = g ? (function () {
function D(F) {
return new h.node(F).getIndex();
};
var E = function (F, G) {
F = F.duplicate();
F.collapse(G);
var H = F.parentElement(),
I = H.ownerDocument;
if (!H.hasChildNodes()) return {
container: H,
offset: 0
};
var J = H.children,
K, L, M = F.duplicate(),
N = 0,
O = J.length - 1,
P = -1,
Q, R;
while (N <= O) {
P = Math.floor((N + O) / 2);
K = J[P];
M.moveToElementText(K);
Q = M.compareEndPoints('StartToStart', F);
if (Q > 0) O = P - 1;
else if (Q < 0) N = P + 1;
else if (f.ie9Compat && K.tagName == 'BR') {
var S = 'cke_range_marker';
F.execCommand('CreateBookmark', false, S);
K = I.getElementsByName(S)[0];
var T = D(K);
H.removeChild(K);
return {
container: H,
offset: T
};
} else return {
container: H,
offset: D(K)
};
}
if (P == -1 || P == J.length - 1 && Q < 0) {
M.moveToElementText(H);
M.setEndPoint('StartToStart', F);
R = M.text.replace(/(\r\n|\r)/g, '\n').length;
J = H.childNodes;
if (!R) {
K = J[J.length - 1];
if (K.nodeType == 1) return {
container: H,
offset: J.length
};
else try {
return {
container: K,
offset: K.nodeValue.length
};
} catch (V) {
return {
container: H,
offset: J.length
};
}
}
var U = J.length;
try {
while (R > 0) R -= J[--U].nodeValue.length;
} catch (W) {
R = 0;
}
if (R === 0) return {
container: H,
offset: U
};
else return {
container: J[U],
offset: -R
};
} else {
M.collapse(Q > 0 ? true : false);
M.setEndPoint(Q > 0 ? 'StartToStart' : 'EndToStart',
F);
R = M.text.replace(/(\r\n|\r)/g, '\n').length;
if (!R) return {
container: H,
offset: D(K) + (Q > 0 ? 0 : 1)
};
while (R > 0) try {
L = K[Q > 0 ? 'previousSibling' : 'nextSibling']
;
R -= L.nodeValue.length;
K = L;
} catch (X) {
return {
container: H,
offset: D(K)
};
}
return {
container: K,
offset: Q > 0 ? -R : K.nodeValue.length + R
};
}
};
return function () {
var P = this;
var F = P.getNative(),
G = F && F.createRange(),
H = P.getType(),
I;
if (!F) return [];
if (H == 2) {
I = new h.range(P.document);
var J = E(G, true);
I.setStart(new h.node(J.container), J.offset);
J = E(G);
I.setEnd(new h.node(J.container), J.offset);
if (I.endContainer.getPosition(I.startContainer) & 4
&& I.endOffset <= I.startContainer.getIndex()) I.collapse();
return [I];
} else if (H == 3) {
var K = [];
for (var L = 0; L < G.length; L++) {
var M = G.item(L),
N = M.parentNode,
O = 0;
I = new h.range(P.document);
for (; O < N.childNodes.length && N.childNodes[O
] != M; O++) {}
I.setStart(new h.node(N), O);
I.setEnd(new h.node(N), O + 1);
K.push(I);
}
return K;
}
return [];
};
})() : function () {
var D = [],
E, F = this.document,
G = this.getNative();
if (!G) return D;
if (!G.rangeCount) {
E = new h.range(F);
E.moveToElementEditStart(F.getBody());
D.push(E);
}
for (var H = 0; H < G.rangeCount; H++) {
var I = G.getRangeAt(H);
E = new h.range(F);
E.setStart(new h.node(I.startContainer), I.startOffset);
E.setEnd(new h.node(I.endContainer), I.endOffset);
D.push(E);
}
return D;
};
return function (D) {
var E = this._.cache;
if (E.ranges && !D) return E.ranges;
else if (!E.ranges) E.ranges = new h.rangeList(C.call(this))
;
if (D) {
var F = E.ranges;
for (var G = 0; G < F.length; G++) {
var H = F[G],
I = H.getCommonAncestor();
if (I.isReadOnly()) F.splice(G, 1);
if (H.collapsed) continue;
if (H.startContainer.isReadOnly()) {
var J = H.startContainer;
while (J) {
if (J.is('body') || !J.isReadOnly()) break;
if (J.type == 1 && J.getAttribute('contentEd
itable') == 'false') H.setStartAfter(J);
J = J.getParent();
}
}
var K = H.startContainer,
L = H.endContainer,
M = H.startOffset,
N = H.endOffset,
O = H.clone();
if (K && K.type == 3)
if (M >= K.getLength()) O.setStartAfter(K);
else O.setStartBefore(K);
if (L && L.type == 3)
if (!N) O.setEndBefore(L);
else O.setEndAfter(L);
var P = new h.walker(O);
P.evaluator = function (Q) {
if (Q.type == 1 && Q.isReadOnly()) {
var R = H.clone();
H.setEndBefore(Q);
if (H.collapsed) F.splice(G--, 1);
if (!(Q.getPosition(O.endContainer) & 16)) {
R.setStartAfter(Q);
if (!R.collapsed) F.splice(G + 1, 0, R);
}
return true;
}
return false;
};
P.next();
}
}
return E.ranges;
};
})(),
getStartElement: function () {
var J = this;
var C = J._.cache;
if (C.startElement !== undefined) return C.startElement;
var D, E = J.getNative();
switch (J.getType()) {
case 3:
return J.getSelectedElement();
case 2:
var F = J.getRanges()[0];
if (F) {
if (!F.collapsed) {
F.optimize();
while (1) {
var G = F.startContainer,
H = F.startOffset;
if (H == (G.getChildCount ? G.getChildCount() :
G.getLength()) && !G.isBlockBoundary()) F.setStartAfter(G);
else break;
}
D = F.startContainer;
if (D.type != 1) return D.getParent();
D = D.getChild(F.startOffset);
if (!D || D.type != 1) D = F.startContainer;
else {
var I = D.getFirst();
while (I && I.type == 1) {
D = I;
I = I.getFirst();
}
}
} else {
D = F.startContainer;
if (D.type != 1) D = D.getParent();
}
D = D.$;
}
}
return C.startElement = D ? new l(D) : null;
},
getSelectedElement: function () {
var C = this._.cache;
if (C.selectedElement !== undefined) return C.selectedElement;
var D = this,
E = i.tryThese(function () {
return D.getNative().createRange().item(0);
}, function () {
var F, G, H = D.getRanges()[0],
I = H.getCommonAncestor(1, 1),
J = {
table: 1,
ul: 1,
ol: 1,
dl: 1
};
for (var K in J) {
if (F = I.getAscendant(K, 1)) break;
}
if (F) {
var L = new h.range(this.document);
L.setStartAt(F, 1);
L.setEnd(H.startContainer, H.startOffset);
var M = i.extend(J, j.$listItem, j.$tableContent),
N = new h.walker(L),
O = function (P, Q) {
return function (R, S) {
if (R.type == 3 && (!i.trim(R.getText())
|| R.getParent().data('cke-bookmark'))) return true;
var T;
if (R.type == 1) {
T = R.getName();
if (T == 'br' && Q && R.equals(R.get
Parent().getBogus())) return true;
if (S && T in M || T in j.$removeEmp
ty) return true;
}
P.halted = 1;
return false;
};
};
N.guard = O(N);
if (N.checkBackward() && !N.halted) {
N = new h.walker(L);
L.setStart(H.endContainer, H.endOffset);
L.setEndAt(F, 2);
N.guard = O(N, 1);
if (N.checkForward() && !N.halted) G = F.$;
}
}
if (!G) throw 0;
return G;
}, function () {
var F = D.getRanges()[0],
G, H;
for (var I = 2; I && !((G = F.getEnclosedNode()) && G.ty
pe == 1 && B[G.getName()] && (H = G)); I--) F.shrink(1);
return H.$;
});
return C.selectedElement = E ? new l(E) : null;
},
getSelectedText: function () {
var C = this._.cache;
if (C.selectedText !== undefined) return C.selectedText;
var D = '',
E = this.getNative();
if (this.getType() == 2) D = g ? E.createRange().text : E.toStri
ng();
return C.selectedText = D;
},
lock: function () {
var C = this;
C.getRanges();
C.getStartElement();
C.getSelectedElement();
C.getSelectedText();
C._.cache.nativeSel = {};
C.isLocked = 1;
C.document.setCustomData('cke_locked_selection', C);
},
unlock: function (C) {
var H = this;
var D = H.document,
E = D.getCustomData('cke_locked_selection');
if (E) {
D.setCustomData('cke_locked_selection', null);
if (C) {
var F = E.getSelectedElement(),
G = !F && E.getRanges();
H.isLocked = 0;
H.reset();
D.getBody().focus();
if (F) H.selectElement(F);
else H.selectRanges(G);
}
}
if (!E || !C) {
H.isLocked = 0;
H.reset();
}
},
reset: function () {
this._.cache = {};
},
selectElement: function (C) {
var E = this;
if (E.isLocked) {
var D = new h.range(E.document);
D.setStartBefore(C);
D.setEndAfter(C);
E._.cache.selectedElement = C;
E._.cache.startElement = C;
E._.cache.ranges = new h.rangeList(D);
E._.cache.type = 3;
return;
}
D = new h.range(C.getDocument());
D.setStartBefore(C);
D.setEndAfter(C);
D.select();
E.document.fire('selectionchange');
E.reset();
},
selectRanges: function (C) {
var Q = this;
if (Q.isLocked) {
Q._.cache.selectedElement = null;
Q._.cache.startElement = C[0] && C[0].getTouchedStartNode();
Q._.cache.ranges = new h.rangeList(C);
Q._.cache.type = 2;
return;
}
if (g) {
if (C.length > 1) {
var D = C[C.length - 1];
C[0].setEnd(D.endContainer, D.endOffset);
C.length = 1;
}
if (C[0]) C[0].select();
Q.reset();
} else {
var E = Q.getNative();
if (!E) return;
if (C.length) {
E.removeAllRanges();
f.webkit && A(Q.document);
}
for (var F = 0; F < C.length; F++) {
if (F < C.length - 1) {
var G = C[F],
H = C[F + 1],
I = G.clone();
I.setStart(G.endContainer, G.endOffset);
I.setEnd(H.startContainer, H.startOffset);
if (!I.collapsed) {
I.shrink(1, true);
var J = I.getCommonAncestor(),
K = I.getEnclosedNode();
if (J.isReadOnly() || K && K.isReadOnly()) {
H.setStart(G.startContainer, G.startOffset);
C.splice(F--, 1);
continue;
}
}
}
var L = C[F],
M = Q.document.$.createRange(),
N = L.startContainer;
if (L.collapsed && (f.opera || f.gecko && f.version < 10
900) && N.type == 1 && !N.getChildCount()) N.appendText('');
if (L.collapsed && f.webkit && v(L)) {
var O = x(Q.document);
L.insertNode(O);
var P = O.getNext();
if (P && !O.getPrevious() && P.type == 1 && P.getNam
e() == 'br') {
A(Q.document);
L.moveToPosition(P, 3);
} else L.moveToPosition(O, 4);
}
M.setStart(L.startContainer.$, L.startOffset);
try {
M.setEnd(L.endContainer.$, L.endOffset);
} catch (R) {
if (R.toString().indexOf('NS_ERROR_ILLEGAL_VALUE') >
= 0) {
L.collapse(1);
M.setEnd(L.endContainer.$, L.endOffset);
} else throw R;
}
E.addRange(M);
}
Q.document.fire('selectionchange');
Q.reset();
}
},
createBookmarks: function (C) {
return this.getRanges().createBookmarks(C);
},
createBookmarks2: function (C) {
return this.getRanges().createBookmarks2(C);
},
selectBookmarks: function (C) {
var D = [];
for (var E = 0; E < C.length; E++) {
var F = new h.range(this.document);
F.moveToBookmark(C[E]);
D.push(F);
}
this.selectRanges(D);
return this;
},
getCommonAncestor: function () {
var C = this.getRanges(),
D = C[0].startContainer,
E = C[C.length - 1].endContainer;
return D.getCommonAncestor(E);
},
scrollIntoView: function () {
var C = this.getStartElement();
C.scrollIntoView();
}
};
})();
(function () {
var q = h.walker.whitespaces(true),
r = /\ufeff|\u00a0/,
s = {
table: 1,
tbody: 1,
tr: 1
};
h.range.prototype.select = g ? function (t) {
var E = this;
var u = E.collapsed,
v, w, x, y = E.getEnclosedNode();
if (y) try {
x = E.document.$.body.createControlRange();
x.addElement(y.$);
x.select();
return;
} catch (F) {}
if (E.startContainer.type == 1 && E.startContainer.getName() in s ||
E.endContainer.type == 1 && E.endContainer.getName() in s) E.shrink(1, true);
var z = E.createBookmark(),
A = z.startNode,
B;
if (!u) B = z.endNode;
x = E.document.$.body.createTextRange();
x.moveToElementText(A.$);
x.moveStart('character', 1);
if (B) {
var C = E.document.$.body.createTextRange();
C.moveToElementText(B.$);
x.setEndPoint('EndToEnd', C);
x.moveEnd('character', -1);
} else {
var D = A.getNext(q);
v = !(D && D.getText && D.getText().match(r)) && (t || !A.hasPre
vious() || A.getPrevious().is && A.getPrevious().is('br'));
w = E.document.createElement('span');
w.setHtml('&#65279;');
w.insertBefore(A);
if (v) E.document.createText('\ufeff').insertBefore(A);
}
E.setStartBefore(A);
A.remove();
if (u) {
if (v) {
x.moveStart('character', -1);
x.select();
E.document.$.selection.clear();
} else x.select();
E.moveToPosition(w, 3);
w.remove();
} else {
E.setEndBefore(B);
B.remove();
x.select();
}
E.document.fire('selectionchange');
} : function () {
this.document.getSelection().selectRanges([this]);
};
})();
(function () {
var q = e.htmlParser.cssStyle,
r = i.cssLength,
s = /^((?:\d*(?:\.\d+))|(?:\d+))(.*)?$/i;
function t(v, w) {
var x = s.exec(v),
y = s.exec(w);
if (x) {
if (!x[2] && y[2] == 'px') return y[1];
if (x[2] == 'px' && !y[2]) return y[1] + 'px';
}
return w;
};
var u = {
elements: {
$: function (v) {
var w = v.attributes,
x = w && w['data-cke-realelement'],
y = x && new e.htmlParser.fragment.fromHtml(decodeURICom
ponent(x)),
z = y && y.children[0];
if (z && v.attributes['data-cke-resizable']) {
var A = new q(v).rules,
B = z.attributes,
C = A.width,
D = A.height;
C && (B.width = t(B.width, C));
D && (B.height = t(B.height, D));
}
return z;
}
}
};
n.add('fakeobjects', {
requires: ['htmlwriter'],
afterInit: function (v) {
var w = v.dataProcessor,
x = w && w.htmlFilter;
if (x) x.addRules(u);
}
});
e.editor.prototype.createFakeElement = function (v, w, x, y) {
var z = this.lang.fakeobjects,
A = z[x] || z.unknown,
B = {
'class': w,
src: e.getUrl('images/spacer.gif'),
'data-cke-realelement': encodeURIComponent(v.getOuterHtml())
,
'data-cke-real-node-type': v.type,
alt: A,
title: A,
align: v.getAttribute('align') || ''
};
if (x) B['data-cke-real-element-type'] = x;
if (y) {
B['data-cke-resizable'] = y;
var C = new q(),
D = v.getAttribute('width'),
E = v.getAttribute('height');
D && (C.rules.width = r(D));
E && (C.rules.height = r(E));
C.populate(B);
}
return this.document.createElement('img', {
attributes: B
});
};
e.editor.prototype.createFakeParserElement = function (v, w, x, y) {
var z = this.lang.fakeobjects,
A = z[x] || z.unknown,
B, C = new e.htmlParser.basicWriter();
v.writeHtml(C);
B = C.getHtml();
var D = {
'class': w,
src: e.getUrl('images/spacer.gif'),
'data-cke-realelement': encodeURIComponent(B),
'data-cke-real-node-type': v.type,
alt: A,
title: A,
align: v.attributes.align || ''
};
if (x) D['data-cke-real-element-type'] = x;
if (y) {
D['data-cke-resizable'] = y;
var E = v.attributes,
F = new q(),
G = E.width,
H = E.height;
G != undefined && (F.rules.width = r(G));
H != undefined && (F.rules.height = r(H));
F.populate(D);
}
return new e.htmlParser.element('img', D);
};
e.editor.prototype.restoreRealElement = function (v) {
if (v.data('cke-real-node-type') != 1) return null;
var w = l.createFromHtml(decodeURIComponent(v.data('cke-realelement'
)), this.document);
if (v.data('cke-resizable')) {
var x = v.getStyle('width'),
y = v.getStyle('height');
x && w.setAttribute('width', t(w.getAttribute('width'), x));
y && w.setAttribute('height', t(w.getAttribute('height'), y));
}
return w;
};
})();
n.add('richcombo', {
requires: ['floatpanel', 'listblock', 'button'],
beforeInit: function (q) {
q.ui.addHandler('richcombo', o.richCombo.handler);
}
});
e.UI_RICHCOMBO = 'richcombo';
o.richCombo = i.createClass({
$: function (q) {
var s = this;
i.extend(s, q, {
title: q.label,
modes: {
wysiwyg: 1
}
});
var r = s.panel || {};
delete s.panel;
s.id = i.getNextNumber();
s.document = r && r.parent && r.parent.getDocument() || e.document;
r.className = (r.className || '') + ' cke_rcombopanel';
r.block = {
multiSelect: r.multiSelect,
attributes: r.attributes
};
s._ = {
panelDefinition: r,
items: {},
state: 2
};
},
statics: {
handler: {
create: function (q) {
return new o.richCombo(q);
}
}
},
proto: {
renderHtml: function (q) {
var r = [];
this.render(q, r);
return r.join('');
},
render: function (q, r) {
var s = f,
t = 'cke_' + this.id,
u = i.addFunction(function (z) {
var C = this;
var A = C._;
if (A.state == 0) return;
C.createPanel(q);
if (A.on) {
A.panel.hide();
return;
}
C.commit();
var B = C.getValue();
if (B) A.list.mark(B);
else A.list.unmarkAll();
A.panel.showBlock(C.id, new l(z), 4);
}, this),
v = {
id: t,
combo: this,
focus: function () {
var z = e.document.getById(t).getChild(1);
z.focus();
},
clickFn: u
};
function w() {
var A = this;
var z = A.modes[q.mode] ? 2 : 0;
A.setState(q.readOnly && !A.readOnly ? 0 : z);
A.setValue('');
};
q.on('mode', w, this);
!this.readOnly && q.on('readOnly', w, this);
var x = i.addFunction(function (z, A) {
z = new h.event(z);
var B = z.getKeystroke();
switch (B) {
case 13:
case 32:
case 40:
i.callFunction(u, A);
break;
default:
v.onkey(v, B);
}
z.preventDefault();
}),
y = i.addFunction(function () {
v.onfocus && v.onfocus();
});
v.keyDownFn = x;
r.push('<span class="cke_rcombo" role="presentation">', '<span i
d=', t);
if (this.className) r.push(' class="', this.className, ' cke_off
"');
r.push(' role="presentation">', '<span id="' + t + '_label" clas
s=cke_label>', this.label, '</span>', '<a hidefocus=true title="', this.title, '
" tabindex="-1"', s.gecko && s.version >= 10900 && !s.hc ? '' : " href=\"javascr
ipt:void('" + this.label + "')\"", ' role="button" aria-labelledby="', t, '_labe
l" aria-describedby="', t, '_text" aria-haspopup="true"');
if (f.opera || f.gecko && f.mac) r.push(' onkeypress="return fal
se;"');
if (f.gecko) r.push(' onblur="this.style.cssText = this.style.cs
sText;"');
r.push(' onkeydown="CKEDITOR.tools.callFunction( ', x, ', event,
this );" onfocus="return CKEDITOR.tools.callFunction(', y, ', event);" ' + (g ?
'onclick="return false;" onmouseup' : 'onclick') + '="CKEDITOR.tools.callFuncti
on(', u, ', this); return false;"><span><span id="' + t + '_text" class="cke_tex
t cke_inline_label">' + this.label + '</span>' + '</span>' + '<span class=cke_op
enbutton><span class=cke_icon>' + (f.hc ? '&#9660;' : f.air ? '&nbsp;' : '') + '
</span></span>' + '</a>' + '</span>' + '</span>');
if (this.onRender) this.onRender();
return v;
},
createPanel: function (q) {
if (this._.panel) return;
var r = this._.panelDefinition,
s = this._.panelDefinition.block,
t = r.parent || e.document.getBody(),
u = new o.floatPanel(q, t, r),
v = u.addListBlock(this.id, s),
w = this;
u.onShow = function () {
if (w.className) this.element.getFirst().addClass(w.classNam
e + '_panel');
w.setState(1);
v.focus(!w.multiSelect && w.getValue());
w._.on = 1;
if (w.onOpen) w.onOpen();
};
u.onHide = function (x) {
if (w.className) this.element.getFirst().removeClass(w.class
Name + '_panel');
w.setState(w.modes && w.modes[q.mode] ? 2 : 0);
w._.on = 0;
if (!x && w.onClose) w.onClose();
};
u.onEscape = function () {
u.hide();
};
v.onClick = function (x, y) {
w.document.getWindow().focus();
if (w.onClick) w.onClick.call(w, x, y);
if (y) w.setValue(x, w._.items[x]);
else w.setValue('');
u.hide(false);
};
this._.panel = u;
this._.list = v;
u.getBlock(this.id).onHide = function () {
w._.on = 0;
w.setState(2);
};
if (this.init) this.init();
},
setValue: function (q, r) {
var t = this;
t._.value = q;
var s = t.document.getById('cke_' + t.id + '_text');
if (s) {
if (!(q || r)) {
r = t.label;
s.addClass('cke_inline_label');
} else s.removeClass('cke_inline_label');
s.setHtml(typeof r != 'undefined' ? r : q);
}
},
getValue: function () {
return this._.value || '';
},
unmarkAll: function () {
this._.list.unmarkAll();
},
mark: function (q) {
this._.list.mark(q);
},
hideItem: function (q) {
this._.list.hideItem(q);
},
hideGroup: function (q) {
this._.list.hideGroup(q);
},
showAll: function () {
this._.list.showAll();
},
add: function (q, r, s) {
this._.items[q] = s || q;
this._.list.add(q, r, s);
},
startGroup: function (q) {
this._.list.startGroup(q);
},
commit: function () {
var q = this;
if (!q._.committed) {
q._.list.commit();
q._.committed = 1;
o.fire('ready', q);
}
q._.committed = 1;
},
setState: function (q) {
var r = this;
if (r._.state == q) return;
r.document.getById('cke_' + r.id).setState(q);
r._.state = q;
}
}
});
o.prototype.addRichCombo = function (q, r) {
this.add(q, 'richcombo', r);
};
n.add('htmlwriter');
e.htmlWriter = i.createClass({
base: e.htmlParser.basicWriter,
$: function () {
var s = this;
s.base();
s.indentationChars = '\t';
s.selfClosingEnd = ' />';
s.lineBreakChars = '\n';
s.forceSimpleAmpersand = 0;
s.sortAttributes = 1;
s._.indent = 0;
s._.indentation = '';
s._.inPre = 0;
s._.rules = {};
var q = j;
for (var r in i.extend({}, q.$nonBodyContent, q.$block, q.$listItem,
q.$tableContent)) s.setRules(r, {
indent: 1,
breakBeforeOpen: 1,
breakAfterOpen: 1,
breakBeforeClose: !q[r]['#'],
breakAfterClose: 1
});
s.setRules('br', {
breakAfterOpen: 1
});
s.setRules('title', {
indent: 0,
breakAfterOpen: 0
});
s.setRules('style', {
indent: 0,
breakBeforeClose: 1
});
s.setRules('pre', {
indent: 0
});
},
proto: {
openTag: function (q, r) {
var t = this;
var s = t._.rules[q];
if (t._.indent) t.indentation();
else if (s && s.breakBeforeOpen) {
t.lineBreak();
t.indentation();
}
t._.output.push('<', q);
},
openTagClose: function (q, r) {
var t = this;
var s = t._.rules[q];
if (r) t._.output.push(t.selfClosingEnd);
else {
t._.output.push('>');
if (s && s.indent) t._.indentation += t.indentationChars;
} if (s && s.breakAfterOpen) t.lineBreak();
q == 'pre' && (t._.inPre = 1);
},
attribute: function (q, r) {
if (typeof r == 'string') {
this.forceSimpleAmpersand && (r = r.replace(/&amp;/g, '&'));
r = i.htmlEncodeAttr(r);
}
this._.output.push(' ', q, '="', r, '"');
},
closeTag: function (q) {
var s = this;
var r = s._.rules[q];
if (r && r.indent) s._.indentation = s._.indentation.substr(s.in
dentationChars.length);
if (s._.indent) s.indentation();
else if (r && r.breakBeforeClose) {
s.lineBreak();
s.indentation();
}
s._.output.push('</', q, '>');
q == 'pre' && (s._.inPre = 0);
if (r && r.breakAfterClose) s.lineBreak();
},
text: function (q) {
var r = this;
if (r._.indent) {
r.indentation();
!r._.inPre && (q = i.ltrim(q));
}
r._.output.push(q);
},
comment: function (q) {
if (this._.indent) this.indentation();
this._.output.push('<!--', q, '-->');
},
lineBreak: function () {
var q = this;
if (!q._.inPre && q._.output.length > 0) q._.output.push(q.lineB
reakChars);
q._.indent = 1;
},
indentation: function () {
var q = this;
if (!q._.inPre) q._.output.push(q._.indentation);
q._.indent = 0;
},
setRules: function (q, r) {
var s = this._.rules[q];
if (s) i.extend(s, r, true);
else this._.rules[q] = r;
}
}
});
n.add('menubutton', {
requires: ['button', 'menu'],
beforeInit: function (q) {
q.ui.addHandler('menubutton', o.menuButton.handler);
}
});
e.UI_MENUBUTTON = 'menubutton';
(function () {
var q = function (r) {
var s = this._;
if (s.state === 0) return;
s.previousState = s.state;
var t = s.menu;
if (!t) {
t = s.menu = new e.menu(r, {
panel: {
className: r.skinClass + ' cke_contextmenu',
attributes: {
'aria-label': r.lang.common.options
}
}
});
t.onHide = i.bind(function () {
this.setState(this.modes && this.modes[r.mode] ? s.previousS
tate : 0);
}, this);
if (this.onMenu) t.addListener(this.onMenu);
}
if (s.on) {
t.hide();
return;
}
this.setState(1);
t.show(e.document.getById(this._.id), 4);
};
o.menuButton = i.createClass({
base: o.button,
$: function (r) {
var s = r.panel;
delete r.panel;
this.base(r);
this.hasArrow = true;
this.click = q;
},
statics: {
handler: {
create: function (r) {
return new o.menuButton(r);
}
}
}
});
})();
n.add('dialogui');
(function () {
var q = function (y) {
var B = this;
B._ || (B._ = {});
B._['default'] = B._.initValue = y['default'] || '';
B._.required = y.required || false;
var z = [B._];
for (var A = 1; A < arguments.length; A++) z.push(arguments[A]);
z.push(true);
i.extend.apply(i, z);
return B._;
},
r = {
build: function (y, z, A) {
return new o.dialog.textInput(y, z, A);
}
},
s = {
build: function (y, z, A) {
return new o.dialog[z.type](y, z, A);
}
},
t = {
build: function (y, z, A) {
var B = z.children,
C, D = [],
E = [];
for (var F = 0; F < B.length && (C = B[F]); F++) {
var G = [];
D.push(G);
E.push(e.dialog._.uiElementBuilders[C.type].build(y, C,
G));
}
return new o.dialog[z.type](y, E, D, A, z);
}
},
u = {
isChanged: function () {
return this.getValue() != this.getInitValue();
},
reset: function (y) {
this.setValue(this.getInitValue(), y);
},
setInitValue: function () {
this._.initValue = this.getValue();
},
resetInitValue: function () {
this._.initValue = this._['default'];
},
getInitValue: function () {
return this._.initValue;
}
},
v = i.extend({}, o.dialog.uiElement.prototype.eventProcessors, {
onChange: function (y, z) {
if (!this._.domOnChangeRegistered) {
y.on('load', function () {
this.getInputElement().on('change', function () {
if (!y.parts.dialog.isVisible()) return;
this.fire('change', {
value: this.getValue()
});
}, this);
}, this);
this._.domOnChangeRegistered = true;
}
this.on('change', z);
}
}, true),
w = /^on([A-Z]\w+)/,
x = function (y) {
for (var z in y) {
if (w.test(z) || z == 'title' || z == 'type') delete y[z];
}
return y;
};
i.extend(o.dialog, {
labeledElement: function (y, z, A, B) {
if (arguments.length < 4) return;
var C = q.call(this, z);
C.labelId = i.getNextId() + '_label';
var D = this._.children = [],
E = function () {
var F = [],
G = z.required ? ' cke_required' : '';
if (z.labelLayout != 'horizontal') F.push('<label class=
"cke_dialog_ui_labeled_label' + G + '" ', ' id="' + C.labelId + '"', ' for="' +
C.inputId + '"', (z.labelStyle ? ' style="' + z.labelStyle + '"' : '') + '>', z.
label, '</label>', '<div class="cke_dialog_ui_labeled_content"' + (z.controlStyl
e ? ' style="' + z.controlStyle + '"' : '') + ' role="presentation">', B.call(th
is, y, z), '</div>');
else {
var H = {
type: 'hbox',
widths: z.widths,
padding: 0,
children: [{
type: 'html',
html: '<label class="cke_dialog_ui_labeled_l
abel' + G + '"' + ' id="' + C.labelId + '"' + ' for="' + C.inputId + '"' + (z.la
belStyle ? ' style="' + z.labelStyle + '"' : '') + '>' + i.htmlEncode(z.label) +
'</span>'
}, {
type: 'html',
html: '<span class="cke_dialog_ui_labeled_co
ntent"' + (z.controlStyle ? ' style="' + z.controlStyle + '"' : '') + '>' + B.ca
ll(this, y, z) + '</span>'
}]
};
e.dialog._.uiElementBuilders.hbox.build(y, H, F);
}
return F.join('');
};
o.dialog.uiElement.call(this, y, z, A, 'div', null, {
role: 'presentation'
}, E);
},
textInput: function (y, z, A) {
if (arguments.length < 3) return;
q.call(this, z);
var B = this._.inputId = i.getNextId() + '_textInput',
C = {
'class': 'cke_dialog_ui_input_' + z.type,
id: B,
type: 'text'
},
D;
if (z.validate) this.validate = z.validate;
if (z.maxLength) C.maxlength = z.maxLength;
if (z.size) C.size = z.size;
if (z.inputStyle) C.style = z.inputStyle;
var E = this,
F = false;
y.on('load', function () {
E.getInputElement().on('keydown', function (H) {
if (H.data.getKeystroke() == 13) F = true;
});
E.getInputElement().on('keyup', function (H) {
if (H.data.getKeystroke() == 13 && F) {
y.getButton('ok') && setTimeout(function () {
y.getButton('ok').click();
}, 0);
F = false;
}
}, null, null, 1000);
});
var G = function () {
var H = ['<div class="cke_dialog_ui_input_', z.type, '" role
="presentation"'];
if (z.width) H.push('style="width:' + z.width + '" ');
H.push('><input ');
C['aria-labelledby'] = this._.labelId;
this._.required && (C['aria-required'] = this._.required);
for (var I in C) H.push(I + '="' + C[I] + '" ');
H.push(' /></div>');
return H.join('');
};
o.dialog.labeledElement.call(this, y, z, A, G);
},
textarea: function (y, z, A) {
if (arguments.length < 3) return;
q.call(this, z);
var B = this,
C = this._.inputId = i.getNextId() + '_textarea',
D = {};
if (z.validate) this.validate = z.validate;
D.rows = z.rows || 5;
D.cols = z.cols || 20;
if (typeof z.inputStyle != 'undefined') D.style = z.inputStyle;
var E = function () {
D['aria-labelledby'] = this._.labelId;
this._.required && (D['aria-required'] = this._.required);
var F = ['<div class="cke_dialog_ui_input_textarea" role="pr
esentation"><textarea class="cke_dialog_ui_input_textarea" id="', C, '" '];
for (var G in D) F.push(G + '="' + i.htmlEncode(D[G]) + '" '
);
F.push('>', i.htmlEncode(B._['default']), '</textarea></div>
');
return F.join('');
};
o.dialog.labeledElement.call(this, y, z, A, E);
},
checkbox: function (y, z, A) {
if (arguments.length < 3) return;
var B = q.call(this, z, {
'default': !!z['default']
});
if (z.validate) this.validate = z.validate;
var C = function () {
var D = i.extend({}, z, {
id: z.id ? z.id + '_checkbox' : i.getNextId() + '_ch
eckbox'
}, true),
E = [],
F = i.getNextId() + '_label',
G = {
'class': 'cke_dialog_ui_checkbox_input',
type: 'checkbox',
'aria-labelledby': F
};
x(D);
if (z['default']) G.checked = 'checked';
if (typeof D.inputStyle != 'undefined') D.style = D.inputSty
le;
B.checkbox = new o.dialog.uiElement(y, D, E, 'input', null,
G);
E.push(' <label id="', F, '" for="', G.id, '"' + (z.labelSty
le ? ' style="' + z.labelStyle + '"' : '') + '>', i.htmlEncode(z.label), '</labe
l>');
return E.join('');
};
o.dialog.uiElement.call(this, y, z, A, 'span', null, null, C);
},
radio: function (y, z, A) {
if (arguments.length < 3) return;
q.call(this, z);
if (!this._['default']) this._['default'] = this._.initValue = z
.items[0][1];
if (z.validate) this.validate = z.valdiate;
var B = [],
C = this,
D = function () {
var E = [],
F = [],
G = {
'class': 'cke_dialog_ui_radio_item',
'aria-labelledby': this._.labelId
},
H = z.id ? z.id + '_radio' : i.getNextId() + '_radio
';
for (var I = 0; I < z.items.length; I++) {
var J = z.items[I],
K = J[2] !== undefined ? J[2] : J[0],
L = J[1] !== undefined ? J[1] : J[0],
M = i.getNextId() + '_radio_input',
N = M + '_label',
O = i.extend({}, z, {
id: M,
title: null,
type: null
}, true),
P = i.extend({}, O, {
title: K
}, true),
Q = {
type: 'radio',
'class': 'cke_dialog_ui_radio_input',
name: H,
value: L,
'aria-labelledby': N
},
R = [];
if (C._['default'] == L) Q.checked = 'checked';
x(O);
x(P);
if (typeof O.inputStyle != 'undefined') O.style = O.
inputStyle;
B.push(new o.dialog.uiElement(y, O, R, 'input', null
, Q));
R.push(' ');
new o.dialog.uiElement(y, P, R, 'label', null, {
id: N,
'for': Q.id
}, J[0]);
E.push(R.join(''));
}
new o.dialog.hbox(y, B, E, F);
return F.join('');
};
o.dialog.labeledElement.call(this, y, z, A, D);
this._.children = B;
},
button: function (y, z, A) {
if (!arguments.length) return;
if (typeof z == 'function') z = z(y.getParentEditor());
q.call(this, z, {
disabled: z.disabled || false
});
e.event.implementOn(this);
var B = this;
y.on('load', function (E) {
var F = this.getElement();
(function () {
F.on('click', function (G) {
B.fire('click', {
dialog: B.getDialog()
});
G.data.preventDefault();
});
F.on('keydown', function (G) {
if (G.data.getKeystroke() in {
32: 1
}) {
B.click();
G.data.preventDefault();
}
});
})();
F.unselectable();
}, this);
var C = i.extend({}, z);
delete C.style;
var D = i.getNextId() + '_label';
o.dialog.uiElement.call(this, y, C, A, 'a', null, {
style: z.style,
href: 'javascript:void(0)',
title: z.label,
hidefocus: 'true',
'class': z['class'],
role: 'button',
'aria-labelledby': D
}, '<span id="' + D + '" class="cke_dialog_ui_button">' + i.html
Encode(z.label) + '</span>');
},
select: function (y, z, A) {
if (arguments.length < 3) return;
var B = q.call(this, z);
if (z.validate) this.validate = z.validate;
B.inputId = i.getNextId() + '_select';
var C = function () {
var D = i.extend({}, z, {
id: z.id ? z.id + '_select' : i.getNextId() + '_sele
ct'
}, true),
E = [],
F = [],
G = {
id: B.inputId,
'class': 'cke_dialog_ui_input_select',
'aria-labelledby': this._.labelId
};
if (z.size != undefined) G.size = z.size;
if (z.multiple != undefined) G.multiple = z.multiple;
x(D);
for (var H = 0, I; H < z.items.length && (I = z.items[H]); H
++) F.push('<option value="', i.htmlEncode(I[1] !== undefined ? I[1] : I[0]).rep
lace(/"/g, '&quot;'), '" /> ', i.htmlEncode(I[0]));
if (typeof D.inputStyle != 'undefined') D.style = D.inputSty
le;
B.select = new o.dialog.uiElement(y, D, E, 'select', null, G
, F.join(''));
return E.join('');
};
o.dialog.labeledElement.call(this, y, z, A, C);
},
file: function (y, z, A) {
if (arguments.length < 3) return;
if (z['default'] === undefined) z['default'] = '';
var B = i.extend(q.call(this, z), {
definition: z,
buttons: []
});
if (z.validate) this.validate = z.validate;
var C = function () {
B.frameId = i.getNextId() + '_fileInput';
var D = f.isCustomDomain(),
E = ['<iframe frameborder="0" allowtransparency="0" clas
s="cke_dialog_ui_input_file" id="', B.frameId, '" title="', z.label, '" src="jav
ascript:void('];
E.push(D ? "(function(){document.open();document.domain='" +
document.domain + "';" + 'document.close();' + '})()' : '0');
E.push(')"></iframe>');
return E.join('');
};
y.on('load', function () {
var D = e.document.getById(B.frameId),
E = D.getParent();
E.addClass('cke_dialog_ui_input_file');
});
o.dialog.labeledElement.call(this, y, z, A, C);
},
fileButton: function (y, z, A) {
if (arguments.length < 3) return;
var B = q.call(this, z),
C = this;
if (z.validate) this.validate = z.validate;
var D = i.extend({}, z),
E = D.onClick;
D.className = (D.className ? D.className + ' ' : '') + 'cke_dial
og_ui_button';
D.onClick = function (F) {
var G = z['for'];
if (!E || E.call(this, F) !== false) {
y.getContentElement(G[0], G[1]).submit();
this.disable();
}
};
y.on('load', function () {
y.getContentElement(z['for'][0], z['for'][1])._.buttons.push
(C);
});
o.dialog.button.call(this, y, D, A);
},
html: (function () {
var y = /^\s*<[\w:]+\s+([^>]*)?>/,
z = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,
A = /\/$/;
return function (B, C, D) {
if (arguments.length < 3) return;
var E = [],
F, G = C.html,
H, I;
if (G.charAt(0) != '<') G = '<span>' + G + '</span>';
var J = C.focus;
if (J) {
var K = this.focus;
this.focus = function () {
K.call(this);
typeof J == 'function' && J.call(this);
this.fire('focus');
};
if (C.isFocusable) {
var L = this.isFocusable;
this.isFocusable = L;
}
this.keyboardFocusable = true;
}
o.dialog.uiElement.call(this, B, C, E, 'span', null, null, '
');
F = E.join('');
H = F.match(y);
I = G.match(z) || ['', '', ''];
if (A.test(I[1])) {
I[1] = I[1].slice(0, -1);
I[2] = '/' + I[2];
}
D.push([I[1], ' ', H[1] || '', I[2]].join(''));
};
})(),
fieldset: function (y, z, A, B, C) {
var D = C.label,
E = function () {
var F = [];
D && F.push('<legend>' + D + '</legend>');
for (var G = 0; G < A.length; G++) F.push(A[G]);
return F.join('');
};
this._ = {
children: z
};
o.dialog.uiElement.call(this, y, C, B, 'fieldset', null, null, E
);
}
}, true);
o.dialog.html.prototype = new o.dialog.uiElement();
o.dialog.labeledElement.prototype = i.extend(new o.dialog.uiElement(), {
setLabel: function (y) {
var z = e.document.getById(this._.labelId);
if (z.getChildCount() < 1) new h.text(y, e.document).appendTo(z)
;
else z.getChild(0).$.nodeValue = y;
return this;
},
getLabel: function () {
var y = e.document.getById(this._.labelId);
if (!y || y.getChildCount() < 1) return '';
else return y.getChild(0).getText();
},
eventProcessors: v
}, true);
o.dialog.button.prototype = i.extend(new o.dialog.uiElement(), {
click: function () {
var y = this;
if (!y._.disabled) return y.fire('click', {
dialog: y._.dialog
});
y.getElement().$.blur();
return false;
},
enable: function () {
this._.disabled = false;
var y = this.getElement();
y && y.removeClass('cke_disabled');
},
disable: function () {
this._.disabled = true;
this.getElement().addClass('cke_disabled');
},
isVisible: function () {
return this.getElement().getFirst().isVisible();
},
isEnabled: function () {
return !this._.disabled;
},
eventProcessors: i.extend({}, o.dialog.uiElement.prototype.eventProc
essors, {
onClick: function (y, z) {
this.on('click', z);
}
}, true),
accessKeyUp: function () {
this.click();
},
accessKeyDown: function () {
this.focus();
},
keyboardFocusable: true
}, true);
o.dialog.textInput.prototype = i.extend(new o.dialog.labeledElement(), {
getInputElement: function () {
return e.document.getById(this._.inputId);
},
focus: function () {
var y = this.selectParentTab();
setTimeout(function () {
var z = y.getInputElement();
z && z.$.focus();
}, 0);
},
select: function () {
var y = this.selectParentTab();
setTimeout(function () {
var z = y.getInputElement();
if (z) {
z.$.focus();
z.$.select();
}
}, 0);
},
accessKeyUp: function () {
this.select();
},
setValue: function (y) {
!y && (y = '');
return o.dialog.uiElement.prototype.setValue.apply(this, argumen
ts);
},
keyboardFocusable: true
}, u, true);
o.dialog.textarea.prototype = new o.dialog.textInput();
o.dialog.select.prototype = i.extend(new o.dialog.labeledElement(), {
getInputElement: function () {
return this._.select.getElement();
},
add: function (y, z, A) {
var B = new l('option', this.getDialog().getParentEditor().docum
ent),
C = this.getInputElement().$;
B.$.text = y;
B.$.value = z === undefined || z === null ? y : z;
if (A === undefined || A === null) {
if (g) C.add(B.$);
else C.add(B.$, null);
} else C.add(B.$, A);
return this;
},
remove: function (y) {
var z = this.getInputElement().$;
z.remove(y);
return this;
},
clear: function () {
var y = this.getInputElement().$;
while (y.length > 0) y.remove(0);
return this;
},
keyboardFocusable: true
}, u, true);
o.dialog.checkbox.prototype = i.extend(new o.dialog.uiElement(), {
getInputElement: function () {
return this._.checkbox.getElement();
},
setValue: function (y, z) {
this.getInputElement().$.checked = y;
!z && this.fire('change', {
value: y
});
},
getValue: function () {
return this.getInputElement().$.checked;
},
accessKeyUp: function () {
this.setValue(!this.getValue());
},
eventProcessors: {
onChange: function (y, z) {
if (!g) return v.onChange.apply(this, arguments);
else {
y.on('load', function () {
var A = this._.checkbox.getElement();
A.on('propertychange', function (B) {
B = B.data.$;
if (B.propertyName == 'checked') this.fire('chan
ge', {
value: A.$.checked
});
}, this);
}, this);
this.on('change', z);
}
return null;
}
},
keyboardFocusable: true
}, u, true);
o.dialog.radio.prototype = i.extend(new o.dialog.uiElement(), {
setValue: function (y, z) {
var A = this._.children,
B;
for (var C = 0; C < A.length && (B = A[C]); C++) B.getElement().
$.checked = B.getValue() == y;
!z && this.fire('change', {
value: y
});
},
getValue: function () {
var y = this._.children;
for (var z = 0; z < y.length; z++) {
if (y[z].getElement().$.checked) return y[z].getValue();
}
return null;
},
accessKeyUp: function () {
var y = this._.children,
z;
for (z = 0; z < y.length; z++) {
if (y[z].getElement().$.checked) {
y[z].getElement().focus();
return;
}
}
y[0].getElement().focus();
},
eventProcessors: {
onChange: function (y, z) {
if (!g) return v.onChange.apply(this, arguments);
else {
y.on('load', function () {
var A = this._.children,
B = this;
for (var C = 0; C < A.length; C++) {
var D = A[C].getElement();
D.on('propertychange', function (E) {
E = E.data.$;
if (E.propertyName == 'checked' && this.$.ch
ecked) B.fire('change', {
value: this.getAttribute('value')
});
});
}
}, this);
this.on('change', z);
}
return null;
}
},
keyboardFocusable: true
}, u, true);
o.dialog.file.prototype = i.extend(new o.dialog.labeledElement(), u, {
getInputElement: function () {
var y = e.document.getById(this._.frameId).getFrameDocument();
return y.$.forms.length > 0 ? new l(y.$.forms[0].elements[0]) :
this.getElement();
},
submit: function () {
this.getInputElement().getParent().$.submit();
return this;
},
getAction: function () {
return this.getInputElement().getParent().$.action;
},
registerEvents: function (y) {
var z = /^on([A-Z]\w+)/,
A, B = function (D, E, F, G) {
D.on('formLoaded', function () {
D.getInputElement().on(F, G, D);
});
};
for (var C in y) {
if (!(A = C.match(z))) continue;
if (this.eventProcessors[C]) this.eventProcessors[C].call(th
is, this._.dialog, y[C]);
else B(this, this._.dialog, A[1].toLowerCase(), y[C]);
}
return this;
},
reset: function () {
var y = this._,
z = e.document.getById(y.frameId),
A = z.getFrameDocument(),
B = y.definition,
C = y.buttons,
D = this.formLoadedNumber,
E = this.formUnloadNumber,
F = y.dialog._.editor.lang.dir,
G = y.dialog._.editor.langCode;
if (!D) {
D = this.formLoadedNumber = i.addFunction(function () {
this.fire('formLoaded');
}, this);
E = this.formUnloadNumber = i.addFunction(function () {
this.getInputElement().clearCustomData();
}, this);
this.getDialog()._.editor.on('destroy', function () {
i.removeFunction(D);
i.removeFunction(E);
});
}
function H() {
A.$.open();
if (f.isCustomDomain()) A.$.domain = document.domain;
var I = '';
if (B.size) I = B.size - (g ? 7 : 0);
A.$.write(['<html dir="' + F + '" lang="' + G + '"><head><ti
tle></title></head><body style="margin: 0; overflow: hidden; background: transpa
rent;">', '<form enctype="multipart/form-data" method="POST" dir="' + F + '" lan
g="' + G + '" action="', i.htmlEncode(B.action), '">', '<input type="file" name=
"', i.htmlEncode(B.id || 'cke_upload'), '" size="', i.htmlEncode(I > 0 ? I : '')
, '" />', '</form>', '</body></html>', '<script>window.parent.CKEDITOR.tools.cal
lFunction(' + D + ');', 'window.onbeforeunload = function() {window.parent.CKEDI
TOR.tools.callFunction(' + E + ')}</script>'].join(''));
A.$.close();
for (var J = 0; J < C.length; J++) C[J].enable();
};
if (f.gecko) setTimeout(H, 500);
else H();
},
getValue: function () {
return this.getInputElement().$.value || '';
},
setInitValue: function () {
this._.initValue = '';
},
eventProcessors: {
onChange: function (y, z) {
if (!this._.domOnChangeRegistered) {
this.on('formLoaded', function () {
this.getInputElement().on('change', function () {
this.fire('change', {
value: this.getValue()
});
}, this);
}, this);
this._.domOnChangeRegistered = true;
}
this.on('change', z);
}
},
keyboardFocusable: true
}, true);
o.dialog.fileButton.prototype = new o.dialog.button();
o.dialog.fieldset.prototype = i.clone(o.dialog.hbox.prototype);
e.dialog.addUIElement('text', r);
e.dialog.addUIElement('password', r);
e.dialog.addUIElement('textarea', s);
e.dialog.addUIElement('checkbox', s);
e.dialog.addUIElement('radio', s);
e.dialog.addUIElement('button', s);
e.dialog.addUIElement('select', s);
e.dialog.addUIElement('file', s);
e.dialog.addUIElement('fileButton', s);
e.dialog.addUIElement('html', s);
e.dialog.addUIElement('fieldset', t);
})();
n.add('panel', {
beforeInit: function (q) {
q.ui.addHandler('panel', o.panel.handler);
}
});
e.UI_PANEL = 'panel';
o.panel = function (q, r) {
var s = this;
if (r) i.extend(s, r);
i.extend(s, {
className: '',
css: []
});
s.id = i.getNextId();
s.document = q;
s._ = {
blocks: {}
};
};
o.panel.handler = {
create: function (q) {
return new o.panel(q);
}
};
o.panel.prototype = {
renderHtml: function (q) {
var r = [];
this.render(q, r);
return r.join('');
},
render: function (q, r) {
var t = this;
var s = t.id;
r.push('<div class="', q.skinClass, '" lang="', q.langCode, '" role=
"presentation" style="display:none;z-index:' + (q.config.baseFloatZIndex + 1) +
'">' + '<div' + ' id=', s, ' dir=', q.lang.dir, ' role="presentation" class="cke
_panel cke_', q.lang.dir);
if (t.className) r.push(' ', t.className);
r.push('">');
if (t.forceIFrame || t.css.length) {
r.push('<iframe id="', s, '_frame" frameborder="0" role="applica
tion" src="javascript:void(');
r.push(f.isCustomDomain() ? "(function(){document.open();documen
t.domain='" + document.domain + "';" + 'document.close();' + '})()' : '0');
r.push(')"></iframe>');
}
r.push('</div></div>');
return s;
},
getHolderElement: function () {
var q = this._.holder;
if (!q) {
if (this.forceIFrame || this.css.length) {
var r = this.document.getById(this.id + '_frame'),
s = r.getParent(),
t = s.getAttribute('dir'),
u = s.getParent().getAttribute('class'),
v = s.getParent().getAttribute('lang'),
w = r.getFrameDocument();
f.iOS && s.setStyles({
overflow: 'scroll',
'-webkit-overflow-scrolling': 'touch'
});
var x = i.addFunction(i.bind(function (A) {
this.isLoaded = true;
if (this.onLoad) this.onLoad();
}, this)),
y = '<!DOCTYPE html><html dir="' + t + '" class="' + u +
'_container" lang="' + v + '">' + '<head>' + '<style>.' + u + '_container{visib
ility:hidden}</style>' + '</head>' + '<body class="cke_' + t + ' cke_panel_frame
' + f.cssClass + '" style="margin:0;padding:0"' + ' onload="( window.CKEDITOR |
| window.parent.CKEDITOR ).tools.callFunction(' + x + ');"></body>' + i.buildSty
leHtml(this.css) + '</html>';
w.write(y);
var z = w.getWindow();
z.$.CKEDITOR = e;
w.on('key' + (f.opera ? 'press' : 'down'), function (A) {
var D = this;
var B = A.data.getKeystroke(),
C = D.document.getById(D.id).getAttribute('dir');
if (D._.onKeyDown && D._.onKeyDown(B) === false) {
A.data.preventDefault();
return;
}
if (B == 27 || B == (C == 'rtl' ? 39 : 37))
if (D.onEscape && D.onEscape(B) === false) A.data.pr
eventDefault();
}, this);
q = w.getBody();
q.unselectable();
f.air && i.callFunction(x);
} else q = this.document.getById(this.id);
this._.holder = q;
}
return q;
},
addBlock: function (q, r) {
var s = this;
r = s._.blocks[q] = r instanceof o.panel.block ? r : new o.panel.blo
ck(s.getHolderElement(), r);
if (!s._.currentBlock) s.showBlock(q);
return r;
},
getBlock: function (q) {
return this._.blocks[q];
},
showBlock: function (q) {
var v = this;
var r = v._.blocks,
s = r[q],
t = v._.currentBlock,
u = v.forceIFrame ? v.document.getById(v.id + '_frame') : v._.ho
lder;
u.getParent().getParent().disableContextMenu();
if (t) {
u.removeAttributes(t.attributes);
t.hide();
}
v._.currentBlock = s;
u.setAttributes(s.attributes);
e.fire('ariaWidget', u);
s._.focusIndex = -1;
v._.onKeyDown = s.onKeyDown && i.bind(s.onKeyDown, s);
s.show();
return s;
},
destroy: function () {
this.element && this.element.remove();
}
};
o.panel.block = i.createClass({
$: function (q, r) {
var s = this;
s.element = q.append(q.getDocument().createElement('div', {
attributes: {
tabIndex: -1,
'class': 'cke_panel_block',
role: 'presentation'
},
styles: {
display: 'none'
}
}));
if (r) i.extend(s, r);
if (!s.attributes.title) s.attributes.title = s.attributes['aria-lab
el'];
s.keys = {};
s._.focusIndex = -1;
s.element.disableContextMenu();
},
_: {
markItem: function (q) {
var t = this;
if (q == -1) return;
var r = t.element.getElementsByTag('a'),
s = r.getItem(t._.focusIndex = q);
if (f.webkit || f.opera) s.getDocument().getWindow().focus();
s.focus();
t.onMark && t.onMark(s);
}
},
proto: {
show: function () {
this.element.setStyle('display', '');
},
hide: function () {
var q = this;
if (!q.onHide || q.onHide.call(q) !== true) q.element.setStyle('
display', 'none');
},
onKeyDown: function (q) {
var v = this;
var r = v.keys[q];
switch (r) {
case 'next':
var s = v._.focusIndex,
t = v.element.getElementsByTag('a'),
u;
while (u = t.getItem(++s)) {
if (u.getAttribute('_cke_focus') && u.$.offsetWidth) {
v._.focusIndex = s;
u.focus();
break;
}
}
return false;
case 'prev':
s = v._.focusIndex;
t = v.element.getElementsByTag('a');
while (s > 0 && (u = t.getItem(--s))) {
if (u.getAttribute('_cke_focus') && u.$.offsetWidth) {
v._.focusIndex = s;
u.focus();
break;
}
}
return false;
case 'click':
case 'mouseup':
s = v._.focusIndex;
u = s >= 0 && v.element.getElementsByTag('a').getItem(s);
if (u) u.$[r] ? u.$[r]() : u.$['on' + r]();
return false;
}
return true;
}
}
});
n.add('listblock', {
requires: ['panel'],
onLoad: function () {
o.panel.prototype.addListBlock = function (q, r) {
return this.addBlock(q, new o.listBlock(this.getHolderElement(),
r));
};
o.listBlock = i.createClass({
base: o.panel.block,
$: function (q, r) {
var u = this;
r = r || {};
var s = r.attributes || (r.attributes = {});
(u.multiSelect = !!r.multiSelect) && (s['aria-multiselectabl
e'] = true);
!s.role && (s.role = 'listbox');
u.base.apply(u, arguments);
var t = u.keys;
t[40] = 'next';
t[9] = 'next';
t[38] = 'prev';
t[2228224 + 9] = 'prev';
t[32] = g ? 'mouseup' : 'click';
g && (t[13] = 'mouseup');
u._.pendingHtml = [];
u._.items = {};
u._.groups = {};
},
_: {
close: function () {
if (this._.started) {
this._.pendingHtml.push('</ul>');
delete this._.started;
}
},
getClick: function () {
if (!this._.click) this._.click = i.addFunction(function
(q) {
var s = this;
var r = true;
if (s.multiSelect) r = s.toggle(q);
else s.mark(q); if (s.onClick) s.onClick(q, r);
}, this);
return this._.click;
}
},
proto: {
add: function (q, r, s) {
var v = this;
var t = v._.pendingHtml,
u = i.getNextId();
if (!v._.started) {
t.push('<ul role="presentation" class=cke_panel_list
>');
v._.started = 1;
v._.size = v._.size || 0;
}
v._.items[q] = u;
t.push('<li id=', u, ' class=cke_panel_listItem role=pre
sentation><a id="', u, '_option" _cke_focus=1 hidefocus=true title="', s || q, '
" href="javascript:void(\'', q, "')\" " + (g ? 'onclick="return false;" onmouseu
p' : 'onclick') + '="CKEDITOR.tools.callFunction(', v._.getClick(), ",'", q, "')
; return false;\"", ' role="option" aria-posinset="' + (++v._.size + 0) + '">',
r || q, '</a></li>');
},
startGroup: function (q) {
this._.close();
var r = i.getNextId();
this._.groups[q] = r;
this._.pendingHtml.push('<h1 role="presentation" id=', r
, ' class=cke_panel_grouptitle>', q, '</h1>');
},
commit: function () {
var t = this;
t._.close();
t.element.appendHtml(t._.pendingHtml.join(''));
var q = t._.items,
r = t.element.getDocument();
for (var s in q) r.getById(q[s] + '_option').setAttribut
e('aria-setsize', t._.size);
delete t._.size;
t._.pendingHtml = [];
},
toggle: function (q) {
var r = this.isMarked(q);
if (r) this.unmark(q);
else this.mark(q);
return !r;
},
hideGroup: function (q) {
var r = this.element.getDocument().getById(this._.groups
[q]),
s = r && r.getNext();
if (r) {
r.setStyle('display', 'none');
if (s && s.getName() == 'ul') s.setStyle('display',
'none');
}
},
hideItem: function (q) {
this.element.getDocument().getById(this._.items[q]).setS
tyle('display', 'none');
},
showAll: function () {
var q = this._.items,
r = this._.groups,
s = this.element.getDocument();
for (var t in q) s.getById(q[t]).setStyle('display', '')
;
for (var u in r) {
var v = s.getById(r[u]),
w = v.getNext();
v.setStyle('display', '');
if (w && w.getName() == 'ul') w.setStyle('display',
'');
}
},
mark: function (q) {
var t = this;
if (!t.multiSelect) t.unmarkAll();
var r = t._.items[q],
s = t.element.getDocument().getById(r);
s.addClass('cke_selected');
t.element.getDocument().getById(r + '_option').setAttrib
ute('aria-selected', true);
t.onMark && t.onMark(s);
},
unmark: function (q) {
var u = this;
var r = u.element.getDocument(),
s = u._.items[q],
t = r.getById(s);
t.removeClass('cke_selected');
r.getById(s + '_option').removeAttribute('aria-selected'
);
u.onUnmark && u.onUnmark(t);
},
unmarkAll: function () {
var u = this;
var q = u._.items,
r = u.element.getDocument();
for (var s in q) {
var t = q[s];
r.getById(t).removeClass('cke_selected');
r.getById(t + '_option').removeAttribute('aria-selec
ted');
}
u.onUnmark && u.onUnmark();
},
isMarked: function (q) {
return this.element.getDocument().getById(this._.items[q
]).hasClass('cke_selected');
},
focus: function (q) {
this._.focusIndex = -1;
if (q) {
var r = this.element.getDocument().getById(this._.it
ems[q]).getFirst(),
s = this.element.getElementsByTag('a'),
t, u = -1;
while (t = s.getItem(++u)) {
if (t.equals(r)) {
this._.focusIndex = u;
break;
}
}
setTimeout(function () {
r.focus();
}, 0);
}
}
}
});
}
});
e.themes.add('default', (function () {
var q = {};
function r(s, t) {
var u, v;
v = s.config.sharedSpaces;
v = v && v[t];
v = v && e.document.getById(v);
if (v) {
var w = '<span class="cke_shared " dir="' + s.lang.dir + '"' + '
>' + '<span class="' + s.skinClass + ' ' + s.id + ' cke_editor_' + s.name + '">'
+ '<span class="' + f.cssClass + '">' + '<span class="cke_wrapper cke_' + s.lan
g.dir + '">' + '<span class="cke_editor">' + '<div class="cke_' + t + '">' + '</
div></span></span></span></span></span>',
x = v.append(l.createFromHtml(w, v.getDocument()));
if (v.getCustomData('cke_hasshared')) x.hide();
else v.setCustomData('cke_hasshared', 1);
u = x.getChild([0, 0, 0, 0]);
!s.sharedSpaces && (s.sharedSpaces = {});
s.sharedSpaces[t] = u;
s.on('focus', function () {
for (var y = 0, z, A = v.getChildren(); z = A.getItem(y); y+
+) {
if (z.type == 1 && !z.equals(x) && z.hasClass('cke_share
d')) z.hide();
}
x.show();
});
s.on('destroy', function () {
x.remove();
});
}
return u;
};
return {
build: function (s, t) {
var u = s.name,
v = s.element,
w = s.elementMode;
if (!v || w == 0) return;
if (w == 1) v.hide();
var x = s.fire('themeSpace', {
space: 'top',
html: ''
}).html,
y = s.fire('themeSpace', {
space: 'contents',
html: ''
}).html,
z = s.fireOnce('themeSpace', {
space: 'bottom',
html: ''
}).html,
A = y && s.config.height,
B = s.config.tabIndex || s.element.getAttribute('tabindex')
|| 0;
if (!y) A = 'auto';
else if (!isNaN(A)) A += 'px';
var C = '',
D = s.config.width;
if (D) {
if (!isNaN(D)) D += 'px';
C += 'width: ' + D + ';';
}
var E = x && r(s, 'top'),
F = r(s, 'bottom');
E && (E.setHtml(x), x = '');
F && (F.setHtml(z), z = '');
var G = '<style>.' + s.skinClass + '{visibility:hidden;}</style>
';
if (q[s.skinClass]) G = '';
else q[s.skinClass] = 1;
var H = l.createFromHtml(['<span id="cke_', u, '" class="', s.sk
inClass, ' ', s.id, ' cke_editor_', u, '" dir="', s.lang.dir, '" title="', f.gec
ko ? ' ' : '', '" lang="', s.langCode, '"' + (f.webkit ? ' tabindex="' + B + '"'
: '') + ' role="application"' + ' aria-labelledby="cke_', u, '_arialbl"' + (C ?
' style="' + C + '"' : '') + '>' + '<span id="cke_', u, '_arialbl" class="cke_v
oice_label">' + s.lang.editor + '</span>' + '<span class="', f.cssClass, '" role
="presentation"><span class="cke_wrapper cke_', s.lang.dir, '" role="presentatio
n"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="pr
esentation"><tbody><tr', x ? '' : ' style="display:none"', ' role="presentation"
><td id="cke_top_', u, '" class="cke_top" role="presentation">', x, '</td></tr><
tr', y ? '' : ' style="display:none"', ' role="presentation"><td id="cke_content
s_', u, '" class="cke_contents" style="height:', A, '" role="presentation">', y,
'</td></tr><tr', z ? '' : ' style="display:none"', ' role="presentation"><td id
="cke_bottom_', u, '" class="cke_bottom" role="presentation">', z, '</td></tr></
tbody></table>' + G + '</span>' + '</span>' + '</span>'].join(''));
H.getChild([1, 0, 0, 0, 0]).unselectable();
H.getChild([1, 0, 0, 0, 2]).unselectable();
if (w == 1) H.insertAfter(v);
else v.append(H);
s.container = H;
H.disableContextMenu();
s.on('contentDirChanged', function (I) {
var J = (s.lang.dir != I.data ? 'add' : 'remove') + 'Class';
H.getChild(1)[J]('cke_mixed_dir_content');
var K = this.sharedSpaces && this.sharedSpaces[this.config.t
oolbarLocation];
K && K.getParent().getParent()[J]('cke_mixed_dir_content');
});
s.fireOnce('themeLoaded');
s.fireOnce('uiReady');
},
buildDialog: function (s) {
var t = i.getNextNumber(),
u = l.createFromHtml(['<div class="', s.id, '_dialog cke_edi
tor_', s.name.replace('.', '\\.'), '_dialog cke_skin_', s.skinName, '" dir="', s
.lang.dir, '" lang="', s.langCode, '" role="dialog" aria-labelledby="%title#"><t
able class="cke_dialog', ' ' + f.cssClass, ' cke_', s.lang.dir, '" style="positi
on:absolute" role="presentation"><tr><td role="presentation"><div class="%body"
role="presentation"><div id="%title#" class="%title" role="presentation"></div><
a id="%close_button#" class="%close_button" href="javascript:void(0)" title="' +
s.lang.common.close + '" role="button"><span class="cke_label">X</span></a>' +
'<div id="%tabs#" class="%tabs" role="tablist"></div>' + '<table class="%content
s" role="presentation">' + '<tr>' + '<td id="%contents#" class="%contents" role=
"presentation"></td>' + '</tr>' + '<tr>' + '<td id="%footer#" class="%footer" ro
le="presentation"></td>' + '</tr>' + '</table>' + '</div>' + '<div id="%tl#" cla
ss="%tl"></div>' + '<div id="%tc#" class="%tc"></div>' + '<div id="%tr#" class="
%tr"></div>' + '<div id="%ml#" class="%ml"></div>' + '<div id="%mr#" class="%mr"
></div>' + '<div id="%bl#" class="%bl"></div>' + '<div id="%bc#" class="%bc"></d
iv>' + '<div id="%br#" class="%br"></div>' + '</td></tr>' + '</table>', g ? '' :
'<style>.cke_dialog{visibility:hidden;}</style>', '</div>'].join('').replace(/#
/g, '_' + t).replace(/%/g, 'cke_dialog_')),
v = u.getChild([0, 0, 0, 0, 0]),
w = v.getChild(0),
x = v.getChild(1);
if (g && !f.ie6Compat) {
var y = f.isCustomDomain(),
z = 'javascript:void(function(){' + encodeURIComponent('
document.open();' + (y ? 'document.domain="' + document.domain + '";' : '') + 'd
ocument.close();') + '}())',
A = l.createFromHtml('<iframe frameBorder="0" class="cke
_iframe_shim" src="' + z + '"' + ' tabIndex="-1"' + '></iframe>');
A.appendTo(v.getParent());
}
w.unselectable();
x.unselectable();
return {
element: u,
parts: {
dialog: u.getChild(0),
title: w,
close: x,
tabs: v.getChild(2),
contents: v.getChild([3, 0, 0, 0]),
footer: v.getChild([3, 0, 1, 0])
}
};
},
destroy: function (s) {
var t = s.container,
u = s.element;
if (t) {
t.clearCustomData();
t.remove();
}
if (u) {
u.clearCustomData();
s.elementMode == 1 && u.show();
delete s.element;
}
}
};
})());
e.editor.prototype.getThemeSpace = function (q) {
var r = 'cke_' + q,
s = this._[r] || (this._[r] = e.document.getById(r + '_' + this.name
));
return s;
};
e.editor.prototype.resize = function (q, r, s, t) {
var z = this;
var u = z.container,
v = e.document.getById('cke_contents_' + z.name),
w = f.webkit && z.document && z.document.getWindow().$.frameElement,
x = t ? u.getChild(1) : u;
x.setSize('width', q, true);
w && (w.style.width = '1%');
var y = s ? 0 : (x.$.offsetHeight || 0) - (v.$.clientHeight || 0);
v.setStyle('height', Math.max(r - y, 0) + 'px');
w && (w.style.width = '100%');
z.fire('resize');
};
e.editor.prototype.getResizable = function (q) {
return q ? e.document.getById('cke_contents_' + this.name) : this.contai
ner;
};
e.editor.prototype.esInsertText = function (q) {
if (this.mode == 'enhancedsource') {
this.focus();
this.fire('saveSnapshot');
if (this.savedselection) {
this.savedselection.select();
delete this.savedselection;
}
this.esInsertAtCursor(q);
i.setTimeout(function () {
this.fire('saveSnapshot');
}, 0, this);
}
};
e.editor.prototype.esInsertAtCursor = function (q) {
var r = this.textarea.$,
s = r.scrollTop;
if (g) {
r.focus();
sel = document.selection.createRange();
sel.text = q;
sel.select();
} else if (r.selectionStart || r.selectionStart == '0') {
var t = r.selectionStart,
u = r.selectionEnd;
r.value = r.value.substring(0, t) + q + r.value.substring(u, r.value
.length);
if (t == u) this.esSetSelectionRange(t + q.length, u + q.length);
else this.esSetCaretToPos(t + q.length);
} else r.value += q;
r.scrollTop = s;
};
e.editor.prototype.esWrapAroundSelection = function (q, r) {
var w = this;
var s = w.textarea.$;
if (w.savedselection) w.savedselection.select();
var t = s.scrollTop;
if (g) {
s.focus();
sel = document.selection.createRange();
sel.text = q + sel.text + r;
sel.moveStart('character', -r.length);
sel.moveEnd('character', -r.length);
sel.select();
} else if (s.selectionStart || s.selectionStart == '0') {
var u = s.selectionStart,
v = s.selectionEnd;
s.value = s.value.substring(0, u) + q + s.value.substring(u, v) + r
+ s.value.substring(v, s.value.length);
if (u == v) w.esSetCaretToPos(u + q.length);
else w.esSetSelectionRange(u + q.length, v + q.length);
}
s.scrollTop = t;
};
e.editor.prototype.esGetSelectionText = function () {
var q = this.textarea.$;
if (g) {
q.focus();
sel = document.selection.createRange();
return sel.text;
} else if (q.selectionStart || q.selectionStart == '0') {
var r = q.selectionStart,
s = q.selectionEnd;
return q.value.substring(r, s);
}
};
e.editor.prototype.esDeleteSelection = function () {
var q = this.textarea.$,
r = q.scrollTop;
q.focus();
if (g) {
var s = document.selection.createRange();
document.selection.clear();
} else if (q.selectionStart || q.selectionStart == '0') {
var t = q.selectionStart,
u = q.selectionEnd;
q.value = q.value.substring(0, t) + q.value.substring(u, q.value.len
gth);
this.esSetCaretToPos(t);
}
q.scrollTop = r;
};
e.editor.prototype.esSetSelectionRange = function (q, r) {
var s = this.textarea.$;
if (s.setSelectionRange) {
s.focus();
s.setSelectionRange(q, r);
} else if (s.createTextRange) {
var t = s.createTextRange();
t.collapse(true);
t.moveEnd('character', r);
t.moveStart('character', q);
t.select();
}
};
e.editor.prototype.esSetCaretToPos = function (q) {
this.esSetSelectionRange(q, q);
};
function a(q, r, s) {
for (var t = 0; t < q.toolbox.toolbars.length; t++) {
var u = q.toolbox.toolbars[t];
for (var v = 0; v < u.items.length; v++) {
var w = u.items[v];
if (r == 'button' && w.button && w.button.label == s || r == 'co
mbo' && w.combo && w.combo.label == s) return w;
}
}
};
function b(q, r, s) {
var t = a(q, 'button', r);
if (t) {
var u = e.document.getById(t.id);
u.setAttribute('title', s);
}
};
function c(q, r, s) {
var t = a(q, 'button', r);
if (t) YAHOO.util.Dom.setStyle(t.id, 'display', s);
};
function d(q) {
e.on('dialogDefinition', function (r) {
var s = r.data.name,
t = r.data.definition;
if (s == 'smiley') {
t.getContents('tab1').elements[0].html = t.getContents('tab1').e
lements[0].html.replace(/src="\.\/([a-z]+:\/\/)/gi, 'src="$1');
var u = t.getContents('tab1').elements[0].onClick;
t.getContents('tab1').elements[0].onClick = i.override(u, functi
on (v) {
return function (w) {
var x = w.data.getTarget(),
y = x.getName();
if (y == 'a') x = x.getChild(0);
else if (y != 'img') return;
var z = x.getAttribute('title');
r.editor.insertHtml(z);
this._.dialog.hide();
w.data.preventDefault();
};
});
}
});
};
n.add('enhancedsourcearea', {
requires: ['editingblock', 'wysiwygarea'],
saveSelection: function (q, r) {
r.savedselection = document.selection.createRange();
},
init: function (q) {
var r = n.enhancedsourcearea,
s, t = e.document.getWindow();
q.textarea = s = new l('textarea');
if (g) {
YAHOO.util.Event.on(q.textarea.$, 'keyup', this.saveSelection, q
);
YAHOO.util.Event.on(q.textarea.$, 'click', this.saveSelection, q
);
YAHOO.util.Event.on(q.textarea.$, 'select', this.saveSelection,
q);
}
q.getSelection = i.override(q.getSelection, function (u) {
return function () {
if (this.mode != 'enhancedsourcearea') return u.call(this);
else return new h.selection(document);
};
});
d(q);
q.on('editingBlockReady', function () {
var u, v = {};
b(q, q.lang.source, q.lang.vbulletin.switch_editor_mode_source);
c(q, q.lang.vbulletin.email, 'none');
q.addMode('enhancedsource', {
load: function (w, x) {
c(q, q.lang.vbulletin.email, '');
b(q, q.lang.source, q.lang.vbulletin.switch_editor_mode_
wysiwyg);
if (YAHOO.util.Dom.get(q.editorid + '_mode')) YAHOO.util
.Dom.get(q.editorid + '_mode').value = 0;
var y = ['bold', 'italic', 'underline', 'justifyleft', '
justifycenter', 'justifyright', 'numberedlist', 'bulletedlist'];
for (command in y) q.getCommand(y[command]).setState(2);
if (g && f.version < 8) w.setStyle('position', 'relative
');
s.setAttributes({
dir: q.config.contentsLangDirection,
tabIndex: f.webkit ? -1 : q.tabIndex,
role: 'textbox',
'aria-label': q.lang.editorTitle.replace('%1', q.nam
e)
});
s.addClass('cke_source');
s.addClass('cke_enable_context_menu');
this.setupCommandOverrides();
var z = {
width: f.ie7Compat ? '99%' : '100%',
height: '100%',
'min-width': '100%',
'max-width': '100%',
resize: 'none',
outline: 'none',
'text-align': q.config.contentsLangDirection == 'ltr
' ? 'left' : 'right'
};
if (g) {
z.width = w.$.clientHeight + 'px';
z.height = w.$.clientWidth + 'px';
u = function () {
s.hide();
s.setStyle('height', w.$.clientHeight + 'px');
s.setStyle('width', w.$.clientWidth + 'px');
s.show();
};
q.on('resize', u);
t.on('resize', u);
setTimeout(u, 0);
} else s.on('mousedown', function (B) {
B.data.stopPropagation();
});
w.setHtml('');
w.append(s);
s.setStyles(z);
q.fire('ariaWidget', s);
s.on('blur', function () {
q.focusManager.blur();
});
s.on('focus', function () {
q.focusManager.focus();
});
q.mayBeDirty = true;
this.loadData(x);
var A = q.keystrokeHandler;
if (A) A.attach(s);
setTimeout(function () {
q.mode = 'enhancedsource';
q.getCommand('enhancedsource').setState(q.mode == 'e
nhancedsource' ? 1 : 2);
q.fire('mode');
}, f.gecko || f.webkit ? 100 : 0);
},
loadData: function (w) {
s.setValue(w);
q.fire('dataReady');
},
loadSnapshotData: function (w) {
s.setValue(w);
},
getData: function () {
return s.getValue();
},
getSnapshotData: function () {
return s.getValue();
},
unload: function (w) {
b(q, q.lang.source, q.lang.vbulletin.switch_editor_mode_
source);
if (YAHOO.util.Dom.get(q.editorid + '_mode')) YAHOO.util
.Dom.get(q.editorid + '_mode').value = 1;
c(q, q.lang.vbulletin.email, 'none');
this.restoreDefaultCommands();
s.clearCustomData();
s.remove();
if (u) {
q.removeListener('resize', u);
t.removeListener('resize', u);
}
if (g && f.version < 8) w.removeStyle('position');
},
focus: function () {
s.focus();
},
setupCommandOverrides: function () {
this.overrideCommands = {
bold: function (B) {
if (vB_Editor[B.editorid].get_button('bold')) B.
esWrapAroundSelection('[B]', '[/B]');
},
italic: function (B) {
if (vB_Editor[B.editorid].get_button('italic'))
B.esWrapAroundSelection('[I]', '[/I]');
},
underline: function (B) {
if (vB_Editor[B.editorid].get_button('underline'
)) B.esWrapAroundSelection('[U]', '[/U]');
},
justifyleft: function (B) {
B.esWrapAroundSelection('[LEFT]', '[/LEFT]');
},
justifycenter: function (B) {
B.esWrapAroundSelection('[CENTER]', '[/CENTER]')
;
},
justifyright: function (B) {
B.esWrapAroundSelection('[RIGHT]', '[/RIGHT]');
},
indent: function (B) {
B.esWrapAroundSelection('[INDENT]', '[/INDENT]')
;
},
Quote: function (B) {
B.esWrapAroundSelection('[QUOTE]', '[/QUOTE]');
},
Code: function (B) {
B.esWrapAroundSelection('[CODE]', '[/CODE]');
},
Html: function (B) {
B.esWrapAroundSelection('[HTML]', '[/HTML]');
},
Php: function (B) {
B.esWrapAroundSelection('[PHP]', '[/PHP]');
},
subscript: function (B) {
B.esWrapAroundSelection('[SUB]', '[/SUB]');
},
superscript: function (B) {
B.esWrapAroundSelection('[SUP]', '[/SUP]');
},
horizontalrule: function (B) {
B.esInsertAtCursor('[HR][/HR]');
},
PageBreak: function (B) {
B.esInsertAtCursor('[PAGE][/PAGE]');
},
PreviewBreak: function (B) {
B.esInsertAtCursor('[PRBREAK][/PRBREAK]');
},
vbimage: function (B) {
var C = v.vbimage;
if (g) {
B.savedselection = document.selection.create
Range();
C.exec(B);
} else C.exec(B);
},
table: function (B) {
var C = v.table;
if (g) {
B.savedselection = document.selection.create
Range();
C.exec(B);
} else C.exec(B);
},
iespell: function (B) {
try {
eval("new ActiveXObject('ieSpell.ieSpellExte
nsion').CheckDocumentNode(editor.textarea.$);");
} catch (C) {
if (C.number == -2146827859 && confirm(B.lan
g.vbulletin.iespell_not_installed)) window.open('http://www.iespell.com/download
.php');
}
},
videotag: function (B) {
var C = v.videotag;
if (g) {
B.savedselection = document.selection.create
Range();
C.exec(B);
} else C.exec(B);
},
numberedlist: function (B) {
var C = B.esGetSelectionText();
B.esInsertAtCursor('[LIST=1]\n');
if (C) {
var D = C.split('\n');
for (var E in D) B.esInsertAtCursor('[*]' +
D[E] + '\n');
} else
do {
var F = prompt(B.config.vbulletin.phrase
.enter_list_item, '');
if (typeof F == 'string') B.esInsertAtCu
rsor('[*]' + F + '\n');
} while (F) B.esInsertAtCursor('[/LIST]\n');
},
bulletedlist: function (B) {
var C = B.esGetSelectionText();
B.esInsertAtCursor('[LIST]\n');
if (C) {
var D = C.split('\n');
for (var E in D) B.esInsertAtCursor('[*]' +
D[E] + '\n');
} else
do {
var F = prompt(B.config.vbulletin.phrase
.enter_list_item, '');
if (typeof F == 'string') B.esInsertAtCu
rsor('[*]' + F + '\n');
} while (F) B.esInsertAtCursor('[/LIST]\n');
},
link: function (B) {
var C = prompt(B.lang.vbulletin.enter_link_url,
'http://');
if (typeof C == 'string') C = PHP.trim(C);
else return; if (C.length > 0 && C != 'http://')
{
var D = B.esGetSelectionText();
if (D) B.esWrapAroundSelection('[URL="' + C
+ '"]', '[/URL]');
else B.esInsertAtCursor('[URL="' + C + '"]'
+ C + '[/URL]');
}
},
Email: function (B) {
var C = PHP.trim(prompt(B.lang.vbulletin.enter_t
he_email_address));
if (typeof C == 'string' && C.length > 0) {
var D = B.esGetSelectionText();
if (D) B.esWrapAroundSelection('[EMAIL="' +
C + '"]', '[/EMAIL]');
else B.esInsertAtCursor('[EMAIL="' + C + '"]
' + C + '[/EMAIL]');
}
}
};
v.insertHtml = q.insertHtml;
q.insertHtml = q.esInsertText;
v.insertText = q.insertText;
q.insertText = q.esInsertText;
for (var w in this.overrideCommands) {
v[w] = q.getCommand(w);
q.addCommand(w, {
modes: {
enhancedsource: 1
},
exec: this.overrideCommands[w]
});
}
for (var x in q.config.vbulletin.bbcodecache) {
var y = q.config.vbulletin.bbcodecache[x];
v[y.title] = q.getCommand(y.title);
q.addCommand(y.title, {
tagname: y.bbcodetag.toUpperCase(),
twoparams: y.twoparams,
modes: {
enhancedsource: 1
},
exec: function (B) {
var D = this;
if (D.twoparams == '1') {
var C = prompt(B.lang.vbulletin.enter_ta
g_option.replace(/\%1\$s/, '[' + D.tagname + ']'));
if (typeof C == 'string' && C.length > 0
) B.esWrapAroundSelection('[' + D.tagname + '=' + C + ']', '[/' + D.tagname + ']
');
else B.esWrapAroundSelection('[' + D.tag
name + ']', '[/' + D.tagname + ']');
} else B.esWrapAroundSelection('[' + D.tagna
me + ']', '[/' + D.tagname + ']');
}
});
}
var z = a(q, 'combo', q.lang.font.label);
if (z) {
z.combo.modes.enhancedsource = 1;
v.font = z.combo.onClick;
z.combo.onClick = function (B, C) {
if (q.savedselection) q.savedselection.select();
q.esWrapAroundSelection('[FONT=' + B + ']', '[/F
ONT]');
};
}
var A = a(q, 'combo', q.lang.fontSize.label);
if (A) {
A.combo.modes.enhancedsource = 1;
v.size = A.combo.onClick;
A.combo.onClick = function (B, C) {
if (q.savedselection) q.savedselection.select();
q.esWrapAroundSelection('[SIZE=' + B + ']', '[/S
IZE]');
};
}
this.setupColorOverride();
q.getCommand('smiley').modes.enhancedsource = 1;
q.getCommand('openAttachmentWindow').modes.enhancedsourc
e = 1;
q.getCommand('vbimage').modes.enhancedsource = 1;
q.getCommand('videotag').modes.enhancedsource = 1;
q.getCommand('undo').modes.enhancedsource = 1;
q.getCommand('redo').modes.enhancedsource = 1;
q.getCommand('iespell').modes.enhancedsource = 1;
},
setupColorOverride: function () {
var w = a(q, 'button', q.lang.colorButton.textColorTitle
);
if (w) {
w.button.modes.enhancedsource = 1;
delete w.button._.panel;
e.vbtextcolor.applyLastColor = i.override(e.vbtextco
lor.applyLastColor, function (z) {
return function (A) {
if (q.mode == 'enhancedsource' && e.vbtextco
lor.lastColor) {
q.esWrapAroundSelection('[COLOR="' + e.v
btextcolor.lastColor + '"]', '[/COLOR]');
A.cancel();
A.stop();
A.data.preventDefault(true);
return false;
} else z.call(this, A);
};
});
var x = e.document.getById(w.id),
y = x.getChild(0);
y.on('click', e.vbtextcolor.applyLastColor, null, nu
ll, 0);
w.button.onBlock = i.override(w.button.onBlock, func
tion (z) {
return function (A, B) {
z.call(this, A, B);
if (q.mode == 'enhancedsource') {
var C = i.addFunction(function (E, F) {
if (E != '?') {
if (q.savedselection) q.save
dselection.select();
e.vbtextcolor.setLastColor(E
);
} else {
var G = arguments.callee;
function H(I) {
this.removeListener('ok'
, H);
this.removeListener('can
cel', H);
if (I.name == 'ok') {
var J = this.getCont
entElement('picker', 'selectedColor').getValue();
e.vbtextcolor.setLas
tColor(J);
q.esWrapAroundSelect
ion('[COLOR="' + J + '"]', '[/COLOR]');
}
};
q.openDialog('colordialog',
function () {
this.on('ok', H);
this.on('cancel', H);
});
return;
} if (E != null) q.esWrapAroundS
election('[COLOR="' + E + '"]', '[/COLOR]');
}),
D = B.element.getHtml();
D = D.replace(/callFunction\(\d+/g, 'cal
lFunction(' + C);
B.element.setHtml(D);
}
};
});
}
},
restoreDefaultCommands: function () {
for (var w in v) {
if (w == 'insertHtml') q.insertHtml = v[w];
else if (w == 'insertText') q.insertText = v[w];
else if (w == 'font') a(q, 'combo', q.lang.font.labe
l).combo.onClick = v.font;
else if (w == 'size') a(q, 'combo', q.lang.fontSize.
label).combo.onClick = v.size;
else q._.commands[w] = v[w];
}
var x = a(q, 'button', q.lang.colorButton.textColorTitle
);
if (x) delete x.button._.panel;
}
});
});
q.addCommand('enhancedsource', r.commands.enhancedsource);
if (q.ui.addButton) q.ui.addButton('EnhancedSource', {
label: q.lang.source,
command: 'enhancedsource'
});
q.on('mode', function () {
q.getCommand('enhancedsource').setState(q.mode == 'enhancedsourc
e' ? 1 : 2);
});
setTimeout(function () {
q.fire('enhancedReady');
}, 0);
}
});
n.enhancedsourcearea = {
commands: {
enhancedsource: {
modes: {
wysiwyg: 1,
enhancedsource: 1
},
editorFocus: false,
exec: function (q) {
if (q.mode == 'wysiwyg') q.fire('saveSnapshot');
q.getCommand('enhancedsource').setState(0);
q.setMode(q.mode == 'enhancedsource' ? 'wysiwyg' : 'enhanced
source');
},
canUndo: false
}
}
};
(function () {
var q = function () {};
q.prototype = {
create: function () {
return window.XMLHttpRequest ? new XMLHttpRequest() : new Active
XObject('Microsoft.XMLHTTP');
},
parseRequestData: function (s) {
var t = null;
if (typeof s == 'string') t = s;
else if (typeof s == 'object') {
t = [];
for (property in s) {
if (s[property]) var u = PHP.urlencode(s[property]);
else var u = '';
t.push(property + '=' + u);
}
t = t.join('&');
}
return t;
},
open: function (s) {
var t = this.create();
t.open(s.type, s.url, s.async);
if (s.type && s.type.toUpperCase() == 'POST') t.setRequestHeader
('Content-type', 'application/x-www-form-urlencoded');
else s.type = 'GET'; if ((typeof s.async == 'undefined' || s.asy
nc != false) && s.callback) t.onreadystatechange = s.callback;
t.send(this.parseRequestData(s.data));
return t;
}
};
e.vbajax = new q();
function r(s) {
var t = s.match(/&#([0-9]+);/g);
if (t)
for (var u = 0; typeof t[u] != 'undefined'; u++) {
if (submatch = t[u].match(/^&#([0-9]+);$/)) s = s.replace(su
bmatch[0], String.fromCharCode(submatch[1]));
}
return s;
};
n.add('bbcode', {
init: function (s) {
var t = s.dataProcessor = new e.bbcodeDataProcessor(s);
}
});
e.bbcodeDataProcessor = function (s) {
var t = this;
t.editor = s;
t.writer = new e.htmlWriter();
t.dataFilter = new e.htmlParser.filter();
t.htmlFilter = new e.htmlParser.filter();
};
e.bbcodeDataProcessor.prototype = {
doServerParse: function (s, t) {
var y = this;
if (s.length > 0) {
var u = {
towysiwyg: t,
message: s,
'do': 'editorswitch',
allowsmilie: 1,
parsetype: PHP.htmlspecialchars(y.editor.config.parsetyp
e),
securitytoken: y.editor.config.vbulletin.securitytoken
};
if (vB_Editor[y.editor.editorid] && vB_Editor[y.editor.edito
rid].textarea.form && typeof vB_Editor[y.editor.editorid].textarea.form['options
[allowbbcode]'] != 'undefined') u.allowbbcode = vB_Editor[y.editor.editorid].tex
tarea.form['options[allowbbcode]'].checked;
if (y.editor.config.ajax_extra)
for (id in y.editor.config.ajax_extra) u[id] = y.editor.
config.ajax_extra[id];
var v = e.vbajax.open({
url: fetch_ajax_url('ajax.php'),
type: 'POST',
data: u,
async: false,
dataType: 'xml'
}).responseXML,
w = fetch_tags(v, 'message')[0];
if (w && w.firstChild) var x = r(v.getElementsByTagName('mes
sage')[0].firstChild.nodeValue);
else x = '';
} else var x = s;
return x;
},
toHtml: function (s, t) {
if (this.editor.hitServer != false) s = this.doServerParse(s, 1)
;
s = s.replace(/<table(.*?)width=(["'])(.+?)\2/gi, function (u, v
, w, x) {
if (!x.match(/%/)) x += 'px';
return '<table ' + v + ' style="width: ' + x + '"';
});
s = s.replace(/<b>/gi, '<strong>');
s = s.replace(/<\/b>/gi, '</strong>');
s = s.replace(/<i>/gi, '<em>');
s = s.replace(/<\/i>/gi, '</em>');
return s;
},
toDataFormat: function (s, t, u) {
var y = this;
s = s.replace(/<div.*>(.+?)<\/div>/gi, '');
if (t == 'p') {
s = s.replace(/<br><\/p>/gi, '<br>');
s = s.replace(/<p>/gi, '');
}
var v = y.editor.document.getElementsByTag('table');
for (var w = 0; w < v.count(); w++) {
var x = v.getItem(w);
x.setAttribute('width', x.getStyle('width').replace(/px/, ''
));
}
s = y.editor.document.getBody().getHtml();
s = s.replace(/<a .*?_cke_saved_href=(["'])(.+?)\1.*?>(.+?)<\/a>
/gi, '<a href="$2">$3</a>');
if (!u) {
s = y.doServerParse(s, 0);
for (var w = 0; w < y.editor.config.smiley_images.length; w+
+) {
path = y.editor.config.smiley_images[w].replace(/\//g, '
\\/');
text = y.editor.config.smiley_descriptions[w];
s = s.replace(new RegExp('\\[IMG\\].*?' + PHP.preg_quote
(path) + '\\[\\/IMG\\]', 'gi'), text);
}
}
return s;
},
getAutoSaveData: function () {
var s = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s
*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,
t = this.editor.config.enterMode != 2 ? this.editor.config.e
nterMode == 3 ? 'div' : 'p' : false,
u = this.editor.document.getBody().getHtml();
if (f.gecko) u = u.replace(/<br>(?=\s*(:?$|<\/body>))/, '');
u = this.toDataFormat(u, t, true);
if (this.editor.config.ignoreEmptyParagraph) u = u.replace(s, fu
nction (v, w) {
return w;
});
return u;
}
};
})();
(function () {
function q(t, u, v) {
for (var w = 0; w < t.toolbox.toolbars.length; w++) {
var x = t.toolbox.toolbars[w];
for (var y = 0; y < x.items.length; y++) {
var z = x.items[y];
if (u == 'button' && z.button && z.button.label == v) return
z;
}
}
};
function r(t, u) {
this.editor = t;
e.dialog.add('attachment', u + 'dialogs/attachment.js?v=' + SIMPLEVE
RSION);
t.addCommand('openAttachmentConfig', new e.dialogCommand('attachment
'));
};
function s(t, u) {
this.editor = t;
this.attachmentConfig = u;
};
s.prototype = {
windows: [],
exec: function (t) {
var v = this;
v.content = m.content;
if (AJAX_Compatible && v.content.enhanced == 1) {
var u = !t.config.nobbcode ? v.content.insertinline : 0;
v.open_window('newattachment.php?' + SESSIONURL + 'do=assetm
anager&' + PHP.unhtmlspecialchars(v.content.values) + '&contenttypeid=' + v.cont
ent.contenttypeid + '&poststarttime=' + v.content.poststarttime + '&posthash=' +
v.content.posthash + '&insertinline=' + u, 725, 520, v.content.contenttypeid +
'_' + v.content.posthash);
} else v.open_window('newattachment.php?' + SESSIONURL + PHP.unh
tmlspecialchars(v.content.values) + '&contenttypeid=' + v.content.contenttypeid
+ '&poststarttime=' + v.content.poststarttime + '&posthash=' + v.content.posthas
h, 480, 480, v.content.posthash);
},
open_window: function (t, u, v, w) {
var x = this;
if (x.windows[w] && x.windows[w].closed == false) x.windows[w].f
ocus();
else x.windows[w] = openWindow(fetch_ajax_url(t), u, v, 'Attach'
+ w);
},
insert_attachment: function (t, u) {
this.editor.insert_attachment(t, u);
}
};
e.editor.prototype.insert_attachment = function (t, u) {
var A = this;
var v = u != 0 ? '[ATTACH=CONFIG]' + t + '[/ATTACH]' : '[ATTACH]' +
t + '[/ATTACH]';
if (A.mode == 'wysiwyg' && f.gecko && parseInt(navigator.productSub)
<= 20100924 && parseInt(navigator.productSub) >= 20100721) {
var w = A.dataProcessor.toHtml(v),
x = A.getSelection(),
y = x.createBookmarks(),
z = new l('span');
z.setHtml(w);
z.insertBefore(y[0].startNode);
z.remove(true);
x.selectBookmarks(y);
} else A.insertHtml(v);
};
n.add('attachment', {
init: function (t) {
var u, v, w = new r(t, t.config.vbPluginPath + 'attachment/'),
x = new s(t, w);
window.ckeattachment = x;
t.addCommand('openAttachmentWindow', x);
var y = function (F) {
t.execCommand('openAttachmentWindow');
F.cancel();
F.stop();
F.data.preventDefault(true);
return false;
},
z, A, B;
t.on('instanceReady', function (F) {
B = q(t, 'button', t.config.vbulletin.phrase.attachments);
if (B) {
var G = e.document.getById(B.id);
z = G.getChild(0);
z.on('click', y, null, null, 1);
A = G.getChild(2);
A.on('click', function (H) {
if (vB_Attachments.attachments.length == 0 || t.conf
ig.nobbcode) y(H);
}, null, null, 1);
B.button.onOpen = function () {
if (u) {
u.element.setHtml(E());
v.element.getFirst().addClass('cke_attach');
}
};
}
}, this);
var C = i.addFunction(function (F) {
t.insert_attachment(F);
}),
D = i.addFunction(function () {
if (vB_Attachments)
for (var F in vB_Attachments.attachments) t.insert_a
ttachment(F, vB_Attachments.attachments[F].thumbnail);
});
function E() {
var F = [];
if (vB_Attachments) {
var G = 0;
for (var H in vB_Attachments.attachments) {
G++;
F.push('<a href="" onclick="CKEDITOR.tools.callFunct
ion(', C, ', ', H, ');return false;">');
F.push(vB_Attachments.attachments[H].html);
F.push('</a>');
}
if (G > 1) F.push('<div class="attach_insert_all" onclic
k="CKEDITOR.tools.callFunction(', D, ')">', t.lang.vbulletin.insert_all, '</div>
');
}
return F.join('');
};
t.ui.add('Attach', 'panelbutton', {
label: t.config.vbulletin.phrase.attachments,
title: t.config.vbulletin.phrase.attachments,
className: 'cke_button_openAttachmentWindow',
modes: {
wysiwyg: 1,
enhancedsource: 1
},
panel: {
css: t.config.vbulletin.bburl + '/css.php?sheet=bbcode.c
ss,editor.css,popupmenu.css,reset-fonts.css,vbulletin.css,vbulletin-chrome.css,v
bulletin-formcontrols.css',
attributes: {
role: 'listbox',
'aria-label': t.config.vbulletin.phrase.attachments
},
onLoad: function () {
v = B.button._.panel;
if (v) v.element.getFirst().addClass('cke_attach');
}
},
onBlock: function (F, G) {
v = F;
u = G;
u.autoSize = true;
u.element.addClass('editorpopupbody');
v.element.getFirst().addClass('cke_attach');
u.element.getDocument().getBody().setStyle('overflow', '
hidden');
if (u.element.getDocument().getHead().getChild(0)) u.ele
ment.getDocument().getHead().getChild(0).remove();
var H = u.keys,
I = t.lang.dir == 'rtl';
H[I ? 37 : 39] = 'next';
H[40] = 'next';
H[9] = 'next';
H[I ? 39 : 37] = 'prev';
H[38] = 'prev';
H[2228224 + 9] = 'prev';
H[32] = 'click';
}
});
}
});
})();
h.range.prototype.wrapSelectionWith = function (q, r) {
var v = this;
var s, t, u;
v.enlarge(1);
s = l.createFromHtml(q, v.document);
t = l.createFromHtml(r, v.document);
u = v.clone();
u.collapse();
u.insertNode(t);
if (v.collapsed) v.moveToPosition(t, 3);
u = v.clone();
u.collapse(true);
u.insertNode(s);
if (v.collapsed) v.moveToPosition(s, 4);
if (!v.collapsed) {
v.setEndBefore(t);
v.setStartAfter(s);
}
};
e.editor.prototype.getSelectedText = function () {
if (g) return this.getSelection().document.$.selection.createRange().tex
t;
else return this.getSelection().getNative();
};
e.editor.prototype.wrapSelectionWith = function (q, r) {
var u = this;
if (u.mode == 'wysiwyg') {
if (g) u.focus();
var s = u.getSelection().getRanges();
for (var t = 0; t < s.length; t++) s[t].wrapSelectionWith(q, r);
u.getSelection().selectRanges(s);
} else if (u.mode == 'enhancedsource') u.esWrapAroundSelection(q, r);
};
n.add('codetags', {
requires: ['button'],
init: function (q) {
var r = q.config.vbulletin.phrase,
s = function (A, B, C, D, E) {
q.addCommand(A, {
exec: function (G) {
if (D == '1') {
var H = prompt(G.lang.vbulletin.enter_tag_option
.replace(/\%1\$s/, '[' + C + ']'));
if (typeof H == 'string' && H.length > 0) G.wrap
SelectionWith('[' + C + '=' + H + ']', '[/' + C + ']');
else G.wrapSelectionWith('[' + C + ']', '[/' + C
+ ']');
} else G.wrapSelectionWith('[' + C + ']', '[/' + C +
']');
}
});
var F = {
label: B,
command: A
};
if (E) F.icon = E;
q.ui.addButton(A, F);
},
t = function (A, B, C) {
q.addCommand(A, {
exec: function (D) {
if (D.mode == 'wysiwyg') {
var E = D.document.getElementsByTag('hr');
for (var F = 0; F < E.count(); F++) {
var G = E.getItem(F);
if (G.hasClass('previewbreak')) {
alert(r.this_message_already_contains_a_
preview_break);
return;
}
}
}
D.insertHtml('[' + C + '][/' + C + ']');
}
});
q.ui.addButton(A, {
label: B,
command: A
});
},
u = function (A, B, C) {
q.addCommand(A, {
exec: function (D) {
D.insertHtml('[' + C + ']' + D.getSelectedText() + '
[/' + C + ']');
}
});
q.ui.addButton(A, {
label: B,
command: A
});
},
v = function (A, B) {
q.addCommand(A, {
exec: function (C) {
try {
eval("new ActiveXObject('ieSpell.ieSpellExtensio
n').CheckDocumentNode(editor.document.$.body);");
} catch (D) {
if (D.number == -2146827859 && confirm(C.lang.vb
ulletin.iespell_not_installed)) window.open('http://www.iespell.com/download.php
');
}
}
});
q.ui.addButton(A, {
label: B,
command: A
});
},
w = function (A, B) {
q.addCommand(A, {
exec: function (C) {}
});
q.ui.addButton(A, {
label: B,
command: A
});
},
r = q.config.vbulletin.phrase;
s('Quote', r.wrap_quote_tags, 'QUOTE');
s('Code', r.wrap_code_tags, 'CODE');
s('Html', r.wrap_html_tags, 'HTML');
s('Php', r.wrap_php_tags, 'PHP');
t('PreviewBreak', r.insert_preview_break, 'PRBREAK');
u('PageBreak', r.insert_page_break, 'PAGE');
v('iespell', q.lang.vbulletin.spell_check);
w('Email', q.lang.vbulletin.email);
for (var x in q.config.vbulletin.bbcodecache) {
var y = q.config.vbulletin.bbcodecache[x],
z = y.buttonimage;
if (z.indexOf(':/') == -1 && z.indexOf('/') !== 0) z = q.config.
baseHref + z;
s(y.title, r.wrap_x_tags.replace(/\%1\$s/, y.bbcodetag), y.bbcod
etag.toUpperCase(), y.twoparams, z);
}
}
});
(function () {
n.add('videotag', {
init: function (q) {
var r = 'videotag';
e.dialog.add(r, q.config.vbPluginPath + 'videotag/dialogs/videot
ag.js?v=' + SIMPLEVERSION);
q.addCommand(r, new e.dialogCommand(r));
q.ui.addButton('Video', {
label: q.config.vbulletin.phrase.insert_video,
command: r
});
}
});
})();
(function () {
n.add('tablebuttons', {
requires: ['tabletools'],
init: function (q) {
var r = q.lang.table;
q.ui.addButton('InsertRowBefore', {
label: r.row.insertBefore,
command: 'vbRowInsertBefore'
});
q.addCommand('vbRowInsertBefore', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('rowInsertBefore').exec();
}
});
q.ui.addButton('InsertRowAfter', {
label: r.row.insertAfter,
command: 'vbRowInsertAfter'
});
q.addCommand('vbRowInsertAfter', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('rowInsertAfter').exec();
}
});
q.ui.addButton('DeleteRow', {
label: r.row.deleteRow,
command: 'vbRowDelete'
});
q.addCommand('vbRowDelete', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('rowDelete').exec();
}
});
q.ui.addButton('InsertColumnBefore', {
label: r.column.insertBefore,
command: 'vbColumnInsertBefore'
});
q.addCommand('vbColumnInsertBefore', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('columnInsertBefore').exec();
}
});
q.ui.addButton('InsertColumnAfter', {
label: r.column.insertAfter,
command: 'vbColumnInsertAfter'
});
q.addCommand('vbColumnInsertAfter', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('columnInsertAfter').exec();
}
});
q.ui.addButton('DeleteColumn', {
label: r.column.deleteColumn,
command: 'vbColumnDelete'
});
q.addCommand('vbColumnDelete', {
exec: function (s) {
var t = s.getSelection(),
u = t && t.getStartElement(),
v = u && u.getAscendant('table', 1);
if (!v) return;
s.getCommand('columnDelete').exec();
}
});
q.addCommand('vbTableProperties', {
exec: function (s) {
if (g) {
s.selectedTable = null;
var t = s.getSelection(),
u = null;
if (t) {
var v = t.getRanges();
if (u = t.getSelectedElement()) s.selectedTable
= u.getAscendant('table', true);
else if (v && v.length > 0) {
if (f.webkit) v[0].shrink(1);
var w = v[0].getCommonAncestor(true);
s.selectedTable = w.getAscendant('table', tr
ue);
}
}
}
s.getCommand('tableProperties').exec();
}
});
q.ui.addButton('TableProperties', {
label: r.menu,
command: 'vbTableProperties'
});
q.ui.addButton('DeleteTable', {
label: r.deleteTable,
command: 'tableDelete'
});
}
});
})();
(function () {
n.add('smiliebox', {
init: function (q) {
var r = YAHOO.util.Dom.getElementsByClassName('smiliebox');
if (r.length > 0) YAHOO.util.Dom.getElementsBy(function (s) {
return true;
}, 'img', r[0], function (s) {
YAHOO.util.Event.addListener(s, 'click', function (t) {
q.insertHtml(YAHOO.util.Dom.getAttribute(s, 'alt'));
});
});
}
});
})();
(function () {
n.add('vbbutton', {
init: function (q) {
if (g) o.button.prototype.render = function (r, s) {
var t = f,
u = this._.id = i.getNextId(),
v = '',
w = this.command,
x;
this._.editor = r;
var y = {
id: u,
button: this,
editor: r,
focus: function () {
var E = e.document.getById(u);
E.focus();
},
execute: function () {
if (g && f.version < 7) i.setTimeout(function ()
{
this.button.click(r);
}, 0, this);
else this.button.click(r);
}
},
z = i.addFunction(function (E) {
if (y.onkey) {
E = new h.event(E);
return y.onkey(y, E.getKeystroke()) !== false;
}
}),
A = i.addFunction(function (E) {
var F;
if (y.onfocus) F = y.onfocus(y, new h.event(E)) !==
false;
if (f.gecko && f.version < 10900) E.preventBubble();
return F;
});
y.clickFn = x = i.addFunction(y.execute, y);
if (this.modes) {
var B = {};
function C() {
var E = r.mode;
if (E) {
var F = this.modes[E] ? B[E] != undefined ? B[E]
: 2 : 0;
this.setState(r.readOnly && !this.readOnly ? 0 :
F);
}
};
r.on('beforeModeUnload', function () {
if (r.mode && this._.state != 0) B[r.mode] = this._.
state;
}, this);
r.on('mode', C, this);
!this.readOnly && r.on('readOnly', C, this);
} else if (w) {
w = r.getCommand(w);
if (w) {
w.on('state', function () {
this.setState(w.state);
}, this);
v += 'cke_' + (w.state == 1 ? 'on' : w.state == 0 ?
'disabled' : 'off');
}
}
if (!w) v += 'cke_off';
if (this.className) v += ' ' + this.className;
s.push('<span class="cke_button' + (this.icon && this.icon.i
ndexOf('.png') == -1 ? ' cke_noalphafix' : '') + '">', '<a id="', u, '" class="'
, v, '"', t.gecko && t.version >= 10900 && !t.hc ? '' : '" href="javascript:void
(\'' + (this.title || '').replace("'", '') + "')\"", ' title="', this.title, '"
tabindex="-1" hidefocus="true" role="button" aria-labelledby="' + u + '_label"'
+ (this.hasArrow ? ' aria-haspopup="true"' : ''));
if (t.opera || t.gecko && t.mac) s.push(' onkeypress="return
false;"');
if (t.gecko) s.push(' onblur="this.style.cssText = this.styl
e.cssText;"');
s.push(' onkeydown="return CKEDITOR.tools.callFunction(', z,
', event);" onfocus="return CKEDITOR.tools.callFunction(', A, ', event);" ' + (
g ? 'onclick="return false;" onmouseup' : 'onclick') + '="CKEDITOR.tools.callFun
ction(', x, ', this); return false;"><span class="cke_icon"');
if (this.icon) {
if (r.lang.dir == 'rtl' && f.version < 8) var D = 'right
';
else var D = (this.iconOffset || 0) * -16 + 'px';
s.push(' style="background-image:url(', e.getUrl(this.ic
on), ');background-position:0 ' + D + ';"');
s.push('><span class="cke_icon_image custom">&nbsp;</spa
n></span><span id="', u, '_label" class="cke_label">', this.label, '</span>');
} else s.push('><span class="cke_icon_image">&nbsp;</span></
span><span id="', u, '_label" class="cke_label">', this.label, '</span>'); if (t
his.hasArrow) s.push('<span class="cke_buttonarrow">' + (f.hc ? '&#9660;' : '&nb
sp;') + '</span>');
s.push('</a>', '</span>');
if (this.onRender) this.onRender();
return y;
};
}
});
})();
(function () {
n.add('vbimage', {
init: function (q) {
q.on('doubleclick', function (s) {
s.cancel();
s.stop();
return false;
}, null, null, 1);
var r = 'vbimage';
e.dialog.add(r, q.config.vbPluginPath + 'vbimage/dialogs/image.j
s?v=' + SIMPLEVERSION);
q.addCommand(r, new e.dialogCommand(r));
q.ui.addButton('Image', {
label: q.lang.vbulletin.insert_image,
command: r
});
}
});
})();
(function () {
function q(r, s) {
s = s === undefined || s;
var t;
if (s) t = r.getComputedStyle('text-align');
else {
while (!r.hasAttribute || !(r.hasAttribute('align') || r.getStyl
e('text-align'))) {
var u = r.getParent();
if (!u) break;
r = u;
}
t = r.getStyle('text-align') || r.getAttribute('align') || '';
}
t && (t = t.replace(/-moz-|-webkit-|start|auto/i, ''));
!t && s && (t = r.getComputedStyle('direction') == 'rtl' ? 'right' :
'left');
return t;
};
n.add('vbjustify', {
requires: ['justify'],
init: function (r) {
var s = function () {
var J = this;
var x = r.getSelection(),
y = r.config.enterMode;
if (!x) return;
var z = x.createBookmarks(),
A = x.getRanges(true),
B = J.cssClassName,
C, D, E = r.config.useComputedState;
E = E === undefined || E;
for (var F = A.length - 1; F >= 0; F--) {
C = A[F].createIterator();
C.enlargeBr = y != 2;
while (D = C.getNextParagraph(y == 1 ? 'p' : 'div'))
{
D.removeAttribute('align');
D.removeStyle('text-align');
var G = B && (D.$.className = i.ltrim(D.$.classN
ame.replace(J.cssClassRegex, ''))),
H = J.state == 2 && (!E || q(D, true) != J.v
alue);
if (B) {
if (H) D.addClass(B);
else if (!G) D.removeAttribute('class');
} else if (H)
if (D.getName() == 'li') {
var I = new l('p');
I.setStyle('text-align', J.value);
I.setStyle('margin', 0);
D.moveChildren(I);
D.append(I);
} else D.setStyle('text-align', J.value);
}
}
r.focus();
r.forceNextSelectionCheck();
x.selectBookmarks(z);
},
t = r.getCommand('justifyleft'),
u = r.getCommand('justifycenter'),
v = r.getCommand('justifyright'),
w = r.getCommand('justifyblock');
if (t) t.exec = s;
if (u) u.exec = s;
if (v) v.exec = s;
if (w) w.exec = s;
r.on('mode', function () {
if (r.mode == 'wysiwyg') {
if (t) r.addCommand('justifyleft', t);
if (u) r.addCommand('justifycenter', u);
if (v) r.addCommand('justifyright', v);
if (w) r.addCommand('justifyblock', w);
}
});
}
});
})();
n.add('vblink', {
init: function (q) {
var r = 'vblink';
q.addCommand('link', new e.dialogCommand('link'));
q.addCommand('anchor', new e.dialogCommand('anchor'));
q.addCommand('unlink', new e.unlinkCommand());
q.addCommand('removeAnchor', new e.removeAnchorCommand());
q.ui.addButton('Link', {
label: q.lang.link.toolbar,
command: 'link'
});
q.ui.addButton('Unlink', {
label: q.lang.unlink,
command: 'unlink'
});
q.ui.addButton('Anchor', {
label: q.lang.anchor.toolbar,
command: 'anchor'
});
e.dialog.add('link', q.config.vbPluginPath + 'vblink/dialogs/link.js
');
e.dialog.add('anchor', q.config.vbPluginPath + 'vblink/dialogs/ancho
r.js');
var s = q.lang.dir == 'rtl' ? 'right' : 'left',
t = 'background:url(' + e.getUrl(this.path + 'images/anchor.gif'
) + ') no-repeat ' + s + ' center;' + 'border:1px dotted #00f;';
q.addCss('a.cke_anchor,a.cke_anchor_empty' + (g && f.version < 7 ? '
' : ',a[name],a[data-cke-saved-name]') + '{' + t + 'padding-' + s + ':18px;' + '
cursor:auto;' + '}' + (g ? 'a.cke_anchor_empty{display:inline-block;}' : '') + '
img.cke_anchor' + '{' + t + 'width:16px;' + 'min-height:15px;' + 'height:1.15em;
' + 'vertical-align:' + (f.opera ? 'middle' : 'text-bottom') + ';' + '}');
q.on('selectionChange', function (u) {
if (q.readOnly) return;
var v = q.getCommand('unlink');
v.setState(2);
});
q.on('doubleclick', function (u) {
var v = n.vblink.getSelectedLink(q) || u.data.element;
if (!v.isReadOnly())
if (v.is('a')) {
u.data.dialog = v.getAttribute('name') && (!v.getAttribu
te('href') || !v.getChildCount()) ? 'anchor' : 'link';
q.getSelection().selectElement(v);
} else if (n.vblink.tryRestoreFakeAnchor(q, v)) u.data.dialo
g = 'anchor';
});
if (q.addMenuItems) q.addMenuItems({
anchor: {
label: q.lang.anchor.menu,
command: 'anchor',
group: 'anchor',
order: 1
},
removeAnchor: {
label: q.lang.anchor.remove,
command: 'removeAnchor',
group: 'anchor',
order: 5
},
link: {
label: q.lang.link.menu,
command: 'link',
group: 'link',
order: 1
},
unlink: {
label: q.lang.unlink,
command: 'unlink',
group: 'link',
order: 5
}
});
if (q.contextMenu) q.contextMenu.addListener(function (u, v) {
if (!u || u.isReadOnly()) return null;
var w = n.vblink.tryRestoreFakeAnchor(q, u);
if (!w && !(w = n.vblink.getSelectedLink(q))) return null;
var x = {};
if (w.getAttribute('href') && w.getChildCount()) x = {
link: 2,
unlink: 2
};
if (w && w.hasAttribute('name')) x.anchor = x.removeAnchor = 2;
return x;
});
},
afterInit: function (q) {
var r = q.dataProcessor,
s = r && r.dataFilter,
t = r && r.htmlFilter,
u = q._.elementsPath && q._.elementsPath.filters;
if (s) s.addRules({
elements: {
a: function (v) {
var w = v.attributes;
if (!w.name) return null;
var x = !v.children.length;
if (n.vblink.synAnchorSelector) {
var y = x ? 'cke_anchor_empty' : 'cke_anchor',
z = w['class'];
if (w.name && (!z || z.indexOf(y) < 0)) w['class'] =
(z || '') + ' ' + y;
if (x && n.vblink.emptyAnchorFix) {
w.contenteditable = 'false';
w['data-cke-editable'] = 1;
}
} else if (n.vblink.fakeAnchor && x) return q.createFake
ParserElement(v, 'cke_anchor', 'anchor');
return null;
}
}
});
if (n.vblink.emptyAnchorFix && t) t.addRules({
elements: {
a: function (v) {
delete v.attributes.contenteditable;
}
}
});
if (u) u.push(function (v, w) {
if (w == 'a')
if (n.vblink.tryRestoreFakeAnchor(q, v) || v.getAttribute('n
ame') && (!v.getAttribute('href') || !v.getChildCount())) return 'anchor';
});
},
requires: ['fakeobjects']
});
n.vblink = {
getSelectedLink: function (q) {
try {
var r = q.getSelection();
if (r.getType() == 3) {
var s = r.getSelectedElement();
if (s.is('a')) return s;
}
var t = r.getRanges(true)[0];
t.shrink(2);
var u = t.getCommonAncestor();
return u.getAscendant('a', true);
} catch (v) {
return null;
}
},
fakeAnchor: f.opera || f.webkit,
synAnchorSelector: g,
emptyAnchorFix: g && f.version < 8,
tryRestoreFakeAnchor: function (q, r) {
if (r && r.data('cke-real-element-type') && r.data('cke-real-element
-type') == 'anchor') {
var s = q.restoreRealElement(r);
if (s.data('cke-saved-name')) return s;
}
}
};
e.unlinkCommand = function () {};
e.unlinkCommand.prototype = {
exec: function (q) {
var r = q.getSelection(),
s = r.createBookmarks(),
t = r.getRanges(),
u, v;
for (var w = 0; w < t.length; w++) {
u = t[w].getCommonAncestor(true);
v = u.getAscendant('a', true);
if (!v) continue;
t[w].selectNodeContents(v);
}
r.selectRanges(t);
q.document.$.execCommand('unlink', false, null);
r.selectBookmarks(s);
},
startDisabled: true
};
e.removeAnchorCommand = function () {};
e.removeAnchorCommand.prototype = {
exec: function (q) {
var r = q.getSelection(),
s = r.createBookmarks(),
t;
if (r && (t = r.getSelectedElement()) && (n.vblink.fakeAnchor && !t.
getChildCount() ? n.vblink.tryRestoreFakeAnchor(q, t) : t.is('a'))) t.remove(1);
else if (t = n.vblink.getSelectedLink(q))
if (t.hasAttribute('href')) {
t.removeAttributes({
name: 1,
'data-cke-saved-name': 1
});
t.removeClass('cke_anchor');
} else t.remove(1);
r.selectBookmarks(s);
}
};
i.extend(m, {
linkShowAdvancedTab: true,
linkShowTargetTab: true
});
(function () {
n.add('vbremoveformat', {
requires: ['selection'],
init: function (q) {
var r = q.addCommand('removeFormat', n.removeformat.commands.rem
oveformat);
r.modes = {
wysiwyg: 1,
enhancedsource: 1
};
q.ui.addButton('RemoveFormat', {
label: q.lang.removeFormat,
command: 'removeFormat'
});
q._.removeFormat = {
filters: []
};
}
});
n.removeformat = {
commands: {
removeformat: {
exec: function (q) {
if (q.mode == 'wysiwyg') {
var r = q._.removeFormatRegex || (q._.removeFormatRe
gex = new RegExp('^(?:' + q.config.removeFormatTags.replace(/,/g, '|') + ')$', '
i')),
s = q._.removeAttributes || (q._.removeAttribute
s = q.config.removeFormatAttributes.split(',')),
t = n.removeformat.filter,
u = q.getSelection().getRanges(1),
v = u.createIterator(),
w;
while (w = v.getNextRange()) {
if (!w.collapsed) w.enlarge(1);
var x = w.createBookmark(),
y = x.startNode,
z = x.endNode,
A, B = function (N) {
var O = new h.elementPath(N),
P = O.elements;
for (var Q = 1, R; R = P[Q]; Q++) {
if (R.equals(O.block) || R.equals(O.
blockLimit)) break;
if (r.test(R.getName()) && t(q, R))
N.breakParent(R);
}
};
B(y);
if (z) {
B(z);
A = y.getNextSourceNode(true, 1);
while (A) {
if (A.equals(z)) break;
var C = A.getNextSourceNode(false, 1);
if (!(A.getName() == 'img' && A.data('ck
e-realelement')) && t(q, A))
if (r.test(A.getName())) A.remove(1)
;
else {
A.removeAttributes(s);
q.fire('removeFormatCleanup', A)
;
}
A = C;
}
}
w.moveToBookmark(x);
}
q.getSelection().selectRanges(u);
} else {
var D = function (N, O, P) {
if (N.setSelectionRange) {
N.focus();
N.setSelectionRange(O, P);
} else if (N.createTextRange) {
var Q = N.createTextRange();
Q.collapse(true);
Q.moveEnd('character', P);
Q.moveStart('character', O);
Q.select();
}
},
E = function (N, O) {
D(N, O, O);
},
F = function (N, O, P) {
var Q = '[' + N + '=',
R = '[/' + N + ']';
if (typeof P == 'undefined') P = -1;
while ((startindex = PHP.stripos(O, Q)) !==
false && P != 0) {
P--;
if ((stopindex = PHP.stripos(O, R)) !==
false) {
var S = PHP.stripos(O, ']', startind
ex);
if (S !== false && S > startindex &&
S < stopindex) {
var T = O.substr(S + 1, stopinde
x - S - 1);
O = O.substr(0, startindex) + T
+ O.substr(stopindex + R.length);
} else break;
} else break;
}
return O;
},
G = function (N, O, P) {
var Q = '[' + N + ']',
R = '[/' + N + ']';
if (typeof P == 'undefined') P = -1;
while ((startindex = PHP.stripos(O, Q)) !==
false && P != 0) {
P--;
if ((stopindex = PHP.stripos(O, R)) !==
false) {
var S = O.substr(startindex + Q.leng
th, stopindex - startindex - Q.length);
O = O.substr(0, startindex) + S + O.
substr(stopindex + R.length);
} else break;
}
return O;
},
H = function (N) {
var O = ['b', 'i', 'u'],
P = ['font', 'color', 'size'];
if (!N) return N;
var Q;
for (Q in O) {
if (YAHOO.lang.hasOwnProperty(O, Q)) N =
G(O[Q], N);
}
for (Q in P) {
if (YAHOO.lang.hasOwnProperty(P, Q)) N =
F(P[Q], N);
}
return N;
},
I = q.textarea.$;
if (g) {
I.focus();
sel = document.selection.createRange();
var J = sel.text,
K = H(J);
sel.text = K;
sel.moveStart('character', -K.length);
sel.select();
} else if (I.selectionStart || I.selectionStart == '
0') {
var L = I.selectionStart,
M = I.selectionEnd,
J = I.value.substring(L, M),
K = H(J);
I.value = I.value.substring(0, L) + K + I.value.
substring(M, I.value.length);
if (L == M) E(I, L);
else D(I, L, L + K.length);
}
}
}
}
},
filter: function (q, r) {
var s = q._.removeFormat.filters;
for (var t = 0; t < s.length; t++) {
if (s[t](r) === false) return false;
}
return true;
}
};
})();
e.editor.prototype.addRemoveFormatFilter = function (q) {
this._.removeFormat.filters.push(q);
};
m.removeFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span
,strike,strong,sub,sup,tt,u,var';
m.removeFormatAttributes = 'class,style,lang,width,height,align,hspace,valig
n';
n.add('vbresize', {
init: function (q) {
if (q.config.resize_enabled !== false) q.on('resize', function () {
var r = e.document.getById('cke_contents_' + q.name),
s = r.getStyle('height');
if (s && q.config.vbtype) {
expires = new Date();
expires.setTime(expires.getTime() + 31536000000);
set_subcookie('editor_height', q.config.vbtype, s, expires);
}
});
}
});
n.add('vbsmiley', {
requires: ['dialog'],
init: function (q) {
q.config.smiley_path = q.config.smiley_path || this.path + 'images/'
;
q.addCommand('smiley', new e.dialogCommand('smiley'));
q.ui.addButton('Smiley', {
label: q.lang.smiley.toolbar,
command: 'smiley'
});
e.dialog.add('smiley', q.config.vbPluginPath + 'vbsmiley/dialogs/smi
ley.js?v=' + SIMPLEVERSION);
}
});
m.smiley_images = ['regular_smile.gif', 'sad_smile.gif', 'wink_smile.gif', '
teeth_smile.gif', 'confused_smile.gif', 'tounge_smile.gif', 'embaressed_smile.gi
f', 'omg_smile.gif', 'whatchutalkingabout_smile.gif', 'angry_smile.gif', 'angel_
smile.gif', 'shades_smile.gif', 'devil_smile.gif', 'cry_smile.gif', 'lightbulb.g
if', 'thumbs_down.gif', 'thumbs_up.gif', 'heart.gif', 'broken_heart.gif', 'kiss.
gif', 'envelope.gif'];
m.smiley_descriptions = ['smiley', 'sad', 'wink', 'laugh', 'frown', 'cheeky'
, 'blush', 'surprise', 'indecision', 'angry', 'angel', 'cool', 'devil', 'crying'
, 'enlightened', 'no', 'yes', 'heart', 'broken heart', 'kiss', 'mail'];
n.add('vbtable', {
init: function (q) {
var r = n.table,
s = q.lang.table,
t = q.addCommand('table', new e.dialogCommand('table'));
t.modes = {
wysiwyg: 1,
enhancedsource: 1
};
q.addCommand('tableProperties', new e.dialogCommand('tableProperties
'));
q.ui.addButton('Table', {
label: s.toolbar,
command: 'table'
});
e.dialog.add('table', q.config.vbPluginPath + 'vbtable/dialogs/table
.js?v=' + SIMPLEVERSION);
e.dialog.add('tableProperties', q.config.vbPluginPath + 'vbtable/dia
logs/table.js?v=' + SIMPLEVERSION);
if (q.addMenuItems) q.addMenuItems({
table: {
label: s.menu,
command: 'tableProperties',
group: 'table',
order: 5
},
tabledelete: {
label: s.deleteTable,
command: 'tableDelete',
group: 'table',
order: 1
}
});
q.on('doubleclick', function (u) {
var v = u.data.element;
if (v.is('table')) u.data.dialog = 'tableProperties';
});
if (q.contextMenu) q.contextMenu.addListener(function (u, v) {
if (!u || u.isReadOnly()) return null;
var w = u.hasAscendant('table', 1);
if (w) return {
tabledelete: 2,
table: 2
};
return null;
});
}
});
(function () {
function q(r, s, t) {
for (var u = 0; u < r.toolbox.toolbars.length; u++) {
var v = r.toolbox.toolbars[u];
for (var w = 0; w < v.items.length; w++) {
var x = v.items[w];
if (s == 'button' && x.button && x.button.label == t) return
x;
}
}
};
e.vbtextcolor = {};
n.add('vbtextcolor', {
requires: ['panelbutton', 'floatpanel', 'styles'],
init: function (r) {
var s = r.config,
t = r.lang.colorButton,
u, v, w;
r.on('instanceReady', function (A) {
var B = q(r, 'button', r.lang.colorButton.textColorTitle);
if (B) {
var C = e.document.getById(B.id);
v = C.getChild(0);
v.on('click', e.vbtextcolor.applyLastColor, null, null,
1);
w = C.getChild(2);
}
}, this);
if (!f.hc) {
x('TextColor', 'fore', t.textColorTitle);
x('BGColor', 'back', t.bgColorTitle);
}
e.vbtextcolor.setLastColor = function (A) {
e.vbtextcolor.lastColor = A;
if (w)
if (A) w.setStyle('background-color', A);
else w.removeStyle('background-color');
};
e.vbtextcolor.applyLastColor = function (A) {
if (e.vbtextcolor.lastColor) {
i.callFunction(u, e.vbtextcolor.lastColor, 'fore');
A.cancel();
A.stop();
A.data.preventDefault(true);
return false;
}
};
function x(A, B, C) {
var D = i.getNextId() + '_colorBox';
r.ui.add(A, 'panelbutton', {
label: C,
title: C,
className: 'cke_button_' + A.toLowerCase(),
modes: {
wysiwyg: 1
},
panel: {
css: r.skin.editor.css,
attributes: {
role: 'listbox',
'aria-label': t.panelTitle
}
},
onBlock: function (E, F) {
F.autoSize = true;
F.element.addClass('cke_colorblock');
F.element.setHtml(y(E, B, D));
F.element.getDocument().getBody().setStyle('overflow
', 'hidden');
o.fire('ready', this);
var G = F.keys,
H = r.lang.dir == 'rtl';
G[H ? 37 : 39] = 'next';
G[40] = 'next';
G[9] = 'next';
G[H ? 39 : 37] = 'prev';
G[38] = 'prev';
G[2228224 + 9] = 'prev';
G[32] = 'click';
},
onOpen: function () {
var E = r.getSelection(),
F = E && E.getStartElement(),
G = new h.elementPath(F),
H;
if (r.mode == 'wysiwyg') {
F = G.block || G.blockLimit || r.document.getBod
y();
do H = F && F.getComputedStyle(B == 'back' ? 'ba
ckground-color' : 'color') || 'transparent'; while (B == 'back' && H == 'transpa
rent' && F && (F = F.getParent()))
}
if (!H || H == 'transparent') H = '#FFFFFF';
this._.panel._.iframe.getFrameDocument().getById(D).
setStyle('background-color', H);
}
});
};
function y(A, B, C) {
var D = [],
E = s.colorButton_colors.split(','),
F = E.length + (s.colorButton_enableMore ? 2 : 1);
u = i.addFunction(function (L, M) {
if (L != '?') e.vbtextcolor.setLastColor(L);
else {
var N = arguments.callee;
function O(Q) {
this.removeListener('ok', O);
this.removeListener('cancel', O);
Q.name == 'ok' && N(this.getContentElement('pick
er', 'selectedColor').getValue(), M);
};
r.openDialog('colordialog', function () {
this.on('ok', O);
this.on('cancel', O);
});
return;
}
r.focus();
A.hide(false);
r.fire('saveSnapshot');
new e.style(s['colorButton_' + M + 'Style'], {
color: 'inherit'
}).remove(r.document);
if (L) {
var P = s['colorButton_' + M + 'Style'];
P.childRule = M == 'back' ? function (Q) {
return z(Q);
} : function (Q) {
return !(Q.is('a') || Q.getElementsByTag('a').co
unt()) || z(Q);
};
new e.style(P, {
color: L
}).apply(r.document);
}
r.fire('saveSnapshot');
});
D.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true
title="', t.auto, '" onclick="CKEDITOR.tools.callFunction(', u, ",null,'", B, "
');return false;\" href=\"javascript:void('", t.auto, '\')" role="option" aria-p
osinset="1" aria-setsize="', F, '"' + (r.mode != 'wysiwyg' ? ' style="display:no
ne"' : '') + '>' + '<table role="presentation" cellspacing=0 cellpadding=0 width
="100%">' + '<tr>' + '<td>' + '<span class="cke_colorbox" id="', C, '"></span></
td><td colspan=7 align=center>', t.auto, '</td></tr></table></a><table role="pre
sentation" cellspacing=0 cellpadding=0 width="100%">');
for (var G = 0; G < E.length; G++) {
if (G % 8 === 0) D.push('</tr><tr>');
var H = E[G].split('/'),
I = H[0],
J = H[1] || I;
if (!H[1]) I = '#' + I.replace(/^(.)(.)(.)$/, '$1$1$2$2$
3$3');
var K = r.lang.colors[J] || J;
D.push('<td><a class="cke_colorbox" _cke_focus=1 hidefoc
us=true title="', K, '" onclick="CKEDITOR.tools.callFunction(', u, ",'", I, "','
", B, "'); return false;\" href=\"javascript:void('", K, '\')" role="option" ari
a-posinset="', G + 2, '" aria-setsize="', F, '"><span class="cke_colorbox" style
="background-color:#', J, '"></span></a></td>');
}
if (s.colorButton_enableMore === undefined || s.colorButton_
enableMore) D.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore"
_cke_focus=1 hidefocus=true title="', t.more, '" onclick="CKEDITOR.tools.callFu
nction(', u, ",'?','", B, "');return false;\" href=\"javascript:void('", t.more,
"')\"", ' role="option" aria-posinset="', F, '" aria-setsize="', F, '">', t.mor
e, '</a></td>');
D.push('</tr></table>');
return D.join('');
};
function z(A) {
return A.getAttribute('contentEditable') == 'false' || A.get
Attribute('data-nostyle');
};
}
});
m.colorButton_colors = '000,800000,8B4513,2F4F4F,008080,000080,4B0082,69
6969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,0
08000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D
3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';
m.colorButton_foreStyle = {
element: 'span',
styles: {
color: '#(color)'
},
overrides: [{
element: 'font',
attributes: {
color: null
}
}]
};
m.colorButton_backStyle = {
element: 'span',
styles: {
'background-color': '#(color)'
}
};
})();
(function () {
n.add('vbundo', {
requires: ['selection', 'wysiwygarea', 'enhancedsourcearea'],
init: function (w) {
var x = new s(w),
y = w.addCommand('undo', {
exec: function () {
if (x.undo()) {
w.selectionChange();
this.fire('afterUndo');
}
},
state: 0,
canUndo: false
}),
z = w.addCommand('redo', {
exec: function () {
if (x.redo()) {
w.selectionChange();
this.fire('afterRedo');
}
},
state: 0,
canUndo: false
});
x.onChange = function () {
y.setState(x.undoable() ? 2 : 0);
z.setState(x.redoable() ? 2 : 0);
};
function A(B) {
if (x.enabled && B.data.command.canUndo !== false) x.save();
};
w.on('beforeCommandExec', A);
w.on('afterCommandExec', A);
w.on('saveSnapshot', function (B) {
x.save(B.data && B.data.contentOnly);
});
w.on('enhancedReady', function () {
w.textarea.on('keydown', function (B) {
if (!B.data.$.ctrlKey && !B.data.$.metaKey) x.type(B);
});
});
w.on('contentDom', function () {
w.document.on('keydown', function (B) {
if (!B.data.$.ctrlKey && !B.data.$.metaKey) x.type(B);
});
w.textarea.on('keydown', function (B) {
if (!B.data.$.ctrlKey && !B.data.$.metaKey) x.type(B);
});
});
w.on('beforeModeUnload', function () {
(w.mode == 'wysiwyg' || w.mode == 'enhancedsource') && x.sav
e(true);
});
w.on('mode', function () {
x.enabled = w.readOnly ? false : w.mode == 'wysiwyg' || w.mo
de == 'enhancedsource';
x.reset();
x.onChange();
});
w.ui.addButton('Undo', {
label: w.lang.undo,
command: 'undo'
});
w.ui.addButton('Redo', {
label: w.lang.redo,
command: 'redo'
});
w.resetUndo = function () {
x.reset();
w.fire('saveSnapshot');
};
w.on('updateSnapshot', function () {
if (x.currentImage) x.update();
});
}
});
n.undo = {};
var q = n.undo.Image = function (w) {
this.editor = w;
w.fire('beforeUndoImage');
var x = w.getSnapshot(),
y = x && w.getSelection();
g && x && (x = x.replace(/\s+data-cke-expando=".*?"/g, ''));
this.contents = x;
this.bookmarks = y && y.createBookmarks2(true);
w.fire('afterUndoImage');
},
r = /\b(?:href|src|name)="[^"]*?"/gi;
q.prototype = {
equals: function (w, x) {
var y = this.contents,
z = w.contents;
if (g && (f.ie7Compat || f.ie6Compat)) {
y = y.replace(r, '');
z = z.replace(r, '');
}
if (y != z) return false;
if (x) return true;
var A = this.bookmarks,
B = w.bookmarks;
if (A || B) {
if (!A || !B || A.length != B.length) return false;
for (var C = 0; C < A.length; C++) {
var D = A[C],
E = B[C];
if (D.startOffset != E.startOffset || D.endOffset != E.e
ndOffset || !i.arrayCompare(D.start, E.start) || !i.arrayCompare(D.end, E.end))
return false;
}
}
return true;
}
};
function s(w) {
this.editor = w;
this.reset();
};
var t = {
8: 1,
46: 1
},
u = {
16: 1,
17: 1,
18: 1
},
v = {
37: 1,
38: 1,
39: 1,
40: 1
};
s.prototype = {
type: function (w) {
var x = w && w.data.getKey(),
y = x in u,
z = x in t,
A = this.lastKeystroke in t,
B = z && x == this.lastKeystroke,
C = x in v,
D = this.lastKeystroke in v,
E = !z && !C,
F = z && !B,
G = !(y || this.typing) || E && (A || D);
if (G || F) {
var H = new q(this.editor);
i.setTimeout(function () {
var J = this;
var I = J.editor.getSnapshot();
if (g) I = I.replace(/\s+data-cke-expando=".*?"/g, '');
if (H.contents != I) {
J.typing = true;
if (!J.save(false, H, false)) J.snapshots.splice(J.i
ndex + 1, J.snapshots.length - J.index - 1);
J.hasUndo = true;
J.hasRedo = false;
J.typesCount = 1;
J.modifiersCount = 1;
J.onChange();
}
}, 0, this);
}
this.lastKeystroke = x;
if (z) {
this.typesCount = 0;
this.modifiersCount++;
if (this.modifiersCount > 25) {
this.save(false, null, false);
this.modifiersCount = 1;
}
} else if (!C) {
this.modifiersCount = 0;
this.typesCount++;
if (this.typesCount > 25) {
this.save(false, null, false);
this.typesCount = 1;
}
}
},
reset: function () {
var w = this;
w.lastKeystroke = 0;
w.snapshots = [];
w.index = -1;
w.limit = w.editor.config.undoStackSize || 20;
w.currentImage = null;
w.hasUndo = false;
w.hasRedo = false;
w.resetType();
},
resetType: function () {
var w = this;
w.typing = false;
delete w.lastKeystroke;
w.typesCount = 0;
w.modifiersCount = 0;
},
fireChange: function () {
var w = this;
w.hasUndo = !!w.getNextImage(true);
w.hasRedo = !!w.getNextImage(false);
w.resetType();
w.onChange();
},
save: function (w, x, y) {
var A = this;
var z = A.snapshots;
if (!x) x = new q(A.editor);
if (x.contents === false) return false;
if (A.currentImage && x.equals(A.currentImage, w)) return false;
z.splice(A.index + 1, z.length - A.index - 1);
if (z.length == A.limit) z.shift();
A.index = z.push(x) - 1;
A.currentImage = x;
if (y !== false) A.fireChange();
return true;
},
restoreImage: function (w) {
var y = this;
y.editor.loadSnapshot(w.contents);
if (w.bookmarks) y.editor.getSelection().selectBookmarks(w.bookm
arks);
else if (g) {
var x = document.body.createTextRange();
x.collapse(true);
x.select();
}
y.index = w.index;
y.update();
y.fireChange();
},
getNextImage: function (w) {
var B = this;
var x = B.snapshots,
y = B.currentImage,
z, A;
if (y)
if (w)
for (A = B.index - 1; A >= 0; A--) {
z = x[A];
if (!y.equals(z, true)) {
z.index = A;
return z;
}
} else
for (A = B.index + 1; A < x.length; A++) {
z = x[A];
if (!y.equals(z, true)) {
z.index = A;
return z;
}
}
return null;
},
redoable: function () {
return this.enabled && this.hasRedo;
},
undoable: function () {
return this.enabled && this.hasUndo;
},
undo: function () {
var x = this;
if (x.undoable()) {
x.save(true);
var w = x.getNextImage(true);
if (w) return x.restoreImage(w), true;
}
return false;
},
redo: function () {
var x = this;
if (x.redoable()) {
x.save(true);
if (x.redoable()) {
var w = x.getNextImage(false);
if (w) return x.restoreImage(w), true;
}
}
return false;
},
update: function () {
var w = this;
w.snapshots.splice(w.index, 1, w.currentImage = new q(w.editor))
;
}
};
})();
})();

Vous aimerez peut-être aussi