Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ "use strict";window.setImmediate||(window.setImmediate=window.msSetImmediate||window.webkitSetImmediate||window.mozSetImmediate||window.oSetImmediate||function(){if(!window.postMessage||!window.addEventListener)return null;var t=[void 0],e="zero-timeout-message";return window.addEventListener("message",function(a){"string"==typeof a.data&&a.data.substr(0,e.length)===e&&(a.stopImmediatePropagation(),a=parseInt(a.data.substr(e.length),36),t[a]&&(t[a](),t[a]=void 0))},!0),window.clearImmediate=function(e){t[e]&&(t[e]=void 0)},function(a){var i=t.length;return t.push(a),window.postMessage(e+i.toString(36),"*"),i}}()||function(t){window.setTimeout(t,0)}),window.clearImmediate||(window.clearImmediate=window.msClearImmediate||window.webkitClearImmediate||window.mozClearImmediate||window.oClearImmediate||function(t){window.clearTimeout(t)}),function(t){function e(t,e){if(a){var r=Math.floor(Math.random()*Date.now());(t=Array.isArray(t)?t:[t]).forEach(function(e,a){if("string"==typeof e){if(t[a]=document.getElementById(e),!t[a])throw new Error("The element id specified is not found.")}else if(!e.tagName&&!e.appendChild)throw new Error("You must pass valid HTML elements, or ID of the element.")});var n,s={list:[],fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",minSize:0,weightFactor:1,clearCanvas:!0,backgroundColor:"#fff",gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,origin:null,drawMask:!1,maskColor:"rgba(255,0,0,0.3)",maskGapWidth:.3,wait:0,abortThreshold:0,abort:function(){},minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationSteps:0,shuffle:!0,rotateRatio:.1,shape:"circle",ellipticity:.65,classes:null,hover:null,click:null};if(e)for(var l in e)l in s&&(s[l]=e[l]);if("function"!=typeof s.weightFactor&&(n=s.weightFactor,s.weightFactor=function(t){return t*n}),"function"!=typeof s.shape)switch(s.shape){case"circle":default:s.shape="circle";break;case"cardioid":s.shape=function(t){return 1-Math.sin(t)};break;case"diamond":s.shape=function(t){return t%=2*Math.PI/4,1/(Math.cos(t)+Math.sin(t))};break;case"square":s.shape=function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))};break;case"triangle-forward":s.shape=function(t){return t%=2*Math.PI/3,1/(Math.cos(t)+Math.sqrt(3)*Math.sin(t))};break;case"triangle":case"triangle-upright":s.shape=function(t){return t=(t+3*Math.PI/2)%(2*Math.PI/3),1/(Math.cos(t)+Math.sqrt(3)*Math.sin(t))};break;case"pentagon":s.shape=function(t){return t=(t+.955)%(2*Math.PI/5),1/(Math.cos(t)+.726543*Math.sin(t))};break;case"star":s.shape=function(t){var e=(t+.955)%(2*Math.PI/10);return 0<=(t+.955)%(2*Math.PI/5)-2*Math.PI/10?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}}s.gridSize=Math.max(Math.floor(s.gridSize),4);var d,f,c,h,u,m,w,g,v=s.gridSize,M=v-s.maskGapWidth,p=Math.abs(s.maxRotation-s.minRotation),x=Math.abs(Math.floor(s.rotationSteps)),b=Math.min(s.maxRotation,s.minRotation);switch(s.color){case"random-dark":w=function(){return z(10,50)};break;case"random-light":w=function(){return z(50,90)};break;default:"function"==typeof s.color&&(w=s.color)}"function"==typeof s.fontWeight&&(g=s.fontWeight);var T=null;"function"==typeof s.classes&&(T=s.classes);var y,I=!1,k=[],C=function(t){var e=t.currentTarget,a=e.getBoundingClientRect(),i=(t=t.touches?(i=t.touches[0].clientX,t.touches[0].clientY):(i=t.clientX,t.clientY),i-a.left);t-=a.top,i=Math.floor(i*(e.width/a.width||1)/v),a=Math.floor(t*(e.height/a.height||1)/v);return k[i][a]},S=function(t){var e=C(t);y!==e&&((y=e)?s.hover(e.item,e.dimension,t):s.hover(void 0,void 0,t))},E=function(t){var e=C(t);e&&(s.click(e.item,e.dimension,t),t.preventDefault())},F=[],P=function(){return 0s.abortThreshold},R=function(e,a,i,o,r,n){var l,h,u=r.occupied,m=s.drawMask;m&&((l=t[0].getContext("2d")).save(),l.fillStyle=s.maskColor),I&&(h={x:(e+(r=r.bounds)[3])*v,y:(a+r[0])*v,w:(r[1]-r[3]+1)*v,h:(r[2]-r[0]+1)*v});for(var w,g,p,x=u.length;x--;){var b=e+u[x][0],T=a+u[x][1];f<=b||c<=T||b<0||T<0||(w=T,g=m,p=h,T=n,f<=(b=b)||c<=w||b<0||w<0||(d[b][w]=!1,g&&t[0].getContext("2d").fillRect(b*v,w*v,M,M),I&&(k[b][w]={item:T,dimension:p})))}m&&l.restore()},O=function e(a){var o,r,n;Array.isArray(a)?(o=a[0],r=a[1]):(o=a.word,r=a.weight,n=a.attributes);var l=0===s.rotateRatio||Math.random()>s.rotateRatio?0:0===p?b:0k[1]&&(k[1]=I),xk[2]&&(k[2]=x);break t}}return{mu:n,occupied:y,bounds:k,gw:u,gh:w,fillTextOffsetX:e,fillTextOffsetY:o,fillTextWidth:c,fillTextHeight:h,fontSize:r}}(o,r,l,m);if(!M)return!1;if(P())return!1;if(!s.drawOutOfBound&&!s.shrinkToFit){var y=M.bounds;if(y[1]-y[3]+1>f||y[2]-y[0]+1>c)return!1}for(var I=u+1,k=function(e){var i,h,p,x,b,y,k,C,S,E,F,P,O,A=Math.floor(e[0]-M.gw/2),z=Math.floor(e[1]-M.gh/2);return M.gw,M.gh,!!function(t,e,a){for(var i=a.length;i--;){var o=t+a[i][0],r=e+a[i][1];if(f<=o||c<=r||o<0||r<0){if(!s.drawOutOfBound)return!1}else if(!d[o][r])return!1}return!0}(A,z,M.occupied)&&(i=A,h=z,p=M,x=o,b=r,y=u-I,k=e[2],C=l,S=n,e=m,E=p.fontSize,F=w?w(x,b,E,y,k,e):s.color,P=g?g(x,b,E,e):s.fontWeight,O=T?T(x,b,E,e):s.classes,t.forEach(function(t){if(t.getContext){var e=t.getContext("2d"),a=p.mu;e.save(),e.scale(1/a,1/a),e.font=P+" "+(E*a).toString(10)+"px "+s.fontFamily,e.fillStyle=F,e.translate((i+p.gw/2)*v*a,(h+p.gh/2)*v*a),0!==C&&e.rotate(-C),e.textBaseline="middle",e.fillText(x,p.fillTextOffsetX*a,(p.fillTextOffsetY+.5*E)*a),e.restore()}else{var o=document.createElement("span");e="",e="rotate("+-C/Math.PI*180+"deg) ";1!==p.mu&&(e+="translateX(-"+p.fillTextWidth/4+"px) scale("+1/p.mu+")");var r,n={position:"absolute",display:"block",font:P+" "+E*p.mu+"px "+s.fontFamily,left:(i+p.gw/2)*v+p.fillTextOffsetX+"px",top:(h+p.gh/2)*v+p.fillTextOffsetY+"px",width:p.fillTextWidth+"px",height:p.fillTextHeight+"px",lineHeight:E+"px",whiteSpace:"nowrap",transform:e,webkitTransform:e,msTransform:e,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};for(r in F&&(n.color=F),o.textContent=x,n)o.style[r]=n[r];if(S)for(var l in S)o.setAttribute(l,S[l]);O&&(o.className+=O),t.appendChild(o)}}),R(A,z,0,0,M,a),!0)};I--;){var C=function(t){if(F[t])return F[t];var e=8*t,a=e,i=[];for(0===t&&i.push([h[0],h[1],0]);a--;){var o=1;"circle"!==s.shape&&(o=s.shape(a/e*2*Math.PI)),i.push([h[0]+t*o*Math.cos(-a/e*2*Math.PI),h[1]+t*o*Math.sin(-a/e*2*Math.PI)*s.ellipticity,a/e*2*Math.PI])}return F[t]=i}(u-I);if(s.shuffle&&function(t){for(var e,a,i=t.length;i;)e=Math.floor(Math.random()*i),a=t[--i],t[i]=t[e],t[e]=a}(C=[].concat(C)),C.some(k))return!0}return!!s.shrinkToFit&&(Array.isArray(a)?a[1]=3*a[1]/4:a.weight=3*a.weight/4,e(a))},A=function(e,a,i){if(a)return!t.some(function(t){var a=new CustomEvent(e,{detail:i||{}});return!t.dispatchEvent(a)},this);t.forEach(function(t){var a=new CustomEvent(e,{detail:i||{}});t.dispatchEvent(a)},this)};!function(){var e,a,i=t[0];if(c=i.getContext?(f=Math.ceil(i.width/v),Math.ceil(i.height/v)):(n=i.getBoundingClientRect(),f=Math.ceil(n.width/v),Math.ceil(n.height/v)),A("wordcloudstart",!0)){if(h=s.origin?[s.origin[0]/v,s.origin[1]/v]:[f/2,c/2],u=Math.floor(Math.sqrt(f*f+c*c)),d=[],!i.getContext||s.clearCanvas)for(t.forEach(function(t){var e;t.getContext?((e=t.getContext("2d")).fillStyle=s.backgroundColor,e.clearRect(0,0,f*(v+1),c*(v+1)),e.fillRect(0,0,f*(v+1),c*(v+1))):(t.textContent="",t.style.backgroundColor=s.backgroundColor,t.style.position="relative")}),p=f;p--;)for(d[p]=[],e=c;e--;)d[p][e]=!0;else{var n=document.createElement("canvas").getContext("2d");n.fillStyle=s.backgroundColor,n.fillRect(0,0,1,1);for(var l,w,g=n.getImageData(0,0,1,1).data,M=i.getContext("2d").getImageData(0,0,f*v,c*v).data,p=f;p--;)for(d[p]=[],e=c;e--;){w=v;t:for(;w--;)for(l=v;l--;)for(x=4;x--;)if(M[4*((e*v+w)*f*v+(p*v+l))+x]!==g[x]){d[p][e]=!1;break t}!1!==d[p][e]&&(d[p][e]=!0)}M=n=g=void 0}if(s.hover||s.click){for(I=!0,p=f+1;p--;)k[p]=[];s.hover&&i.addEventListener("mousemove",S),s.click&&(i.addEventListener("click",E),i.style.webkitTapHighlightColor="rgba(0, 0, 0, 0)"),i.addEventListener("wordcloudstart",function t(){i.removeEventListener("wordcloudstart",t),i.removeEventListener("mousemove",S),i.removeEventListener("click",E),y=void 0})}var x=0,b=0!==s.wait?(a=window.setTimeout,window.clearTimeout):(a=window.setImmediate,window.clearImmediate),T=function(e,a){t.forEach(function(t){t.removeEventListener(e,a)},this)},C=function t(){T("wordcloudstart",t),b(o[r])};!function(e,a){t.forEach(function(t){t.addEventListener("wordcloudstart",a)},this)}(0,C),o[r]=a(function t(){if(x>=s.list.length)return b(o[r]),A("wordcloudstop",!1),T("wordcloudstart",C),void delete o[r];m=(new Date).getTime();var e=O(s.list[x]);e=!A("wordclouddrawn",!0,{item:s.list[x],drawn:e});if(P()||e)return b(o[r]),s.abort(),A("wordcloudabort",!1),A("wordcloudstop",!1),T("wordcloudstart",C),void delete o[r];x++,o[r]=a(t,s.wait)},s.wait)}}()}function z(t,e){return"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)"}}var a=function(){var t=document.createElement("canvas");return!(!t||!t.getContext)&&!!((t=t.getContext("2d"))&&t.getImageData&&t.fillText&&Array.prototype.some&&Array.prototype.push)}(),i=function(){if(a){for(var t,e,i=document.createElement("canvas").getContext("2d"),o=20;o;){if(i.font=o.toString(10)+"px sans-serif",i.measureText("W").width===t&&i.measureText("m").width===e)return o+1;t=i.measureText("W").width,e=i.measureText("m").width,o--}return 0}}(),o={};e.isSupported=a,e.minFontSize=i,e.stop=function(){if(o)for(var t in o)window.clearImmediate(o[t])},"function"==typeof define&&define.amd?(t.WordCloud=e,define("wordcloud",[],function(){return e})):"undefined"!=typeof module&&module.exports?module.exports=e:t.WordCloud=e}(this);