mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-12 09:40:45 +01:00
1 line
7.6 KiB
JavaScript
1 line
7.6 KiB
JavaScript
|
!function(){"use strict";var e,t,n,r,a,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(e){return function(){return e}},i=u(!1),c=u(!0),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),p=tinymce.util.Tools.resolve("tinymce.util.XHR"),l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(e){return e.getParam("template_cdate_classes","cdate")},m=function(e){return e.getParam("template_mdate_classes","mdate")},d=function(e){return e.getParam("template_selected_content_classes","selcontent")},g=function(e){return e.getParam("template_preview_replace_values")},y=function(e){return e.getParam("template_replace_values")},h=function(e){return e.templates},v=function(e){return e.getParam("template_cdate_format",e.getLang("template.cdate_format"))},b=function(e){return e.getParam("template_mdate_format",e.getLang("template.mdate_format"))},_=function(e){return e.getParam("template_popup_width",600)},M=function(e){return Math.min(l.DOM.getViewPort().h,e.getParam("template_popup_height",500))},T=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},O=function(e,t,n){var r="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),a="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),o="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),u="January February March April May June July August September October November December".split(" ");return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",T(n.getMonth()+1,2))).replace("%d",T(n.getDate(),2))).replace("%H",""+T(n.getHours(),2))).replace("%M",""+T(n.getMinutes(),2))).replace("%S",""+T(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(u[n.getMonth()]))).replace("%b",""+e.translate(o[n.getMonth()]))).replace("%A",""+e.translate(a[n.getDay()]))).replace("%a",""+e.translate(r[n.getDay()]))).replace("%%","%")},x=function(n,e){return f.each(e,function(e,t){"function"==typeof e&&(e=e(t)),n=n.replace(new RegExp("\\{\\$"+t+"\\}","g"),e)}),n},P=function(e,t){var r=e.dom,a=y(e);f.each(r.select("*",t),function(n){f.each(a,function(e,t){r.hasClass(n,t)&&"function"==typeof a[t]&&a[t](n)})})},S=function(e,t){return new RegExp("\\b"+t+"\\b","g").test(e.className)},w=function(t,n){return function(){var e=h(t);"function"!=typeof e?"string"==typeof e?p.send({url:e,success:function(e){n(JSON.parse(e))}}):n(e):e(n)}},A=x,D=P,C=function(t,e,n){var r,a,o=t.dom,u=t.selection.getContent();n=x(n,y(t)),r=o.create("div",null,n),(a=o.select(".mceTmpl",r))&&0<a.length&&(r=o.create("div",null)).appendChild(a[0].cloneNode(!0)),f.each(o.select("*",r),function(e){S(e,s(t).replace(/\s+/g,"|"))&&(e.innerHTML=O(t,v(t))),S(e,m(t).replace(/\s+/g,"|"))&&(e.innerHTML=O(t,b(t))),S(e,d(t).replace(/\s+/g,"|"))&&(e.innerHTML=u)}),P(t,r),t.execCommand("mceInsertContent",!1,r.innerHTML),t.addVisual()},H=function(e){e.addCommand("mceInsertTemplate",function(o){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var u=new Array(arguments.length-1),n=1;n<arguments.length;n++)u[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var a=u.concat(n);return o.apply(null,a)}}(C,e))},N=function(r){r.on("PreProcess",function(e){var t=r.dom,n=b(r);f.each(t.select("div",e.node),function(e){t.hasClass(e,"mceTmpl")&&(f.each(t.select("*",e),function(e){t.hasClass(e,r.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(e.innerHTML=O(r,n))}),D(r,e))})})},k=i,I=c,L=function(){return J},J=(r={fold:function(e,t){return e()},is:k,isSome:k,isNone:I,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:t,map:L,ap:L,each:function(){},bind:
|