📄 tiny_mce_src.js
字号:
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 = [];
// 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;
// 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);
}
});
})();
/* 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<o.length; i++)
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
}
}
});
/* 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);
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);
}
}
});
/* 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
});
// 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);
}
}
});
}());
/* file:jscripts/tiny_mce/classes/dom/DOMUtils.js */
(function() {
// 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,
listeners : {},
pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
cache : {},
idPattern : /^#[\w]+$/,
elmPattern : /^[\w_*]+$/,
elmClassPattern : /^([\w_]*)\.([\w_]+)$/,
props : {
"for" : "htmlFor",
"class" : "className",
className : "className",
checked : "checked",
disabled : "disabled",
maxlength : "maxLength",
readonly : "readOnly",
selected : "selected",
value : "value"
},
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;
this.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) {
var na, se = this.settings;
n = this.get(n);
if (se.strict_root)
r = r || this.getRoot();
// Wrap node name as func
if (is(f, 'string')) {
na = f.toUpperCase();
f = function(n) {
var s = false;
// Any element
if (n.nodeType == 1 && na === '*') {
s = true;
return false;
}
each(na.split(','), function(v) {
if (n.nodeType == 1 && ((se.strict && n.nodeName.toUpperCase() == v) || n.nodeName.toUpperCase() == v)) {
s = true;
return false; // Break loop
}
});
return s;
};
}
while (n) {
if (n == r)
return null;
if (f(n))
return n;
n = n.parentNode;
}
return 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;
},
// #if !jquery
select : function(pa, s) {
var t = this, cs, c, pl, o = [], x, i, l, n, xp;
s = t.get(s) || t.doc;
// Look for native support and use that if it's found
if (s.querySelectorAll) {
// Element scope then use temp id
// We need to do this to be compatible with other implementations
// See bug report: http://bugs.webkit.org/show_bug.cgi?id=17461
if (s != t.doc) {
i = s.id;
s.id = '_mc_tmp';
pa = '#_mc_tmp ' + pa;
}
// Select elements
l = tinymce.grep(s.querySelectorAll(pa));
// Restore old id
s.id = i;
return l;
}
if (!t.selectorRe)
t.selectorRe = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;
// Air doesn't support eval due to security sandboxing and querySelectorAll isn't supported yet
if (tinymce.isAir) {
each(tinymce.explode(pa), function(v) {
if (!(xp = t.cache[v])) {
xp = '';
each(v.split(' '), function(v) {
v = t.selectorRe.exec(v);
xp += v[1] ? '//' + v[1] : '//*';
// Id
if (v[2])
xp += "[@id='" + v[2] + "']";
// Class
if (v[3]) {
each(v[3].split('.'), function(n) {
xp += "[@class = '" + n + "' or contains(concat(' ', @class, ' '), ' " + n + " ')]";
});
}
});
t.cache[v] = xp;
}
xp = t.doc.evaluate(xp, s, null, 4, null);
while (n = xp.iterateNext())
o.push(n);
});
return o;
}
if (t.settings.strict) {
function get(s, n) {
return s.getElementsByTagName(n.toLowerCase());
};
} else {
function get(s, n) {
return s.getElementsByTagName(n);
};
}
// Simple element pattern. For example: "p" or "*"
if (t.elmPattern.test(pa)) {
x = get(s, pa);
for (i = 0, l = x.length; i<l; i++)
o.push(x[i]);
return o;
}
// Simple class pattern. For example: "p.class" or ".class"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -