diff -r 2a31905a567d -r dc96d6c5cd1e includes/clientside/tinymce/tiny_mce_src.js
--- a/includes/clientside/tinymce/tiny_mce_src.js Thu Jun 02 05:28:28 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13231 +0,0 @@
-var tinymce = {
- majorVersion : '3',
- minorVersion : '2.7',
- releaseDate : '2009-09-22',
-
- _init : function() {
- var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
-
- t.isOpera = w.opera && opera.buildNumber;
-
- t.isWebKit = /WebKit/.test(ua);
-
- t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
-
- t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
-
- t.isGecko = !t.isWebKit && /Gecko/.test(ua);
-
- t.isMac = ua.indexOf('Mac') != -1;
-
- t.isAir = /adobeair/i.test(ua);
-
- // TinyMCE .NET webcontrol might be setting the values for TinyMCE
- if (w.tinyMCEPreInit) {
- t.suffix = tinyMCEPreInit.suffix;
- t.baseURL = tinyMCEPreInit.base;
- t.query = tinyMCEPreInit.query;
- return;
- }
-
- // Get suffix and base
- t.suffix = '';
-
- // If base element found, add that infront of baseURL
- nl = d.getElementsByTagName('base');
- 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;
- }
-
- // Create default constructor
- if (!p[cn]) {
- p[cn] = function() {};
- de = 1;
- }
-
- // 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) {
- 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 (n != cn)
- ns[cn].prototype[n] = f;
- }
- });
- }
-
- // Add static methods
- t.each(p['static'], function(f, n) {
- ns[cn][n] = f;
- });
-
- if (this.onCreate)
- this.onCreate(s[2], s[3], ns[cn].prototype);
- },
-
- walk : function(o, f, n, s) {
- s = s || this;
-
- if (o) {
- if (n)
- o = o[n];
-
- tinymce.each(o, function(o, i) {
- if (f.call(s, o, i, n) === false)
- return false;
-
- tinymce.walk(o, f, n, s);
- });
- }
- },
-
- createNS : function(n, o) {
- var i, v;
-
- o = o || window;
-
- n = n.split('.');
- for (i=0; i= items.length) {
- for (i = 0, l = base.length; i < l; i++) {
- if (i >= items.length || base[i] != items[i]) {
- bp = i + 1;
- break;
- }
- }
- }
-
- if (base.length < items.length) {
- for (i = 0, l = items.length; i < l; i++) {
- if (i >= base.length || base[i] != items[i]) {
- bp = i + 1;
- break;
- }
- }
- }
-
- if (bp == 1)
- return path;
-
- for (i = 0, l = base.length - (bp - 1); i < l; i++)
- out += "../";
-
- for (i = bp - 1, l = items.length; i < l; i++) {
- if (i != bp - 1)
- out += "/" + items[i];
- else
- out += items[i];
- }
-
- return out;
- },
-
- toAbsPath : function(base, path) {
- var i, nb = 0, o = [], tr, outPath;
-
- // Split paths
- tr = /\/$/.test(path) ? '/' : '';
- 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)
- outPath = o.reverse().join('/');
- else
- outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
-
- // Add front / if it's needed
- if (outPath.indexOf('/') !== 0)
- outPath = '/' + outPath;
-
- // Add traling / if it's needed
- if (tr && outPath.lastIndexOf('/') !== outPath.length - 1)
- outPath += tr;
-
- return outPath;
- },
-
- 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;
- }
- });
-})();
-(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;
-
- // Strict mode
- 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.hasOwnProperty && 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
- }
- }
-
- });
-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.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
-
- x.send(o.data);
-
- function ready() {
- if (!o.async || x.readyState == 4 || c++ > 10000) {
- 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;
- } else
- w.setTimeout(ready, 10);
- };
-
- // Syncronous request
- if (!o.async)
- return ready();
-
- // Wait for response, onReadyStateChange can not be used since it leaks memory in IE
- t = w.setTimeout(ready, 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
- });
-
- // JSON content type for Ruby on rails. Bug: #1883287
- o.content_type = 'application/json';
-
- XHR.send(o);
- },
-
- 'static' : {
- sendRPC : function(o) {
- return new tinymce.util.JSONRequest().send(o);
- }
- }
- });
-}());(function(tinymce) {
- // Shorten names
- 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,
- pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
- props : {
- "for" : "htmlFor",
- "class" : "className",
- className : "className",
- checked : "checked",
- disabled : "disabled",
- maxlength : "maxLength",
- readonly : "readOnly",
- selected : "selected",
- value : "value",
- id : "id",
- name : "name",
- type : "type"
- },
-
- DOMUtils : function(d, s) {
- var t = this;
-
- t.doc = d;
- t.win = window;
- t.files = {};
- t.cssFlicker = false;
- t.counter = 0;
- t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat";
- t.stdMode = d.documentMode === 8;
-
- t.settings = s = tinymce.extend({
- keep_values : false,
- hex_colors : 1,
- process_html : 1
- }, s);
-
- // Fix IE6SP2 flicker and check it failed for pre SP2
- if (tinymce.isIE6) {
- try {
- d.execCommand('BackgroundImageCache', false, true);
- } catch (e) {
- t.cssFlicker = true;
- }
- }
-
- tinymce.addUnload(t.destroy, t);
- },
-
- 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 ? this.win : w;
- d = w.document;
- b = this.boxModel ? d.documentElement : d.body;
-
- // Returns viewport size excluding scrollbars
- 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, sr;
-
- e = t.get(e);
- p = t.getPos(e);
- sr = t.getSize(e);
-
- return {
- x : p.x,
- y : p.y,
- w : sr.w,
- h : sr.h
- };
- },
-
- getSize : function(e) {
- var t = this, w, h;
-
- e = t.get(e);
- w = t.getStyle(e, 'width');
- h = t.getStyle(e, 'height');
-
- // Non pixel value, then force offset/clientWidth
- if (w.indexOf('px') === -1)
- w = 0;
-
- // Non pixel value, then force offset/clientWidth
- if (h.indexOf('px') === -1)
- h = 0;
-
- return {
- w : parseInt(w) || e.offsetWidth || e.clientWidth,
- h : parseInt(h) || e.offsetHeight || e.clientHeight
- };
- },
-
- getParent : function(n, f, r) {
- return this.getParents(n, f, r, false);
- },
-
- getParents : function(n, f, r, c) {
- var t = this, na, se = t.settings, o = [];
-
- n = t.get(n);
- c = c === undefined;
-
- if (se.strict_root)
- r = r || t.getRoot();
-
- // Wrap node name as func
- if (is(f, 'string')) {
- na = f;
-
- if (f === '*') {
- f = function(n) {return n.nodeType == 1;};
- } else {
- f = function(n) {
- return t.is(n, na);
- };
- }
- }
-
- while (n) {
- if (n == r || !n.nodeType || n.nodeType === 9)
- break;
-
- if (!f || f(n)) {
- if (c)
- o.push(n);
- else
- return n;
- }
-
- n = n.parentNode;
- }
-
- return c ? o : null;
- },
-
- get : function(e) {
- var n;
-
- if (e && this.doc && typeof(e) == 'string') {
- n = e;
- e = this.doc.getElementById(e);
-
- // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
- if (e && e.id !== n)
- return this.doc.getElementsByName(n)[1];
- }
-
- return e;
- },
-
- getNext : function(node, selector) {
- return this._findSib(node, selector, 'nextSibling');
- },
-
- getPrev : function(node, selector) {
- return this._findSib(node, selector, 'previousSibling');
- },
-
-
- select : function(pa, s) {
- var t = this;
-
- return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
- },
-
- is : function(n, patt) {
- return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
- },
-
-
- 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;
- t.setAttribs(e, a);
-
- 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) {
- var t = this;
-
- return this.run(n, function(n) {
- var p, g, i;
-
- p = n.parentNode;
-
- if (!p)
- return null;
-
- if (k) {
- for (i = n.childNodes.length - 1; i >= 0; i--)
- t.insertAfter(n.childNodes[i], n);
-
- //each(n.childNodes, function(c) {
- // p.insertBefore(c.cloneNode(true), n);
- //});
- }
-
- // Fix IE psuedo leak
- if (t.fixPsuedoLeaks) {
- p = n.cloneNode(true);
- k = 'IELeakGarbageBin';
- g = t.get(k) || t.add(t.doc.body, 'div', {id : k, style : 'display:none'});
- g.appendChild(n);
- g.innerHTML = '';
-
- return p;
- }
-
- return p.removeChild(n);
- });
- },
-
- setStyle : function(n, na, v) {
- var t = this;
-
- return t.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 (t.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[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';
- break;
-
- case 'float':
- isIE ? s.styleFloat = v : s.cssFloat = v;
- break;
-
- default:
- s[na] = v || '';
- }
-
- // Force update of the style data
- if (t.settings.update_styles)
- t.setAttrib(e, 'mce_style');
- });
- },
-
- 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, s = t.settings, ol;
-
- ol = s.update_styles;
- s.update_styles = 0;
-
- each(o, function(v, n) {
- t.setStyle(e, n, v);
- });
-
- // Update style info
- s.update_styles = ol;
- if (s.update_styles)
- t.setAttrib(e, s.cssText);
- },
-
- setAttrib : function(e, n, v) {
- var t = this;
-
- // Whats the point
- if (!e || !n)
- return;
-
- // Strict XML mode
- if (t.settings.strict)
- n = n.toLowerCase();
-
- return this.run(e, function(e) {
- var s = t.settings;
-
- switch (n) {
- case "style":
- if (!is(v, 'string')) {
- each(v, function(v, n) {
- t.setStyle(e, n, v);
- });
-
- return;
- }
-
- // No mce_style for elements with these since they might get resized by the user
- if (s.keep_values) {
- if (v && !t._isRes(v))
- e.setAttribute('mce_style', v, 2);
- else
- e.removeAttribute('mce_style', 2);
- }
-
- e.style.cssText = v;
- break;
-
- case "class":
- e.className = v || ''; // Fix IE null bug
- 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;
-
- case "shape":
- e.setAttribute('mce_style', v);
- 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 || e.nodeType !== 1)
- return false;
-
- if (!is(dv))
- dv = '';
-
- // Try the mce variant for these
- if (/^(src|href|style|coords|shape)$/.test(n)) {
- v = e.getAttribute("mce_" + n);
-
- if (v)
- return v;
- }
-
- if (isIE && t.props[n]) {
- v = e[t.props[n]];
- v = v && v.nodeValue ? v.nodeValue : v;
- }
-
- if (!v)
- v = e.getAttribute(n, 2);
-
- // Check boolean attribs
- if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {
- if (e[t.props[n]] === true && v === '')
- return n;
-
- return v ? n : '';
- }
-
- // Inner input elements will override attributes on form elements
- if (e.nodeName === "FORM" && e.getAttributeNode(n))
- return e.getAttributeNode(n).nodeValue;
-
- if (n === 'style') {
- v = v || e.style.cssText;
-
- if (v) {
- v = t.serializeStyle(t.parseStyle(v));
-
- if (t.settings.keep_values && !t._isRes(v))
- e.setAttribute('mce_style', v);
- }
- }
-
- // 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 === 20 || v === 0)
- v = '';
-
- break;
-
- case 'width':
- case 'height':
- case 'vspace':
- case 'checked':
- case 'disabled':
- case 'readonly':
- if (v === 0)
- v = '';
-
- break;
-
- case 'hspace':
- // IE returns -1 as default value
- if (v === -1)
- v = '';
-
- break;
-
- case 'maxlength':
- case 'tabindex':
- // IE returns default value
- if (v === 32768 || v === 2147483647 || v === '32768')
- v = '';
-
- break;
-
- case 'multiple':
- case 'compact':
- case 'noshade':
- case 'nowrap':
- if (v === 65535)
- return n;
-
- return dv;
-
- case 'shape':
- v = v.toLowerCase();
- break;
-
- default:
- // IE has odd anonymous function for event attributes
- if (n.indexOf('on') === 0 && v)
- v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1');
- }
- }
-
- return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
- },
-
- getPos : function(n, ro) {
- var t = this, x = 0, y = 0, e, d = t.doc, r;
-
- n = t.get(n);
- ro = ro || d.body;
-
- if (n) {
- // Use getBoundingClientRect on IE, Opera has it but it's not perfect
- if (isIE && !t.stdMode) {
- 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 += t.win.self != t.win.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};
- }
-
- r = n;
- while (r && r != ro && r.nodeType) {
- x += r.offsetLeft || 0;
- y += r.offsetTop || 0;
- r = r.offsetParent;
- }
-
- r = n.parentNode;
- while (r && r != ro && r.nodeType) {
- x -= r.scrollLeft || 0;
- y -= r.scrollTop || 0;
- r = r.parentNode;
- }
- }
-
- 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];
- };
-
- st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities
-
- each(st.split(';'), function(v) {
- var sv, ur = [];
-
- if (v) {
- v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities
- 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(' + 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) {
- // Remove pointless border
- if (o.border == 'medium none')
- o.border = '';
- }
-
- return o;
- },
-
- serializeStyle : function(o) {
- var s = '';
-
- each(o, function(v, k) {
- if (k && v) {
- if (tinymce.isGecko && k.indexOf('-moz-') === 0)
- return;
-
- switch (k) {
- case 'color':
- case 'background-color':
- v = v.toLowerCase();
- break;
- }
-
- s += (s ? ' ' : '') + k + ': ' + v + ';';
- }
- });
-
- return s;
- },
-
- loadCSS : function(u) {
- var t = this, d = t.doc, head;
-
- if (!u)
- u = '';
-
- head = t.select('head')[0];
-
- each(u.split(','), function(u) {
- var link;
-
- if (t.files[u])
- return;
-
- t.files[u] = true;
- link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});
-
- // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
- // This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading
- // It's ugly but it seems to work fine.
- if (isIE && d.documentMode) {
- link.onload = function() {
- d.recalc();
- link.onload = null;
- };
- }
-
- head.appendChild(link);
- });
- },
-
- 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 || 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, i, nl, n, p, x;
-
- h = t.processHTML(h);
-
- if (isIE) {
- function set() {
- try {
- // IE will remove comments from the beginning
- // unless you padd the contents with something
- e.innerHTML = '
' + h;
- e.removeChild(e.firstChild);
- } catch (ex) {
- // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p
- // This seems to fix this problem
-
- // Remove all child nodes
- while (e.firstChild)
- e.firstChild.removeNode();
-
- // Create new div with HTML contents and a BR infront to keep comments
- x = t.create('div');
- x.innerHTML = '
' + h;
-
- // Add all children from div to target
- each (x.childNodes, function(n, i) {
- // Skip br element
- if (i)
- e.appendChild(n);
- });
- }
- };
-
- // IE has a serious bug when it comes to paragraphs it can produce an invalid
- // DOM tree if contents like this
is inserted
- // It seems to be that IE doesn't like a root block element placed inside another root block element
- if (t.settings.fix_ie_paragraphs)
- h = h.replace(/<\/p>|
]+)><\/p>|
/gi, '
');
-
- set();
-
- if (t.settings.fix_ie_paragraphs) {
- // Check for odd paragraphs this is a sign of a broken DOM
- nl = e.getElementsByTagName("p");
- for (i = nl.length - 1, x = 0; i >= 0; i--) {
- n = nl[i];
-
- if (!n.hasChildNodes()) {
- if (!n.mce_keep) {
- x = 1; // Is broken
- break;
- }
-
- n.removeAttribute('mce_keep');
- }
- }
- }
-
- // Time to fix the madness IE left us
- if (x) {
- // So if we replace the p elements with divs and mark them and then replace them back to paragraphs
- // after we use innerHTML we can fix the DOM tree
- h = h.replace(/]+)>|
/ig, '
');
- h = h.replace(/<\/p>/g, '
');
-
- // Set the new HTML with DIVs
- set();
-
- // Replace all DIV elements with he mce_tmp attibute back to paragraphs
- // This is needed since IE has a annoying bug see above for details
- // This is a slow process but it has to be done. :(
- if (t.settings.fix_ie_paragraphs) {
- nl = e.getElementsByTagName("DIV");
- for (i = nl.length - 1; i >= 0; i--) {
- n = nl[i];
-
- // Is it a temp div
- if (n.mce_tmp) {
- // Create new paragraph
- p = t.doc.createElement('p');
-
- // Copy all attributes
- n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {
- var v;
-
- if (b !== 'mce_tmp') {
- v = n.getAttribute(b);
-
- if (!v && b === 'class')
- v = n.className;
-
- p.setAttribute(b, v);
- }
- });
-
- // Append all children to new paragraph
- for (x = 0; x|]+)>/gi, '<$1b$2>');
- h = h.replace(/<(\/?)em>|]+)>/gi, '<$1i$2>');
- } else if (isIE) {
- h = h.replace(/'/g, '''); // IE can't handle apos
- h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct
- }
-
- // Fix some issues
- h = h.replace(/]+)\/>|/gi, ''); // Force open
-
- // Store away src and href in mce_src and mce_href since browsers mess them up
- if (s.keep_values) {
- // Wrap scripts and styles in comments for serialization purposes
- if (/');
- };
-
- 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;
-
- // Evaluate script
- if (!w.execScript) {
- try {
- eval.call(w, co);
- } catch (ex) {
- eval(co, w); // Firefox 3.0a8
- }
- } else
- w.execScript(co); // IE
- },
-
- loadScripts : function(sc, cb, s) {
- var t = this, lo = t.lookup;
-
- function done(o) {
- o.state = 2; // Has been loaded
-
- // Run callback
- if (o.func)
- o.func.call(o.scope || t);
- };
-
- function allDone() {
- var l;
-
- // Check if all files are loaded
- l = sc.length;
- each(sc, function(o) {
- o = lo[o.url];
-
- if (o.state === 2) {// It has finished loading
- done(o);
- l--;
- } else
- load(o);
- });
-
- // They are all loaded
- if (l === 0 && cb) {
- cb.call(s || t);
- cb = 0;
- }
- };
-
- function load(o) {
- if (o.state > 0)
- return;
-
- o.state = 1; // Is loading
-
- tinymce.dom.ScriptLoader.loadScript(o.url, function() {
- done(o);
- allDone();
- });
-
- /*
- 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;
-
- // Add to queue if needed
- if (!lo[u]) {
- lo[u] = o;
- t.queue.push(o);
- } else
- o = lo[u];
-
- // Is already loading or has been loaded
- if (o.state > 0)
- return;
-
- if (!Event.domLoaded && !t.settings.strict_mode) {
- var ix, ol = '';
-
- // Add onload events
- if (cb || o.func) {
- o.state = 1; // Is loading
-
- 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 methods
- '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);
- },
-
- loadScript : function(u, cb) {
- var id = tinymce.DOM.uniqueId(), e;
-
- function done() {
- Event.clear(id);
- tinymce.DOM.remove(id);
-
- if (cb) {
- cb.call(document, u);
- cb = 0;
- }
- };
-
- if (tinymce.isIE) {
-/* Event.add(e, 'readystatechange', function(e) {
- if (e.target && e.target.readyState == 'complete')
- done();
- });*/
-
- tinymce.util.XHR.send({
- url : tinymce._addVer(u),
- async : false,
- success : function(co) {
- window.execScript(co);
- done();
- }
- });
- } else {
- e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)});
- Event.add(e, 'load', done);
-
- // Check for head or body
- (document.getElementsByTagName('head')[0] || document.body).appendChild(e);
- }
- }
- }
- });
-
- // Global script loader
- tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
-})(tinymce);
-(function(tinymce) {
- // Shorten class names
- 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);
-
- // Add accessibility title for unavailable actions
- 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;
-
- // Set pending states
- 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);
- }
- },
-
- remove : function() {
- DOM.remove(this.id);
- this.destroy();
- },
-
- destroy : function() {
- tinymce.dom.Event.clear(this.id);
- }
- });
-})(tinymce);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', {
- Separator : function(id, s) {
- this.parent(id, s);
- this.classPrefix = 'mceSeparator';
- },
-
- renderHTML : function() {
- return tinymce.DOM.createHTML('span', {'class' : this.classPrefix});
- }
-});
-(function(tinymce) {
- 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();
-
- // Set pending state
- if (is(t.selected))
- t.setSelected(t.selected);
- }
- });
-})(tinymce);
-(function(tinymce) {
- 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();
- else
- o.remove();
-
- 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;
- }
- });
-})(tinymce);(function(tinymce) {
- 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 || DOM.doc.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'] += ' mceNoIcons';
-
- this.parent(id, s);
- this.onShowMenu = new tinymce.util.Dispatcher(this);
- 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.clientHeight < s.max_height)
- DOM.setStyle(co, 'overflow', 'hidden');
- }
- },
-
- showMenu : function(x, y, px) {
- var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix;
-
- t.collapse(1);
-
- if (t.isMenuVisible)
- return;
-
- if (!t.rendered) {
- co = DOM.add(t.settings.container, t.renderNode());
-
- each(t.items, function(o) {
- o.postRender();
- });
-
- t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
- } else
- co = DOM.get('menu_' + t.id);
-
- // Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug
- if (!tinymce.isOpera)
- DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF});
-
- DOM.show(co);
- t.update();
-
- x += s.offset_x || 0;
- y += s.offset_y || 0;
- vp.w -= 4;
- vp.h -= 4;
-
- // Move inside viewport if not submenu
- if (s.constrain) {
- w = co.clientWidth - ot;
- h = co.clientHeight - ot;
- mx = vp.x + vp.w;
- my = vp.y + vp.h;
-
- if ((x + s.vp_offset_x + w) > mx)
- 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, cp + 'ItemSub')) {
- m = t.items[e.id];
-
- if (m.isDisabled())
- return;
-
- dm = t;
-
- while (dm) {
- if (dm.hideMenu)
- dm.hideMenu();
-
- dm = dm.settings.parent;
- }
-
- if (m.settings.onclick)
- m.settings.onclick(e);
-
- return Event.cancel(e); // Cancel to fix onbeforeunload problem
- }
- });
-
- 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, cp + 'ItemSub')) {
- //p = DOM.getPos(s.container);
- 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, cp + 'ItemActive');
- }
- }
- });
- }
-
- t.onShowMenu.dispatch(t);
-
- if (s.keyboard_focus) {
- Event.add(co, 'keydown', t._keyHandler, t);
- DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link
- t._focusIdx = 0;
- }
- },
-
- 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);
- Event.remove(co, 'keydown', t._keyHandler);
- 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, t.classPrefix + 'ItemActive');
-
- 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);
- this.destroy();
-
- 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:200000'});
- co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (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' : t.classPrefix + 'Line'});
-
-// n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});
- 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;
- },
-
- // Internal functions
-
- _keyHandler : function(e) {
- var t = this, kc = e.keyCode;
-
- function focus(d) {
- var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i];
-
- if (e) {
- t._focusIdx = i;
- e.focus();
- }
- };
-
- switch (kc) {
- case 38:
- focus(-1); // Select first link
- return;
-
- case 40:
- focus(1);
- return;
-
- case 13:
- return;
-
- case 27:
- return this.hideMenu();
- }
- },
-
- _add : function(tb, o) {
- var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;
-
- if (s.separator) {
- ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});
- DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});
-
- if (n = ro.previousSibling)
- DOM.addClass(n, 'mceLast');
-
- return;
- }
-
- n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});
- 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']);
-// n = DOM.add(n, 'span', {'class' : 'item'});
-
- ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
-
- if (s.icon_src)
- DOM.add(ic, 'img', {src : s.icon_src});
-
- n = DOM.add(n, s.element || 'span', {'class' : 'mceText', 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, 'mceFirst');
-
- if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))
- DOM.addClass(ro, 'mceFirst');
-
- if (o.collapse)
- DOM.addClass(ro, cp + 'ItemSub');
-
- if (n = ro.previousSibling)
- DOM.removeClass(n, 'mceLast');
-
- DOM.addClass(ro, 'mceLast');
- }
- });
-})(tinymce);(function(tinymce) {
- 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 cp = this.classPrefix, s = this.settings, h, l;
-
- l = DOM.encode(s.label || '');
- h = '';
-
- if (s.image)
- h += '' + l + '';
- else
- h += '' + (l ? '' + l + '' : '') + '';
-
- 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);
- });
- }
- });
-})(tinymce);
-(function(tinymce) {
- 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(va) {
- var t = this, fv, f;
-
- if (va == undefined)
- return t.selectByIndex(-1);
-
- // Is string or number make function selector
- if (va && va.call)
- f = va;
- else {
- f = function(v) {
- return v == va;
- };
- }
-
- // Do we need to do something?
- if (va != t.selectedValue) {
- // Find item
- each(t.items, function(o, i) {
- if (f(o.value)) {
- fv = 1;
- t.selectByIndex(i);
- return false;
- }
- });
-
- if (!fv)
- t.selectByIndex(-1);
- }
- },
-
- selectByIndex : function(idx) {
- var t = this, e, o;
-
- if (idx != t.selectedIndex) {
- e = DOM.get(t.id + '_text');
- o = t.items[idx];
-
- if (o) {
- t.selectedValue = o.value;
- t.selectedIndex = idx;
- DOM.setHTML(e, DOM.encode(o.title));
- DOM.removeClass(e, 'mceTitle');
- } else {
- DOM.setHTML(e, DOM.encode(t.settings.title));
- DOM.addClass(e, 'mceTitle');
- t.selectedValue = t.selectedIndex = null;
- }
-
- 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, cp = t.classPrefix;
-
- h = '';
- h += '' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + ' | ';
- h += '' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', 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.menu && t.menu.isMenuVisible)
- return t.hideMenu();
-
- 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;
- m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus
-
- // Select in menu
- 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(DOM.doc, 'mousedown', t.hideMenu, t);
- DOM.addClass(t.id, t.classPrefix + 'Selected');
-
- //DOM.get(t.id + '_text').focus();
- },
-
- hideMenu : function(e) {
- var t = this;
-
- // Prevent double toogles by canceling the mouse click event to the button
- if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
- return;
-
- if (!e || !DOM.getParent(e.target, '.mceMenu')) {
- DOM.removeClass(t.id, t.classPrefix + 'Selected');
- Event.remove(DOM.doc, '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' : t.classPrefix + 'Menu mceNoIcons',
- max_width : 150,
- max_height : 150
- });
-
- m.onHideMenu.add(t.hideMenu, t);
-
- m.add({
- title : t.settings.title,
- 'class' : 'mceMenuItemTitle',
- onclick : function() {
- if (t.settings.onselect('') !== false)
- t.select(''); // Must be runned after
- }
- });
-
- each(t.items, function(o) {
- o.id = DOM.uniqueId();
- o.onclick = function() {
- if (t.settings.onselect(o.value) !== false)
- t.select(o.value); // Must be runned after
- };
-
- m.add(o);
- });
-
- t.onRenderMenu.dispatch(t, m);
- t.menu = m;
- },
-
- postRender : function() {
- var t = this, cp = t.classPrefix;
-
- Event.add(t.id, 'click', t.showMenu, t);
- Event.add(t.id + '_text', 'focus', function(e) {
- if (!t._focused) {
- t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) {
- var idx = -1, v, kc = e.keyCode;
-
- // Find current index
- each(t.items, function(v, i) {
- if (t.selectedValue == v.value)
- idx = i;
- });
-
- // Move up/down
- if (kc == 38)
- v = t.items[idx - 1];
- else if (kc == 40)
- v = t.items[idx + 1];
- else if (kc == 13) {
- // Fake select on enter
- v = t.selectedValue;
- t.selectedValue = null; // Needs to be null to fake change
- t.settings.onselect(v);
- return Event.cancel(e);
- }
-
- if (v) {
- t.hideMenu();
- t.select(v.value);
- }
- });
- }
-
- t._focused = 1;
- });
- Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;});
-
- // Old IE doesn't have hover on all elements
- if (tinymce.isIE6 || !DOM.boxModel) {
- Event.add(t.id, 'mouseover', function() {
- if (!DOM.hasClass(t.id, cp + 'Disabled'))
- DOM.addClass(t.id, cp + 'Hover');
- });
-
- Event.add(t.id, 'mouseout', function() {
- if (!DOM.hasClass(t.id, cp + 'Disabled'))
- DOM.removeClass(t.id, cp + 'Hover');
- });
- }
-
- t.onPostRender.dispatch(t, DOM.get(t.id));
- },
-
- destroy : function() {
- this.parent();
-
- Event.clear(this.id + '_text');
- Event.clear(this.id + '_open');
- }
- });
-})(tinymce);(function(tinymce) {
- 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(va) {
- var t = this, fv, f;
-
- if (va == undefined)
- return t.selectByIndex(-1);
-
- // Is string or number make function selector
- if (va && va.call)
- f = va;
- else {
- f = function(v) {
- return v == va;
- };
- }
-
- // Do we need to do something?
- if (va != t.selectedValue) {
- // Find item
- each(t.items, function(o, i) {
- if (f(o.value)) {
- fv = 1;
- t.selectByIndex(i);
- return false;
- }
- });
-
- if (!fv)
- t.selectByIndex(-1);
- }
- },
-
- selectByIndex : function(idx) {
- DOM.get(this.id).selectedIndex = idx + 1;
- this.selectedValue = this.items[idx] ? this.items[idx].value : null;
- },
-
- 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 = t.items[e.target.selectedIndex - 1];
-
- if (v && (v = v.value)) {
- t.onChange.dispatch(t, v);
-
- if (t.settings.onselect)
- t.settings.onselect(v);
- }
- };
-
- Event.add(t.id, 'change', onChange);
-
- // Accessibility keyhandler
- 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));
- }
- });
-})(tinymce);(function(tinymce) {
- 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 || DOM.doc.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;
- }
-
- if (t.isMenuVisible)
- return t.hideMenu();
-
- 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.settings.keyboard_focus = t._focused;
- m.showMenu(0, e.clientHeight);
-
- Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
- t.setState('Selected', 1);
-
- t.isMenuVisible = 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;
-
- // Prevent double toogles by canceling the mouse click event to the button
- if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))
- return;
-
- if (!e || !DOM.getParent(e.target, '.mceMenu')) {
- t.setState('Selected', 0);
- Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
- if (t.menu)
- t.menu.hideMenu();
- }
-
- t.isMenuVisible = 0;
- },
-
- 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();
- }
- });
- }
- });
-})(tinymce);
-(function(tinymce) {
- 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' : 'mceAction ' + s['class']});
- else
- h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');
-
- h += '' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + ' | ';
-
- h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']});
- h += '' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen ' + 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);
- Event.add(t.id + '_open', 'focus', function() {t._focused = 1;});
- Event.add(t.id + '_open', 'blur', function() {t._focused = 0;});
-
- // Old IE doesn't have hover on all elements
- 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');
- });
- }
- },
-
- destroy : function() {
- this.parent();
-
- Event.clear(this.id + '_action');
- Event.clear(this.id + '_open');
- }
- });
-})(tinymce);
-(function(tinymce) {
- 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.onShowMenu = new tinymce.util.Dispatcher(t);
-
- t.onHideMenu = new tinymce.util.Dispatcher(t);
-
- t.value = s.default_color;
- },
-
- showMenu : function() {
- var t = this, r, p, e, p2;
-
- if (t.isDisabled())
- return;
-
- if (!t.isMenuRendered) {
- t.renderMenu();
- t.isMenuRendered = true;
- }
-
- if (t.isMenuVisible)
- return t.hideMenu();
-
- 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 : 200000
- });
- e = 0;
-
- Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
- t.onShowMenu.dispatch(t);
-
- if (t._focused) {
- t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {
- if (e.keyCode == 27)
- t.hideMenu();
- });
-
- DOM.select('a', t.id + '_menu')[0].focus(); // Select first link
- }
-
- t.isMenuVisible = 1;
- },
-
- hideMenu : function(e) {
- var t = this;
-
- // Prevent double toogles by canceling the mouse click event to the button
- if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))
- return;
-
- if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {
- DOM.removeClass(t.id, 'mceSplitButtonSelected');
- Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
- Event.remove(t.id + '_menu', 'keydown', t._keyHandler);
- DOM.hide(t.id + '_menu');
- }
-
- t.onHideMenu.dispatch(t);
-
- t.isMenuVisible = 0;
- },
-
- 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');
-
- // Generate color grid
- 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
- },
- mce_color : '#' + c
- });
- });
-
- if (s.more_colors_func) {
- n = DOM.add(tb, 'tr');
- n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});
- n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);
-
- Event.add(n, 'click', function(e) {
- s.more_colors_func.call(s.more_colors_scope || this);
- return Event.cancel(e); // Cancel to fix onbeforeunload problem
- });
- }
-
- DOM.addClass(m, 'mceColorSplitMenu');
-
- Event.add(t.id + '_menu', 'click', function(e) {
- var c;
-
- e = e.target;
-
- if (e.nodeName == 'A' && (c = e.getAttribute('mce_color')))
- t.setColor(c);
-
- return Event.cancel(e); // Prevent IE auto save warning
- });
-
- return w;
- },
-
- setColor : function(c) {
- var t = this;
-
- DOM.setStyle(t.id + '_preview', 'backgroundColor', c);
-
- t.value = c;
- t.hideMenu();
- t.settings.onselect(c);
- },
-
- postRender : function() {
- var t = this, id = t.id;
-
- t.parent();
- DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});
- DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);
- },
-
- destroy : function() {
- this.parent();
-
- Event.clear(this.id + '_menu');
- Event.clear(this.id + '_more');
- DOM.remove(this.id + '_menu');
- }
- });
-})(tinymce);
-tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
- renderHTML : function() {
- var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;
-
- cl = t.controls;
- for (i=0; i'));
- }
-
- // Add toolbar end before list box and after the previous button
- // This is to fix the o2k7 editor skins
- if (pr && co.ListBox) {
- if (pr.Button || pr.SplitButton)
- h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, ''));
- }
-
- // Render control HTML
-
- // IE 8 quick fix, needed to propertly generate a hit area for anchors
- if (dom.stdMode)
- h += '' + co.renderHTML() + ' | ';
- else
- h += '' + co.renderHTML() + ' | ';
-
- // Add toolbar start after list box and before the next button
- // This is to fix the o2k7 editor skins
- if (nx && co.ListBox) {
- if (nx.Button || nx.SplitButton)
- h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, ''));
- }
- }
-
- c = 'mceToolbarEnd';
-
- if (co.Button)
- c += ' mceToolbarEndButton';
- else if (co.SplitButton)
- c += ' mceToolbarEndSplitButton';
- else if (co.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(tinymce) {
- 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 = tinymce.EditorManager.settings;
-
- if (s && s.language) {
- u = this.urls[n] + '/langs/' + s.language + '.js';
-
- 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) {
- var t = this;
-
- if (t.urls[n])
- return;
-
- if (u.indexOf('/') != 0 && u.indexOf('://') == -1)
- u = tinymce.baseURL + '/' + u;
-
- t.urls[n] = u.substring(0, u.lastIndexOf('/'));
- tinymce.ScriptLoader.add(u, cb, s);
- }
- });
-
- // Create plugin and theme managers
- tinymce.PluginManager = new tinymce.AddOnManager();
- tinymce.ThemeManager = new tinymce.AddOnManager();
-}(tinymce));
-
-(function(tinymce) {
- // Shorten names
- var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, explode = tinymce.explode;
-
- tinymce.create('static tinymce.EditorManager', {
- editors : {},
-
- i18n : {},
-
- activeEditor : null,
-
- preInit : function() {
- var t = this, lo = window.location;
-
- // Setup some URLs where the editor API is located and where the document is
- tinymce.documentBaseURL = lo.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);
-
- // Add before unload listener
- // This was required since IE was leaking memory if you added and removed beforeunload listeners
- // with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
- t.onBeforeUnload = new tinymce.util.Dispatcher(t);
-
- // Must be on window or IE will leak if the editor is placed in frame or iframe
- Event.add(window, 'beforeunload', function(e) {
- t.onBeforeUnload.dispatch(t, e);
- });
- },
-
- init : function(s) {
- var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed;
-
- 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 page not loaded and strict mode isn't enabled then load them
- if (!Event.domLoaded && !s.strict_loading_mode) {
- // Load language
- if (s.language)
- sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
-
- // Load theme
- if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
- ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
-
- // Load plugins
- if (s.plugins) {
- pl = explode(s.plugins);
-
- // Load rest if plugins
- each(pl, function(v) {
- if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) {
- // Skip safari plugin for other browsers
- if (!tinymce.isWebKit && v == 'safari')
- return;
-
- PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js');
- }
- });
- }
-
- sl.loadQueue();
- }
-
- // Legacy call
- Event.add(document, 'init', function() {
- var l, co;
-
- execCallback(s, 'onpageload');
-
- // Verify that it's a valid browser
- if (s.browsers) {
- l = false;
-
- each(explode(s.browsers), 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;
- }
- });
-
- // Not a valid one
- if (!l)
- return;
- }
-
- switch (s.mode) {
- case "exact":
- l = s.elements || '';
-
- if(l.length > 0) {
- each(explode(l), function(v) {
- if (DOM.get(v)) {
- ed = new tinymce.Editor(v, s);
- el.push(ed);
- ed.render(1);
- } else {
- c = 0;
-
- each(document.forms, function(f) {
- each(f.elements, function(e) {
- if (e.name === v) {
- v = 'mce_editor_' + c;
- DOM.setAttrib(e, 'id', v);
-
- ed = new tinymce.Editor(v, s);
- el.push(ed);
- ed.render(1);
- }
- });
- });
- }
- });
- }
- break;
-
- case "textareas":
- case "specific_textareas":
- function hasClass(n, c) {
- return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);
- };
-
- 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)) {
- // Can we use the name
- e = DOM.get(v.name);
- if (!v.id && !e)
- v.id = v.name;
-
- // Generate unique name if missing or already exists
- if (!v.id || t.get(v.id))
- v.id = DOM.uniqueId();
-
- ed = new tinymce.Editor(v.id, s);
- el.push(ed);
- ed.render(1);
- }
- });
- break;
- }
-
- // Call onInit when all editors are initialized
- if (s.oninit) {
- l = co = 0;
-
- each (el, function(ed) {
- co++;
-
- if (!ed.initialized) {
- // Wait for it
- ed.onInit.add(function() {
- l++;
-
- // All done
- if (l == co)
- execCallback(s, 'oninit');
- });
- } else
- l++;
-
- // All done
- 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;
-
- // Not in the collection
- if (!t.editors[e.id])
- return null;
-
- delete t.editors[e.id];
-
- // Select another editor since the active one was removed
- if (t.activeEditor == e) {
- t._setActive(null);
-
- each(t.editors, function(e) {
- t._setActive(e);
- return false; // Break
- });
- }
-
- e.destroy();
-
- return e;
- },
-
- execCommand : function(c, u, v) {
- var t = this, ed = t.get(v), w;
-
- // Manager commands
- switch (c) {
- case "mceFocus":
- ed.focus();
- return true;
-
- case "mceAddEditor":
- case "mceAddControl":
- if (!t.get(v))
- new tinymce.Editor(v, t.settings).render();
-
- return true;
-
- case "mceAddFrameControl":
- w = v.window;
-
- // Add tinyMCE global instance and tinymce namespace to specified window
- w.tinyMCE = tinyMCE;
- w.tinymce = tinymce;
-
- tinymce.DOM.doc = w.document;
- tinymce.DOM.win = w;
-
- ed = new tinymce.Editor(v.element_id, v);
- ed.render();
-
- // Fix IE memory leaks
- if (tinymce.isIE) {
- function clr() {
- ed.destroy();
- w.detachEvent('onunload', clr);
- w = w.tinyMCE = w.tinymce = null; // IE leak
- };
-
- w.attachEvent('onunload', clr);
- }
-
- v.page_window = null;
-
- return true;
-
- case "mceRemoveEditor":
- case "mceRemoveControl":
- if (ed)
- 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;
- }
-
- // Run command on active editor
- 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;
- });
- }
- },
-
- // Private methods
-
- _setActive : function(e) {
- this.selectedInstance = this.activeEditor = e;
- }
- });
-
- tinymce.EditorManager.preInit();
-})(tinymce);
-
-var tinyMCE = window.tinyMCE = tinymce.EditorManager;
-(function(tinymce) {
- 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, explode = tinymce.explode;
-
- tinymce.create('tinymce.Editor', {
- Editor : function(id, s) {
- var t = this;
-
- t.id = t.editorId = id;
-
- t.execCommands = {};
- t.queryStateCommands = {};
- t.queryValueCommands = {};
-
- t.isNotDirty = false;
-
- t.plugins = {};
-
- // Add events to the editor
- 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';
-
- // We only need to override paths if we have to
- // IE has a bug where it remove site absolute urls to relative ones if this is specified
- if (s.document_base_url != tinymce.documentBaseURL)
- t.iframeHTML += '';
-
- t.iframeHTML += '';
-
- if (tinymce.relaxedDomain)
- t.iframeHTML += '';
-
- bi = s.body_id || 'tinymce';
- if (bi.indexOf('=') != -1) {
- bi = t.getParam('body_id', '', 'hash');
- bi = bi[t.id] || bi;
- }
-
- bc = s.body_class || '';
- if (bc.indexOf('=') != -1) {
- bc = t.getParam('body_class', '', 'hash');
- bc = bc[t.id] || '';
- }
-
- t.iframeHTML += '