mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
1 line
112 KiB
JSON
1 line
112 KiB
JSON
|
|
{"ast":null,"code":"/*!\r\n * wordcloud2.js\r\n * http://timdream.org/wordcloud2.js/\r\n *\r\n * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors.\r\n * Released under the MIT license\r\n */\n\n'use strict';\n\n// setImmediate\nif (!window.setImmediate) {\n window.setImmediate = function setupSetImmediate() {\n return window.msSetImmediate || window.webkitSetImmediate || window.mozSetImmediate || window.oSetImmediate || function setupSetZeroTimeout() {\n if (!window.postMessage || !window.addEventListener) {\n return null;\n }\n var callbacks = [undefined];\n var message = 'zero-timeout-message';\n\n // Like setTimeout, but only takes a function argument. There's\n // no time argument (always zero) and no arguments (you have to\n // use a closure).\n var setZeroTimeout = function setZeroTimeout(callback) {\n var id = callbacks.length;\n callbacks.push(callback);\n window.postMessage(message + id.toString(36), '*');\n return id;\n };\n window.addEventListener('message', function setZeroTimeoutMessage(evt) {\n // Skipping checking event source, retarded IE confused this window\n // object with another in the presence of iframe\n if (typeof evt.data !== 'string' || evt.data.substr(0, message.length) !== message /* ||\r\n evt.source !== window */) {\n return;\n }\n evt.stopImmediatePropagation();\n var id = parseInt(evt.data.substr(message.length), 36);\n if (!callbacks[id]) {\n return;\n }\n callbacks[id]();\n callbacks[id] = undefined;\n }, true);\n\n /* specify clearImmediate() here since we need the scope */\n window.clearImmediate = function clearZeroTimeout(id) {\n if (!callbacks[id]) {\n return;\n }\n callbacks[id] = undefined;\n };\n return setZeroTimeout;\n }() ||\n // fallback\n function setImmediateFallback(fn) {\n window.setTimeout(fn, 0);\n };\n }();\n}\nif (!window.clearImmediate) {\n window.clearImmediate = function setupClearImmediate() {\n return window.msClearImmediate || window.webkitClearImmediate || window.mozClearImmediate || window.oClearImmediate ||\n // \"clearZeroTimeout\" is implement on the previous block ||\n // fallback\n function clearImmediateFallback(timer) {\n window.clearTimeout(timer);\n };\n }();\n}\n(function (global) {\n // Check if WordCloud can run on this browser\n var isSupported = function isSupported() {\n var canvas = document.createElement('canvas');\n if (!canvas || !canvas.getContext) {\n return false;\n }\n var ctx = canvas.getContext('2d');\n if (!ctx) {\n return false;\n }\n if (!ctx.getImageData) {\n return false;\n }\n if (!ctx.fillText) {\n return false;\n }\n if (!Array.prototype.some) {\n return false;\n }\n if (!Array.prototype.push) {\n return false;\n }\n return true;\n }();\n\n // Find out if the browser impose minium font size by\n // drawing small texts on a canvas and measure it's width.\n var minFontSize = function getMinFontSize() {\n if (!isSupported) {\n return;\n }\n var ctx = document.createElement('canvas').getContext('2d');\n\n // start from 20\n var size = 20;\n\n // two sizes to measure\n var hanWidth, mWidth;\n while (size) {\n ctx.font = size.toString(10) + 'px sans-serif';\n if (ctx.measureText('\\uFF37').width === hanWidth && ctx.measureText('m').width === mWidth) {\n return size + 1;\n }\n hanWidth = ctx.measureText('\\uFF37').width;\n mWidth = ctx.measureText('m').width;\n size--;\n }\n return 0;\n }();\n\n // Based on http://jsfromhell.com/array/shuffle\n var shuffleArray = function shuffleArray(arr) {\n for (var j, x, i = arr.length; i;) {\n j = Math.floor(Math.random() * i);\n x = arr[--i];\n arr[i] = arr[j
|