diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/tiny_mce_src.js --- a/includes/clientside/tinymce/tiny_mce_src.js Wed Dec 26 00:37:26 2007 -0500 +++ b/includes/clientside/tinymce/tiny_mce_src.js Thu Dec 27 22:09:33 2007 -0500 @@ -1,6339 +1,2524 @@ -/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */ - -function TinyMCE_Engine() { - var ua; - - this.majorVersion = "2"; - this.minorVersion = "1.0"; - this.releaseDate = "2007-02-13"; - - this.instances = new Array(); - this.switchClassCache = new Array(); - this.windowArgs = new Array(); - this.loadedFiles = new Array(); - this.pendingFiles = new Array(); - this.loadingIndex = 0; - this.configs = new Array(); - this.currentConfig = 0; - this.eventHandlers = new Array(); - this.log = new Array(); - this.undoLevels = []; - this.undoIndex = 0; - this.typingUndoIndex = -1; - - // Browser check - ua = navigator.userAgent; - this.isMSIE = (navigator.appName == "Microsoft Internet Explorer"); - this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1); - this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1); - this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1); - this.isGecko = ua.indexOf('Gecko') != -1; - this.isSafari = ua.indexOf('Safari') != -1; - this.isOpera = ua.indexOf('Opera') != -1; - this.isMac = ua.indexOf('Mac') != -1; - this.isNS7 = ua.indexOf('Netscape/7') != -1; - this.isNS71 = ua.indexOf('Netscape/7.1') != -1; - this.dialogCounter = 0; - this.plugins = new Array(); - this.themes = new Array(); - this.menus = new Array(); - this.loadedPlugins = new Array(); - this.buttonMap = new Array(); - this.isLoaded = false; - - // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those - if (this.isOpera) { - this.isMSIE = true; - this.isGecko = false; - this.isSafari = false; - } - - this.isIE = this.isMSIE; - this.isRealIE = this.isMSIE && !this.isOpera; - - // TinyMCE editor id instance counter - this.idCounter = 0; -}; - -TinyMCE_Engine.prototype = { - init : function(settings) { - var theme, nl, baseHREF = "", i; - - // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry. - if (this.isMSIE5_0) +/* file:jscripts/tiny_mce/classes/tinymce.js */ + +var tinymce = { + majorVersion : '3', + minorVersion : '0b3', + releaseDate : '2007-12-14', + + _init : function() { + var t = this, ua = navigator.userAgent, i, nl, n, base; + + // Browser checks + 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.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua); + t.isMac = ua.indexOf('Mac') != -1; + + // TinyMCE .NET webcontrol might be setting the values for TinyMCE + if (window.tinyMCEPreInit) { + t.suffix = tinyMCEPreInit.suffix; + t.baseURL = tinyMCEPreInit.base; return; - - this.settings = settings; - - // Check if valid browser has execcommand support - if (typeof(document.execCommand) == 'undefined') - return; - - // Get script base path - if (!tinyMCE.baseURL) { - var elements = document.getElementsByTagName('script'); - - // If base element found, add that infront of baseURL - nl = document.getElementsByTagName('base'); + } + + // Get suffix and base + t.suffix = ''; + + // If base element found, add that infront of baseURL + nl = document.getElementsByTagName('base'); + for (i=0; i'); - this._def("font_size_classes", ''); - this._def("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large', true); - this._def("event_elements", 'a,img', true); - this._def("convert_urls", true); - this._def("table_inline_editing", false); - this._def("object_resizing", true); - this._def("custom_shortcuts", true); - this._def("convert_on_click", false); - this._def("content_css", ''); - this._def("fix_list_elements", true); - this._def("fix_table_elements", false); - this._def("strict_loading_mode", ( ( IE ) ? true : true ) ); // document.contentType == 'application/xhtml+xml'); - this._def("hidden_tab_class", ''); - this._def("display_tab_class", ''); - this._def("gecko_spellcheck", false); - this._def("hide_selects_on_submit", true); - - // Force strict loading mode to false on non Gecko browsers - //if (this.isMSIE && !this.isOpera) - // this.settings.strict_loading_mode = false; - - // Browser check IE - if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1) - return; - - // Browser check Gecko - if (this.isGecko && this.settings['browsers'].indexOf('gecko') == -1) - return; - - // Browser check Safari - if (this.isSafari && this.settings['browsers'].indexOf('safari') == -1) - return; - - // Browser check Opera - if (this.isOpera && this.settings['browsers'].indexOf('opera') == -1) - return; - - // If not super absolute make it so - baseHREF = tinyMCE.settings['document_base_url']; - var h = document.location.href; - var p = h.indexOf('://'); - if (p > 0 && document.location.protocol != "file:") { - p = h.indexOf('/', p + 3); - h = h.substring(0, p); - - if (baseHREF.indexOf('://') == -1) - baseHREF = h + baseHREF; - - tinyMCE.settings['document_base_url'] = baseHREF; - tinyMCE.settings['document_base_prefix'] = h; - } - - // Trim away query part - if (baseHREF.indexOf('?') != -1) - baseHREF = baseHREF.substring(0, baseHREF.indexOf('?')); - - this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; - - theme = this.settings['theme']; - this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; - this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; - this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; - this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); - this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); - this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL - this.uniqueTag = ''; - this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'); - - // Theme url - this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme; - - if (!tinyMCE.isIE || tinyMCE.isOpera) - this.settings['force_br_newlines'] = false; - - if (tinyMCE.getParam("popups_css", false)) { - var cssPath = tinyMCE.getParam("popups_css", ""); - - // Is relative - if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings['popups_css'] = this.documentBasePath + "/" + cssPath; - else - this.settings['popups_css'] = cssPath; - } else - this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css"; - - if (tinyMCE.getParam("editor_css", false)) { - var cssPath = tinyMCE.getParam("editor_css", ""); - - // Is relative - if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings['editor_css'] = this.documentBasePath + "/" + cssPath; - else - this.settings['editor_css'] = cssPath; - } else { - if (this.settings.editor_css != '') - this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; - } - - if (tinyMCE.settings['debug']) { - var msg = "Debug: \n"; - - msg += "baseURL: " + this.baseURL + "\n"; - msg += "documentBasePath: " + this.documentBasePath + "\n"; - msg += "content_css: " + this.settings['content_css'] + "\n"; - msg += "popups_css: " + this.settings['popups_css'] + "\n"; - msg += "editor_css: " + this.settings['editor_css'] + "\n"; - - alert(msg); - } - - // Only do this once - if (this.configs.length == 0) { - if (typeof(TinyMCECompressed) == "undefined") { - tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad); - - if (tinyMCE.isRealIE) { - if (document.body) - tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad); - else - tinyMCE.addEvent(document, "readystatechange", TinyMCE_Engine.prototype.onLoad); - } - - tinyMCE.addEvent(window, "load", TinyMCE_Engine.prototype.onLoad); - tinyMCE._addUnloadEvents(); - } - } - - this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings['theme'] + '/editor_template' + tinyMCE.srcMode + '.js'); - this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings['language'] + '.js'); - this.loadCSS(this.settings['editor_css']); - - // Add plugins - var p = tinyMCE.getParam('plugins', '', true, ','); - if (p.length > 0) { - for (var i=0; i&"\']', 'g'); - this.xmlEncodeRe = new RegExp('[<>&"]', 'g'); -// this.xmlEncodeEnts = {'&':'&','"':'"',"'":''','<':'<','>':'>'}; + return; + }, + + is : function(o, t) { + var n = typeof(o); + + if (!t) + return n != 'undefined'; + + if (t == 'array' && (o instanceof Array)) + return true; + + return n == t; }, - _addUnloadEvents : function() { - if (tinyMCE.isIE) { - if (tinyMCE.settings['add_unload_trigger']) { - tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler); - tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler); + // #if !jquery + + each : function(o, cb, s) { + var n, l; + + if (!o) + return 0; + + s = s || o; + + if (typeof(o.length) != 'undefined') { + // Indexed arrays, needed for Safari + for (n=0, l = o.length; n'); - } - - this.loadedFiles[this.loadedFiles.length] = url; - }, - - loadNextScript : function() { - var d = document, se; - - if (!tinyMCE.settings.strict_loading_mode) - return; - - if (this.loadingIndex < this.pendingFiles.length) { - try { - /* - se = d.createElementNS('http://www.w3.org/1999/xhtml', 'script'); - se.setAttribute('language', 'javascript'); - se.setAttribute('type', 'text/javascript'); - se.setAttribute('src', this.pendingFiles[this.loadingIndex++]); - */ - - se = d.createElement('script'); - se.language = 'javascript'; - se.type = 'text/javascript'; - se.src = this.pendingFiles[this.loadingIndex++]; - - d.getElementsByTagName("head")[0].appendChild(se); - } catch(e) { - var error = e.toString(); - alert(error); - } - } else - this.loadingIndex = -1; // Done with loading - }, - - loadCSS : function(url) { - var ar = url.replace(/\s+/, '').split(','); - var lflen = 0, csslen = 0; - var skip = false; - var x = 0, i = 0, nl, le; - - for (x = 0,csslen = ar.length; x 0) { - /* Make sure it doesn't exist. */ - for (i=0, lflen=this.loadedFiles.length; i'); - } - - this.loadedFiles[this.loadedFiles.length] = ar[x]; + // Hashtables + for (n in o) { + if (o.hasOwnProperty(n)) { + if (cb.call(s, o[n], n, o) === false) + return 0; } } } - }, - - importCSS : function(doc, css) { - var css_ary = css.replace(/\s+/, '').split(','); - var csslen, elm, headArr, x, css_file; - - for (x = 0, csslen = css_ary.length; x 0) { - // Is relative, make absolute - if (css_file.indexOf('://') == -1 && css_file.charAt(0) != '/') - css_file = this.documentBasePath + "/" + css_file; - - if (typeof(doc.createStyleSheet) == "undefined") { - elm = doc.createElement("link"); - - elm.rel = "stylesheet"; - elm.href = css_file; - - if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0) - headArr[0].appendChild(elm); - } else - doc.createStyleSheet(css_file); - } - } - }, - - confirmAdd : function(e, settings) { - var elm = tinyMCE.isIE ? event.srcElement : e.target; - var elementId = elm.name ? elm.name : elm.id; - - tinyMCE.settings = settings; - - if (tinyMCE.settings['convert_on_click'] || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang['lang_edit_confirm']))) - tinyMCE.addMCEControl(elm, elementId); - - elm.setAttribute('mce_noask', 'true'); - }, - - updateContent : function(form_element_name) { - // Find MCE instance linked to given form element and copy it's value - var formElement = document.getElementById(form_element_name); - for (var n in tinyMCE.instances) { - var inst = tinyMCE.instances[n]; - if (!tinyMCE.isInstance(inst)) - continue; - - inst.switchSettings(); - - if (inst.formElement == formElement) { - var doc = inst.getDoc(); - - tinyMCE._setHTML(doc, inst.formElement.value); - - if (!tinyMCE.isIE) - doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid); - } - } - }, - - addMCEControl : function(replace_element, form_element_name, target_document) { - var id = "mce_editor_" + tinyMCE.idCounter++; - - var inst = new TinyMCE_Control(tinyMCE.settings); - - inst.editorId = id; - this.instances[id] = inst; - - inst._onAdd(replace_element, form_element_name, target_document); - }, - - removeInstance : function(ti) { - var t = [], n, i; - - // Remove from instances - for (n in tinyMCE.instances) { - i = tinyMCE.instances[n]; - - if (tinyMCE.isInstance(i) && ti != i) - t[n] = i; - } - - tinyMCE.instances = t; - - // Remove from global undo/redo - n = []; - t = tinyMCE.undoLevels; - - for (i=0; i 0) { - tinyMCE.nextUndoRedoAction = 'Undo'; - inst = this.undoLevels[--this.undoIndex]; - inst.select(); - - if (!tinyMCE.nextUndoRedoInstanceId) - inst.execCommand('Undo'); - } - } else - inst.execCommand('Undo'); - return true; - - case "Redo": - if (this.getParam('custom_undo_redo_global')) { - if (this.undoIndex <= this.undoLevels.length - 1) { - tinyMCE.nextUndoRedoAction = 'Redo'; - inst = this.undoLevels[this.undoIndex++]; - inst.select(); - - if (!tinyMCE.nextUndoRedoInstanceId) - inst.execCommand('Redo'); - } - } else - inst.execCommand('Redo'); - - return true; - - case 'mceFocus': - var inst = tinyMCE.getInstanceById(value); - if (inst) - inst.getWin().focus(); - return; - - case "mceAddControl": - case "mceAddEditor": - tinyMCE.addMCEControl(tinyMCE._getElementById(value), value); - return; - - case "mceAddFrameControl": - tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'], value['document']), value['element'], value['document']); - return; - - case "mceRemoveControl": - case "mceRemoveEditor": - tinyMCE.removeMCEControl(value); - return; - - case "mceToggleEditor": - var inst = tinyMCE.getInstanceById(value), pe, te; - - if (inst) { - pe = document.getElementById(inst.editorId + '_parent'); - te = inst.oldTargetElement; - - if (typeof(inst.enabled) == 'undefined') - inst.enabled = true; - - inst.enabled = !inst.enabled; - - if (!inst.enabled) { - pe.style.display = 'none'; - te.value = inst.getHTML(); - te.style.display = inst.oldTargetDisplay; - tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst); - } else { - pe.style.display = 'block'; - te.style.display = 'none'; - inst.setHTML(te.value); - inst.useCSS = false; - tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst); - } - } else - tinyMCE.addMCEControl(tinyMCE._getElementById(value), value); - - return; - - case "mceResetDesignMode": - // Resets the designmode state of the editors in Gecko - if (!tinyMCE.isIE) { - for (var n in tinyMCE.instances) { - if (!tinyMCE.isInstance(tinyMCE.instances[n])) - continue; - - try { - tinyMCE.instances[n].getDoc().designMode = "on"; - } catch (e) { - // Ignore any errors - } - } - } - - return; - } - - if (inst) { - inst.execCommand(command, user_interface, value); - } else if (tinyMCE.settings['focus_alert']) - alert(tinyMCELang['lang_focus_alert']); - }, - - _createIFrame : function(replace_element, doc, win) { - var iframe, id = replace_element.getAttribute("id"); - var aw, ah; - - if (typeof(doc) == "undefined") - doc = document; - - if (typeof(win) == "undefined") - win = window; - - iframe = doc.createElement("iframe"); - - aw = "" + tinyMCE.settings['area_width']; - ah = "" + tinyMCE.settings['area_height']; - - if (aw.indexOf('%') == -1) { - aw = parseInt(aw); - aw = (isNaN(aw) || aw < 0) ? 300 : aw; - aw = aw + "px"; - } - - if (ah.indexOf('%') == -1) { - ah = parseInt(ah); - ah = (isNaN(ah) || ah < 0) ? 240 : ah; - ah = ah + "px"; - } - - iframe.setAttribute("id", id); - iframe.setAttribute("name", id); - iframe.setAttribute("class", "mceEditorIframe"); - iframe.setAttribute("border", "0"); - iframe.setAttribute("frameBorder", "0"); - iframe.setAttribute("marginWidth", "0"); - iframe.setAttribute("marginHeight", "0"); - iframe.setAttribute("leftMargin", "0"); - iframe.setAttribute("topMargin", "0"); - iframe.setAttribute("width", aw); - iframe.setAttribute("height", ah); - iframe.setAttribute("allowtransparency", "true"); - iframe.className = 'mceEditorIframe'; - - if (tinyMCE.settings["auto_resize"]) - iframe.setAttribute("scrolling", "no"); - - // Must have a src element in MSIE HTTPs breaks aswell as absoute URLs - if (tinyMCE.isRealIE) - iframe.setAttribute("src", this.settings['default_document']); - - iframe.style.width = aw; - iframe.style.height = ah; - - // Ugly hack for Gecko problem in strict mode - if (tinyMCE.settings.strict_loading_mode) - iframe.style.marginBottom = '-5px'; - - // MSIE 5.0 issue - if (tinyMCE.isRealIE) - replace_element.outerHTML = iframe.outerHTML; - else - replace_element.parentNode.replaceChild(iframe, replace_element); - - if (tinyMCE.isRealIE) - return win.frames[id]; - else - return iframe; - }, - - setupContent : function(editor_id) { - var inst = tinyMCE.instances[editor_id], i; - var doc = inst.getDoc(); - var head = doc.getElementsByTagName('head').item(0); - var content = inst.startContent; - - // HTML values get XML encoded in strict mode - if (tinyMCE.settings.strict_loading_mode) { - content = content.replace(/</g, '<'); - content = content.replace(/>/g, '>'); - content = content.replace(/"/g, '"'); - content = content.replace(/&/g, '&'); - } - - tinyMCE.selectedInstance = inst; - inst.switchSettings(); - - // Not loaded correctly hit it again, Mozilla bug #997860 - if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") { - // This part will remove the designMode status - // Failes first time in Firefox 1.5b2 on Mac - try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {} - window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000); - return; - } - - if (!head) { - window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10); - return; - } - - // Import theme specific content CSS the user specific - tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings['theme'] + "/css/editor_content.css"); - tinyMCE.importCSS(inst.getDoc(), inst.settings['content_css']); - tinyMCE.dispatchCallback(inst, 'init_instance_callback', 'initInstance', inst); - - // Setup keyboard shortcuts - if (tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')) { - inst.addShortcut('ctrl', 'z', 'lang_undo_desc', 'Undo'); - inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo'); - } - - // BlockFormat shortcuts keys - for (i=1; i<=6; i++) - inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, ''); - - inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '

'); - inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '

'); - inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '
'); - - // Add default shortcuts for gecko - if (tinyMCE.isGecko) { - inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold'); - inst.addShortcut('ctrl', 'i', 'lang_italic_desc', 'Italic'); - inst.addShortcut('ctrl', 'u', 'lang_underline_desc', 'Underline'); - } - - // Setup span styles - if (tinyMCE.getParam("convert_fonts_to_spans")) - inst.getBody().setAttribute('id', 'mceSpanFonts'); - - if (tinyMCE.settings['nowrap']) - doc.body.style.whiteSpace = "nowrap"; - - doc.body.dir = this.settings['directionality']; - doc.editorId = editor_id; - - // Add on document element in Mozilla - if (!tinyMCE.isIE) - doc.documentElement.editorId = editor_id; - - inst.setBaseHREF(tinyMCE.settings['base_href']); - - // Replace new line characters to BRs - if (tinyMCE.settings['convert_newlines_to_brs']) { - content = tinyMCE.regexpReplace(content, "\r\n", "
", "gi"); - content = tinyMCE.regexpReplace(content, "\r", "
", "gi"); - content = tinyMCE.regexpReplace(content, "\n", "
", "gi"); - } - - // Open closed anchors - // content = content.replace(new RegExp('', 'gi'), ''); - - // Call custom cleanup code - content = tinyMCE.storeAwayURLs(content); - content = tinyMCE._customCleanup(inst, "insert_to_editor", content); - - if (tinyMCE.isIE) { - // Ugly!!! - window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500); - - if (tinyMCE.settings["force_br_newlines"]) - doc.styleSheets[0].addRule("p", "margin: 0;"); - - var body = inst.getBody(); - body.editorId = editor_id; - } - - content = tinyMCE.cleanupHTMLCode(content); - - // Fix for bug #958637 - if (!tinyMCE.isIE) { - var contentElement = inst.getDoc().createElement("body"); - var doc = inst.getDoc(); - - contentElement.innerHTML = content; - - // Remove weridness! - if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt']) - content = content.replace(new RegExp('<>', 'g'), ""); - - if (tinyMCE.settings['cleanup_on_startup']) - tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement)); - else - tinyMCE.setInnerHTML(inst.getBody(), content); - - tinyMCE.convertAllRelativeURLs(inst.getBody()); - } else { - if (tinyMCE.settings['cleanup_on_startup']) { - tinyMCE._setHTML(inst.getDoc(), content); - - // Produces permission denied error in MSIE 5.5 - eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}'); - } else - tinyMCE._setHTML(inst.getDoc(), content); - } - - // Fix for bug #957681 - //inst.getDoc().designMode = inst.getDoc().designMode; - - tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst); - tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc()); - - // Re-add design mode on mozilla - if (!tinyMCE.isIE) - tinyMCE.addEventHandlers(inst); - - // Add blur handler - if (tinyMCE.isIE) { - tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch); - tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953 - - // Workaround for drag drop/copy paste base href bug - if (!tinyMCE.isOpera) { - tinyMCE.addEvent(doc.body, "mousemove", TinyMCE_Engine.prototype.onMouseMove); - tinyMCE.addEvent(doc.body, "beforepaste", TinyMCE_Engine.prototype._eventPatch); - tinyMCE.addEvent(doc.body, "drop", TinyMCE_Engine.prototype._eventPatch); - } - } - - // Trigger node change, this call locks buttons for tables and so forth - inst.select(); - tinyMCE.selectedElement = inst.contentWindow.document.body; - - // Call custom DOM cleanup - tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody()); - tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody()); - tinyMCE._setEventsEnabled(inst.getBody(), false); - tinyMCE.cleanupAnchors(inst.getDoc()); - - if (tinyMCE.getParam("convert_fonts_to_spans")) - tinyMCE.convertSpansToFonts(inst.getDoc()); - - inst.startContent = tinyMCE.trim(inst.getBody().innerHTML); - inst.undoRedo.add({ content : inst.startContent }); - - // Cleanup any mess left from storyAwayURLs - if (tinyMCE.isGecko) { - // Remove mce_src from textnodes and comments - tinyMCE.selectNodes(inst.getBody(), function(n) { - if (n.nodeType == 3 || n.nodeType == 8) - n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); - - return false; - }); - } - - // Remove Gecko spellchecking - if (tinyMCE.isGecko) - inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck"); - - // Cleanup any mess left from storyAwayURLs - tinyMCE._removeInternal(inst.getBody()); - - inst.select(); - tinyMCE.triggerNodeChange(false, true); - }, - - storeAwayURLs : function(s) { - // Remove all mce_src, mce_href and replace them with new ones - // s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - // s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - - if (!s.match(/(mce_src|mce_href)/gi, s)) { - s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"'); - s = s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'href="$1" mce_href="$1"'); - } - - return s; - }, - - _removeInternal : function(n) { - if (tinyMCE.isGecko) { - // Remove mce_src from textnodes and comments - tinyMCE.selectNodes(n, function(n) { - if (n.nodeType == 3 || n.nodeType == 8) - n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), ""); - - return false; - }); - } - }, - - removeTinyMCEFormElements : function(form_obj) { - var i, elementId; - - // Skip form element removal - if (!tinyMCE.getParam('hide_selects_on_submit')) - return; - - // Check if form is valid - if (typeof(form_obj) == "undefined" || form_obj == null) - return; - - // If not a form, find the form - if (form_obj.nodeName != "FORM") { - if (form_obj.form) - form_obj = form_obj.form; - else - form_obj = tinyMCE.getParentElement(form_obj, "form"); - } - - // Still nothing - if (form_obj == null) - return; - - // Disable all UI form elements that TinyMCE created - for (i=0; i"); - rng.collapse(false); - rng.select(); - - tinyMCE.execCommand("mceAddUndoLevel"); - tinyMCE.triggerNodeChange(false); - return false; - } - } - - // Backspace or delete - if (e.keyCode == 8 || e.keyCode == 46) { - tinyMCE.selectedElement = e.target; - tinyMCE.linkElement = tinyMCE.getParentElement(e.target, "a"); - tinyMCE.imgElement = tinyMCE.getParentElement(e.target, "img"); - tinyMCE.triggerNodeChange(false); - } - - return false; - break; - - case "keyup": - case "keydown": - tinyMCE.hideMenus(); - tinyMCE.hasMouseMoved = false; - - if (inst && inst.handleShortcut(e)) - return false; - - if (e.target.editorId) - tinyMCE.instances[e.target.editorId].select(); - - if (tinyMCE.selectedInstance) - tinyMCE.selectedInstance.switchSettings(); - - var inst = tinyMCE.selectedInstance; - - // Handle backspace - if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) { - // Insert P element instead of BR - if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) { - // Cancel event - tinyMCE.execCommand("mceAddUndoLevel"); - e.preventDefault(); - return false; - } - } - - tinyMCE.selectedElement = null; - tinyMCE.selectedNode = null; - var elm = tinyMCE.selectedInstance.getFocusElement(); - tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a"); - tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img"); - tinyMCE.selectedElement = elm; - - // Update visualaids on tabs - if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9) - tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings['visual'], tinyMCE.selectedInstance); - - // Fix empty elements on return/enter, check where enter occured - if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13) - tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement(); - - // Fix empty elements on return/enter - if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) { - var elm = tinyMCE.enterKeyElement; - if (elm) { - var re = new RegExp('^HR|IMG|BR$','g'); // Skip these - var dre = new RegExp('^H[1-6]$','g'); // Add double on these - - if (!elm.hasChildNodes() && !re.test(elm.nodeName)) { - if (dre.test(elm.nodeName)) - elm.innerHTML = "  "; - else - elm.innerHTML = " "; - } - } - } - - // Check if it's a position key - var keys = tinyMCE.posKeyCodes; - var posKey = false; - for (var i=0; i'; - h += ''; - h += ''; - } else { - // Normal button - h += ''; - h += ''; - h += ''; - } - - return h; + + return 1; }, - getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) { - var h = '', m, x; - - mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');'; - cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\''; - - if (typeof(ui) != "undefined" && ui != null) - cmd += ',' + ui; - - if (typeof(val) != "undefined" && val != null) - cmd += ",'" + val + "'"; - - cmd += ');'; - - // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled - if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) { - x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20); - - if (tinyMCE.isRealIE) - h += ''; - else - h += ''; - - h += ''; - h += ''; - h += ''; - h += ''; - } else { - if (tinyMCE.isRealIE) - h += ''; - else - h += ''; - - h += ''; - h += ''; - h += ''; - h += ''; - } - - return h; - }, - - _menuButtonEvent : function(e, o) { - if (o.className == 'mceMenuButtonFocus') - return; - - if (e == 'over') - o.className = o.className + ' mceMenuHover'; - else - o.className = o.className.replace(/\s.*$/, ''); - }, - - addButtonMap : function(m) { - var i, a = m.replace(/\s+/, '').split(','); - - for (i=0; i 0); - - if (tinyMCE.settings['custom_undo_redo']) { - undoIndex = inst.undoRedo.undoIndex; - undoLevels = inst.undoRedo.undoLevels.length; - } - - tinyMCE.dispatchCallback(inst, 'handle_node_change_callback', 'handleNodeChange', editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content); - } - - if (this.selectedInstance && (typeof(focus) == "undefined" || focus)) - this.selectedInstance.contentWindow.focus(); - }, - - _customCleanup : function(inst, type, content) { - var pl, po, i; - - // Call custom cleanup - var customCleanup = tinyMCE.settings['cleanup_callback']; - if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined") - content = eval(customCleanup + "(type, content, inst);"); - - // Trigger theme cleanup - po = tinyMCE.themes[tinyMCE.settings['theme']]; - if (po && po.cleanup) - content = po.cleanup(type, content, inst); - - // Trigger plugin cleanups - pl = inst.plugins; - for (i=0; i 0) - className += " "; - - className += classNames[i]; - } - - return className; - }, - - handleVisualAid : function(el, deep, state, inst, skip_dispatch) { - if (!el) - return; - - if (!skip_dispatch) - tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst); - - var tableElement = null; - - switch (el.nodeName) { - case "TABLE": - var oldW = el.style.width; - var oldH = el.style.height; - var bo = tinyMCE.getAttrib(el, "border"); - - bo = bo == "" || bo == "0" ? true : false; - - tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo)); - - el.style.width = oldW; - el.style.height = oldH; - - for (var y=0; y<\/o:p>", "
"); - html = tinyMCE.regexpReplace(html, " <\/o:p>", ""); - html = tinyMCE.regexpReplace(html, "", ""); - html = tinyMCE.regexpReplace(html, "

<\/p>", ""); - html = tinyMCE.regexpReplace(html, "

<\/p>\r\n

<\/p>", ""); - html = tinyMCE.regexpReplace(html, "

 <\/p>", "
"); - html = tinyMCE.regexpReplace(html, "

\s*(

\s*)?", "

"); - html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "

"); - }*/ - - // Always set the htmlText output - tinyMCE.setInnerHTML(doc.body, html); - } - - tinyMCE.cleanupAnchors(doc); - - if (tinyMCE.getParam("convert_fonts_to_spans")) - tinyMCE.convertSpansToFonts(doc); - }, - - getEditorId : function(form_element) { - var inst = this.getInstanceById(form_element); - if (!inst) - return null; - - return inst.editorId; - }, - - getInstanceById : function(editor_id) { - var inst = this.instances[editor_id]; - if (!inst) { - for (var n in tinyMCE.instances) { - var instance = tinyMCE.instances[n]; - if (!tinyMCE.isInstance(instance)) - continue; - - if (instance.formTargetElementId == editor_id) { - inst = instance; - break; - } - } - } - - return inst; - }, - - queryInstanceCommandValue : function(editor_id, command) { - var inst = tinyMCE.getInstanceById(editor_id); - if (inst) - return inst.queryCommandValue(command); - - return false; - }, - - queryInstanceCommandState : function(editor_id, command) { - var inst = tinyMCE.getInstanceById(editor_id); - if (inst) - return inst.queryCommandState(command); - - return null; - }, - - setWindowArg : function(n, v) { - this.windowArgs[n] = v; - }, - - getWindowArg : function(n, d) { - return (typeof(this.windowArgs[n]) == "undefined") ? d : this.windowArgs[n]; - }, - - getCSSClasses : function(editor_id, doc) { - var inst = tinyMCE.getInstanceById(editor_id); - - // Is cached, use that - if (inst && inst.cssClasses.length > 0) - return inst.cssClasses; - - if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") { - var instance; - - for (var instanceName in tinyMCE.instances) { - instance = tinyMCE.instances[instanceName]; - if (!tinyMCE.isInstance(instance)) - continue; - - break; - } - - doc = instance.getDoc(); - } - - if (typeof(doc) == "undefined") { - var instance = tinyMCE.getInstanceById(editor_id); - doc = instance.getDoc(); - } - - if (doc) { - var styles = doc.styleSheets; - - if (styles && styles.length > 0) { - for (var x=0; x' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '
'; - - return tinyMCE.replaceVar(v, "pluginurl", o.baseURL); - } - } - - o = tinyMCE.themes[tinyMCE.settings['theme']]; - if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { - if (rtl) - return '' + v + ''; - - return v; - } - - return ''; - }, - - evalFunc : function(f, idx, a, o) { - o = !o ? window : o; - f = typeof(f) == 'function' ? f : o[f]; - - return f.apply(o, Array.prototype.slice.call(a, idx)); - }, - - dispatchCallback : function(i, p, n) { - return this.callFunc(i, p, n, 0, this.dispatchCallback.arguments); - }, - - executeCallback : function(i, p, n) { - return this.callFunc(i, p, n, 1, this.executeCallback.arguments); - }, - - execCommandCallback : function(i, p, n) { - return this.callFunc(i, p, n, 2, this.execCommandCallback.arguments); - }, - - callFunc : function(ins, p, n, m, a) { - var l, i, on, o, s, v; - - s = m == 2; - - l = tinyMCE.getParam(p, ''); - - if (l != '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0) - return true; - - if (ins != null) { - for (i=0, l = ins.plugins; i 0) - return true; - } - } - - l = tinyMCE.themes; - for (on in l) { - o = l[on]; - - if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0) - return true; - } - - return false; - }, - - xmlEncode : function(s, skip_apos) { - return s ? ('' + s).replace(!skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe, function (c, b) { - switch (c) { - case '&': - return '&'; - - case '"': - return '"'; - - case '\'': - return '''; // ' is not working in MSIE - - case '<': - return '<'; - - case '>': - return '>'; - } - - return c; - }) : s; - }, - - extend : function(p, np) { - var o = {}; - - o.parent = p; - - for (n in p) - o[n] = p[n]; - - for (n in np) - o[n] = np[n]; + grep : function(a, f) { + var o = []; + + tinymce.each(a, function(v) { + if (!f || f(v)) + o.push(v); + }); return o; }, - hideMenus : function() { - var e = tinyMCE.lastSelectedMenuBtn; - - if (tinyMCE.lastMenu) { - tinyMCE.lastMenu.hide(); - tinyMCE.lastMenu = null; - } - - if (e) { - tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass); - tinyMCE.lastSelectedMenuBtn = null; + inArray : function(a, v) { + var i, l; + + if (a) { + for (i = 0, l = a.length; i < l; i++) { + if (a[i] === v) + return i; + } } - } - - }; - -// Global instances -var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors -var tinyMCE = new TinyMCE_Engine(); -var tinyMCELang = {}; - -/* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */ - -function TinyMCE_Control(settings) { - - var t, i, to, fu, p, x, fn, fu, pn, s = settings; - - this.undoRedoLevel = true; - this.isTinyMCE_Control = true; - - // Default settings - this.settings = s; - this.settings['theme'] = tinyMCE.getParam("theme", "default"); - this.settings['width'] = tinyMCE.getParam("width", -1); - this.settings['height'] = tinyMCE.getParam("height", -1); - this.selection = new TinyMCE_Selection(this); - this.undoRedo = new TinyMCE_UndoRedo(this); - this.cleanup = new TinyMCE_Cleanup(); - this.shortcuts = new Array(); - this.hasMouseMoved = false; - this.foreColor = this.backColor = "#999999"; - this.data = {}; - this.cssClasses = []; - - this.cleanup.init({ - valid_elements : s.valid_elements, - extended_valid_elements : s.extended_valid_elements, - valid_child_elements : s.valid_child_elements, - entities : s.entities, - entity_encoding : s.entity_encoding, - debug : s.cleanup_debug, - indent : s.apply_source_formatting, - invalid_elements : s.invalid_elements, - verify_html : s.verify_html, - fix_content_duplication : s.fix_content_duplication, - convert_fonts_to_spans : s.convert_fonts_to_spans - }); - - // Wrap old theme - t = this.settings['theme']; - if (!tinyMCE.hasTheme(t)) { - fn = tinyMCE.callbacks; - to = {}; - - for (i=0; i 0) { - for (i=0; i 1 && tinyMCE.currentConfig != this.settings['index']) { - tinyMCE.settings = this.settings; - tinyMCE.currentConfig = this.settings['index']; - } - }, - - select : function() { - var oldInst = tinyMCE.selectedInstance; - - if (oldInst != this) { - if (oldInst) - oldInst.execCommand('mceEndTyping'); - - tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst); - tinyMCE.selectedInstance = this; - } - }, - - getBody : function() { - return this.contentBody ? this.contentBody : this.getDoc().body; - }, - - getDoc : function() { -// return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ? - return this.contentWindow.document; - }, - - getWin : function() { - return this.contentWindow; - }, - - getContainerWin : function() { - return this.containerWindow ? this.containerWindow : window; - }, - - getViewPort : function() { - return tinyMCE.getViewPort(this.getWin()); - }, - - getParentNode : function(n, f) { - return tinyMCE.getParentNode(n, f, this.getBody()); - }, - - getParentElement : function(n, na, f) { - return tinyMCE.getParentElement(n, na, f, this.getBody()); - }, - - getParentBlockElement : function(n) { - return tinyMCE.getParentBlockElement(n, this.getBody()); + trim : function(s) { + return (s ? '' + s : '').replace(/^\s*|\s*$/g, ''); }, - resizeToContent : function() { - var d = this.getDoc(), b = d.body, de = d.documentElement; - - this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px'; - }, - - addShortcut : function(m, k, d, cmd, ui, va) { - var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts; - - if (!tinyMCE.getParam('custom_shortcuts')) - return false; - - m = m.toLowerCase(); - k = ie && !n ? k.toUpperCase() : k; - c = n ? null : k.charCodeAt(0); - d = d && d.indexOf('lang_') == 0 ? tinyMCE.getLang(d) : d; - - sc = { - alt : m.indexOf('alt') != -1, - ctrl : m.indexOf('ctrl') != -1, - shift : m.indexOf('shift') != -1, - charCode : c, - keyCode : n ? k : (ie ? c : null), - desc : d, - cmd : cmd, - ui : ui, - val : va - }; - - for (i=0; i : + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name + + // Create namespace for new class + ns = t.createNS(s[3].replace(/\.\w+$/, '')); + + // Class already exists + if (ns[cn]) + return; + + // Make pure static class + if (s[2] == 'static') { + ns[cn] = p; + + if (this.onCreate) + this.onCreate(s[2], s[3], ns[cn]); + return; } - var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style")); - var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style")); - var className = tinyMCE.getAttrib(pa, "class"); - - // Removed class adding due to bug #1478272 - className = tinyMCE.getAttrib(ch, "class"); - - if (override) { - for (var n in st) { - if (typeof(st[n]) == 'function') - continue; - - stc[n] = st[n]; - } - } else { - for (var n in stc) { - if (typeof(stc[n]) == 'function') - continue; - - st[n] = stc[n]; - } - } - - tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st)); - tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className)); - ch.className = ""; - ch.style.cssText = ""; - ch.removeAttribute("class"); - ch.removeAttribute("style"); - }, - - _setUseCSS : function(b) { - var d = this.getDoc(); - - try {d.execCommand("useCSS", false, !b);} catch (ex) {} - try {d.execCommand("styleWithCSS", false, b);} catch (ex) {} - - if (!tinyMCE.getParam("table_inline_editing")) - try {d.execCommand('enableInlineTableEditing', false, "false");} catch (ex) {} - - if (!tinyMCE.getParam("object_resizing")) - try {d.execCommand('enableObjectResizing', false, "false");} catch (ex) {} - }, - - execCommand : function(command, user_interface, value) { - var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); - - // Is not a undo specific command - if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) - this.undoBookmark = null; - - // Mozilla issue - if (!tinyMCE.isIE && !this.useCSS) { - this._setUseCSS(false); - this.useCSS = true; - } - - //debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value); - this.contentDocument = doc; // <-- Strange, unless this is applied Mozilla 1.3 breaks - - // Don't dispatch key commands - if (!/mceStartTyping|mceEndTyping/.test(command)) { - if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value)) - return; + // Create default constructor + if (!p[cn]) { + p[cn] = function() {}; + de = 1; } - // Fix align on images - if (focusElm && focusElm.nodeName == "IMG") { - var align = focusElm.getAttribute('align'); - var img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm; - - switch (command) { - case "JustifyLeft": - if (align == 'left') - img.removeAttribute('align'); - else - img.setAttribute('align', 'left'); - - // Remove the div - var div = focusElm.parentNode; - if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - - case "JustifyCenter": - img.removeAttribute('align'); - - // Is centered - var div = tinyMCE.getParentElement(focusElm, "div"); - if (div && div.style.textAlign == "center") { - // Remove div - if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - } else { - // Add div - var div = this.getDoc().createElement("div"); - div.style.textAlign = 'center'; - div.appendChild(img); - focusElm.parentNode.replaceChild(div, focusElm); - } - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - - case "JustifyRight": - if (align == 'right') - img.removeAttribute('align'); - else - img.setAttribute('align', 'right'); - - // Remove the div - var div = focusElm.parentNode; - if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) - div.parentNode.replaceChild(img, div); - - this.selection.selectNode(img); - this.repaint(); - tinyMCE.triggerNodeChange(); - return; - } - } - - if (tinyMCE.settings['force_br_newlines']) { - var alignValue = ""; - - if (doc.selection.type != "Control") { - switch (command) { - case "JustifyLeft": - alignValue = "left"; - break; - - case "JustifyCenter": - alignValue = "center"; - break; - - case "JustifyFull": - alignValue = "justify"; - break; - - case "JustifyRight": - alignValue = "right"; - break; - } - - if (alignValue != "") { - var rng = doc.selection.createRange(); - - if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null) - divElm.setAttribute("align", alignValue); - else if (rng.pasteHTML && rng.htmlText.length > 0) - rng.pasteHTML('
' + rng.htmlText + "
"); - - tinyMCE.triggerNodeChange(); - return; - } - } - } - - switch (command) { - case "mceRepaint": - this.repaint(); - return true; - - case "unlink": - // Unlink if caret is inside link - if (tinyMCE.isGecko && this.getSel().isCollapsed) { - focusElm = tinyMCE.getParentElement(focusElm, 'A'); - - if (focusElm) - this.selection.selectNode(focusElm, false); - } - - this.getDoc().execCommand(command, user_interface, value); - - tinyMCE.isGecko && this.getSel().collapseToEnd(); - - tinyMCE.triggerNodeChange(); - - return true; - - case "InsertUnorderedList": - case "InsertOrderedList": - this.getDoc().execCommand(command, user_interface, value); - tinyMCE.triggerNodeChange(); - break; - - case "Strikethrough": - this.getDoc().execCommand(command, user_interface, value); - tinyMCE.triggerNodeChange(); - break; - - case "mceSelectNode": - this.selection.selectNode(value); - tinyMCE.triggerNodeChange(); - tinyMCE.selectedNode = value; - break; - - case "FormatBlock": - if (value == null || value == "") { - var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"); - - if (elm) - this.execCommand("mceRemoveNode", false, elm); + // Add constructor and methods + ns[cn] = p[cn]; + t.extend(ns[cn].prototype, p); + + // Extend + if (s[5]) { + sp = t.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; // Class name + + // Extend constructor + c = ns[cn]; + if (de) { + // Add passthrough constructor + ns[cn] = function() { + return sp[scn].apply(this, arguments); + }; + } else { + // Add inherit constructor + ns[cn] = function() { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; + } + ns[cn].prototype[cn] = ns[cn]; + + // Add super methods + t.each(sp, function(f, n) { + if (n != scn) + ns[cn].prototype[n] = sp[n]; + }); + + // Add overridden methods + t.each(p, function(f, n) { + // Extend methods if needed + if (sp[n]) { + ns[cn].prototype[n] = function() { + this.parent = sp[n]; + return f.apply(this, arguments); + }; } else { - if (!this.cleanup.isValid(value)) - return true; - - if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value)) - value = value.replace(/[^a-z]/gi, ''); - - if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) { - var b = this.selection.getBookmark(); - this.getDoc().execCommand("FormatBlock", false, '

'); - tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value); - this.selection.moveToBookmark(b); - } else - this.getDoc().execCommand("FormatBlock", false, value); - } - - tinyMCE.triggerNodeChange(); - - break; - - case "mceRemoveNode": - if (!value) - value = tinyMCE.getParentElement(this.getFocusElement()); - - if (tinyMCE.isIE) { - value.outerHTML = value.innerHTML; - } else { - var rng = value.ownerDocument.createRange(); - rng.setStartBefore(value); - rng.setEndAfter(value); - rng.deleteContents(); - rng.insertNode(rng.createContextualFragment(value.innerHTML)); - } - - tinyMCE.triggerNodeChange(); - - break; - - case "mceSelectNodeDepth": - var parentNode = this.getFocusElement(); - for (var i=0; parentNode; i++) { - if (parentNode.nodeName.toLowerCase() == "body") - break; - - if (parentNode.nodeName.toLowerCase() == "#text") { - i--; - parentNode = parentNode.parentNode; - continue; - } - - if (i == value) { - this.selection.selectNode(parentNode, false); - tinyMCE.triggerNodeChange(); - tinyMCE.selectedNode = parentNode; - return; - } - - parentNode = parentNode.parentNode; - } - - break; - - case "mceSetStyleInfo": - case "SetStyleInfo": - var rng = this.getRng(); - var sel = this.getSel(); - var scmd = value['command']; - var sname = value['name']; - var svalue = value['value'] == null ? '' : value['value']; - //var svalue = value['value'] == null ? '' : value['value']; - var wrapper = value['wrapper'] ? value['wrapper'] : "span"; - var parentElm = null; - var invalidRe = new RegExp("^BODY|HTML$", "g"); - var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null; - - // Whole element selected check - if (tinyMCE.isIE) { - // Control range - if (rng.item) - parentElm = rng.item(0); - else { - var pelm = rng.parentElement(); - var prng = doc.selection.createRange(); - prng.moveToElementText(pelm); - - if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) { - if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName)) - parentElm = pelm; - } - } - } else { - var felm = this.getFocusElement(); - if (sel.isCollapsed || (new RegExp('td|tr|tbody|table', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode)) - parentElm = felm; - } - - // Whole element selected - if (parentElm && !invalidRe.test(parentElm.nodeName)) { - if (scmd == "setstyle") - tinyMCE.setStyleAttrib(parentElm, sname, svalue); - - if (scmd == "setattrib") - tinyMCE.setAttrib(parentElm, sname, svalue); - - if (scmd == "removeformat") { - parentElm.style.cssText = ''; - tinyMCE.setAttrib(parentElm, 'class', ''); - } - - // Remove style/attribs from all children - var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1); - for (var z=0; z=0; i--) { - var elm = nodes[i]; - var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true"; - - elm.removeAttribute("mce_new"); - - // Is only child a element - if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) { - //tinyMCE.debug("merge1" + isNew); - this._mergeElements(scmd, elm, elm.childNodes[0], isNew); - continue; - } - - // Is I the only child - if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) { - //tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName); - if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName)) - this._mergeElements(scmd, elm.parentNode, elm, false); - } - } - - // Remove empty wrappers - var nodes = doc.getElementsByTagName(wrapper); - for (var i=nodes.length-1; i>=0; i--) { - var elm = nodes[i]; - var isEmpty = true; - - // Check if it has any attribs - var tmp = doc.createElement("body"); - tmp.appendChild(elm.cloneNode(false)); - - // Is empty span, remove it - tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), ''); - //tinyMCE.debug(tmp.innerHTML); - if (new RegExp('', 'gi').test(tmp.innerHTML)) { - for (var x=0; x 0) { - value = tinyMCE.replaceVar(value, "selection", selectedText); - tinyMCE.execCommand('mceInsertContent', false, value); - } - - tinyMCE.triggerNodeChange(); - break; - - case "mceSetAttribute": - if (typeof(value) == 'object') { - var targetElms = (typeof(value['targets']) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value['targets']; - var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms); - - if (targetNode) { - targetNode.setAttribute(value['name'], value['value']); - tinyMCE.triggerNodeChange(); - } - } - break; - - case "mceSetCSSClass": - this.execCommand("mceSetStyleInfo", false, {command : "setattrib", name : "class", value : value}); - break; - - case "mceInsertRawHTML": - var key = 'tiny_mce_marker'; - - this.execCommand('mceBeginUndoLevel'); - - // Insert marker key - this.execCommand('mceInsertContent', false, key); - - // Store away scroll pos - var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft; - var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop; - - // Find marker and replace with RAW HTML - var html = this.getBody().innerHTML; - if ((pos = html.indexOf(key)) != -1) - tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length)); - - // Restore scoll pos - this.contentWindow.scrollTo(scrollX, scrollY); - - this.execCommand('mceEndUndoLevel'); - - break; - - case "mceInsertContent": - // Force empty string - if (!value) - value = ''; - - var insertHTMLFailed = false; - - // Removed since it produced problems in IE - // this.getWin().focus(); - - if (tinyMCE.isGecko || tinyMCE.isOpera) { - try { - // Is plain text or HTML, &,   etc will be encoded wrong in FF - if (value.indexOf('<') == -1 && !value.match(/(&| |<|>)/g)) { - var r = this.getRng(); - var n = this.getDoc().createTextNode(tinyMCE.entityDecode(value)); - var s = this.getSel(); - var r2 = r.cloneRange(); - - // Insert text at cursor position - s.removeAllRanges(); - r.deleteContents(); - r.insertNode(n); - - // Move the cursor to the end of text - r2.selectNode(n); - r2.collapse(false); - s.removeAllRanges(); - s.addRange(r2); - } else { - value = tinyMCE.fixGeckoBaseHREFBug(1, this.getDoc(), value); - this.getDoc().execCommand('inserthtml', false, value); - tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value); - } - } catch (ex) { - insertHTMLFailed = true; - } - - if (!insertHTMLFailed) { - tinyMCE.triggerNodeChange(); - return; - } - } - - if (!tinyMCE.isIE) { - var isHTML = value.indexOf('<') != -1; - var sel = this.getSel(); - var rng = this.getRng(); - - if (isHTML) { - if (tinyMCE.isSafari) { - var tmpRng = this.getDoc().createRange(); - - tmpRng.setStart(this.getBody(), 0); - tmpRng.setEnd(this.getBody(), 0); - - value = tmpRng.createContextualFragment(value); - } else - value = rng.createContextualFragment(value); - } else { - // Setup text node - var el = document.createElement("div"); - el.innerHTML = value; - value = el.firstChild.nodeValue; - value = doc.createTextNode(value); - } - - // Insert plain text in Safari - if (tinyMCE.isSafari && !isHTML) { - this.execCommand('InsertText', false, value.nodeValue); - tinyMCE.triggerNodeChange(); - return true; - } else if (tinyMCE.isSafari && isHTML) { - rng.deleteContents(); - rng.insertNode(value); - tinyMCE.triggerNodeChange(); - return true; - } - - rng.deleteContents(); - - // If target node is text do special treatment, (Mozilla 1.3 fix) - if (rng.startContainer.nodeType == 3) { - var node = rng.startContainer.splitText(rng.startOffset); - node.parentNode.insertBefore(value, node); - } else - rng.insertNode(value); - - if (!isHTML) { - // Removes weird selection trails - sel.selectAllChildren(doc.body); - sel.removeAllRanges(); - - // Move cursor to end of content - var rng = doc.createRange(); - - rng.selectNode(value); - rng.collapse(false); - - sel.addRange(rng); - } else - rng.collapse(false); - - tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value); - } else { - var rng = doc.selection.createRange(), tmpRng = null; - var c = value.indexOf('"; - } - - if (hc) { - cn = n.childNodes; - - for (i=0, l=cn.length; i'; - - return h; - }, - - _serializeAttribute : function(n, r, an) { - var av = '', t, os = this.settings.on_save; - - if (os && (an.indexOf('mce_') == 0 || an.indexOf('_moz') == 0)) - return ''; - - if (os && this.mceAttribs[an]) - av = this._getAttrib(n, this.mceAttribs[an]); - - if (av.length == 0) - av = this._getAttrib(n, an); - - if (av.length == 0 && r.defaultAttribs && (t = r.defaultAttribs[an])) { - av = t; - - if (av == "mce_empty") - return " " + an + '=""'; - } - - if (r.forceAttribs && (t = r.forceAttribs[an])) - av = t; - - if (os && av.length != 0 && /^(src|href|longdesc)$/.test(an)) - av = this._urlConverter(this, n, av); - - if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) - return ""; - - if (av.length != 0 && av == "{$uid}") - av = "uid_" + (this.idCount++); - - if (av.length != 0) { - if (an.indexOf('on') != 0) - av = this.xmlEncode(av, 1); - - return " " + an + "=" + '"' + av + '"'; - } - - return ""; - }, - - formatHTML : function(h) { - var s = this.settings, p = '', i = 0, li = 0, o = '', l; - - // Replace BR in pre elements to \n - h = h.replace(/]*)>(.*?)<\/pre>/gi, function (a, b, c) { - c = c.replace(//gi, '\n'); - return '' + c + ''; - }); - - h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :) - h = '\n' + h; - h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting - h = h.replace(this.nlBeforeRe, '\n<$1$2>'); - h = h.replace(this.nlAfterRe, '<$1$2>\n'); - h = h.replace(this.nlBeforeAfterRe, '\n<$1$2$3>\n'); - h += '\n'; - - //tinyMCE.debug(h); - - while ((i = h.indexOf('\n', i + 1)) != -1) { - if ((l = h.substring(li + 1, i)).length != 0) { - if (this.ouRe.test(l) && p.length >= s.indent_levels) - p = p.substring(s.indent_levels); - - o += p + l + '\n'; - - if (this.inRe.test(l)) - p += this.inStr; - } - - li = i; - } - - //tinyMCE.debug(h); return o; }, - xmlEncode : function(s, skip_apos) { - var cl = this, re = !skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe; - - this._setupEntities(); // Will intialize lookup table - - switch (this.settings.entity_encoding) { - case "raw": - return tinyMCE.xmlEncode(s, skip_apos); - - case "named": - return s.replace(re, function (c, b) { - b = cl.entities[c.charCodeAt(0)]; - - return b ? '&' + b + ';' : c; - }); - - case "numeric": - return s.replace(re, function (c, b) { - return b ? '&#' + c.charCodeAt(0) + ';' : c; - }); - } - - return s; - }, - - split : function(re, s) { - var c = s.split(re); - var i, l, o = new Array(); - - for (i=0, l=c.length; i' : '>' + h + ''; - - return o; -}; - -TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) { - var o = d.createElement(tn); - - if (a) { - for (n in a) { - if (typeof(a[n]) != 'function' && a[n] != null) - tinyMCE.setAttrib(o, n, a[n]); + }); + +/* file:jscripts/tiny_mce/classes/util/URI.js */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.util.URI', { + URI : function(u, s) { + var t = this, o, a, b; + + // Default settings + s = t.settings = s || {}; + + // Strange app protocol or local anchor + if (/^(mailto|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) { + t.source = u; + return; + } + + // Absolute path with no host, fake host and protocol + if (u.indexOf('/') === 0 && u.indexOf('//') !== 0) + u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u; + + // Relative path + if (u.indexOf('://') === -1 && u.indexOf('//') !== 0) + u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u); + + // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) + u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); + each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { + t[v] = u[i]; + }); + + if (b = s.base_uri) { + if (!t.protocol) + t.protocol = b.protocol; + + if (!t.userInfo) + t.userInfo = b.userInfo; + + if (!t.port && t.host == 'mce_host') + t.port = b.port; + + if (!t.host || t.host == 'mce_host') + t.host = b.host; + + t.source = ''; + } + + //t.path = t.path || '/'; + }, + + setPath : function(p) { + var t = this; + + p = /^(.*?)\/?(\w+)?$/.exec(p); + + // Update path parts + t.path = p[0]; + t.directory = p[1]; + t.file = p[2]; + + // Rebuild source + t.source = ''; + t.getURI(); + }, + + toRelative : function(u) { + var t = this, o; + + u = new tinymce.util.URI(u, {base_uri : t}); + + // Not on same domain/port or protocol + if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol) + return u.getURI(); + + o = t.toRelPath(t.path, u.path); + + // Add query + if (u.query) + o += '?' + u.query; + + // Add anchor + if (u.anchor) + o += '#' + u.anchor; + + return o; + }, + + toAbsolute : function(u, nh) { + var u = new tinymce.util.URI(u, {base_uri : this}); + + return u.getURI(this.host == u.host ? nh : 0); + }, + + toRelPath : function(base, path) { + var items, bp = 0, out = '', i; + + // Split the paths + base = base.substring(0, base.lastIndexOf('/')); + base = base.split('/'); + items = path.split('/'); + + if (base.length >= items.length) { + for (i = 0; i < base.length; i++) { + if (i >= items.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (base.length < items.length) { + for (i = 0; i < items.length; i++) { + if (i >= base.length || base[i] != items[i]) { + bp = i + 1; + break; + } + } + } + + if (bp == 1) + return path; + + for (i = 0; i < base.length - (bp - 1); i++) + out += "../"; + + for (i = bp - 1; i < items.length; i++) { + if (i != bp - 1) + out += "/" + items[i]; + else + out += items[i]; + } + + return out; + }, + + toAbsPath : function(base, path) { + var i, nb = 0, o = []; + + // Split paths + base = base.split('/'); + path = path.split('/'); + + // Remove empty chunks + each(base, function(k) { + if (k) + o.push(k); + }); + + base = o; + + // Merge relURLParts chunks + for (i = path.length - 1, o = []; i >= 0; i--) { + // Ignore empty or . + if (path[i].length == 0 || path[i] == ".") + continue; + + // Is parent + if (path[i] == '..') { + nb++; + continue; + } + + // Move up + if (nb > 0) { + nb--; + continue; + } + + o.push(path[i]); + } + + i = base.length - nb; + + // If /a/b/c or / + if (i <= 0) + return '/' + o.reverse().join('/'); + + return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/'); + }, + + getURI : function(nh) { + var s, t = this; + + // Rebuild source + 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; + } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/util/Cookie.js */ + +(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 = 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); + } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/util/JSON.js */ + +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 = '['; i 0 ? ',' : '') + 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) { + // Ignore } } - if (h) - o.innerHTML = h; - - return o; -}; - -TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) { - return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0]; -}; - -TinyMCE_Engine.prototype.getElementsByAttributeValue = function(n, e, a, v) { - var i, nl = n.getElementsByTagName(e), o = new Array(); - - for (i=0; i]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/<\/strong>/gi, ''); - h = h.replace(/<\/em>/gi, ''); - } - - if (tinyMCE.isRealIE) { - // Since MSIE handles invalid HTML better that valid XHTML we - // need to make some things invalid.


gets converted to
. - h = h.replace(/\s\/>/g, '>'); - - // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones - h = h.replace(/]*)>\u00A0?<\/p>/gi, ' 

'); // Keep empty paragraphs - h = h.replace(/]*)>\s* \s*<\/p>/gi, ' 

'); // Keep empty paragraphs - h = h.replace(/]*)>\s+<\/p>/gi, ' 

'); // Keep empty paragraphs - - // Remove first comment - e.innerHTML = tinyMCE.uniqueTag + h; - e.firstChild.removeNode(true); - - // Remove weird auto generated empty paragraphs unless it's supposed to be there - nl = e.getElementsByTagName("p"); - for (i=nl.length-1; i>=0; i--) { - n = nl[i]; - - if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) - n.parentNode.removeChild(n); + }); + +/* file:jscripts/tiny_mce/classes/util/XHR.js */ + +tinymce.create('static tinymce.util.XHR', { + send : function(o) { + var x, t, w = window, c = 0; + + // Default settings + 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); + + // Wait for response, onReadyStateChange can not be used since it leaks memory in IE + 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); + } + + } +}); + +/* file:jscripts/tiny_mce/classes/util/JSONRequest.js */ + +(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); + } } - } else { - h = this.fixGeckoBaseHREFBug(1, e, h); - e.innerHTML = h; - this.fixGeckoBaseHREFBug(2, e, h); - } -}; - -TinyMCE_Engine.prototype.getOuterHTML = function(e) { - if (tinyMCE.isIE) - return e.outerHTML; - - var d = e.ownerDocument.createElement("body"); - d.appendChild(e.cloneNode(true)); - return d.innerHTML; -}; - -TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) { - var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; - - if (tinyMCE.isIE && e.nodeType == 1) - e.outerHTML = h; - else { - t = d.createElement("body"); - t.innerHTML = h; - - for (i=0, nl=t.childNodes; i= 0; i--) + cs += '}, ' + (i ? 'n' : 's') + ');'; + + cs += '})'; + + // Compile CSS pattern function + t.cache[pa] = cs = eval(cs); + } + + // Run selector function + cs(isIE ? collectIE : collect, s); + }); + + // Cleanup + each(o, function(n) { + if (isIE) + n.removeAttribute('mce_save'); + else + delete n.mce_save; + }); + + return o; + }, + + // #endif + + 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 + e.innerHTML = 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 + ''; + + 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); + }); + }, + + // #if !jquery + + setStyle : function(n, na, v) { + return this.run(n, function(e) { + var s, i; + + s = e.style; + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + // Default px suffix on these + if (this.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v))) + v += 'px'; + + switch (na) { + case 'opacity': + // IE specific opacity + if (isIE) { + s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")"; + + if (!n.currentStyle || !n.currentStyle.hasLayout) + s.display = 'inline-block'; + } + + // Fix for older browsers + s['-moz-opacity'] = s['-khtml-opacity'] = v; + break; + + case 'float': + isIE ? s.styleFloat = v : s.cssFloat = v; + break; + } + + s[na] = v; + }); + }, + + getStyle : function(n, na, c) { + n = this.get(n); + + if (!n) + return false; + + // Gecko + if (this.doc.defaultView && c) { + // Remove camelcase + na = na.replace(/[A-Z]/g, function(a){ + return '-' + a; + }); + + try { + return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na); + } catch (ex) { + // Old safari might fail + return null; + } + } + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + if (na == 'float') + na = isIE ? 'styleFloat' : 'cssFloat'; + + // IE & Opera + if (n.currentStyle && c) + return n.currentStyle[na]; + + return n.style[na]; + }, + + setStyles : function(e, o) { + var t = this; + + each(o, function(v, n) { + t.setStyle(e, n, v); + }); + }, + + setAttrib : function(e, n, v) { + var t = this; + + 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); + }); + }); + }, + + // #endif + + getAttrib : function(e, n, dv) { + var v, t = this; + + e = t.get(e); + + if (!e) + return false; + + if (!is(dv)) + dv = ""; + + // Try the mce variant for these + if (/^(src|href|style)$/.test(n)) { + v = t.getAttrib(e, "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; + } + + // Remove Apple and WebKit stuff + if (isWebKit && n == "class" && v) + v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, ''); + + // Handle IE issues + if (isIE) { + switch (n) { + case 'rowspan': + case 'colspan': + // IE returns 1 as default value + if (v === 1) + v = ''; + + break; + + case 'size': + // IE returns +0 as default value for size + if (v === '+0') + v = ''; + + break; + + case 'hspace': + // IE returns -1 as default value + if (v === -1) + v = ''; + + break; + + case 'tabindex': + // IE returns 32768 as default value + if (v === 32768) + v = ''; + + break; + + default: + // IE has odd anonymous function for event attributes + 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; + + n = t.get(n); + + // Use getBoundingClientRect on IE, Opera has it but it's not perfect + if (n && isIE) { + n = n.getBoundingClientRect(); + e = t.boxModel ? d.documentElement : d.body; + x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border + x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x; + n.top += window.self != window.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset + + return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x}; + } + + while (n) { + x += n.offsetLeft || 0; + y += n.offsetTop || 0; + x -= n.scrollLeft || 0; + y -= n.scrollTop || 0; + n = n.offsetParent; + } + + 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; + + // Get values and check it it needs compressing + 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; + + // Compress + 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; + + // Compress + 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'); + + 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); + }); + }, + + // #if !jquery + + 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'; + }, + + // #endif + + uniqueId : function(p) { + return (!p ? 'mce_' : p) + (this.counter++); + }, + + setHTML : function(e, h) { + var t = this; + + return this.run(e, function(e) { + h = t.processHTML(h); + + if (isIE) { + // Fix for IE bug, first node comments gets stripped + e.innerHTML = '
' + h; + e.removeChild(e.firstChild); + } else + e.innerHTML = h; + + return h; + }); + }, + + processHTML : function(h) { + var t = this, s = t.settings; + + // Convert strong and em to b and i in FF since it can't handle them + if (tinymce.isGecko) { + h = h.replace(/<(\/?)strong>|]+)>/gi, '<$1b$2>'); + h = h.replace(/<(\/?)em>|]+)>/gi, '<$1i$2>'); + } + + // Store away src and href in mce_src and mce_href since browsers mess them up + if (s.keep_values) { + // Process all tags with src, href or style + h = h.replace(/<([\w:]+) [^>]*(src|href|style)[^>]*>/gi, function(a, n) { + function handle(m, b, c) { + var u = c; + + // Tag already got a mce_ version + if (a.indexOf('mce_' + b) != -1) + return m; + + if (b == 'style') { + // Why did I need this one? + //if (isIE) + // u = t.serializeStyle(t.parseStyle(u)); + + if (s.hex_colors) { + u = u.replace(/rgb\([^\)]+\)/g, function(v) { + return t.toHex(v); + }); + } + + if (s.url_converter) { + u = u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g, function(x, c) { + return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)) + ')'; + }); + } + } else { + if (s.url_converter) + u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)); + } + + return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"'; + }; + + a = a.replace(/ (src|href|style)=[\"]([^\"]+)[\"]/gi, handle); // W3C + a = a.replace(/ (src|href|style)=[\']([^\']+)[\']/gi, handle); // W3C + + return a.replace(/ (src|href|style)=([^\s\"\'>]+)/gi, handle); // IE + }); + } + + return h; + }, + + getOuterHTML : function(e) { + var d; + + e = this.get(e); + + if (!e) + return null; + + if (isIE) + return e.outerHTML; + + d = (e.ownerDocument || this.doc).createElement("body"); + d.appendChild(e.cloneNode(true)); + + return d.innerHTML; + }, + + setOuterHTML : function(e, h, d) { + var t = this; + + return this.run(e, function(e) { + var n, tp; + + e = t.get(e); + d = d || e.ownerDocument || t.doc; + + if (isIE && e.nodeType == 1) + e.outerHTML = h; + else { + tp = d.createElement("body"); + tp.innerHTML = h; + + n = tp.lastChild; + while (n) { + t.insertAfter(n.cloneNode(true), e); + n = n.previousSibling; + } + + t.remove(e); + } + }); + }, + + decode : function(s) { + var e = document.createElement("div"); + + e.innerHTML = s; + + return !e.firstChild ? s : e.firstChild.nodeValue; + }, + + encode : function(s) { + return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) { + switch (c) { + case '&': + return '&'; + + case '"': + return '"'; + + case '<': + return '<'; + + case '>': + return '>'; + } + + return c; + }) : s; + }, + + // #if !jquery + + insertAfter : function(n, r) { + var t = this; + + r = t.get(r); + + return this.run(n, function(n) { + var p, ns; + + p = r.parentNode; + ns = r.nextSibling; + + if (ns) + p.insertBefore(n, ns); + else + p.appendChild(n); + + return n; + }); + }, + + // #endif + + isBlock : function(n) { + if (n.nodeType && n.nodeType !== 1) + return false; + + n = n.nodeName || n; + + return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n); + }, + + // #if !jquery + + replace : function(n, o, k) { + if (is(o, 'array')) + n = n.cloneNode(true); + + return this.run(o, function(o) { + if (k) { + each(o.childNodes, function(c) { + n.appendChild(c.cloneNode(true)); + }); + } + + return o.parentNode.replaceChild(n, o); + }); + }, + + // #endif + + toHex : function(s) { + var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s); + + function hex(s) { + s = parseInt(s).toString(16); + + return s.length > 1 ? s : '0' + s; // 0 -> 00 + }; + + if (c) { + s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]); + + return s; + } + + return s; + }, + + getClasses : function() { + var t = this, cl = [], i, lo = {}, f = t.settings.class_filter; + + if (t.classes) + return t.classes; + + function addClasses(s) { + // IE style imports + each(s.imports, function(r) { + addClasses(r); + }); + + each(s.cssRules || s.rules, function(r) { + // Real type or fake it on IE + switch (r.type || 1) { + // Rule + case 1: + if (r.selectorText) { + each(r.selectorText.split(','), function(v) { + v = v.replace(/^\s*|\s*$|^\s\./g, ""); + + if (f && !(v = f(v))) + return; + + if (/^\.mce/.test(v) || !/^\.[\w\-]+$/.test(v)) + return; + + v = v.substring(1); + if (!lo[v]) { + cl.push({'class' : v}); + lo[v] = 1; + } + }); + } + break; + + // Import + case 3: + addClasses(r.styleSheet); + break; + } + }); + }; + + try { + each(t.doc.styleSheets, addClasses); + } catch (ex) { + // Ignore + } + + if (cl.length > 0) + t.classes = cl; + + return cl; + }, + + run : function(e, f, s) { + var t = this, o; + + if (typeof(e) === 'string') + e = t.doc.getElementById(e); + + if (!e) + return false; + + s = s || this; + if (!e.nodeType && (e.length || e.length === 0)) { + o = []; + + each(e, function(e, i) { + if (e) { + if (typeof(e) == 'string') + e = t.doc.getElementById(e); + + o.push(f.call(s, e, i)); + } + }); + + return o; + } + + return f.call(s, e); + } + + /* + walk : function(n, f, s) { + var d = this.doc, w; + + if (d.createTreeWalker) { + w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + + while ((n = w.nextNode()) != null) + f.call(s || this, n); + } else + tinymce.walk(n, f, 'childNodes', s); + } + */ + + /* + toRGB : function(s) { + var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s); + + if (c) { + // #FFF -> #FFFFFF + if (!is(c[3])) + c[3] = c[2] = c[1]; + + return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")"; + } + + return s; + } + */ + + }); + + // Setup page DOM + tinymce.DOM = new tinymce.dom.DOMUtils(document); +})(); + +/* file:jscripts/tiny_mce/classes/dom/Event.js */ + +(function() { + // Shorten names + var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event; + + tinymce.create('static tinymce.dom.Event', { + inits : [], + events : [], + + // #if !jquery + + add : function(o, n, f, s) { + var cb, t = this, el = t.events, r; + + // Handle array + if (o && o instanceof Array) { + r = []; + + each(o, function(o) { + o = DOM.get(o); + r.push(t.add(o, n, f, s)); + }); + + return r; + } + + o = DOM.get(o); + + if (!o) + return; + + // Setup event callback + cb = function(e) { + e = e || window.event; + + // Patch in target in IE it's W3C valid + if (e && !e.target && isIE) + e.target = e.srcElement; + + if (!s) + return f(e); + + return f.call(s, e); + }; + + if (n == 'unload') { + tinymce.unloads.unshift({func : cb}); + return cb; + } + + if (n == 'init') { + if (t.domLoaded) + cb(); + else + t.inits.push(cb); + + return cb; + } + + // Store away listener reference + el.push({ + obj : o, + name : n, + func : f, + cfunc : cb, + scope : s + }); + + t._add(o, n, cb); + + return f; + }, + + remove : function(o, n, f) { + var t = this, a = t.events, s = false, r; + + // Handle array + if (o && o instanceof Array) { + r = []; + + each(o, function(o) { + o = DOM.get(o); + r.push(t.remove(o, n, f)); + }); + + return r; + } + + o = DOM.get(o); + + each(a, function(e, i) { + if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) { + a.splice(i, 1); + t._remove(o, n, e.cfunc); + s = true; + return false; + } + }); + + return s; + }, + + // #endif + + cancel : function(e) { + if (!e) + return false; + + this.stop(e); + return this.prevent(e); + }, + + stop : function(e) { + if (e.stopPropagation) + e.stopPropagation(); + else + e.cancelBubble = true; + + return false; + }, + + prevent : function(e) { + if (e.preventDefault) + e.preventDefault(); + else + e.returnValue = false; + + return false; + }, + + _unload : function() { + var t = Event; + + each(t.events, function(e, i) { + t._remove(e.obj, e.name, e.cfunc); + e.obj = e.cfunc = null; + }); + + t.events = []; + t = null; + }, + + _add : function(o, n, f) { + if (o.attachEvent) + o.attachEvent('on' + n, f); + else if (o.addEventListener) + o.addEventListener(n, f, false); + else + o['on' + n] = f; + }, + + _remove : function(o, n, f) { + if (o.detachEvent) + o.detachEvent('on' + n, f); + else if (o.removeEventListener) + o.removeEventListener(n, f, false); + else + o['on' + n] = null; + }, + + _pageInit : function() { + var e = Event; + + e._remove(window, 'DOMContentLoaded', e._pageInit); + e.domLoaded = true; + + each(e.inits, function(c) { + c(); + }); + + e.inits = []; + }, + + _wait : function() { + var t; + + // No need since the document is already loaded + if (window.tinyMCE_GZ && tinyMCE_GZ.loaded) + return; + + if (isIE && document.location.protocol != 'https:') { + // Fake DOMContentLoaded on IE + document.write('