gnu-social/plugins/TinyMCE/js/tiny_mce.js

1 line
161 KiB
JavaScript
Raw Normal View History

2010-03-12 00:18:11 +09:00
(function(b){var a=/^\s*|\s*$/g,c;b.tinymce=b.tinyMCE={majorVersion:"3",minorVersion:"3rc1",releaseDate:"2010-02-23",_init:function(){var r=this,o=document,m=navigator,f=m.userAgent,l,e,k,j,h,q;r.isOpera=b.opera&&opera.buildNumber;r.isWebKit=/WebKit/.test(f);r.isIE=!r.isWebKit&&!r.isOpera&&(/MSIE/gi).test(f)&&(/Explorer/gi).test(m.appName);r.isIE6=r.isIE&&/MSIE [56]/.test(f);r.isGecko=!r.isWebKit&&/Gecko/.test(f);r.isMac=f.indexOf("Mac")!=-1;r.isAir=/adobeair/i.test(f);if(b.tinyMCEPreInit){r.suffix=tinyMCEPreInit.suffix;r.baseURL=tinyMCEPreInit.base;r.query=tinyMCEPreInit.query;return}r.suffix="";e=o.getElementsByTagName("base");for(l=0;l<e.length;l++){if(q=e[l].href){if(/^https?:\/\/[^\/]+$/.test(q)){q+="/"}j=q?q.match(/.*\//)[0]:""}}function g(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){r.suffix="_src"}if((h=d.src.indexOf("?"))!=-1){r.query=d.src.substring(h+1)}r.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(j&&r.baseURL.indexOf("://")==-1&&r.baseURL.indexOf("/")!==0){r.baseURL=j+r.baseURL}return r.baseURL}return null}e=o.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}k=o.getElementsByTagName("head")[0];if(k){e=k.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}}return},is:function(e,d){if(!d){return e!==c}if(d=="array"&&(e.hasOwnProperty&&e instanceof Array)){return true}return typeof(e)==d},each:function(g,d,f){var h,e;if(!g){return 0}f=f||g;if(g.length!==c){for(h=0,e=g.length;h<e;h++){if(d.call(f,g[h],h,g)===false){return 0}}}else{for(h in g){if(g.hasOwnProperty(h)){if(d.call(f,g[h],h,g)===false){return 0}}}}return 1},trim:function(d){return(d?""+d:"").replace(a,"")},create:function(l,d){var k=this,e,g,h,i,f,j=0;l=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(l);h=l[3].match(/(^|\.)(\w+)$/i)[2];g=k.createNS(l[3].replace(/\.\w+$/,""));if(g[h]){return}if(l[2]=="static"){g[h]=d;if(this.onCreate){this.onCreate(l[2],l[3],g[h])}return}if(!d[h]){d[h]=function(){};j=1}g[h]=d[h];k.extend(g[h].prototype,d);if(l[5]){e=k.resolve(l[5]).prototype;i=l[5].match(/\.(\w+)$/i)[1];f=g[h];if(j){g[h]=function(){return e[i].apply(this,arguments)}}else{g[h]=function(){this.parent=e[i];return f.apply(this,arguments)}}g[h].prototype[h]=g[h];k.each(e,function(m,o){g[h].prototype[o]=e[o]});k.each(d,function(m,o){if(e[o]){g[h].prototype[o]=function(){this.parent=e[o];return m.apply(this,arguments)}}else{if(o!=h){g[h].prototype[o]=m}}})}k.each(d["static"],function(m,o){g[h][o]=m});if(this.onCreate){this.onCreate(l[2],l[3],g[h].prototype)}},walk:function(g,e,h,d){d=d||this;if(g){if(h){g=g[h]}tinymce.each(g,function(j,f){if(e.call(d,j,f,h)===false){return false}tinymce.walk(j,e,h,d)})}},createNS:function(g,f){var e,d;f=f||window;g=g.split(".");for(e=0;e<g.length;e++){d=g[e];if(!f[d]){f[d]={}}f=f[d]}return f},resolve:function(g,f){var e,d;f=f||b;g=g.split(".");for(e=0,d=g.length;e<d;e++){f=f[g[e]];if(!f){break}}return f},addUnload:function(h,g){var e=this;h={func:h,scope:g||this};if(!e.unloads){function d(){var f=e.unloads,j,k;if(f){for(k in f){j=f[k];if(j&&j.func){j.func.call(j.scope,1)}}if(b.detachEvent){b.detachEvent("onbeforeunload",i);b.detachEvent("onunload",d)}else{if(b.removeEventListener){b.removeEventListener("unload",d,false)}}e.unloads=j=f=w=d=0;if(b.CollectGarbage){CollectGarbage()}}}function i(){var j=document;if(j.readyState=="interactive"){function f(){j.detachEvent("onstop",f);if(d){d()}j=0}if(j){j.attachEvent("onstop",f)}b.setTimeout(function(){if(j){j.detachEvent("onstop",f)}},0)}}if(b.attachEvent){b.attachEvent("onunload",d);b.attachEvent("onbeforeunload",i)}else{if(b.addEventListener){b.addEventListener("unload",d,false)}}e.unloads=[h]}else{e.unloads.push(h)}return h},removeUnload:function(g){var d=this.unloads,e=null;tinymce.each(d,function(h,f){if(h&&h.func==g){d.splice(f,1);e=g;return false}});return e},explode:function(e,f){return e?tinymce.map(e.split(f||","),tinymce.trim):e},_addVer:function(e){var d;if(!this.query){return e}d=(e.indexOf("?")==-1?"?":"&")+this.query;if(e.indexOf("#")==-1){return e+