/, '');
- o.content = o.content.replace(/<\/pre>\s*$/, '');
-
- if (o.set)
- o.content = '' + o.content + '
';
- });
- }
-
- if (s.verify_css_classes) {
- t.serializer.attribValueFilter = function(n, v) {
- var s, cl;
-
- if (n == 'class') {
- // Build regexp for classes
- if (!t.classesRE) {
- cl = t.dom.getClasses();
-
- if (cl.length > 0) {
- s = '';
-
- each (cl, function(o) {
- s += (s ? '|' : '') + o['class'];
- });
-
- t.classesRE = new RegExp('(' + s + ')', 'gi');
- }
- }
-
- return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';
- }
-
- return v;
- };
- }
-
- if (s.convert_fonts_to_spans)
- t._convertFonts();
-
- if (s.inline_styles)
- t._convertInlineElements();
-
- if (s.cleanup_callback) {
- t.onSetContent.add(function(ed, o) {
- if (o.initial) {
- t.setContent(t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o), {format : 'raw', no_events : true});
- t.execCallback('cleanup_callback', 'insert_to_editor_dom', t.getDoc(), o);
- }
- });
-
- t.onPreProcess.add(function(ed, o) {
- if (o.set)
- t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);
-
- if (o.get)
- t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);
- });
-
- t.onPostProcess.add(function(ed, o) {
- if (o.set)
- o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
-
- if (o.get)
- o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);
- });
- }
-
- if (s.save_callback) {
- t.onGetContent.add(function(ed, o) {
- if (o.save)
- o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());
- });
- }
-
- if (s.handle_event_callback) {
- t.onEvent.add(function(ed, e, o) {
- if (t.execCallback('handle_event_callback', e, ed, o) === false)
- Event.cancel(e);
- });
- }
-
- t.onSetContent.add(function() {
- // Safari needs some time, it will crash the browser when a link is created otherwise
- // I think this crash issue is resolved in the latest 3.0.4
- //window.setTimeout(function() {
- t.addVisual(t.getBody());
- //}, 1);
- });
-
- // Remove empty contents
- if (s.padd_empty_editor) {
- t.onPostProcess.add(function(ed, o) {
- o.content = o.content.replace(/^( |#160;|\s)<\/p>$/, '');
- });
- }
-
- // A small timeout was needed since firefox will remove. Bug: #1838304
- setTimeout(function () {
- if (t.removed)
- return;
-
- t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
- t.startContent = t.getContent({format : 'raw'});
- t.undoManager.add({initial : true});
- t.initialized = true;
-
- t.onInit.dispatch(t);
- t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());
- t.execCallback('init_instance_callback', t);
- t.focus(true);
- t.nodeChanged({initial : 1});
-
- // Load specified content CSS last
- if (s.content_css) {
- tinymce.each(s.content_css.split(','), function(u) {
- t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
- });
- }
-
- // Handle auto focus
- if (s.auto_focus) {
- setTimeout(function () {
- var ed = EditorManager.get(s.auto_focus);
-
- ed.selection.select(ed.getBody(), 1);
- ed.selection.collapse(1);
- ed.getWin().focus();
- }, 100);
- }
- }, 1);
-
- e = null;
- },
-
-
- focus : function(sf) {
- var oed, t = this;
-
- if (!sf) {
- t.getWin().focus();
-
- }
-
- if (EditorManager.activeEditor != t) {
- if ((oed = EditorManager.activeEditor) != null)
- oed.onDeactivate.dispatch(oed, t);
-
- t.onActivate.dispatch(t, oed);
- }
-
- EditorManager._setActive(t);
- },
-
- execCallback : function(n) {
- var t = this, f = t.settings[n], s;
-
- if (!f)
- return;
-
- // Look through lookup
- if (t.callbackLookup && (s = t.callbackLookup[n])) {
- f = s.func;
- s = s.scope;
- }
-
- if (is(f, 'string')) {
- s = f.replace(/\.\w+$/, '');
- s = s ? tinymce.resolve(s) : 0;
- f = tinymce.resolve(f);
- t.callbackLookup = t.callbackLookup || {};
- t.callbackLookup[n] = {func : f, scope : s};
- }
-
- return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
- },
-
- translate : function(s) {
- var c = this.settings.language, i18n = EditorManager.i18n;
-
- if (!s)
- return '';
-
- return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
- return i18n[c + '.' + b] || '{#' + b + '}';
- });
- },
-
- getLang : function(n, dv) {
- return EditorManager.i18n[this.settings.language + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
- },
-
- getParam : function(n, dv) {
- return is(this.settings[n]) ? this.settings[n] : dv;
- },
-
- nodeChanged : function(o) {
- var t = this, s = t.selection, n = s.getNode() || this.getBody();
-
- this.onNodeChange.dispatch(
- t,
- o ? o.controlManager || t.controlManager : t.controlManager,
- isIE && n.ownerDocument != t.getDoc() ? this.getBody() : n, // Fix for IE initial state
- s.isCollapsed(),
- o
- );
- },
-
- addButton : function(n, s) {
- var t = this;
-
- t.buttons = t.buttons || {};
- t.buttons[n] = s;
- },
-
- addCommand : function(n, f, s) {
- this.execCommands[n] = {func : f, scope : s || this};
- },
-
- addQueryStateHandler : function(n, f, s) {
- this.queryStateCommands[n] = {func : f, scope : s || this};
- },
-
- addQueryValueHandler : function(n, f, s) {
- this.queryValueCommands[n] = {func : f, scope : s || this};
- },
-
- addShortcut : function(pa, desc, cmd_func, sc) {
- var t = this, c;
-
- if (!t.settings.custom_shortcuts)
- return false;
-
- t.shortcuts = t.shortcuts || {};
-
- if (is(cmd_func, 'string')) {
- c = cmd_func;
-
- cmd_func = function() {
- t.execCommand(c, false, null);
- };
- }
-
- if (is(cmd_func, 'object')) {
- c = cmd_func;
-
- cmd_func = function() {
- t.execCommand(c[0], c[1], c[2]);
- };
- }
-
- each(pa.split(','), function(pa) {
- var o = {
- func : cmd_func,
- scope : sc || this,
- desc : desc,
- alt : false,
- ctrl : false,
- shift : false
- };
-
- each(pa.split('+'), function(v) {
- switch (v) {
- case 'alt':
- case 'ctrl':
- case 'shift':
- o[v] = true;
- break;
-
- default:
- o.charCode = v.charCodeAt(0);
- o.keyCode = v.toUpperCase().charCodeAt(0);
- }
- });
-
- t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;
- });
-
- return true;
- },
-
- execCommand : function(cmd, ui, val, a) {
- var t = this, s = 0, o;
-
- if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))
- t.focus();
-
- o = {};
- t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);
- if (o.terminate)
- return false;
-
- // Comamnd callback
- if (t.execCallback('execcommand_callback', null, t.id, t.selection.getNode(), cmd, ui, val)) {
- t.onExecCommand.dispatch(t, cmd, ui, val);
- return true;
- }
-
- // Registred commands
- if (o = t.execCommands[cmd]) {
- s = o.func.call(o.scope, ui, val);
- t.onExecCommand.dispatch(t, cmd, ui, val);
- return s;
- }
-
- // Plugin commands
- each(t.plugins, function(p) {
- if (p.execCommand && p.execCommand(cmd, ui, val)) {
- t.onExecCommand.dispatch(t, cmd, ui, val);
- s = 1;
- return false;
- }
- });
-
- if (s)
- return true;
-
- // Theme commands
- if (t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {
- t.onExecCommand.dispatch(t, cmd, ui, val);
- return true;
- }
-
- // Editor commands
- if (t.editorCommands.execCommand(cmd, ui, val)) {
- t.onExecCommand.dispatch(t, cmd, ui, val);
- return true;
- }
-
- // Browser commands
- t.getDoc().execCommand(cmd, ui, val);
- t.onExecCommand.dispatch(t, cmd, ui, val);
- },
-
- queryCommandState : function(c) {
- var t = this, o;
-
- // Is hidden then return undefined
- if (t._isHidden())
- return;
-
- // Registred commands
- if (o = t.queryStateCommands[c])
- return o.func.call(o.scope);
-
- // Registred commands
- o = t.editorCommands.queryCommandState(c);
- if (o !== -1)
- return o;
-
- // Browser commands
- return this.getDoc().queryCommandState(c);
- },
-
- queryCommandValue : function(c) {
- var t = this, o;
-
- // Is hidden then return undefined
- if (t._isHidden())
- return;
-
- // Registred commands
- if (o = t.queryValueCommands[c])
- return o.func.call(o.scope);
-
- // Registred commands
- o = t.editorCommands.queryCommandValue(c);
- if (is(o))
- return o;
-
- // Browser commands
- return this.getDoc().queryCommandValue(c);
- },
-
- show : function() {
- var t = this;
-
- DOM.show(t.getContainer());
- DOM.hide(t.id);
- t.load();
- },
-
- hide : function() {
- var t = this, s = t.settings, d = t.getDoc();
-
- // Fixed bug where IE has a blinking cursor left from the editor
- if (isIE && d)
- d.execCommand('SelectAll');
-
- DOM.hide(t.getContainer());
- DOM.setStyle(s.id, 'display', t.orgDisplay);
- t.save();
- },
-
- isHidden : function() {
- return !DOM.isHidden(this.id);
- },
-
- setProgressState : function(b, ti, o) {
- this.onSetProgressState.dispatch(this, b, ti, o);
-
- return b;
- },
-
- remove : function() {
- var t = this;
-
- t.removed = 1; // Cancels post remove event execution
- t.hide();
- DOM.remove(t.getContainer());
-
- t.execCallback('remove_instance_callback', t);
- t.onRemove.dispatch(t);
-
- EditorManager.remove(t);
- },
-
- resizeToContent : function() {
- var t = this;
-
- DOM.setStyle(t.id + "_ifr", 'height', t.getBody().scrollHeight);
- },
-
- load : function(o) {
- var t = this, e = t.getElement(), h;
-
- o = o || {};
- o.load = true;
-
- h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
- o.element = e;
-
- if (!o.no_events)
- t.onLoadContent.dispatch(t, o);
-
- o.element = e = null;
-
- return h;
- },
-
- save : function(o) {
- var t = this, e = t.getElement(), h, f;
-
- if (!t.initialized)
- return;
-
- o = o || {};
- o.save = true;
-
- o.element = e;
- h = o.content = t.getContent(o);
-
- if (!o.no_events)
- t.onSaveContent.dispatch(t, o);
-
- h = o.content;
-
- if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {
- e.innerHTML = h;
-
- // Update hidden form element
- if (f = DOM.getParent(t.id, 'form')) {
- each(f.elements, function(e) {
- if (e.name == t.id) {
- e.value = h;
- return false;
- }
- });
- }
- } else
- e.value = h;
-
- o.element = e = null;
-
- return h;
- },
-
- setContent : function(h, o) {
- var t = this;
-
- o = o || {};
- o.format = o.format || 'html';
- o.set = true;
- o.content = h;
-
- if (!o.no_events)
- t.onBeforeSetContent.dispatch(t, o);
-
- // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
- // It will also be impossible to place the caret in the editor unless there is a BR element present
- if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
- o.content = t.dom.setHTML(t.getBody(), '
', 1);
- o.format = 'raw';
- }
-
- o.content = t.dom.setHTML(t.getBody(), o.content);
-
- if (o.format != 'raw' && t.settings.cleanup) {
- o.getInner = true;
- o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));
- }
-
- if (!o.no_events)
- t.onSetContent.dispatch(t, o);
-
- return o.content;
- },
-
- getContent : function(o) {
- var t = this, h;
-
- o = o || {};
- o.format = o.format || 'html';
- o.get = true;
-
- if (!o.no_events)
- t.onBeforeGetContent.dispatch(t, o);
-
- if (o.format != 'raw' && t.settings.cleanup) {
- o.getInner = true;
- h = t.serializer.serialize(t.getBody(), o);
- } else
- h = t.getBody().innerHTML;
-
- h = h.replace(/^\s*|\s*$/g, '');
- o = {content : h};
- t.onGetContent.dispatch(t, o);
-
- return o.content;
- },
-
- isDirty : function() {
- var t = this;
-
- return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;
- },
-
- getContainer : function() {
- var t = this;
-
- if (!t.container)
- t.container = DOM.get(t.editorContainer || t.id + '_parent');
-
- return t.container;
- },
-
- getContentAreaContainer : function() {
- return this.contentAreaContainer;
- },
-
- getElement : function() {
- return DOM.get(this.settings.content_element || this.id);
- },
-
- getWin : function() {
- var t = this, e;
-
- if (!t.contentWindow) {
- e = DOM.get(t.id + "_ifr");
-
- if (e)
- t.contentWindow = e.contentWindow;
- }
-
- return t.contentWindow;
- },
-
- getDoc : function() {
- var t = this, w;
-
- if (!t.contentDocument) {
- w = this.getWin();
-
- if (w)
- t.contentDocument = w.document;
- }
-
- return t.contentDocument;
- },
-
- getBody : function() {
- return this.bodyElement || this.getDoc().body;
- },
-
- convertURL : function(u, n, e) {
- var t = this, s = t.settings;
-
- // Use callback instead
- if (s.urlconverter_callback)
- return t.execCallback('urlconverter_callback', u, e, true, n);
-
- // Don't convert link href since thats the CSS files that gets loaded into the editor
- if (!s.convert_urls || (e && e.nodeName == 'LINK'))
- return u;
-
- // Convert to relative
- if (s.relative_urls)
- return t.documentBaseURI.toRelative(u);
-
- // Convert to absolute
- u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);
-
- return u;
- },
-
- addVisual : function(e) {
- var t = this, s = t.settings;
-
- e = e || t.getBody();
-
- if (!is(t.hasVisual))
- t.hasVisual = s.visual;
-
- each(t.dom.select('table,a', e), function(e) {
- var v;
-
- switch (e.nodeName) {
- case 'TABLE':
- v = t.dom.getAttrib(e, 'border');
-
- if (!v || v == '0') {
- if (t.hasVisual)
- t.dom.addClass(e, s.visual_table_class);
- else
- t.dom.removeClass(e, s.visual_table_class);
- }
-
- return;
-
- case 'A':
- v = t.dom.getAttrib(e, 'name');
-
- if (v) {
- if (t.hasVisual)
- t.dom.addClass(e, 'mceItemAnchor');
- else
- t.dom.removeClass(e, 'mceItemAnchor');
- }
-
- return;
- }
- });
-
- t.onVisualAid.dispatch(t, e, t.hasVisual);
- },
-
- // Internal functions
-
- _addEvents : function() {
- // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
- var t = this, i, s = t.settings, lo = {
- mouseup : 'onMouseUp',
- mousedown : 'onMouseDown',
- click : 'onClick',
- keyup : 'onKeyUp',
- keydown : 'onKeyDown',
- keypress : 'onKeyPress',
- submit : 'onSubmit',
- reset : 'onReset',
- contextmenu : 'onContextMenu',
- dblclick : 'onDblClick',
- paste : 'onPaste' // Doesn't work in all browsers yet
- };
-
- function eventHandler(e, o) {
- var ty = e.type;
-
- // Don't fire events when it's removed
- if (t.removed)
- return;
-
- // Generic event handler
- if (t.onEvent.dispatch(t, e, o) !== false) {
- // Specific event handler
- t[lo[e.fakeType || e.type]].dispatch(t, e, o);
- }
- };
-
- // Add DOM events
- each(lo, function(v, k) {
- switch (k) {
- case 'contextmenu':
- if (tinymce.isOpera) {
- // Fake contextmenu on Opera
- Event.add(t.getDoc(), 'mousedown', function(e) {
- if (e.ctrlKey) {
- e.fakeType = 'contextmenu';
- eventHandler(e);
- }
- });
- } else
- Event.add(t.getDoc(), k, eventHandler);
- break;
-
- case 'paste':
- Event.add(t.getBody(), k, function(e) {
- var tx, h, el, r;
-
- // Get plain text data
- if (e.clipboardData)
- tx = e.clipboardData.getData('text/plain');
- else if (tinymce.isIE)
- tx = t.getWin().clipboardData.getData('Text');
-
- // Get HTML data
- /*if (tinymce.isIE) {
- el = DOM.add(document.body, 'div', {style : 'visibility:hidden;overflow:hidden;position:absolute;width:1px;height:1px'});
- r = document.body.createTextRange();
- r.moveToElementText(el);
- r.execCommand('Paste');
- h = el.innerHTML;
- DOM.remove(el);
- }*/
-
- eventHandler(e, {text : tx, html : h});
- });
- break;
-
- case 'submit':
- case 'reset':
- Event.add(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
- break;
-
- default:
- Event.add(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
- }
- });
-
- Event.add(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
- t.focus(true);
- });
-
- // Fixes bug where a specified document_base_uri could result in broken images
- // This will also fix drag drop of images in Gecko
- if (tinymce.isGecko) {
- // Convert all images to absolute URLs
-/* t.onSetContent.add(function(ed, o) {
- each(ed.dom.select('img'), function(e) {
- var v;
-
- if (v = e.getAttribute('mce_src'))
- e.src = t.documentBaseURI.toAbsolute(v);
- })
- });*/
-
- Event.add(t.getDoc(), 'DOMNodeInserted', function(e) {
- var v;
-
- e = e.target;
-
- if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src')))
- e.src = t.documentBaseURI.toAbsolute(v);
- });
- }
-
- // Set various midas options in Gecko
- if (isGecko) {
- function setOpts() {
- var t = this, d = t.getDoc(), s = t.settings;
-
- if (isGecko) {
- if (t._isHidden()) {
- try {
- d.designMode = 'On';
- } catch (ex) {
- // Fails if it's hidden
- }
- }
-
- try {
- // Try new Gecko method
- d.execCommand("styleWithCSS", 0, false);
- } catch (ex) {
- // Use old method
- if (!t._isHidden())
- d.execCommand("useCSS", 0, true);
- }
-
- if (!s.table_inline_editing)
- try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
-
- if (!s.object_resizing)
- try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
- }
- };
-
- t.onBeforeExecCommand.add(setOpts);
- t.onMouseDown.add(setOpts);
- }
-
- // Add node change handlers
- t.onMouseUp.add(t.nodeChanged);
- t.onClick.add(t.nodeChanged);
- t.onKeyUp.add(function(ed, e) {
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.keyCode == 46 || e.keyCode == 8 || e.ctrlKey)
- t.nodeChanged();
- });
-
- // Add reset handler
- t.onReset.add(function() {
- t.setContent(t.startContent, {format : 'raw'});
- });
-
- if (t.getParam('tab_focus')) {
- function tabCancel(ed, e) {
- if (e.keyCode === 9)
- return Event.cancel(e);
- };
-
- function tabHandler(ed, e) {
- var v, f, el;
-
- if (e.keyCode === 9) {
- v = ed.getParam('tab_focus');
-
- if (v == ':next') {
- f = DOM.getParent(ed.id, 'form');
-
- if (f) {
- each(f.elements, function(e, i) {
- if (e.id == ed.id)
- el = f.elements[i + 1];
- });
- }
- } else
- el = DOM.get(v);
-
- if (el) {
- window.setTimeout(function() {window.focus();el.focus();}, 10);
- return Event.cancel(e);
- }
- }
- };
-
- t.onKeyUp.add(tabCancel);
-
- if (isGecko) {
- t.onKeyPress.add(tabHandler);
- t.onKeyDown.add(tabCancel);
- } else
- t.onKeyDown.add(tabHandler);
- }
-
- // Add shortcuts
- if (s.custom_shortcuts) {
- if (s.custom_undo_redo_keyboard_shortcuts) {
- t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');
- t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');
- }
-
- // Add default shortcuts for gecko
- if (isGecko) {
- t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');
- t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');
- t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');
- }
-
- // BlockFormat shortcuts keys
- for (i=1; i<=6; i++)
- t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '']);
-
- t.addShortcut('ctrl+7', '', ['FormatBlock', false, '']);
- t.addShortcut('ctrl+8', '', ['FormatBlock', false, '
']);
- t.addShortcut('ctrl+9', '', ['FormatBlock', false, '
']);
-
- function find(e) {
- var v = null;
-
- if (!e.altKey && !e.ctrlKey && !e.metaKey)
- return v;
-
- each(t.shortcuts, function(o) {
- if (o.ctrl != e.ctrlKey && (!tinymce.isMac || o.ctrl == e.metaKey))
- return;
-
- if (o.alt != e.altKey)
- return;
-
- if (o.shift != e.shiftKey)
- return;
-
- if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
- v = o;
- return false;
- }
- });
-
- return v;
- };
-
- t.onKeyUp.add(function(ed, e) {
- var o = find(e);
-
- if (o)
- return Event.cancel(e);
- });
-
- t.onKeyPress.add(function(ed, e) {
- var o = find(e);
-
- if (o)
- return Event.cancel(e);
- });
-
- t.onKeyDown.add(function(ed, e) {
- var o = find(e);
-
- if (o) {
- o.func.call(o.scope);
- return Event.cancel(e);
- }
- });
- }
-
- if (tinymce.isIE) {
- // Fix so resize will only update the width and height attributes not the styles of an image
- // It will also block mceItemNoResize items
- Event.add(t.getDoc(), 'controlselect', function(e) {
- var re = t.resizeInfo, cb;
-
- e = e.target;
-
- if (re)
- Event.remove(re.node, re.ev, re.cb);
-
- if (!t.dom.hasClass(e, 'mceItemNoResize')) {
- ev = 'resizeend';
- cb = Event.add(e, ev, function(e) {
- var v;
-
- e = e.target;
-
- if (v = t.dom.getStyle(e, 'width')) {
- t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
- t.dom.setStyle(e, 'width', '');
- }
-
- if (v = t.dom.getStyle(e, 'height')) {
- t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
- t.dom.setStyle(e, 'height', '');
- }
- });
- } else {
- ev = 'resizestart';
- cb = Event.add(e, 'resizestart', Event.cancel, Event);
- }
-
- re = t.resizeInfo = {
- node : e,
- ev : ev,
- cb : cb
- };
- });
-
- t.onKeyDown.add(function(ed, e) {
- switch (e.keyCode) {
- case 8:
- // Fix IE control + backspace browser bug
- if (t.selection.getRng().item) {
- t.selection.getRng().item(0).removeNode();
- return Event.cancel(e);
- }
- }
- });
- }
-
- if (tinymce.isOpera) {
- t.onClick.add(function(ed, e) {
- Event.prevent(e);
- });
- }
-
- // Add custom undo/redo handlers
- if (s.custom_undo_redo) {
- function addUndo() {
- t.undoManager.typing = 0;
- t.undoManager.add();
- };
-
- // Add undo level on editor blur
- if (tinymce.isIE) {
- Event.add(t.getWin(), 'blur', function(e) {
- var n;
-
- // Check added for fullscreen bug
- if (t.selection) {
- n = t.selection.getNode();
-
- // Add undo level is selection was lost to another document
- if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc())
- addUndo();
- }
- });
- } else {
- Event.add(t.getDoc(), 'blur', function() {
- if (t.selection && !t.removed)
- addUndo();
- });
- }
-
- t.onMouseDown.add(addUndo);
-
- t.onKeyUp.add(function(ed, e) {
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) {
- t.undoManager.typing = 0;
- t.undoManager.add();
- }
- });
-
- t.onKeyDown.add(function(ed, e) {
- // Is caracter positon keys
- if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
- if (t.undoManager.typing) {
- t.undoManager.add();
- t.undoManager.typing = 0;
- }
-
- return;
- }
-
- if (!t.undoManager.typing) {
- t.undoManager.add();
- t.undoManager.typing = 1;
- }
- });
- }
- },
-
- _destroy : function() {
- var t = this;
-
- if (t.formElement) {
- t.formElement.submit = t.formElement._mceOldSubmit;
- t.formElement._mceOldSubmit = null;
- }
-
- t.contentAreaContainer = t.formElement = t.container = t.contentDocument = t.contentWindow = null;
-
- if (t.selection)
- t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
-
- t.destroyed = 1;
- },
-
- _convertInlineElements : function() {
- var t = this, s = t.settings, dom = t.dom;
-
- function convert(ed, o) {
- if (!s.inline_styles)
- return;
-
- if (o.get) {
- each(t.dom.select('table,u,strike', o.node), function(n) {
- switch (n.nodeName) {
- case 'TABLE':
- if (v = dom.getAttrib(n, 'height')) {
- dom.setStyle(n, 'height', v);
- dom.setAttrib(n, 'height', '');
- }
- break;
-
- case 'U':
- dom.replace(dom.create('span', {style : 'text-decoration: underline;'}), n, 1);
- break;
-
- case 'STRIKE':
- dom.replace(dom.create('span', {style : 'text-decoration: line-through;'}), n, 1);
- break;
- }
- });
- } else if (o.set) {
- each(t.dom.select('table,span', o.node), function(n) {
- if (n.nodeName == 'TABLE') {
- if (v = dom.getStyle(n, 'height'))
- dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, ''));
- } else {
- // Convert spans to elements
- if (n.style.textDecoration == 'underline')
- dom.replace(dom.create('u'), n, 1);
- else if (n.style.textDecoration == 'line-through')
- dom.replace(dom.create('strike'), n, 1);
- }
- });
- }
- };
-
- t.onPreProcess.add(convert);
-
- if (!s.cleanup_on_startup) {
- t.onInit.add(function() {
- convert(t, {node : t.getBody(), set : 1});
- });
- }
- },
-
- _convertFonts : function() {
- var t = this, s = t.settings, dom = t.dom, sl, cl, fz, fzn, v, i;
-
- // Font pt values and font size names
- fz = [8, 10, 12, 14, 18, 24, 36];
- fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
-
- if (sl = s.font_size_style_values)
- sl = sl.split(',');
-
- if (cl = s.font_size_classes)
- cl = cl.split(',');
-
- t.onPreProcess.add(function(ed, o) {
- if (!s.inline_styles)
- return;
-
- if (o.set) {
- // Convert spans to fonts on non WebKit browsers
- if (tinymce.isWebKit)
- return;
-
- each(t.dom.select('span', o.node), function(n) {
- var f = dom.create('font', {
- color : dom.toHex(dom.getStyle(n, 'color')),
- face : dom.getStyle(n, 'fontFamily')
- });
-
- if (sl) {
- i = inArray(sl, dom.getStyle(n, 'fontSize'));
-
- if (i != -1)
- dom.setAttrib(f, 'size', '' + (i + 1 || 1));
- } else if (cl) {
- i = inArray(cl, dom.getAttrib(n, 'class'));
-
- v = dom.getStyle(n, 'fontSize');
-
- if (i == -1 && v.indexOf('pt') > 0)
- i = inArray(fz, parseInt(v));
-
- if (i == -1)
- i = inArray(fzn, v);
-
- if (i != -1)
- dom.setAttrib(f, 'size', '' + (i + 1 || 1));
- }
-
- if (f.color || f.face || f.size)
- dom.replace(f, n, 1);
- });
- } else if (o.get) {
- each(t.dom.select('font', o.node), function(n) {
- var sp = dom.create('span', {
- style : {
- fontFamily : dom.getAttrib(n, 'face'),
- color : dom.getAttrib(n, 'color'),
- backgroundColor : n.style.backgroundColor
- }
- });
-
- if (n.size) {
- if (sl)
- dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
- else
- dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
- }
-
- dom.replace(sp, n, 1);
- });
- }
- });
- },
-
- _isHidden : function() {
- var s;
-
- if (!isGecko)
- return 0;
-
- // Weird, wheres that cursor selection?
- s = this.selection.getSel();
- return (!s || !s.rangeCount || s.rangeCount == 0);
- },
-
- _fixNesting : function(s) {
- var d = [], i;
-
- s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {
- var e;
-
- // Handle end element
- if (b === '/') {
- if (!d.length)
- return '';
-
- if (c !== d[d.length - 1].tag) {
- for (i=d.length - 1; i>=0; i--) {
- if (d[i].tag === c) {
- d[i].close = 1;
- break;
- }
- }
-
- return '';
- } else {
- d.pop();
-
- if (d.length && d[d.length - 1].close) {
- a = a + '' + d[d.length - 1].tag + '>';
- d.pop();
- }
- }
- } else {
- // Ignore these
- if (/^(br|hr|input|meta|img|link|param)$/i.test(c))
- return a;
-
- // Ignore closed ones
- if (/\/>$/.test(a))
- return a;
-
- d.push({tag : c}); // Push start element
- }
-
- return a;
- });
-
- // End all open tags
- for (i=d.length - 1; i>=0; i--)
- s += '' + d[i].tag + '>';
-
- return s;
- }
-
- });
-})();
-
-/* file:jscripts/tiny_mce/classes/EditorCommands.js */
-
-(function() {
- var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
-
- tinymce.create('tinymce.EditorCommands', {
- EditorCommands : function(ed) {
- this.editor = ed;
- },
-
- execCommand : function(cmd, ui, val) {
- var t = this, ed = t.editor, f;
-
- switch (cmd) {
- case 'Cut':
- case 'Copy':
- case 'Paste':
- try {
- ed.getDoc().execCommand(cmd, ui, val);
- } catch (ex) {
- if (isGecko) {
- ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) {
- if (s)
- window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', 'mceExternal');
- });
- } else
- ed.windowManager.alert(ed.getLang('clipboard_no_support'));
- }
-
- return true;
-
- // Ignore these
- case 'mceResetDesignMode':
- case 'mceBeginUndoLevel':
- return true;
-
- // Ignore these
- case 'unlink':
- t.UnLink();
- return true;
-
- // Bundle these together
- case 'JustifyLeft':
- case 'JustifyCenter':
- case 'JustifyRight':
- case 'JustifyFull':
- t.mceJustify(cmd, cmd.substring(7).toLowerCase());
- return true;
-
- case 'mceEndUndoLevel':
- case 'mceAddUndoLevel':
- ed.undoManager.add();
- return true;
-
- default:
- f = this[cmd];
-
- if (f) {
- f.call(this, ui, val);
- return true;
- }
- }
-
- return false;
- },
-
- Indent : function() {
- var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu;
-
- // Setup indent level
- iv = ed.settings.indentation;
- iu = /[a-z%]+$/i.exec(iv);
- iv = parseInt(iv);
-
- if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
- each(this._getSelectedBlocks(), function(e) {
- d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu);
- });
-
- return;
- }
-
- ed.getDoc().execCommand('Indent', false, null);
-
- if (isIE) {
- d.getParent(s.getNode(), function(n) {
- if (n.nodeName == 'BLOCKQUOTE') {
- n.dir = n.style.cssText = '';
- }
- });
- }
- },
-
- Outdent : function() {
- var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu;
-
- // Setup indent level
- iv = ed.settings.indentation;
- iu = /[a-z%]+$/i.exec(iv);
- iv = parseInt(iv);
-
- if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
- each(this._getSelectedBlocks(), function(e) {
- v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv);
- d.setStyle(e, 'paddingLeft', v ? v + iu : '');
- });
-
- return;
- }
-
- ed.getDoc().execCommand('Outdent', false, null);
- },
-
- mceSetAttribute : function(u, v) {
- var ed = this.editor, d = ed.dom, e;
-
- if (e = d.getParent(ed.selection.getNode(), d.isBlock))
- d.setAttrib(e, v.name, v.value);
- },
-
- mceSetContent : function(u, v) {
- this.editor.setContent(v);
- },
-
- mceToggleVisualAid : function() {
- var ed = this.editor;
-
- ed.hasVisual = !ed.hasVisual;
- ed.addVisual();
- },
-
- mceReplaceContent : function(u, v) {
- var s = this.editor.selection;
-
- s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'})));
- },
-
- mceInsertLink : function(u, v) {
- var ed = this.editor, e = ed.dom.getParent(ed.selection.getNode(), 'A');
-
- if (tinymce.is(v, 'string'))
- v = {href : v};
-
- function set(e) {
- each(v, function(v, k) {
- ed.dom.setAttrib(e, k, v);
- });
- };
-
- if (!e) {
- ed.execCommand('CreateLink', false, 'javascript:mctmp(0);');
- each(ed.dom.select('a'), function(e) {
- if (e.href == 'javascript:mctmp(0);')
- set(e);
- });
- } else {
- if (v.href)
- set(e);
- else
- ed.dom.remove(e, 1);
- }
- },
-
- UnLink : function() {
- var ed = this.editor, s = ed.selection;
-
- if (s.isCollapsed())
- s.select(s.getNode());
-
- ed.getDoc().execCommand('unlink', false, null);
- s.collapse(0);
- },
-
- FontName : function(u, v) {
- var t = this, ed = t.editor, s = ed.selection, e;
-
- if (!v) {
- if (s.isCollapsed())
- s.select(s.getNode());
-
- t.RemoveFormat();
- } else
- ed.getDoc().execCommand('FontName', false, v);
- },
-
- queryCommandValue : function(c) {
- var f = this['queryValue' + c];
-
- if (f)
- return f.call(this, c);
-
- return false;
- },
-
- queryCommandState : function(cmd) {
- var f;
-
- switch (cmd) {
- // Bundle these together
- case 'JustifyLeft':
- case 'JustifyCenter':
- case 'JustifyRight':
- case 'JustifyFull':
- return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase());
-
- default:
- if (f = this['queryState' + cmd])
- return f.call(this, cmd);
- }
-
- return -1;
- },
-
- queryValueFontSize : function() {
- var ed = this.editor, v = 0, p;
-
- if (isOpera || isWebKit) {
- if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
- v = p.size;
-
- return v;
- }
-
- return ed.getDoc().queryCommandValue('FontSize');
- },
-
- queryValueFontName : function() {
- var ed = this.editor, v = 0, p;
-
- if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
- v = p.face;
-
- if (!v)
- v = ed.getDoc().queryCommandValue('FontName');
-
- return v;
- },
-
- mceJustify : function(c, v) {
- var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm;
-
- if (ed.settings.inline_styles && this.queryStateJustify(c, v))
- rm = 1;
-
- bl = dom.getParent(n, ed.dom.isBlock);
-
- if (nn == 'IMG') {
- if (v == 'full')
- return;
-
- if (rm) {
- dom.setStyle(n, 'float', '');
- this.mceRepaint();
- return;
- }
-
- if (v == 'center') {
- if (!bl || bl.childNodes.length > 1) {
- nb = dom.create('p');
- nb.appendChild(n.cloneNode(false));
-
- if (bl)
- dom.insertAfter(nb, bl);
- else
- dom.insertAfter(nb, n);
-
- dom.remove(n);
- n = nb.firstChild;
- bl = nb;
- }
-
- dom.setStyle(bl, 'textAlign', v);
- dom.setStyle(n, 'float', '');
- } else
- dom.setStyle(n, 'float', v);
-
- this.mceRepaint();
- return;
- }
-
- // Handle the alignment outselfs, less quirks in all browsers
- if (ed.settings.inline_styles && ed.settings.forced_root_block) {
- if (rm)
- v = '';
-
- each(this._getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) {
- dom.setAttrib(e, 'align', '');
- dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v);
- });
-
- return;
- } else if (!rm)
- ed.getDoc().execCommand(c, false, null);
-
- if (ed.settings.inline_styles) {
- if (rm) {
- dom.getParent(ed.selection.getNode(), function(n) {
- if (n.style && n.style.textAlign)
- dom.setStyle(n, 'textAlign', '');
- });
-
- return;
- }
-
- each(dom.select('*'), function(n) {
- var v = n.align;
-
- if (v) {
- if (v == 'full')
- v = 'justify';
-
- dom.setStyle(n, 'textAlign', v);
- dom.setAttrib(n, 'align', '');
- }
- });
- }
- },
-
- mceSetCSSClass : function(u, v) {
- this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v});
- },
-
- getSelectedElement : function() {
- var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re;
-
- if (se.isCollapsed() || r.item)
- return se.getNode();
-
- // Setup regexp
- re = ed.settings.merge_styles_invalid_parents;
- if (tinymce.is(re, 'string'))
- re = new RegExp(re, 'i');
-
- if (isIE) {
- r1 = r.duplicate();
- r1.collapse(true);
- sc = r1.parentElement();
-
- r2 = r.duplicate();
- r2.collapse(false);
- ec = r2.parentElement();
-
- if (sc != ec) {
- r1.move('character', 1);
- sc = r1.parentElement();
- }
-
- if (sc == ec) {
- r1 = r.duplicate();
- r1.moveToElementText(sc);
-
- if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0)
- return re && re.test(sc.nodeName) ? null : sc;
- }
- } else {
- function getParent(n) {
- return dom.getParent(n, function(n) {return n.nodeType == 1;});
- };
-
- sc = r.startContainer;
- ec = r.endContainer;
- so = r.startOffset;
- eo = r.endOffset;
-
- if (!r.collapsed) {
- if (sc == ec) {
- if (so - eo < 2) {
- if (sc.hasChildNodes()) {
- sp = sc.childNodes[so];
- return re && re.test(sp.nodeName) ? null : sp;
- }
- }
- }
- }
-
- if (sc.nodeType != 3 || ec.nodeType != 3)
- return null;
-
- if (so == 0) {
- sp = getParent(sc);
-
- if (sp && sp.firstChild != sc)
- sp = null;
- }
-
- if (so == sc.nodeValue.length) {
- e = sc.nextSibling;
-
- if (e && e.nodeType == 1)
- sp = sc.nextSibling;
- }
-
- if (eo == 0) {
- e = ec.previousSibling;
-
- if (e && e.nodeType == 1)
- ep = e;
- }
-
- if (eo == ec.nodeValue.length) {
- ep = getParent(ec);
-
- if (ep && ep.lastChild != ec)
- ep = null;
- }
-
- // Same element
- if (sp == ep)
- return re && sp && re.test(sp.nodeName) ? null : sp;
- }
-
- return null;
- },
-
- InsertHorizontalRule : function() {
- // Fix for Gecko
issue and IE bug rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]");
- if (isGecko || isIE)
- this.editor.selection.setContent('
');
- else
- this.editor.getDoc().execCommand('InsertHorizontalRule', false, '');
- },
-
- RemoveFormat : function() {
- var t = this, ed = t.editor, s = ed.selection, b;
-
- // Safari breaks tables
- if (isWebKit)
- s.setContent(s.getContent({format : 'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g, ''), {format : 'raw'});
- else
- ed.getDoc().execCommand('RemoveFormat', false, null);
-
- t.mceSetStyleInfo(0, {command : 'removeformat'});
- ed.addVisual();
- },
-
- mceSetStyleInfo : function(u, v) {
- var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re;
-
- function set(n, e) {
- if (n.nodeType == 1) {
- switch (v.command) {
- case 'setattrib':
- return dom.setAttrib(n, v.name, v.value);
-
- case 'setstyle':
- return dom.setStyle(n, v.name, v.value);
-
- case 'removeformat':
- return dom.setAttrib(n, 'class', '');
- }
- }
- };
-
- // Setup regexp
- re = ed.settings.merge_styles_invalid_parents;
- if (tinymce.is(re, 'string'))
- re = new RegExp(re, 'i');
-
- // Set style info on selected element
- if (e = t.getSelectedElement())
- set(e, 1);
- else {
- // Generate wrappers and set styles on them
- d.execCommand('FontName', false, '__');
- each(isWebKit ? dom.select('span') : dom.select('font'), function(n) {
- var sp, e;
-
- if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') {
- sp = dom.create(nn, {mce_new : '1'});
-
- set(sp);
-
- each (n.childNodes, function(n) {
- sp.appendChild(n.cloneNode(true));
- });
-
- dom.replace(sp, n);
- }
- });
- }
-
- // Remove wrappers inside new ones
- each(dom.select(nn).reverse(), function(n) {
- var p = n.parentNode;
-
- dom.setAttrib(n, 'mce_new', '');
-
- // Check if it's an old span in a new wrapper
- if (!dom.getAttrib(n, 'mce_new')) {
- // Find new wrapper
- p = dom.getParent(n, function(n) {
- return n.nodeType == 1 && dom.getAttrib(n, 'mce_new');
- });
-
- if (p)
- dom.remove(n, 1);
- }
- });
-
- // Merge wrappers with parent wrappers
- each(dom.select(nn).reverse(), function(n) {
- var p = n.parentNode;
-
- if (!p)
- return;
-
- // Has parent of the same type and only child
- if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
- return dom.remove(p, 1);
-
- // Has parent that is more suitable to have the class and only child
- if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) {
- set(p); // Set style info on parent instead
- dom.setAttrib(n, 'class', '');
- }
- });
-
- // Remove empty wrappers
- each(dom.select(nn).reverse(), function(n) {
- if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style'))
- return dom.remove(n, 1);
- });
-
- s.moveToBookmark(b);
- },
-
- queryStateJustify : function(c, v) {
- var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom;
-
- if (n && n.nodeName == 'IMG')
- return dom.getStyle(n, 'float') == v;
-
- n = dom.getParent(ed.selection.getStart(), function(n) {
- return n.nodeType == 1 && n.style.textAlign;
- });
-
- if (v == 'full')
- v = 'justify';
-
- if (ed.settings.inline_styles)
- return (n && n.style.textAlign == v);
-
- return ed.getDoc().queryCommandState(c);
- },
-
- HiliteColor : function(ui, val) {
- var t = this, ed = t.editor, d = ed.getDoc();
-
- function set(s) {
- if (!isGecko)
- return;
-
- try {
- // Try new Gecko method
- d.execCommand("styleWithCSS", 0, s);
- } catch (ex) {
- // Use old
- d.execCommand("useCSS", 0, !s);
- }
- };
-
- if (isGecko || isOpera) {
- set(true);
- d.execCommand('hilitecolor', false, val);
- set(false);
- } else
- d.execCommand('BackColor', false, val);
- },
-
- Undo : function() {
- var ed = this.editor;
-
- if (ed.settings.custom_undo_redo) {
- ed.undoManager.undo();
- ed.nodeChanged();
- } else
- ed.getDoc().execCommand('Undo', false, null);
- },
-
- Redo : function() {
- var ed = this.editor;
-
- if (ed.settings.custom_undo_redo) {
- ed.undoManager.redo();
- ed.nodeChanged();
- } else
- ed.getDoc().execCommand('Redo', false, null);
- },
-
- FormatBlock : function(ui, val) {
- var t = this, ed = t.editor;
-
- val = ed.settings.forced_root_block ? (val || '') : val;
- t.mceRemoveNode();
-
- if (val.indexOf('<') == -1)
- val = '<' + val + '>';
-
- if (tinymce.isGecko)
- val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1');
-
- ed.getDoc().execCommand('FormatBlock', false, val);
- },
-
- mceCleanup : function() {
- var ed = this.editor, s = ed.selection, b = s.getBookmark();
- ed.setContent(ed.getContent());
- s.moveToBookmark(b);
- },
-
- mceRemoveNode : function(ui, val) {
- var ed = this.editor, s = ed.selection, b, n = val || s.getNode();
-
- // Make sure that the body node isn't removed
- if (n == ed.getBody())
- return;
-
- b = s.getBookmark();
- ed.dom.remove(n, 1);
- s.moveToBookmark(b);
- ed.nodeChanged();
- },
-
- mceSelectNodeDepth : function(ui, val) {
- var ed = this.editor, s = ed.selection, c = 0;
-
- ed.dom.getParent(s.getNode(), function(n) {
- if (n.nodeType == 1 && c++ == val) {
- s.select(n);
- ed.nodeChanged();
- return false;
- }
- }, ed.getBody());
- },
-
- mceSelectNode : function(u, v) {
- this.editor.selection.select(v);
- },
-
- mceInsertContent : function(ui, val) {
- this.editor.selection.setContent(val);
- },
-
- mceInsertRawHTML : function(ui, val) {
- var ed = this.editor;
-
- ed.execCommand('mceInsertContent', false, 'tiny_mce_marker');
- ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val));
- },
-
- mceRepaint : function() {
- var s, b, e = this.editor;
-
- if (tinymce.isGecko) {
- try {
- s = e.selection;
- b = s.getBookmark(true);
-
- if (s.getSel())
- s.getSel().selectAllChildren(e.getBody());
-
- s.collapse(true);
- s.moveToBookmark(b);
- } catch (ex) {
- // Ignore
- }
- }
- },
-
- queryStateUnderline : function() {
- var ed = this.editor, n;
-
- if (n && n.nodeName == 'A')
- return false;
-
- return ed.getDoc().queryCommandState('Underline');
- },
-
- queryStateOutdent : function() {
- var ed = this.editor, n;
-
- if (ed.settings.inline_styles) {
- if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
- return true;
-
- if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
- return true;
- } else
- return !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE');
-
- return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList();
- },
-
- queryStateInsertUnorderedList : function() {
- return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
- },
-
- queryStateInsertOrderedList : function() {
- return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL');
- },
-
- queryStatemceBlockQuote : function() {
- return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';});
- },
-
- mceBlockQuote : function() {
- var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom;
-
- function findBQ(e) {
- return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
- };
-
- // Remove blockquote(s)
- if (findBQ(s.getStart())) {
- each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) {
- // Found BQ lets remove it
- if (e.nodeName == 'BLOCKQUOTE')
- dom.remove(e, 1);
- });
-
- t.editor.selection.moveToBookmark(b);
- return;
- }
-
- each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) {
- var n;
-
- // Found existing BQ add to this one
- if (e.nodeName == 'BLOCKQUOTE' && !bq) {
- bq = e;
- return;
- }
-
- // No BQ found, create one
- if (!bq) {
- bq = dom.create('blockquote');
- e.parentNode.insertBefore(bq, e);
- }
-
- // Add children from existing BQ
- if (e.nodeName == 'BLOCKQUOTE' && bq) {
- n = e.firstChild;
-
- while (n) {
- bq.appendChild(n.cloneNode(true));
- n = n.nextSibling;
- }
-
- dom.remove(e);
-
- return;
- }
-
- // Add non BQ element to BQ
- bq.appendChild(dom.remove(e));
- });
-
- t.editor.selection.moveToBookmark(b);
- },
-
- _getSelectedBlocks : function(st, en) {
- var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = [];
-
- sb = dom.getParent(st || s.getStart(), dom.isBlock);
- eb = dom.getParent(en || s.getEnd(), dom.isBlock);
-
- if (sb)
- bl.push(sb);
-
- if (sb && eb && sb != eb) {
- n = sb;
-
- while ((n = n.nextSibling) && n != eb) {
- if (dom.isBlock(n))
- bl.push(n);
- }
- }
-
- if (eb && sb != eb)
- bl.push(eb);
-
- return bl;
- }
- });
-})();
-
-
-/* file:jscripts/tiny_mce/classes/UndoManager.js */
-
-tinymce.create('tinymce.UndoManager', {
- index : 0,
- data : null,
- typing : 0,
-
- UndoManager : function(ed) {
- var t = this, Dispatcher = tinymce.util.Dispatcher;
-
- t.editor = ed;
- t.data = [];
- t.onAdd = new Dispatcher(this);
- t.onUndo = new Dispatcher(this);
- t.onRedo = new Dispatcher(this);
- },
-
- add : function(l) {
- var t = this, i, ed = t.editor, b, s = ed.settings, la;
-
- l = l || {};
- l.content = l.content || ed.getContent({format : 'raw', no_events : 1});
-
- // Add undo level if needed
- l.content = l.content.replace(/^\s*|\s*$/g, '');
- la = t.data[t.index > 0 ? t.index - 1 : 0];
- if (!l.initial && la && l.content == la.content)
- return null;
-
- // Time to compress
- if (s.custom_undo_redo_levels) {
- if (t.data.length > s.custom_undo_redo_levels) {
- for (i = 0; i < t.data.length - 1; i++)
- t.data[i] = t.data[i + 1];
-
- t.data.length--;
- t.index = t.data.length;
- }
- }
-
- if (s.custom_undo_redo_restore_selection)
- l.bookmark = b = l.bookmark || ed.selection.getBookmark();
-
- if (t.index < t.data.length && t.data[t.index].initial)
- t.index++;
-
- // Add level
- t.data.length = t.index + 1;
- t.data[t.index++] = l;
-
- if (l.initial)
- t.index = 0;
-
- // Set initial bookmark use first real undo level
- if (t.data.length == 2 && t.data[0].initial)
- t.data[0].bookmark = b;
-
- t.onAdd.dispatch(t, l);
-
- //console.dir(t.data);
-
- return l;
- },
-
- undo : function() {
- var t = this, ed = t.editor, l = l, i;
-
- if (t.typing) {
- t.add();
- t.typing = 0;
- }
-
- if (t.index > 0) {
- // If undo on last index then take snapshot
- if (t.index == t.data.length && t.index > 1) {
- i = t.index;
- t.typing = 0;
-
- if (!t.add())
- t.index = i;
-
- --t.index;
- }
-
- l = t.data[--t.index];
- ed.setContent(l.content, {format : 'raw'});
- ed.selection.moveToBookmark(l.bookmark);
-
- t.onUndo.dispatch(t, l);
- }
-
- return l;
- },
-
- redo : function() {
- var t = this, ed = t.editor, l = null;
-
- if (t.index < t.data.length - 1) {
- l = t.data[++t.index];
- ed.setContent(l.content, {format : 'raw'});
- ed.selection.moveToBookmark(l.bookmark);
-
- t.onRedo.dispatch(t, l);
- }
-
- return l;
- },
-
- clear : function() {
- var t = this;
-
- t.data = [];
- t.index = 0;
- t.typing = 0;
- t.add({initial : true});
- },
-
- hasUndo : function() {
- return this.index != 0 || this.typing;
- },
-
- hasRedo : function() {
- return this.index < this.data.length - 1;
- }
-
- });
-/* file:jscripts/tiny_mce/classes/ForceBlocks.js */
-
-(function() {
- // Shorten names
- var Event, isIE, isGecko, isOpera, each, extend;
-
- Event = tinymce.dom.Event;
- isIE = tinymce.isIE;
- isGecko = tinymce.isGecko;
- isOpera = tinymce.isOpera;
- each = tinymce.each;
- extend = tinymce.extend;
-
- tinymce.create('tinymce.ForceBlocks', {
- ForceBlocks : function(ed) {
- var t = this, s;
-
- t.editor = ed;
- t.dom = ed.dom;
-
- // Default settings
- t.settings = s = extend({
- element : 'P',
- forced_root_block : 'p',
- force_p_newlines : true
- }, ed.settings);
-
- ed.onPreInit.add(t.setup, t);
-
- if (!isIE) {
- ed.onSetContent.add(function(ed, o) {
- o.content = o.content.replace(/
[\s\u00a0]+<\/p>/g, '
');
- });
- }
-
- ed.onPostProcess.add(function(ed, o) {
- if (isOpera)
- o.content = o.content.replace(/(\u00a0| | )<\/p>/g, '');
-
- o.content = o.content.replace(/<\/p>/g, '
\u00a0
');
-
- // Use BR instead of padded paragraphs
- o.content = o.content.replace(/\s*
\s*<\/p>/g, '
\u00a0
');
- o.content = o.content.replace(/\s*
\s*<\/p>/g, '');
- });
-
- if (s.forced_root_block) {
- ed.onInit.add(t.forceRoots, t);
- ed.onSetContent.add(t.forceRoots, t);
- ed.onBeforeGetContent.add(t.forceRoots, t);
- }
- },
-
- setup : function() {
- var t = this, ed = t.editor, s = t.settings;
-
- // Force root blocks when typing and when getting output
- if (s.forced_root_block) {
- ed.onKeyUp.add(t.forceRoots, t);
- ed.onPreProcess.add(t.forceRoots, t);
- }
-
- if (s.force_br_newlines) {
- // Force IE to produce BRs on enter
- if (isIE) {
- ed.onKeyPress.add(function(ed, e) {
- var n, s = ed.selection;
-
- if (e.keyCode == 13) {
- s.setContent('
', {format : 'raw'});
- n = ed.dom.get('__');
- n.removeAttribute('id');
- s.select(n);
- s.collapse();
- return Event.cancel(e);
- }
- });
- }
-
- return;
- }
-
- if (!isIE && s.force_p_newlines) {
- ed.onPreProcess.add(function(ed, o) {
- each(ed.dom.select('br', o.node), function(n) {
- var p = n.parentNode;
-
- // Replace
with
- if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n))
- p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n);
- });
- });
-
- ed.onKeyPress.add(function(ed, e) {
- if (e.keyCode == 13 && !e.shiftKey) {
- if (!t.insertPara(e))
- Event.cancel(e);
- }
- });
-
- if (isGecko) {
- ed.onKeyDown.add(function(ed, e) {
- if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
- t.backspaceDelete(e, e.keyCode == 8);
- });
- }
- }
- },
-
- find : function(n, t, s) {
- var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1;
-
- while (n = w.nextNode()) {
- c++;
-
- // Index by node
- if (t == 0 && n == s)
- return c;
-
- // Node by index
- if (t == 1 && c == s)
- return n;
- }
-
- return -1;
- },
-
- forceRoots : function(ed, e) {
- var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
- var nx, bl, bp, sp, le, nl = b.childNodes, i;
-
- // Fix for bug #1863847
- if (e && e.keyCode == 13)
- return true;
-
- // Wrap non blocks into blocks
- for (i = nl.length - 1; i >= 0; i--) {
- nx = nl[i];
-
- // Is text or non block element
- if (nx.nodeType == 3 || !t.dom.isBlock(nx)) {
- if (!bl) {
- // Create new block but ignore whitespace
- if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
- // Store selection
- if (si == -2 && r) {
- if (!isIE) {
- so = r.startOffset;
- eo = r.endOffset;
- si = t.find(b, 0, r.startContainer);
- ei = t.find(b, 0, r.endContainer);
- } else {
- tr = d.body.createTextRange();
- tr.moveToElementText(b);
- tr.collapse(1);
- bp = tr.move('character', c) * -1;
-
- tr = r.duplicate();
- tr.collapse(1);
- sp = tr.move('character', c) * -1;
-
- tr = r.duplicate();
- tr.collapse(0);
- le = (tr.move('character', c) * -1) - sp;
-
- si = sp - bp;
- ei = le;
- }
- }
-
- bl = ed.dom.create(t.settings.forced_root_block);
- bl.appendChild(nx.cloneNode(1));
- b.replaceChild(bl, nx);
- }
- } else {
- if (bl.hasChildNodes())
- bl.insertBefore(nx, bl.firstChild);
- else
- bl.appendChild(nx);
- }
- } else
- bl = null; // Time to create new block
- }
-
- // Restore selection
- if (si != -2) {
- if (!isIE) {
- bl = d.getElementsByTagName(t.settings.element)[0];
- r = d.createRange();
-
- // Select last location or generated block
- if (si != -1)
- r.setStart(t.find(b, 1, si), so);
- else
- r.setStart(bl, 0);
-
- // Select last location or generated block
- if (ei != -1)
- r.setEnd(t.find(b, 1, ei), eo);
- else
- r.setEnd(bl, 0);
-
- if (s) {
- s.removeAllRanges();
- s.addRange(r);
- }
- } else {
- try {
- r = s.createRange();
- r.moveToElementText(b);
- r.collapse(1);
- r.moveStart('character', si);
- r.moveEnd('character', ei);
- r.select();
- } catch (ex) {
- // Ignore
- }
- }
- }
- },
-
- getParentBlock : function(n) {
- var d = this.dom;
-
- return d.getParent(n, d.isBlock);
- },
-
- insertPara : function(e) {
- var t = this, ed = t.editor, d = ed.getDoc(), se = t.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;
- var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n;
-
- function isEmpty(n) {
- n = n.innerHTML;
- n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
- n = n.replace(/<[^>]+>/g, ''); // Remove all tags
-
- return n.replace(/[ \t\r\n]+/g, '') == '';
- };
-
- // If root blocks are forced then use Operas default behavior since it's really good
-// Removed due to bug: #1853816
-// if (se.forced_root_block && isOpera)
-// return true;
-
- // Setup before range
- rb = d.createRange();
-
- // If is before the first block element and in body, then move it into first block element
- rb.setStart(s.anchorNode, s.anchorOffset);
- rb.collapse(true);
-
- // Setup after range
- ra = d.createRange();
-
- // If is before the first block element and in body, then move it into first block element
- ra.setStart(s.focusNode, s.focusOffset);
- ra.collapse(true);
-
- // Setup start/end points
- dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
- sn = dir ? s.anchorNode : s.focusNode;
- so = dir ? s.anchorOffset : s.focusOffset;
- en = dir ? s.focusNode : s.anchorNode;
- eo = dir ? s.focusOffset : s.anchorOffset;
-
- // If the caret is in an invalid location in FF we need to move it into the first block
- if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) {
- sn = en = sn.firstChild;
- so = eo = 0;
- rb = d.createRange();
- rb.setStart(sn, 0);
- ra = d.createRange();
- ra.setStart(en, 0);
- }
-
- // Never use body as start or end node
- sn = sn.nodeName == "BODY" ? sn.firstChild : sn;
- en = en.nodeName == "BODY" ? en.firstChild : en;
-
- // Get start and end blocks
- sb = t.getParentBlock(sn);
- eb = t.getParentBlock(en);
- bn = sb ? sb.nodeName : se.element; // Get block name to create
-
- // Return inside list use default browser behavior
- if (t.dom.getParent(sb, function(n) { return /OL|UL|PRE/.test(n.nodeName); }))
- return true;
-
- // If caption or absolute layers then always generate new blocks within
- if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(sb.style.position))) {
- bn = se.element;
- sb = null;
- }
-
- // If caption or absolute layers then always generate new blocks within
- if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(eb.style.position))) {
- bn = se.element;
- eb = null;
- }
-
- // Use P instead
- if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(sb.style.cssFloat))) {
- bn = se.element;
- sb = eb = null;
- }
-
- // Setup new before and after blocks
- bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn);
- aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn);
-
- // Remove id from after clone
- aft.removeAttribute('id');
-
- // Is header and cursor is at the end, then force paragraph under
- if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length)
- aft = ed.dom.create(se.element);
-
- // Find start chop node
- n = sc = sn;
- do {
- if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
- break;
-
- sc = n;
- } while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
-
- // Find end chop node
- n = ec = en;
- do {
- if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
- break;
-
- ec = n;
- } while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
-
- // Place first chop part into before block element
- if (sc.nodeName == bn)
- rb.setStart(sc, 0);
- else
- rb.setStartBefore(sc);
-
- rb.setEnd(sn, so);
- bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
-
- // Place secnd chop part within new block element
- try {
- ra.setEndAfter(ec);
- } catch(ex) {
- //console.debug(s.focusNode, s.focusOffset);
- }
-
- ra.setStart(en, eo);
- aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
-
- // Create range around everything
- r = d.createRange();
- if (!sc.previousSibling && sc.parentNode.nodeName == bn) {
- r.setStartBefore(sc.parentNode);
- } else {
- if (rb.startContainer.nodeName == bn && rb.startOffset == 0)
- r.setStartBefore(rb.startContainer);
- else
- r.setStart(rb.startContainer, rb.startOffset);
- }
-
- if (!ec.nextSibling && ec.parentNode.nodeName == bn)
- r.setEndAfter(ec.parentNode);
- else
- r.setEnd(ra.endContainer, ra.endOffset);
-
- // Delete and replace it with new block elements
- r.deleteContents();
-
- // Never wrap blocks in blocks
- if (bef.firstChild && bef.firstChild.nodeName == bn)
- bef.innerHTML = bef.firstChild.innerHTML;
-
- if (aft.firstChild && aft.firstChild.nodeName == bn)
- aft.innerHTML = aft.firstChild.innerHTML;
-
- // Padd empty blocks
- if (isEmpty(bef))
- bef.innerHTML = '
';
-
- if (isEmpty(aft))
- aft.innerHTML = isOpera ? ' ' : '
'; // Extra space for Opera so that the caret can move there
-
- // Opera needs this one backwards
- if (isOpera) {
- r.insertNode(bef);
- r.insertNode(aft);
- } else {
- r.insertNode(aft);
- r.insertNode(bef);
- }
-
- // Normalize
- aft.normalize();
- bef.normalize();
-
- // Move cursor and scroll into view
- r = d.createRange();
- r.selectNodeContents(aft);
- r.collapse(1);
- s.removeAllRanges();
- s.addRange(r);
- aft.scrollIntoView(0);
-
- return false;
- },
-
- backspaceDelete : function(e, bs) {
- var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n;
-
- // The caret sometimes gets stuck in Gecko if you delete empty paragraphs
- // This workaround removes the element by hand and moves the caret to the previous element
- if (sc && ed.dom.isBlock(sc) && bs) {
- if (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR') {
- n = sc.previousSibling;
- if (n) {
- ed.dom.remove(sc);
- se.select(n, 1);
- se.collapse(0);
- return Event.cancel(e);
- }
- }
- }
-
- // Gecko generates BR elements here and there, we don't like those so lets remove them
- function handler(e) {
- e = e.target;
-
- // A new BR was created in a block element, remove it
- if (e && e.parentNode && e.nodeName == 'BR' && t.getParentBlock(e)) {
- ed.dom.remove(e);
- Event.remove(b, 'DOMNodeInserted', handler);
- }
- };
-
- // Listen for new nodes
- Event._add(b, 'DOMNodeInserted', handler);
-
- // Remove listener
- window.setTimeout(function() {
- Event._remove(b, 'DOMNodeInserted', handler);
- }, 1);
- }
- });
-})();
-
-/* file:jscripts/tiny_mce/classes/ControlManager.js */
-
-(function() {
- // Shorten names
- var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;
-
- tinymce.create('tinymce.ControlManager', {
- ControlManager : function(ed, s) {
- var t = this, i;
-
- s = s || {};
- t.editor = ed;
- t.controls = {};
- t.onAdd = new tinymce.util.Dispatcher(t);
- t.onPostRender = new tinymce.util.Dispatcher(t);
- t.prefix = s.prefix || ed.id + '_';
-
- t.onPostRender.add(function() {
- each(t.controls, function(c) {
- c.postRender();
- });
- });
- },
-
- get : function(id) {
- return this.controls[this.prefix + id] || this.controls[id];
- },
-
- setActive : function(id, s) {
- var c = null;
-
- if (c = this.get(id))
- c.setActive(s);
-
- return c;
- },
-
- setDisabled : function(id, s) {
- var c = null;
-
- if (c = this.get(id))
- c.setDisabled(s);
-
- return c;
- },
-
- add : function(c) {
- var t = this;
-
- if (c) {
- t.controls[c.id] = c;
- t.onAdd.dispatch(c, t);
- }
-
- return c;
- },
-
- createControl : function(n) {
- var c, t = this, ed = t.editor;
-
- each(ed.plugins, function(p) {
- if (p.createControl) {
- c = p.createControl(n, t);
-
- if (c)
- return false;
- }
- });
-
- switch (n) {
- case "|":
- case "separator":
- return t.createSeparator();
- }
-
- if (!c && ed.buttons && (c = ed.buttons[n]))
- return t.createButton(n, c);
-
- return t.add(c);
- },
-
- createDropMenu : function(id, s) {
- var t = this, ed = t.editor, c;
-
- s = extend({
- 'class' : 'mceDropDown'
- }, s);
-
- s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin';
-
- id = t.prefix + id;
- c = t.controls[id] = new tinymce.ui.DropMenu(id, s);
- c.onAddItem.add(function(c, o) {
- var s = o.settings;
-
- s.title = ed.getLang(s.title, s.title);
-
- if (!s.onclick) {
- s.onclick = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
- });
-
- ed.onRemove.add(function() {
- c.destroy();
- });
-
- return t.add(c);
- },
-
- createListBox : function(id, s) {
- var t = this, ed = t.editor, cmd, c;
-
- if (t.get(id))
- return null;
-
- s.title = ed.translate(s.title);
- s.scope = s.scope || ed;
-
- if (!s.onselect) {
- s.onselect = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
-
- s = extend({
- title : s.title,
- 'class' : id,
- scope : s.scope,
- control_manager : t
- }, s);
-
- id = t.prefix + id;
-
- if (ed.settings.use_native_selects)
- c = new tinymce.ui.NativeListBox(id, s);
- else
- c = new tinymce.ui.ListBox(id, s);
-
- t.controls[id] = c;
-
- // Fix focus problem in Safari
- if (tinymce.isWebKit) {
- c.onPostRender.add(function(c, n) {
- // Store bookmark on mousedown
- Event.add(n, 'mousedown', function() {
- ed.bookmark = ed.selection.getBookmark('simple');
- });
-
- // Restore on focus, since it might be lost
- Event.add(n, 'focus', function() {
- ed.selection.moveToBookmark(ed.bookmark);
- ed.bookmark = null;
- });
- });
- }
-
- if (c.hideMenu)
- ed.onMouseDown.add(c.hideMenu, c);
-
- return t.add(c);
- },
-
- createButton : function(id, s) {
- var t = this, ed = t.editor, o, c;
-
- if (t.get(id))
- return null;
-
- s.title = ed.translate(s.title);
- s.scope = s.scope || ed;
-
- if (!s.onclick && !s.menu_button) {
- s.onclick = function() {
- ed.execCommand(s.cmd, s.ui || false, s.value);
- };
- }
-
- s = extend({
- title : s.title,
- 'class' : id,
- unavailable_prefix : ed.getLang('unavailable', ''),
- scope : s.scope,
- control_manager : t
- }, s);
-
- id = t.prefix + id;
-
- if (s.menu_button) {
- c = new tinymce.ui.MenuButton(id, s);
- ed.onMouseDown.add(c.hideMenu, c);
- } else
- c = new tinymce.ui.Button(id, s);
-
- return t.add(c);
- },
-
- createMenuButton : function(id, s) {
- s = s || {};
- s.menu_button = 1;
-
- return this.createButton(id, s);
- },
-
- createSplitButton : function(id, s) {
- var t = this, ed = t.editor, cmd, c;
-
- if (t.get(id))
- return null;
-
- s.title = ed.translate(s.title);
- s.scope = s.scope || ed;
-
- if (!s.onclick) {
- s.onclick = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
-
- if (!s.onselect) {
- s.onselect = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
-
- s = extend({
- title : s.title,
- 'class' : id,
- scope : s.scope,
- control_manager : t
- }, s);
-
- id = t.prefix + id;
- c = t.add(new tinymce.ui.SplitButton(id, s));
- ed.onMouseDown.add(c.hideMenu, c);
-
- return c;
- },
-
- createColorSplitButton : function(id, s) {
- var t = this, ed = t.editor, cmd, c;
-
- if (t.get(id))
- return null;
-
- s.title = ed.translate(s.title);
- s.scope = s.scope || ed;
-
- if (!s.onclick) {
- s.onclick = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
-
- if (!s.onselect) {
- s.onselect = function(v) {
- ed.execCommand(s.cmd, s.ui || false, v || s.value);
- };
- }
-
- s = extend({
- title : s.title,
- 'class' : id,
- 'menu_class' : ed.getParam('skin') + 'Skin',
- scope : s.scope,
- more_colors_title : ed.getLang('more_colors')
- }, s);
-
- id = t.prefix + id;
- c = new tinymce.ui.ColorSplitButton(id, s);
- ed.onMouseDown.add(c.hideMenu, c);
-
- return t.add(c);
- },
-
- createToolbar : function(id, s) {
- var c, t = this;
-
- id = t.prefix + id;
- c = new tinymce.ui.Toolbar(id, s);
-
- if (t.get(id))
- return null;
-
- return t.add(c);
- },
-
- createSeparator : function() {
- return new tinymce.ui.Separator();
- }
-
- });
-})();
-
-/* file:jscripts/tiny_mce/classes/WindowManager.js */
-
-(function() {
- var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
-
- tinymce.create('tinymce.WindowManager', {
- WindowManager : function(ed) {
- var t = this;
-
- t.editor = ed;
- t.onOpen = new Dispatcher(t);
- t.onClose = new Dispatcher(t);
- t.params = {};
- t.features = {};
- },
-
- open : function(s, p) {
- var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort();
-
- // Default some options
- s = s || {};
- p = p || {};
- sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window
- sh = isOpera ? vp.h : screen.height;
- s.name = s.name || 'mc_' + new Date().getTime();
- s.width = parseInt(s.width || 320);
- s.height = parseInt(s.height || 240);
- s.resizable = true;
- s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0);
- s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0);
- p.inline = false;
- p.mce_width = s.width;
- p.mce_height = s.height;
-
- if (mo) {
- if (isIE) {
- s.center = true;
- s.help = false;
- s.dialogWidth = s.width + 'px';
- s.dialogHeight = s.height + 'px';
- s.scroll = s.scrollbars || false;
- } else
- s.modal = s.alwaysRaised = s.dialog = s.centerscreen = s.dependent = true;
- }
-
- // Build features string
- each(s, function(v, k) {
- if (tinymce.is(v, 'boolean'))
- v = v ? 'yes' : 'no';
-
- if (!/^(name|url)$/.test(k)) {
- if (isIE && mo)
- f += (f ? ';' : '') + k + ':' + v;
- else
- f += (f ? ',' : '') + k + '=' + v;
- }
- });
-
- t.features = s;
- t.params = p;
- t.onOpen.dispatch(t, s, p);
-
- try {
- if (isIE && mo) {
- w = 1;
- window.showModalDialog(s.url || s.file, window, f);
- } else
- w = window.open(s.url || s.file, s.name, f);
- } catch (ex) {
- // Ignore
- }
-
- if (!w)
- alert(t.editor.getLang('popup_blocked'));
- },
-
- close : function(w) {
- w.close();
- this.onClose.dispatch(this);
- },
-
- createInstance : function(cl) {
- var a = arguments, i, f = tinymce.resolve(cl), s = '';
-
- // Is there a better way to dynamically create
- // a class with a dynamic number of arguments
- for (i=1; i 1 ? ',' : '') + 'a[' + i + ']';
-
- return eval('(new f(' + s + '))');
- },
-
- confirm : function(t, cb, s) {
- cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t))));
- },
-
- alert : function(t, cb, s) {
- alert(this._decode(t));
-
- if (cb)
- cb.call(s || this);
- },
-
- // Internal functions
-
- _decode : function(s) {
- return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
- }
-
- });
-}());
\ No newline at end of file
+var tinymce={majorVersion:'3',minorVersion:'0',releaseDate:'2008-01-30',_init:function(){var t=this,ua=navigator.userAgent,i,nl,n,base;t.isOpera=window.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!window.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(navigator.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(window.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;return;}t.suffix='';nl=document.getElementsByTagName('base');for(i=0;i=items.length){for(i=0;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);t=w.setInterval(function(){if(x.readyState==4||c++>10000){w.clearInterval(t);if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}},10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(function(){t.doc=t.root=null;});},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?window:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){if(typeof(e)=='string')return this.doc.getElementById(e);return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+''+n+'>';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s['-moz-opacity']=s['-khtml-opacity']=v;break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;}s[na]=v||'';if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values){if(v)e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v;break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e)return false;if(!is(dv))dv="";if(/^(src|href|style|coords)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values)e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'tabindex':if(v===32768)v='';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=window.self!=window.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){x-=r.scrollLeft||0;y-=r.scrollTop||0;r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null))+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=this.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;if(!d.createStyleSheet)t.add(t.select('head')[0],'link',{rel:'stylesheet',href:u});else d.createStyleSheet(u);});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x;h=t.processHTML(h);if(isIE){try{e.innerHTML='
'+h;e.removeChild(e.firstChild);}catch(ex){x=t.create('div');x.innerHTML='
'+h;each(x.childNodes,function(n,i){if(i>1)e.appendChild(n);});}}else e.innerHTML=h;return h;});},processHTML:function(h){var t=this,s=t.settings;if(!s.process_html)return h;if(tinymce.isGecko){h=h.replace(/<(\/?)strong>|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}h=h.replace(/]+)\/>|/gi,'');if(s.keep_values){if(h.indexOf('');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.util.XHR.send({url:o.url,error:t.settings.error,success:function(co){t.eval(co);done(o);allDone();}});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!tinymce.dom.Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},destroy:function(){DOM.remove(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':'mceSeparator'});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||document.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' noIcons';this.parent(id,s);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeightmx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,'mceMenuItemSub')){m=t.items[e.id];if(m.isDisabled())return;if(m.settings.onclick)m.settings.onclick(e);dm=t;while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,'mceMenuItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,'mceMenuItemActive');}}});}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,'mceMenuItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:150'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':'mceMenu'+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':'mceMenuLine'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_add:function(tb,o){var n,s=o.settings,a,ro,it;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':'mceMenuItemSeparator'});DOM.add(ro,'td',{'class':'mceMenuItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'last');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':'mceMenuItem mceMenuItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);DOM.add(n,'span',{'class':'icon'+(s.icon?' '+s.icon:'')});n=DOM.add(n,s.element||'span',{'class':'text',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'first');if((n=ro.previousSibling)&&DOM.hasClass(n,'mceMenuItemSeparator'))DOM.addClass(ro,'first');if(o.collapse)DOM.addClass(ro,'mceMenuItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'last');DOM.addClass(ro,'last');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var s=this.settings,h='';if(s.image)h+='
';else h+='';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(v){var t=this,e,fv;if(v!=t.selectedValue){e=DOM.get(t.id+'_text');t.selectedValue=v;each(t.items,function(o){if(o.value==v){DOM.setHTML(e,DOM.encode(o.title));fv=1;return false;}});if(!fv){DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'title');e=0;return;}else DOM.removeClass(e,'title');}e=0;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings;h='';h+=''+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'text',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+' | ';h+=''+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'open',onclick:"return false;",onmousedown:'return false;'},'')+' | ';h+='
';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(document,'mousedown',t.hideMenu,t);DOM.addClass(t.id,'mceListBoxSelected');},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,'mceListBoxSelected');Event.remove(document,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':'mceListBoxMenu noIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle'}).setDisabled(1);each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this;Event.add(t.id,'click',t.showMenu,t);if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceListBoxDisabled'))DOM.addClass(t.id,'mceListBoxHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceListBoxDisabled'))DOM.removeClass(t.id,'mceListBoxHover');});}t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(v){var e=DOM.get(this.id),ol=e.options;v=''+(v||'');e.selectedIndex=0;each(ol,function(o,i){if(o.value==v){e.selectedIndex=i;return false;}});},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=e.target.options[e.target.selectedIndex].value;t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||document.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.showMenu(0,e.clientHeight);Event.add(document,'mousedown',t.hideMenu,t);t.setState('Selected',1);},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(document,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'action '+s['class']});else h1=DOM.createHTML('span',{'class':'action '+s['class']});h+=''+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'action '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+' | ';h1=DOM.createHTML('span',{'class':'open '+s['class']});h+=''+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'open '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+' | ';h+='
';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:150});e=0;Event.add(document,'mousedown',t.hideMenu,t);},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(document,'mousedown',t.hideMenu,t);DOM.hide(t.id+'_menu');}},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c}});Event.add(n,'mousedown',function(){t.setColor('#'+c);});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'morecolors'});n=DOM.add(n,'a',{href:'javascript:;',onclick:'return false;','class':'morecolors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');return w;},setColor:function(c){var t=this,p,s=this.settings,co=s.menu_container,po,cp,id=t.id+'_preview';if(!(p=DOM.get(id))){DOM.setStyle(t.id+'_action','position','relative');p=DOM.add(t.id+'_action','div',{id:id,'class':'mceColorPreview'});}p.style.backgroundColor=c;t.value=c;t.hideMenu();s.onselect(c);}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c='mceToolbarEnd',co,dom=tinymce.DOM,s=t.settings;h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,''));tinymce.each(t.controls,function(c){h+=''+c.renderHTML()+' | ';});co=t.controls[t.controls.length-1].constructor;if(co===tinymce.ui.Button)c+=' mceToolbarEndButton';else if(co===tinymce.ui.SplitButton)c+=' mceToolbarEndSplitButton';else if(co===tinymce.ui.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,''));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},''+h+'
');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s;if(tinymce.EditorManager.settings){u=this.urls[n]+'/langs/'+tinymce.EditorManager.settings.language+'.js';s=tinymce.EditorManager.settings;if(s){if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;this.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,init:function(s){var t=this,pl,sl=tinymce.ScriptLoader;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-')ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=s.plugins.split(',');if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(s.browsers.split(','),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';each(l.split(','),function(v){new tinymce.Editor(v,s).render();});break;case"textareas":function hasClass(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector))new tinymce.Editor(v.id=(v.id||v.name||(v.id=DOM.uniqueId())),s).render();});break;}if(s.oninit){l=co=0;each(t.editors,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e._destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v);switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":return true;case"mceRemoveEditor":case"mceRemoveControl":ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.documentBaseURL=window.location.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir');d.close();if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE)t.getBody().contentEditable=true;t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content=''+o.content+'
';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^( |#160;|\s)<\/p>$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(s.content_css.split(','),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this;if(!sf){t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv){return is(this.settings[n])?this.settings[n]:dv;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||this.getBody();this.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?this.getBody():n,s.isCollapsed(),o);},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(pa.split(','),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(pa.split('+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}if(o=t.execCommands[cmd]){s=o.func.call(o.scope,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val);return s;}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val);},queryCommandState:function(c){var t=this,o;if(t._isHidden())return;if(o=t.queryStateCommands[c])return o.func.call(o.scope);o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;return this.getDoc().queryCommandState(c);},queryCommandValue:function(c){var t=this,o;if(t._isHidden())return;if(o=t.queryValueCommands[c])return o.func.call(o.scope);o=t.editorCommands.queryCommandValue(c);if(is(o))return o;return this.getDoc().queryCommandValue(c);},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,s=t.settings,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');DOM.hide(t.getContainer());DOM.setStyle(s.id,'display',t.orgDisplay);t.save();},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},remove:function(){var t=this;t.removed=1;t.hide();DOM.remove(t.getContainer());t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);EditorManager.remove(t);},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
',1);o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o={content:h};t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=this.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK'))return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getDoc(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getDoc(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())d.execCommand("useCSS",0,true);}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var v,f,el;function find(d){f=DOM.getParent(ed.id,'form'),el=f.elements;if(f){each(f.elements,function(e,i){if(e.id==ed.id){i=i+d;if(i<0||i>el.length)return;el=el[i];}});}return el;};if(e.keyCode===9){v=ed.getParam('tab_focus').split(',');if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'']);t.addShortcut('ctrl+8','',['FormatBlock',false,'
']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_destroy:function(){var t=this;if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':dom.replace(dom.create('span',{style:'text-decoration: underline;'}),n,1);break;case'STRIKE':dom.replace(dom.create('span',{style:'text-decoration: line-through;'}),n,1);break;}});}else if(o.set){each(t.dom.select('table,span',o.node),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')dom.replace(dom.create('u'),n,1);else if(n.style.textDecoration=='line-through')dom.replace(dom.create('strike'),n,1);}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onInit.add(function(){convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,sl,cl,fz,fzn,v,i;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=sl.split(',');if(cl=s.font_size_classes)cl=cl.split(',');t.onPreProcess.add(function(ed,o){if(!s.inline_styles)return;if(o.set){if(tinymce.isWebKit)return;each(t.dom.select('span',o.node),function(n){var f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily')});if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1)dom.setAttrib(f,'size',''+(i+1||1));}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1)dom.setAttrib(f,'size',''+(i+1||1));}if(f.color||f.face||f.size)dom.replace(f,n,1);});}else if(o.get){each(t.dom.select('font',o.node),function(n){var sp=dom.create('span',{style:{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor}});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.replace(sp,n,1);});}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+''+d[d.length-1].tag+'>';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+=''+d[i].tag+'>';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,e=ed.dom.getParent(ed.selection.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return ed.getDoc().queryCommandValue('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=ed.getDoc().queryCommandValue('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else dom.setStyle(n,'float',v);this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;dom.setAttrib(n,'mce_new','');if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p)return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG')return dom.getStyle(n,'float')==v;n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return ed.getDoc().queryCommandState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor;val=ed.settings.forced_root_block?(val||''):val;t.mceRemoveNode();if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.execCommand('mceInsertContent',false,'tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n;if(n&&n.nodeName=='A')return false;return ed.getDoc().queryCommandState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,s=t.editor.selection,b=s.getBookmark(),bq,dom=t.editor.dom;function findBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};if(findBQ(s.getStart())){each(t._getSelectedBlocks(findBQ(s.getStart()),findBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE')dom.remove(e,1);});t.editor.selection.moveToBookmark(b);return;}each(t._getSelectedBlocks(findBQ(s.getStart()),findBQ(s.getEnd())),function(e){var n;if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});t.editor.selection.moveToBookmark(b);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0?t.index-1:0];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index/gi,'
');o.content=o.content.replace(/]+)><\/p>|
]+)\/>|
]+)>\s+<\/p>|
<\/p>|
|\s+<\/p>/gi,'
\u00a0
');if(!isIE&&o.set){o.content=o.content.replace(/]+)>[\s\u00a0]+<\/p>|
[\s\u00a0]+<\/p>/gi,'
');}else{o.content=o.content.replace(/]+)>\s*
\s*<\/p>|
\s*
\s*<\/p>/gi,'
\u00a0
');o.content=o.content.replace(/\s*
\s*<\/p>/gi,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=t.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13){s.setContent('
',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onPreProcess.add(function(ed,o){each(ed.dom.select('br',o.node),function(n){var p=n.parentNode;if(p&&p.nodeName=='p'&&(p.childNodes.length==1||p.lastChild==n))p.replaceChild(ed.getDoc().createTextNode('\u00a0'),n);});});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||!t.dom.isBlock(nx)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(t.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=d.getElementsByTagName(t.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,d=ed.getDoc(),se=t.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
';if(isOpera){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();r=d.createRange();r.selectNodeContents(aft);r.collapse(1);s.removeAllRanges();s.addRange(r);if(tinymce.isWebKit)ed.getWin().scrollTo(0,ed.dom.getPos(aft).y);else aft.scrollIntoView(0);return false;},backspaceDelete:function(e,bs){var t=this,ed=t.editor,b=ed.getBody(),n,se=ed.selection,r=se.getRng(),sc=r.startContainer,n;if(sc&&ed.dom.isBlock(sc)&&bs){if(sc.childNodes.length==1&&sc.firstChild.nodeName=='BR'){n=sc.previousSibling;if(n){ed.dom.remove(sc);se.select(n,1);se.collapse(0);return Event.cancel(e);}}}function handler(e){e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&t.getParentBlock(e)){ed.dom.remove(e);Event.remove(b,'DOMNodeInserted',handler);}};Event._add(b,'DOMNodeInserted',handler);window.setTimeout(function(){Event._remove(b,'DOMNodeInserted',handler);},1);}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,extend=tinymce.extend;tinymce.create('tinymce.ControlManager',{ControlManager:function(ed,s){var t=this,i;s=s||{};t.editor=ed;t.controls={};t.onAdd=new tinymce.util.Dispatcher(t);t.onPostRender=new tinymce.util.Dispatcher(t);t.prefix=s.prefix||ed.id+'_';t.onPostRender.add(function(){each(t.controls,function(c){c.postRender();});});},get:function(id){return this.controls[this.prefix+id]||this.controls[id];},setActive:function(id,s){var c=null;if(c=this.get(id))c.setActive(s);return c;},setDisabled:function(id,s){var c=null;if(c=this.get(id))c.setDisabled(s);return c;},add:function(c){var t=this;if(c){t.controls[c.id]=c;t.onAdd.dispatch(c,t);}return c;},createControl:function(n){var c,t=this,ed=t.editor;each(ed.plugins,function(p){if(p.createControl){c=p.createControl(n,t);if(c)return false;}});switch(n){case"|":case"separator":return t.createSeparator();}if(!c&&ed.buttons&&(c=ed.buttons[n]))return t.createButton(n,c);return t.add(c);},createDropMenu:function(id,s){var t=this,ed=t.editor,c;s=extend({'class':'mceDropDown'},s);s['class']=s['class']+' '+ed.getParam('skin')+'Skin';id=t.prefix+id;c=t.controls[id]=new tinymce.ui.DropMenu(id,s);c.onAddItem.add(function(c,o){var s=o.settings;s.title=ed.getLang(s.title,s.title);if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}});ed.onRemove.add(function(){c.destroy();});return t.add(c);},createListBox:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,scope:s.scope,control_manager:t},s);id=t.prefix+id;if(ed.settings.use_native_selects)c=new tinymce.ui.NativeListBox(id,s);else c=new tinymce.ui.ListBox(id,s);t.controls[id]=c;if(tinymce.isWebKit){c.onPostRender.add(function(c,n){Event.add(n,'mousedown',function(){ed.bookmark=ed.selection.getBookmark('simple');});Event.add(n,'focus',function(){ed.selection.moveToBookmark(ed.bookmark);ed.bookmark=null;});});}if(c.hideMenu)ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createButton:function(id,s){var t=this,ed=t.editor,o,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick&&!s.menu_button){s.onclick=function(){ed.execCommand(s.cmd,s.ui||false,s.value);};}s=extend({title:s.title,'class':id,unavailable_prefix:ed.getLang('unavailable',''),scope:s.scope,control_manager:t},s);id=t.prefix+id;if(s.menu_button){c=new tinymce.ui.MenuButton(id,s);ed.onMouseDown.add(c.hideMenu,c);}else c=new tinymce.ui.Button(id,s);return t.add(c);},createMenuButton:function(id,s){s=s||{};s.menu_button=1;return this.createButton(id,s);},createSplitButton:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,scope:s.scope,control_manager:t},s);id=t.prefix+id;c=t.add(new tinymce.ui.SplitButton(id,s));ed.onMouseDown.add(c.hideMenu,c);return c;},createColorSplitButton:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope,more_colors_title:ed.getLang('more_colors')},s);id=t.prefix+id;c=new tinymce.ui.ColorSplitButton(id,s);ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createToolbar:function(id,s){var c,t=this;id=t.prefix+id;c=new tinymce.ui.Toolbar(id,s);if(t.get(id))return null;return t.add(c);},createSeparator:function(){return new tinymce.ui.Separator();}});})();(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each,isIE=tinymce.isIE,isOpera=tinymce.isOpera;tinymce.create('tinymce.WindowManager',{WindowManager:function(ed){var t=this;t.editor=ed;t.onOpen=new Dispatcher(t);t.onClose=new Dispatcher(t);t.params={};t.features={};},open:function(s,p){var t=this,f='',x,y,mo=t.editor.settings.dialog_type=='modal',w,sw,sh,vp=tinymce.DOM.getViewPort();s=s||{};p=p||{};sw=isOpera?vp.w:screen.width;sh=isOpera?vp.h:screen.height;s.name=s.name||'mc_'+new Date().getTime();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240);s.resizable=true;s.left=s.left||parseInt(sw/ 2.0) - (s.width /2.0);s.top=s.top||parseInt(sh/ 2.0) - (s.height /2.0);p.inline=false;p.mce_width=s.width;p.mce_height=s.height;if(mo){if(isIE){s.center=true;s.help=false;s.dialogWidth=s.width+'px';s.dialogHeight=s.height+'px';s.scroll=s.scrollbars||false;}else s.modal=s.alwaysRaised=s.dialog=s.centerscreen=s.dependent=true;}each(s,function(v,k){if(tinymce.is(v,'boolean'))v=v?'yes':'no';if(!/^(name|url)$/.test(k)){if(isIE&&mo)f+=(f?';':'')+k+':'+v;else f+=(f?',':'')+k+'='+v;}});t.features=s;t.params=p;t.onOpen.dispatch(t,s,p);try{if(isIE&&mo){w=1;window.showModalDialog(s.url||s.file,window,f);}else w=window.open(s.url||s.file,s.name,f);}catch(ex){}if(!w)alert(t.editor.getLang('popup_blocked'));},close:function(w){w.close();this.onClose.dispatch(this);},createInstance:function(cl){var a=arguments,i,f=tinymce.resolve(cl),s='';for(i=1;i1?',':'')+'a['+i+']';return eval('(new f('+s+'))');},confirm:function(t,cb,s){cb.call(s||this,confirm(this._decode(this.editor.getLang(t,t))));},alert:function(t,cb,s){alert(this._decode(t));if(cb)cb.call(s||this);},_decode:function(s){return tinymce.DOM.decode(s).replace(/\\n/g,'\n');}});}());
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php
index 821672594f..d244ad634e 100644
--- a/wp-includes/js/tinymce/tiny_mce_config.php
+++ b/wp-includes/js/tinymce/tiny_mce_config.php
@@ -25,59 +25,46 @@
$valid_elements = '*[*]';
$valid_elements = apply_filters('mce_valid_elements', $valid_elements);
- $invalid_elements = apply_filters('mce_invalid_elements', '');
+ $invalid_elements = apply_filters('mce_invalid_elements', '');
- $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'wphelp', 'media', 'fullscreen' );
+ $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' );
$plugins = apply_filters('mce_plugins', $plugins);
$plugins = implode($plugins, ',');
- $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv', 'wp_adv_start', 'wp_adv_end'));
+ $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'outdent', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'image', 'wp_more', '|', 'spellchecker', '|', 'wp_help', 'wp_adv' ));
$mce_buttons = implode($mce_buttons, ',');
- $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', 'media', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'fullscreen'));
+
+ $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', '|', 'removeformat', 'cleanup', '|', 'media', 'charmap', 'blockquote', '|', 'undo', 'redo', 'fullscreen' ));
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
+
+ $mce_buttons_4 = apply_filters('mce_buttons_4', array());
+ $mce_buttons_4 = implode($mce_buttons_4, ',');
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
$mce_browsers = implode($mce_browsers, ',');
- $mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
- $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
+ $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/wordpress.css';
$mce_css = apply_filters('mce_css', $mce_css);
- if ( $_SERVER['HTTPS'] == 'on' ) {
+ if ( $_SERVER['HTTPS'] == 'on' )
$mce_css = str_replace('http://', 'https://', $mce_css);
- $mce_popups_css = str_replace('http://', 'https://', $mce_popups_css);
- }
$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower(get_locale());
?>
-/*
-wpEditorInit = function() {
- // Activate tinyMCE if it's the user's default editor
- if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor )
- tinyMCE.execCommand('mceAddControl', false, 'content');
-};
-*/
-
-wpEditorInit = function() {
- if ( ( 'undefined' != typeof wpTinyMCEConfig ) && 'tinymce' != wpTinyMCEConfig.defaultEditor )
- tinyMCE.get('content').hide();
-}
-
initArray = {
- mode : "exact",
- elements : "content",
-// editor_selector : "mceEditor",
- oninit : "wpEditorInit",
- width : "100%",
+ mode : "none",
+ onpageload : "wpEditorInit",
+ width : "100%",
theme : "advanced",
- skin : "o2k7",
+ skin : "wp_theme",
theme_advanced_buttons1 : "",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
+ theme_advanced_buttons4 : "",
language : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
@@ -94,14 +81,15 @@ initArray = {
convert_newlines_to_brs : false,
remove_linebreaks : false,
fix_list_elements : true,
+ fix_table_elements : true,
gecko_spellcheck : true,
entities : "38,amp,60,lt,62,gt",
- button_tile_map : false,
+ accessibility_focus : false,
+ tab_focus : ":next",
content_css : "",
- valid_elements : "",
- invalid_elements : "",
- save_callback : 'TinyMCE_wordpressPlugin.saveCallback',
- imp_version : "",
+
+
+ save_callback : "switchEditors.saveCallback",
plugins : ""
};
@@ -112,4 +100,4 @@ initArray = {
do_action('tinymce_before_init');
?>
-tinyMCE.init(initArray);
+tinyMCE_GZ.init(initArray);
diff --git a/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-includes/js/tinymce/tiny_mce_gzip.php
index 290d1d4236..4f2438a59f 100644
--- a/wp-includes/js/tinymce/tiny_mce_gzip.php
+++ b/wp-includes/js/tinymce/tiny_mce_gzip.php
@@ -1,181 +1,216 @@
- var scriptURL = '/js/tinymce/tiny_mce.js';
- document.write('');
- -1) {
- // Write main script and patch some things
- if ( $index == 0 ) {
- // Add core
- $content .= wp_compact_tinymce_js(getFileContents("tiny_mce" . $suffix . ".js"));
- $content .= 'TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;';
- $content .= 'TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;';
- } else
- $content .= 'tinyMCE = realTinyMCE;';
+ // Add core
+ if ( $core == 'true' ) {
+ $content .= getFileContents('tiny_mce' . $suffix . '.js');
- // Patch loading functions
- //$content .= "tinyMCE_GZ.start();";
-
- // Do init based on index
- $content .= "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);";
-
- // Load external plugins
- if ( $index == 0 )
- $content .= "tinyMCECompressed.loadPlugins();";
+ // Patch loading functions
+ $content .= 'tinyMCE_GZ.start();';
+ }
// Add core languages
$lang_content = '';
- foreach ($languages as $lang)
- $lang_content .= getFileContents("langs/" . $lang . ".js");
- if ( empty($lang_content) )
- $lang_content .= getFileContents("langs/en.js");
- $content .= $lang_content;
+ foreach ( $languages as $lang )
+ $lang_content .= getFileContents('langs/' . $lang . '.js');
+
+ if ( empty($lang_content) && file_exists('langs/en.js') )
+ $lang_content .= getFileContents('langs/en.js');
+
+ $content .= $lang_content;
// Add themes
- foreach ($themes as $theme) {
- $content .= wp_compact_tinymce_js(getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js"));
+ foreach ( $themes as $theme ) {
+ $content .= getFileContents( 'themes/' . $theme . '/editor_template' . $suffix . '.js');
$lang_content = '';
- foreach ($languages as $lang)
- $lang_content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
- if ( empty($lang_content) )
- $lang_content .= getFileContents("themes/" . $theme . "/langs/en.js");
- $content .= $lang_content;
+ foreach ( $languages as $lang )
+ $lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' );
+
+ if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) )
+ $lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' );
+
+ $content .= $lang_content;
}
// Add plugins
- foreach ($plugins as $plugin) {
- $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
+ foreach ( $plugins as $plugin ) {
+ $content .= getFileContents('plugins/' . $plugin . '/editor_plugin' . $suffix . '.js');
$lang_content = '';
- foreach ($languages as $lang)
- $lang_content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
- if ( empty($lang_content) )
- $lang_content .= getFileContents("plugins/" . $plugin . "/langs/en.js");
- $content .= $lang_content;
+ foreach ( $languages as $lang )
+ $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' );
+
+ if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) )
+ $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' );
+
+ $content .= $lang_content;
}
// Add custom files
- foreach ($custom as $file)
+ foreach ( $custom as $file )
$content .= getFileContents($file);
- // Reset tinyMCE compressor engine
- $content .= "tinyMCE = tinyMCECompressed;";
-
// Restore loading functions
- //$content .= "tinyMCE_GZ.end();";
+ if ( $core == 'true' )
+ $content .= 'tinyMCE_GZ.end();';
// Generate GZIP'd content
- if ($supportsGzip) {
- if ($compress) {
- header("Content-Encoding: " . $enc);
- $cacheData = gzencode($content, 9, FORCE_GZIP);
+ if ( $supportsGzip ) {
+ if ( $compress ) {
+ header('Content-Encoding: ' . $enc);
+ $cacheData = gzencode( $content, 9, FORCE_GZIP );
} else
$cacheData = $content;
// Write gz file
- if ($diskCache && $cacheKey != "")
- putFileContents($cacheFile, $cacheData);
+ if ( $diskCache && $cacheKey != '' )
+ putFileContents( $cacheFile, $cacheData );
// Stream to client
echo $cacheData;
@@ -184,183 +219,205 @@ if ($index > -1) {
echo $content;
}
- die;
+ exit;
}
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- function getParam($name, $def = false) {
- if (!isset($_GET[$name]))
- return $def;
-
- return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
- }
-
- function getFileContents($path) {
- $path = realpath($path);
-
- if (!$path || !@is_file($path))
- return "";
-
- if (function_exists("file_get_contents"))
- return @file_get_contents($path);
-
- $content = "";
- $fp = @fopen($path, "r");
- if (!$fp)
- return "";
-
- while (!feof($fp))
- $content .= fgets($fp);
-
- fclose($fp);
-
- return $content;
- }
-
- function putFileContents($path, $content) {
- if (function_exists("file_put_contents"))
- return @file_put_contents($path, $content);
-
- $fp = @fopen($path, "wb");
- if ($fp) {
- fwrite($fp, $content);
- fclose($fp);
- }
- }
-
- // WP specific
- function wp_compact_tinymce_js($text) {
- // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS.
-
- // Strip comments
- $text = preg_replace("!(^|\s+)//.*$!m", '', $text);
- $text = preg_replace("!/\*.*?\*/!s", '', $text);
-
- // Strip leading tabs, carriage returns and unnecessary line breaks.
- $text = preg_replace("!^\t+!m", '', $text);
- $text = str_replace("\r", '', $text);
- $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text);
-
- return "$text\n";
- }
?>
-function TinyMCECompressed() {
- this.configs = new Array();
- this.loadedFiles = new Array();
- this.externalPlugins = new Array();
- this.loadAdded = false;
- this.isLoaded = false;
-}
+var tinyMCEPreInit = {suffix : ''};
-TinyMCECompressed.prototype.init = function(settings) {
- var elements = document.getElementsByTagName('script');
- var scriptURL = "";
+var tinyMCE_GZ = {
+ settings : {
+ themes : '',
+ plugins : '',
+ languages : '',
+ disk_cache : false,
+ page_name : 'tiny_mce_gzip.php',
+ debug : false,
+ suffix : ''
+ },
+
+ opt : {},
+
+ init : function(arr, cb) {
+ var t = this, n, s, nl = document.getElementsByTagName('script');
+
+ t.opt = arr;
- for (var i=0; i');
+
+ // Send request
+ x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
+ x.overrideMimeType && x.overrideMimeType('text/javascript');
+ x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
+// x.setRequestHeader('Content-Type', 'text/javascript');
+ x.send('');
+
+ // Handle asyncronous loading
+ if (cb) {
+ // Wait for response
+ ti = w.setInterval(function() {
+ if (x.readyState == 4 || c++ > 10000) {
+ w.clearInterval(ti);
+
+ if (c < 10000 && x.status == 200) {
+ t.loaded = 1;
+ t.eval(x.responseText);
+ tinymce.dom.Event.domLoaded = true;
+ // cb.call(sc || t, x);
+ }
+
+ ti = x = null;
+ }
+ }, 10);
+ } else
+ t.eval(x.responseText);
+ },
+
+ start : function() {
+ var t = this, each = tinymce.each, s = t.settings, sl, ln = s.languages.split(',');
+
+ tinymce.suffix = s.suffix;
+
+ // Extend script loader
+ tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', {
+ loadScripts : function(sc, cb, s) {
+ var ti = this, th = [], pl = [], la = [];
+
+ each(sc, function(o) {
+ var u = o.url;
+
+ if ((!ti.lookup[u] || ti.lookup[u].state != 2) && u.indexOf(t.baseURL) === 0) {
+ // Collect theme
+ if (u.indexOf('editor_template') != -1) {
+ th.push(/\/themes\/([^\/]+)/.exec(u)[1]);
+ load(u, 1);
+ }
+
+ // Collect plugin
+ if (u.indexOf('editor_plugin') != -1) {
+ pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]);
+ load(u, 1);
+ }
+
+ // Collect language
+ if (u.indexOf('/langs/') != -1) {
+ la.push(/\/langs\/([^.]+)/.exec(u)[1]);
+ load(u, 1);
+ }
+ }
+ });
+
+ if (th.length + pl.length + la.length > 0) {
+ if (sl.settings.strict_mode) {
+ // Async
+ t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
+ return;
+ } else
+ t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
+ }
+
+ return ti.parent(sc, cb, s);
+ }
+ });
+
+ sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader();
+
+ function load(u, sp) {
+ var o;
+
+ if (!sp)
+ u = t.baseURL + u;
+
+ o = {url : u, state : 2};
+ sl.queue.push(o);
+ sl.lookup[o.url] = o;
+ };
+
+ // Add core languages
+ each (ln, function(c) {
+ if (c)
+ load('/langs/' + c + '.js');
+ });
+
+ // Add themes with languages
+ each(s.themes.split(','), function(n) {
+ if (n) {
+ load('/themes/' + n + '/editor_template' + s.suffix + '.js');
+
+ each (ln, function(c) {
+ if (c)
+ load('/themes/' + n + '/langs/' + c + '.js');
+ });
+ }
+ });
+
+ // Add plugins with languages
+ each(s.plugins.split(','), function(n) {
+ if (n) {
+ load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js');
+
+ each (ln, function(c) {
+ if (c)
+ load('/plugins/' + n + '/langs/' + c + '.js');
+ });
+ }
+ });
+ },
+
+ end : function() {
+ tinyMCE.init(this.opt);
+ },
+
+ eval : function(co) {
+ var w = window;
+
+ // Evaluate script
+ if (!w.execScript) {
+ try {
+ eval.call(w, co);
+ } catch (ex) {
+ eval(co, w); // Firefox 3.0a8
+ }
+ } else
+ w.execScript(co); // IE
}
-
- settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
- settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
- settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
- settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
- this.configs[this.configs.length] = settings;
- this.settings = settings;
-
- scriptURL += (scriptURL.indexOf('?') == -1) ? '?' : '&';
- scriptURL += "theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
- document.write('');
-
- if (!this.loadAdded) {
- tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
- tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
- this.loadAdded = true;
- }
-}
-
-TinyMCECompressed.prototype.onLoad = function() {
- if (tinyMCE.isLoaded)
- return true;
-
- tinyMCE = realTinyMCE;
- TinyMCE_Engine.prototype.onLoad();
- tinyMCE._addUnloadEvents();
-
- tinyMCE.isLoaded = true;
-}
-
-TinyMCECompressed.prototype.addEvent = function(o, n, h) {
- if (o.attachEvent)
- o.attachEvent("on" + n, h);
- else
- o.addEventListener(n, h, false);
-}
-
-TinyMCECompressed.prototype.getOnce = function(str) {
- var ar = str.replace(/\s+/g, '').split(',');
-
- for (var i=0; i