-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextY-min.js
7 lines (7 loc) · 16.6 KB
/
TextY-min.js
1
2
3
4
5
6
7
/**
* TextY v0.1.14
*
* @author Diono CORBEL http://www.diono.fr/
* DEMO : http://www.dionoportfolio.com/TextY/
*/
"use strict";(function(e,t){var n=e.document,r=parseInt(null,10).toString(),i=typeof function(){},s=typeof n,o=typeof {},u={fonts:{arial:[10,,,,/(['ijl]|%27)/,/([ !,\.\/:;I\[\\\]ft\| ,]|%(20|21|2C|2F|3A|3B|5B|5C|5D|7C|20|2C))/,/(["\(\)\-`r\{\}]|%(22|28|29|60|7B|7D))/,/[\*]/,/([\^x]|%5E)/,/([#\$0123456789\?JL_abcdeghknopqsuvyz]|%(23|24|3F))/,/([\+<=>FTZ~]|%(2B|3C|3D|3E|7E))/,/([&ABEKPSVXY]|%26)/,/[CDHNRUw]/,/[GOQ]/,/[Mm]/,/(%|%25)/,/W/,/(@|%40)/],"arial black":[11,,,,,/(['\/\\\|]|%(27|2F|5C|7C))/,/([ !,\-\.:;`ijl ,]|%(20|21|2C|3A|3B|60|20|2C))/,/([\(\)I\[\]f\{\}]|%(28|29|5B|5D|7B|7D))/,/[rt]/,/(["\*_z]|%22)/,/([\?svy]|%3F)/,/([#\$\+0123456789<=>FJL\^abcdeghknopqux~]|%(23|24|2B|3C|3D|3E|5E|7E))/,/([@EPSTZ]|%40)/,/[ABCDRVXY]/,/[GHKNOQU]/,/(&|%26)/,/[Mw]/,/([%Wm]|%25)/],"arial narrow":[8,,,/(['ijl]|%27)/,/([ !,\.\/:;I\[\\\]ft\| ,]|%(20|21|2C|2F|3A|3B|5B|5C|5D|7C|20|2C))/,/(["\(\)\-`r\{\}]|%(22|28|29|60|7B|7D))/,/[\*]/,/([J\^cksvxyz]|%5E)/,/([#\$\+0123456789<=>\?L_abdeghnopqu~]|%(23|24|2B|3C|3D|3E|3F|7E))/,/([&ABEFKPSTVXYZ]|%26)/,/[CDHNRUw]/,/[GMOQm]/,/(%|%25)/,/W/,/(@|%40)/],"arial rounded mt bold":[10,,,,/('|%27)/,/([ \/\\ijl\| ]|%(20|2F|5C|7C|20))/,/([!\(\),\-\.:;I\[\]`ft,]|%(21|28|29|2C|3A|3B|5B|5D|60|2C))/,/([\{\}]|%(7B|7D))/,/(["\*r]|%22)/,/([#_svxyz]|%23)/,/([\$\+0123456789<=>\?FJLX\^acehknou~]|%(24|2B|3C|3D|3E|3F|5E|7E))/,/[EPSTYZbdgpq]/,/[ABCDKRV]/,/([&GHNOQU]|%26)/,/([%Mw]|%25)/,/m/,/([@W]|%40)/],"bookman old style":[10,,,,/('|%27)/,/([!\(\)\[\]ijl\{\}]|%(21|28|29|5B|5D|7B|7D))/,/([ ,\.:;I`f ,]|%(20|2C|3A|3B|60|20|2C))/,/(["\-t]|%22)/,/[\*rz]/,/([\?_cegsvy]|%3F)/,/([#\$\+\/0123456789<=>JLPT\\\^abdkopqx\|~]|%(23|24|2B|2F|3C|3D|3E|5C|5E|7C|7E))/,/[AFSYZhnu]/,/[BCEKNRVX]/,/([&DGHOQUw]|%26)/,/(@|%40)/,/([%M]|%25)/,/[Wm]/],"bradley hand itc":[10,,,,/('|%27)/,/([ !",\.:;IJijl ,]|%(20|21|22|2C|3A|3B|20|2C))/,/[\-et]/,/([\(\)\/\?\[\\\]_cfor\{\}]|%(28|29|2F|3F|5B|5C|5D|7B|7D))/,/[1abpsvx]/,/([\*089FP`dhz\|]|%(60|7C))/,/([#&2356CELTgkqu]|%(23|26))/,/([\$47BDVXYnwy]|%24)/,/([%@AGHKOQRSU]|%(25|40))/,/N/,/([\+<=>Mm~]|%(2B|3C|3D|3E|7E))/,/Z/,/W/,/([\^]|%5E)/],century:[10,,,,/('|%27)/,/([ !,\.\/:;j ,]|%(20|21|2C|2F|3A|3B|20|2C))/,/([\(\)\-\[\]`fil\{\}]|%(28|29|5B|5D|60|7B|7D))/,/(["It]|%22)/,/([\?crsz]|%3F)/,/([#\$\*0123456789J_abegoqvxy]|%(23|24))/,/([\+<=>Z\\\^dhknpu\|~]|%(2B|3C|3D|3E|5C|5E|7C|7E))/,/[FLPST]/,/([@ABCERVXY]|%40)/,/[DGKOQw]/,/([%&HNU]|%(25|26))/,/m/,/[MW]/],"century gothic":[10,,,,/(['Iijl]|%27)/,/([ !",\.:;r ,]|%(20|21|22|2C|3A|3B|20|2C))/,/([\(\)\-\[\]ft\{\}]|%(28|29|5B|5D|7B|7D))/,/([\*T`sz]|%60)/,/([\/FJLZx]|%2F)/,/([\$0123456789ES_kvy]|%24)/,/([\+<=>\?BKPRXY\\hnu~]|%(2B|3C|3D|3E|3F|5C|7E))/,/([HU\^abcegopq\|]|%(5E|7C))/,/([#ADNVd]|%23)/,/([%&]|%(25|26))/,/([@COQw]|%40)/,/[GM]/,/[Wm]/],"comic sans ms":[10,,,,/([!\.]|%21)/,/([ ,:;il ,]|%(20|2C|3A|3B|20|2C))/,/([\(\)\{\}]|%(28|29|7B|7D))/,/(["'\-<>\[\]j\|]|%(22|27|3C|3E|5B|5D|7C))/,/([\+1rstv]|%2B)/,/([\*\/=\?ILP\\`acefgknopquyz]|%(2F|3D|3F|5C|60))/,/([023456789CFK\^bdhx~]|%(5E|7E))/,/([&BEGJRTVY_w]|%26)/,/([\$ADSUXZ]|%24)/,/[HNOm]/,/([#%]|%(23|25))/,/([@MQ]|%40)/,,/W/],courier:[10,,,,,,,,,,/([ !"#\$%&'\(\)\*\+,\-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}~ ,]|%(20|21|22|23|24|25|26|27|28|29|2B|2C|2F|3A|3B|3C|3D|3E|3F|40|5B|5C|5D|5E|60|7B|7C|7D|7E|20|2C))/],"courier new":[10,,,,,,,,,,/([ !"#\$%&'\(\)\*\+,\-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}~ ,]|%(20|21|22|23|24|25|26|27|28|29|2B|2C|2F|3A|3B|3C|3D|3E|3F|40|5B|5C|5D|5E|60|7B|7C|7D|7E|20|2C))/],cursive:[10,,,,/([!\.]|%21)/,/([ ,:;il ,]|%(20|2C|3A|3B|20|2C))/,/([\(\)\{\}]|%(28|29|7B|7D))/,/(["'\-<>\[\]j\|]|%(22|27|3C|3E|5B|5D|7C))/,/([\+1rstv]|%2B)/,/([\*\/=\?ILP\\`acefgknopquyz]|%(2F|3D|3F|5C|60))/,/([023456789CFK\^bdhx~]|%(5E|7E))/,/([&BEGJRTVY_w]|%26)/,/([\$ADSUXZ]|%24)/,/[HNOm]/,/([#%]|%(23|25))/,/([@MQ]|%40)/,,/W/],"default":[8,,,/([ , ,]|%(20|2C|20|2C))/,/(['\.:;]|%(27|3A|3B))/,/([!\*\-I\[\]fijlt\|]|%(21|5B|5D|7C))/,/(["\(\)J`rz\{\}]|%(22|28|29|60|7B|7D))/,/([\/17EFLZ\\x]|%(2F|5C))/,/([TXY\^cksvy]|%5E)/,/([\$\+02345689<=>\?ABCDGHKNOPQRSUV_abdeghnopqu~]|%(24|2B|3C|3D|3E|3F|7E))/,/(&|%26)/,/([#w]|%23)/,/([%M]|%25)/,/([@m]|%40)/,/W/],fantasy:[8,,,/([ , ,]|%(20|2C|20|2C))/,/(['\.:;]|%(27|3A|3B))/,/([!\*\-I\[\]fijlt\|]|%(21|5B|5D|7C))/,/(["\(\)J`rz\{\}]|%(22|28|29|60|7B|7D))/,/([\/17EFLZ\\x]|%(2F|5C))/,/([TXY\^cksvy]|%5E)/,/([\$\+02345689<=>\?ABCDGHKNOPQRSUV_abdeghnopqu~]|%(24|2B|3C|3D|3E|3F|7E))/,/(&|%26)/,/([#w]|%23)/,/([%M]|%25)/,/([@m]|%40)/,/W/],gentium:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],georgia:[10,,,,/([ ' ]|%(20|27|20))/,/([,\.ijl,]|%(2C|2C))/,/([!:;ft]|%(21|3A|3B))/,/(["\(\)\-1I\[\]rs\{\|\}]|%(22|28|29|5B|5D|7B|7C|7D))/,/([\*\/\?\\cevyz]|%(2F|3F|5C))/,/([2357J`agkox]|%60)/,/([\$04689FLPSTYZbdhnpqu]|%24)/,/([#\+<=>ABCEV\^_~]|%(23|2B|3C|3D|3E|5E|7E))/,/([&GKOQRXw]|%26)/,/[DNU]/,/([%H]|%25)/,/([@Mm]|%40)/,/W/],impact:[8,,,/([ , ,]|%(20|2C|20|2C))/,/(['\.:;]|%(27|3A|3B))/,/([!\*\-I\[\]fijlt\|]|%(21|5B|5D|7C))/,/(["\(\)J`rz\{\}]|%(22|28|29|60|7B|7D))/,/([\/17EFLZ\\x]|%(2F|5C))/,/([TXY\^cksvy]|%5E)/,/([\$\+02345689<=>\?ABCDGHKNOPQRSUV_abdeghnopqu~]|%(24|2B|3C|3D|3E|3F|7E))/,/(&|%26)/,/([#w]|%23)/,/([%M]|%25)/,/([@m]|%40)/,/W/],king:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],lalit:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],"lucida console":[10,,,,,,,,,,/([ !"#\$%&'\(\)\*\+,\-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}~ ,]|%(20|21|22|23|24|25|26|27|28|29|2B|2C|2F|3A|3B|3C|3D|3E|3F|40|5B|5C|5D|5E|60|7B|7C|7D|7E|20|2C))/],modena:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],monospace:[10,,,,,,,,,,/([ !"#\$%&'\(\)\*\+,\-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}~ ,]|%(20|21|22|23|24|25|26|27|28|29|2B|2C|2F|3A|3B|3C|3D|3E|3F|40|5B|5C|5D|5E|60|7B|7C|7D|7E|20|2C))/],"monotype corsiva":[9,,,/('|%27)/,/([ "\),\.;\[`ijl\{\} ,]|%(20|22|29|2C|3B|5B|60|7B|7D|20|2C))/,/([!\(\-:r]|%(21|28|3A))/,/([\/\]cefst]|%(2F|5D))/,/([\*\?IJabgoqxy]|%3F)/,/([\$0123456789S\\dhknpuvz]|%(24|5C))/,/([\+<=>CPT\^_\|~]|%(2B|3C|3D|3E|5E|7C|7E))/,/[ABEFGLOQRXYZm]/,/([#%HKVw]|%(23|25))/,/([@DNU]|%40)/,/(&|%26)/,/M/,/W/],papyrus:[11,,,,/([ !',\.:;ijl ,]|%(20|21|27|2C|3A|3B|20|2C))/,/I/,/(["\(\)\*\-\[\]frt]|%(22|28|29|5B|5D))/,/([\?`vxz\{\}]|%(3F|60|7B|7D))/,/[cks]/,/[aeghnquy]/,/([#\$\+\/0123456789<=>\\\^_bdopw\|~]|%(23|24|2B|2F|3C|3D|3E|5C|5E|7C|7E))/,/([%&JPm]|%(25|26))/,/L/,/([@FRVX]|%40)/,/[YZ]/,/K/,/[ABDEHNST]/,/[CGMU]/,/[OW]/,/Q/],"sans-serif":[10,,,,/(['ijl]|%27)/,/([ !,\.\/:;I\[\\\]ft\| ,]|%(20|21|2C|2F|3A|3B|5B|5C|5D|7C|20|2C))/,/(["\(\)\-`r\{\}]|%(22|28|29|60|7B|7D))/,/[\*]/,/([\^x]|%5E)/,/([#\$0123456789\?JL_abcdeghknopqsuvyz]|%(23|24|3F))/,/([\+<=>FTZ~]|%(2B|3C|3D|3E|7E))/,/([&ABEKPSVXY]|%26)/,/[CDHNRUw]/,/[GOQ]/,/[Mm]/,/(%|%25)/,/W/,/(@|%40)/],serif:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],tahoma:[9,,,,/(['il]|%27)/,/([,\.j,]|%(2C|2C))/,/([ !\-:;frt ]|%(20|21|3A|3B|20))/,/(["\(\)\/IJ\[\\\]\|]|%(22|28|29|2F|5B|5C|5D|7C))/,/([\?csxz\{\}]|%(3F|7B|7D))/,/([\$\*0123456789FLPSZ_`abdeghknopquvy]|%(24|60))/,/[ABCEKRTVXY]/,/([&DGHNU]|%26)/,/([#\+<=>OQ\^w~]|%(23|2B|3C|3D|3E|5E|7E))/,/M/,/m/,/([@W]|%40)/,/(%|%25)/],tex:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],times:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],"times new roman":[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/],"trebuchet ms":[9,,,/('|%27)/,,/([ Iil ]|%(20|20))/,/([!"\(\)\*,\-\.:;\?\[\\\]fj\{\},]|%(21|22|28|29|2C|3A|3B|3F|5B|5C|5D|7B|7D|2C))/,/[rst]/,/[JScvyz]/,/([#\$\+\/0123456789<=>EFLPXZ\^_`abdeghknopqux\|~]|%(23|24|2B|2F|3C|3D|3E|5E|60|7C|7E))/,/([%ABCDKRTVY]|%25)/,/[GHNOQU]/,/([&Mw]|%26)/,/(@|%40)/,/[Wm]/],verdana:[11,,,,,/(['il]|%27)/,/([ ,\.fj ,]|%(20|2C|20|2C))/,/([!Irt]|%21)/,/(["\(\)\-\/:;J\[\\\]\|]|%(22|28|29|2F|3A|3B|5B|5C|5D|7C))/,/([\?Lcsz]|%3F)/,/[FPTYaekovxy]/,/([\$\*0123456789AESV_`bdghnpqu\{\}]|%(24|60|7B|7D))/,/([&BCKRUXZ]|%26)/,/[DGHNOQ]/,/([#\+<=>M\^w~]|%(23|2B|3C|3D|3E|5E|7E))/,,/[Wm]/,/(@|%40)/,/(%|%25)/],verona:[10,,,/('|%27)/,/([\|]|%7C)/,/([ ,\.\/:;\\ijlt ,]|%(20|2C|2F|3A|3B|5C|20|2C))/,/([!\(\)\-I\[\]`fr]|%(21|28|29|5B|5D|60))/,/(["Js]|%22)/,/([\?\^acez\{\}]|%(3F|5E|7B|7D))/,/([#\$\*0123456789FPS_bdghknopquvxy~]|%(23|24|7E))/,/([\+<=>ELTZ]|%(2B|3C|3D|3E))/,/[BCR]/,/[ADGHKNOQUVXYw]/,/([&m]|%26)/,/(%|%25)/,/([@M]|%40)/,/W/]},minSize:7,fontSizeInPixels:function(e){if(/^\d+([\.,]\d+)?pt$/i.test(e))e=parseFloat(e)*16/12;else if(/^\d+([\.,]\d+)?em$/i.test(e))e=parseFloat(e)*16;else if(/^\d+([\.,]\d+)?%$/i.test(e))e=parseFloat(e)*16/100;else if(/^\d+([\.,]\d+)?px$/i.test(e))e=parseFloat(e);return e},getCssProperty:function(e,t,r){var s="";if(e&&e.nodeName&&!/#text/i.test(e.nodeName)){var o=n.defaultView&&typeof n.defaultView.getComputedStyle===i?n.defaultView.getComputedStyle(e,null):typeof window.getComputedStyle===i?window.getComputedStyle(e,null):null;if(o)s=o.getPropertyValue(t);else if(e.currentStyle)s=e.currentStyle[t];else if(e.style)s=e.style[t]}if(s)s=/(px|pt|em|%)/i.test(s)?this.fontSizeInPixels(s):s;else if(!r){var u=[];if(/\-/.test(t)){u=t.split("-");if(u.length>1)s=this.getCssProperty(e,u[0]+u[1].charAt(0).toUpperCase()+u[1].slice(1),true)}else if(/[A-Z]/.test(t)){u=t.match(/([a-z]*)([A-Z])([a-z]*)/);if(u.length>3)s=this.getCssProperty(e,u[1]+"-"+u[2].toLowerCase()+u[3],true)}}else if(e.parentNode)s=this.getCssProperty(e.parentNode,t);else if(e.parentElement)s=this.getCssProperty(e.parentElement,t);return s},wordSize:function(e,t){var n=0;if(e){var r=e.length;if(this.fonts[t]){var i=this.fonts[t].length;for(var s=0;s<r;s++){var o=e.charAt(s),u=this.fonts[t][0];if(o.match(/%/gi)){o=e.substr(s,3);s+=3}for(var a=1;a<i;a++){if(this.fonts[t][a]&&this.fonts[t][a].test(o)){u=a;a=i}}n+=u}}else n=r*7}return n},getText:function(e,t){var n="",r=e.nodeName;if(/^#text$/i.test(r))n+=e.nodeValue;else if(/^(input|textarea)$/i.test(r))n+=e.value;else if(t){var i=e.childNodes?e.childNodes.length:0;for(var s=0;s<i;s++)n+=this.getText(e.childNodes[s],true)}return n},getWordSize:function(e,t,n){var i=0;if(typeof e===s&&e.nodeName){var o=this.getCssProperty(e,"font-size"),u=this.getCssProperty(e,"font-family"),a=this.getCssProperty(e,"text-indent"),f=this.getText(e,true),l=parseInt(t,10).toString();a=a.toString()!==r?a:0;u=u.replace(/["']/gi,"").toLowerCase();i=a+Math.ceil(this.wordSize(f,u)*o/16);if(t&&l===r){t=e.offsetWidth||e.clientWidth;var c=parseInt(this.getCssProperty(e,"padding-right"),10),h=parseInt(this.getCssProperty(e,"padding-left"),10);if(c.toString()!==r)t-=c;if(h.toString()!==r)t-=h;t=Math.max(t-10,0);l=parseInt(t,10).toString()}if(t&&l!==r){if(i>t){if(!e.TextYSize)e.TextYSize=o;o=n||this.minSize;i=a+Math.ceil(this.wordSize(f,u)*o/16);if(i>t||e.TextYText&&f!==e.TextYText){if(!e.TextYText)e.TextYText=f;else f=e.TextYText;var p="";while(i>t&&a<t){f=f.substring(0,f.length-1);p=f+" ...";i=a+Math.ceil(this.wordSize(p,u)*o/16)}f=p}else{e.TextYText=null;while(i<=t){o++;i=a+Math.ceil(this.wordSize(f,u)*o/16)}o--}e.style.fontSize=o+"px";if(/^#text$/i.test(e.firstChild.nodeName))e.firstChild.nodeValue=f}else if(e.TextYSize&&o!==e.TextYSize){while(i>0&&i<=t){o++;i=a+Math.ceil(this.wordSize(f,u)*o/16)}o--;o=Math.min(o,e.TextYSize);e.style.fontSize=o+"px";if(o===e.TextYSize){e.TextYSize=null}}}}return i},div:n.createElement("div"),span:n.createElement("span"),sty:n.createElement("style"),letters:[" ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~"," ",","],processing:false,waiting:[],hexaWin:["escape","encodeURI","encodeURIComponent"],$genContainer:null,toHexa:function(t){var n=t;for(var r=0,s=this.hexaWin.length;r<s;r++){if(typeof e[this.hexaWin[r]]===i){n=e[this.hexaWin[r]](t);if(n!==t){r=s;break}}}return n},generatesFontMap:function(t){if(!this.processing){this.processing=true;var r=this.letters.length;if(!this.$genContainer){this.$genContainer=this.div.cloneNode(true);var s=this.sty.cloneNode(true),o=this.span.cloneNode(true);this.$genContainer.id="TextY-genContainer";this.$genContainer.style.fontFamily=t;this.$genContainer.style.fontWeight="normal";this.$genContainer.style.fontSize="160px";this.$genContainer.style.color="transparent";this.$genContainer.style.position="absolute";this.$genContainer.style.bottom="100%";this.$genContainer.style.right="100%";s.type="text/css";s.appendChild(n.createTextNode("#TextY-genContainer span{display:inline-block;float:left;margin:0;padding:0;font-size:160px;}"));this.$genContainer.appendChild(s);o.appendChild(n.createTextNode(".."));this.$genContainer.appendChild(o);for(var u=0;u<r;u++){var a=this.span.cloneNode(true);a.appendChild(n.createTextNode("."+this.letters[u]+"."));this.$genContainer.appendChild(a)}n.body.appendChild(this.$genContainer)}else{this.$genContainer.style.fontFamily=t}(function(t,r,s){e.setTimeout(function(){var o=[],a=[],f=0,l=0,c=t.waiting.length,h=[],p=t.$genContainer.childNodes[1]?t.$genContainer.childNodes[1].offsetWidth:0;for(u=0;u<r;u++){var d=t.$genContainer.childNodes[u+2],v=d?((d.offsetWidth-p)/10<<0)+1:0;var m=o[v]||"",g=t.letters[u];if(g.length===1){if(/[a-zA-Z0-9]/.test(g)){f+=v;l++}m+=g.replace(/([\\\.\$\[\]\(\)\{\}\^\?\*\+\-\|\/])/,"\\$1").replace("/s/","\\s");o[v]=m;g=t.toHexa(g);if(g!==t.letters[u]&&g.length===3){var y=a[v]||"";if(y.length>0)y+="|";y+=g.replace("%","");a[v]=y}}}var b=[.5+f/l<<0],w=o.length;for(u=1;u<w;u++){var E="";if(a[u])E+="(";if(o[u]){if(o[u].length>1){E+="[";E+=o[u];E+="]"}else E+=o[u]}if(a[u]){if(/\|/.test(a[u])){E+="|%(";E+=a[u];E+="))"}else{E+="|%";E+=a[u];E+=")"}}b[u]=E.length>0?new RegExp(E):null}t.fonts[s.toLowerCase()]=b;for(u=0;u<c;u++){if(t.waiting[u]!==s){h[h.length]=t.waiting[u]}}t.waiting=h;if(h.length>0){t.processing=false;t.generatesFontMap(h[0])}else{if(e.console&&typeof e.console.log==i){var S="";for(var x in t.fonts){S+='"'+x+'":['+t.fonts[x]+"],"}console.log(S.substring(0,S.length-1))}n.body.removeChild(t.$genContainer);t.$genContainer=null;t.processing=false}},0)})(this,r,t)}else this.waiting[this.waiting.length]=t;return this}},a=function(e,t){var n=false,i=u.minSize;if(typeof t===o){if(t.clear)e.TextYText=null;n=t.limit;var s=parseInt(t.min,10);if(s.toString()!==r)i=s}return u.getWordSize(e,n,i)};a.addFont=function(e,t){if(typeof e===o){for(var n in e){var r=n.toLowerCase();if(t||!u.fonts[r])u.fonts[r]=e[r]}}else if(typeof e===typeof "a"){var i=e.toLowerCase();if(t||!u.fonts[i])u.generatesFontMap(e)}return this};e.TextY=a})(window)