Subversion Repositories oidplus

Rev

Rev 2 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 1... Line -...
1
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]],i=function(i){var o;return o='<table role="list" class="mce-grid">',e.each(n,function(t){o+="<tr>",e.each(t,function(t){var e=i+"/img/smiley-"+t+".gif";o+='<td><a href="#" data-mce-url="'+e+'" data-mce-alt="'+t+'" tabindex="-1" role="option" aria-label="'+t+'"><img src="'+e+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),o+="</tr>"}),o+="</table>"},o=function(a,t){var e=i(t);a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:e,onclick:function(t){var e,i,o,n=a.dom.getParent(t.target,"a");n&&(e=a,i=n.getAttribute("data-mce-url"),o=n.getAttribute("data-mce-alt"),e.insertContent(e.dom.createHTML("img",{src:i,alt:o})),this.hide())}},tooltip:"Emoticons"})};t.add("emoticons",function(t,e){o(t,e)})}();
-
 
2
1
/**
-
 
2
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
-
 
3
 * Licensed under the LGPL or a commercial license.
-
 
4
 * For LGPL see License.txt in the project root for license information.
-
 
5
 * For commercial licenses see https://www.tiny.cloud/
-
 
6
 *
-
 
7
 * Version: 5.0.2 (2019-03-05)
-
 
8
 */
-
 
9
!function(){"use strict";var n,t,e,r,o,u,i=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t]},a=function(n){return function(){return n}},l=function(n){return n},f=a(!1),s=a(!0),d=f,m=s,g=function(){return y},y=(r={fold:function(n,t){return n()},is:d,isSome:d,isNone:m,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:g,ap:g,each:function(){},bind:g,flatten:g,exists:d,forall:m,filter:g,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:a("none()")},Object.freeze&&Object.freeze(r),r),p=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:m,isNone:d,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return p(n(e))},ap:function(n){return n.fold(g,function(n){return p(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:y},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(d,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},h={some:p,none:g,from:function(n){return null===n||n===undefined?y:p(n)}},v=(o="function",function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"===t&&Array.prototype.isPrototypeOf(n)?"array":"object"===t&&String.prototype.isPrototypeOf(n)?"string":t}(n)===o}),O=function(n,t){for(var e=0,r=n.length;e<r;e++)if(t(n[e],e,n))return h.some(e);return h.none()},b=(Array.prototype.slice,v(Array.from)&&Array.from,function(n,t){return-1!==n.indexOf(t)}),w=function(n,t){return b(n.title.toLowerCase(),t)||(e=n.keywords,O(e,function(n){return b(n.toLowerCase(),t)}).isSome());var e},k=function(n,t,e){for(var r=[],o=t.toLowerCase(),i=e.fold(function(){return f},function(t){return function(n){return t<=n}}),u=0;u<n.length&&(0!==t.length&&!w(n[u],o)||(r.push({value:n[u]["char"],text:n[u].title,icon:n[u]["char"]}),!i(r.length)));u++);return r},A=function(n){var t=n,e=function(){return t};return{get:e,set:function(n){t=n},clone:function(){return A(e())}}},j="undefined"!=typeof window?window:Function("return this;")(),C=Object.keys,T=Object.hasOwnProperty,S=function(n,t){for(var e=C(n),r=0,o=e.length;r<o;r++){var i=e[r];t(n[i],i,n)}},_=function(r,o){var i={};return S(r,function(n,t){var e=o(n,t,r);i[e.k]=e.v}),i},x=function(e){return{is:function(n){return e===n},isValue:s,isError:f,getOr:a(e),getOrThunk:a(e),getOrDie:a(e),or:function(n){return x(e)},orThunk:function(n){return x(e)},fold:function(n,t){return t(e)},map:function(n){return x(n(e))},mapError:function(n){return x(e)},each:function(n){n(e)},bind:function(n){return n(e)},exists:function(n){return n(e)},forall:function(n){return n(e)},toOption:function(){return h.some(e)}}},L=function(e){return{is:f,isValue:f,isError:s,getOr:l,getOrThunk:function(n){return n()},getOrDie:function(){return n=String(e),function(){throw new Error(n)}();var n},or:function(n){return n},orThunk:function(n){return n()},fold:function(n,t){return n(e)},map:function(n){return L(e)},mapError:function(n){return L(n(e))},each:c,bind:function(n){return L(e)},exists:f,forall:s,toOption:h.none}},D={value:x,error:L},E=Object.prototype.hasOwnProperty,P=(u=function(n,t){return t},function(){for(var n=new Array(arguments.length),t=0;t<n.length;t++)n[t]=arguments[t];if(0===n.length)throw new Error("Can't merge zero objects");for(var e={},r=0;r<n.length;r++){var o=n[r];for(var i in o)E.call(o,i)&&(e[i]=u(e[i],o[i]))}return e}),F=tinymce.util.Tools.resolve("tinymce.dom.ScriptLoader"),N=tinymce.util.Tools.resolve("tinymce.util.Promise"),q=function(n,t){return n.getParam("emoticons_database_url",t+"/js/emojis"+n.suffix+".js")},z=function(n){return n.getParam("emoticons_append",{},"object")},I="All",U={symbols:"Symbols",people:"People",animals_and_nature:"Animals and Nature",food_and_drink:"Food and Drink",activity:"Activity",travel_and_places:"Travel and Places",objects:"Objects",flags:"Flags",user:"User Defined"},M="emoticons_plugin_database",R=function(n,t){return e=n,r=t,T.call(e,r)?n[t]:t;var e,r},V=function(n){var r,t=z(n);return r=function(n){return P({keywords:[],category:"user"},n)},_(t,function(n,t,e){return{k:t,v:r(n,t,e)}})},B=function(r,o){var u=A(h.none()),c=A(h.none());r.on("init",function(){F.ScriptLoader.loadScript(o,function(){(function(n){if(j.tinymce[M]){var t=D.value(j.tinymce[M]);return delete j.tinymce[M],t}return D.error("URL "+n+" did not contain the expected format for emoticons")})(o).fold(function(n){console.log(n),u.set(h.some({})),c.set(h.some([]))},function(n){var t,o,i,e=V(r);t=P(n,e),o={},i=[],S(t,function(n,t){var e={title:t,keywords:n.keywords,"char":n["char"],category:R(U,n.category)},r=o[e.category]!==undefined?o[e.category]:[];o[e.category]=r.concat([e]),i.push(e)}),u.set(h.some(o)),c.set(h.some(i))})},function(){})});var n=function(){return c.get().getOr([])},i=function(){return u.get().isSome()&&c.get().isSome()};return{listCategories:function(){return[I].concat(C(u.get().getOr({})))},hasLoaded:i,waitForLoad:function(){return i()?N.resolve(!0):new N(function(n,t){var e=3,r=setInterval(function(){i()?(clearInterval(r),n(!0)):--e<0&&(console.log("Could not load emojis from url: "+o),clearInterval(r),t(!1))},500)})},listAll:n,listCategory:function(t){return t===I?n():u.get().bind(function(n){return h.from(n[t])}).getOr([])}}},G="pattern",H=function(o,c){var e,r,i,n={pattern:"",results:k(c.listAll(),"",h.some(300))},u=(e=function(n){var t,e,r,o,i,u=a.get();e=u,r=(t=n).getData(),o=c.listCategory(e),i=k(o,r[G],e===I?h.some(300):h.none()),t.setData({results:i})},r=200,i=null,{cancel:function(){null!==i&&(clearTimeout(i),i=null)},throttle:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];null!==i&&clearTimeout(i),i=setTimeout(function(){e.apply(null,n),i=null},r)}}),a=A(I),t={label:"Search",type:"input",name:G},l={type:"collection",name:"results"},f=function(){return{title:"Emoticons",size:"normal",body:{type:"tabpanel",tabs:function(n,t){for(var e=n.length,r=new Array(e),o=0;o<e;o++){var i=n[o];r[o]=t(i,o,n)}return r}(c.listCategories(),function(n){return{title:n,items:[t,l]}})},initialData:n,onTabChange:function(n,t){a.set(t),u.throttle(n)},onChange:u.throttle,onAction:function(n,t){var e,r;"results"===t.name&&(e=o,r=t.value,e.insertContent(r),n.close())},buttons:[{type:"cancel",text:"Close",primary:!0}]}},s=o.windowManager.open(f());s.focus(G),c.hasLoaded()||(s.block("Loading emoticons..."),c.waitForLoad().then(function(){s.redial(f()),u.throttle(s),s.focus(G),s.unblock()})["catch"](function(n){s.redial({title:"Emoticons",body:{type:"panel",items:[{type:"alertbanner",level:"error",icon:"warning",text:"<p>Could not load emoticons</p>"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{pattern:"",results:[]}}),s.focus(G),s.unblock()}))},J=function(n,t){var e=function(){return H(n,t)};n.ui.registry.addButton("emoticons",{tooltip:"Emoticons",icon:"emoji",onAction:e}),n.ui.registry.addMenuItem("emoticons",{text:"Emoticons...",icon:"emoji",onAction:e})};i.add("emoticons",function(n,t){var r,o,e=q(n,t),i=B(n,e);J(n,i),o=i,(r=n).ui.registry.addAutocompleter("emoticons",{ch:":",columns:"auto",minChars:2,fetch:function(t,e){return o.waitForLoad().then(function(){var n=o.listAll();return k(n,t,h.some(e))})},onAction:function(n,t,e){r.selection.setRng(t),r.insertContent(e),n.hide()}})}),function K(){}}();
-
 
10
3
11