Skip to content
Browse files

Fixed Chrome initial load failure (with Typekit), and it no longer br…

…eaks in IE7 (though it should not work)
  • Loading branch information...
1 parent 4722c5b commit 16af1eb6b08f7e7549e6c516f8a848254ddff2b9 Nathan Ford committed Jun 28, 2012
Showing with 38 additions and 29 deletions.
  1. +1 −1 widowtamer-min.js
  2. +37 −28 widowtamer.js
View
2 widowtamer-min.js
@@ -1,2 +1,2 @@
// Widow Tamer JS by Nathan C. Ford http://artequalswork.com
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2={u:{B:\'p,1h,1i\',v:14,6:\'1j\',C:\'1k\',M:\'1l\'},D:N 1m(),1n:3(a){2.E(\'1o\',3(){2.O(a)})},O:3(a){5 m=a.6;1p(m){k\'8-P\':k\'Q\':k\'8-R\':k\'S-w\':k\'T-w\':k U:4(a.C==\'F\'&&m&&m.G(\'8\')){V.W(\'X 6. 1q 1r Y F 1s 8.\')}7 2.H(a);11;1t:V.W(\'X 6. 1u Y 1v 8-P, 8-R, S-w, 1w T-w.\')}},H:3(a){5 b=N 1x();4(a){1y(i 1z 2.u){4(a[i])b[i]=(i==\'6\'&&a[i].G(\'-\'))?2.12(a[i]):a[i];7 b[i]=2.u[i]}}7 b=2.u;5 d=13.1A(b.B),i=0;15(i<d.I){5 t=d[i];4(t.J>2.16(t,\'1B-1C\',17)){5 e=t.1D,j=e.I-1,c=1E;15(j>=0){5 f=2.x(e[j]);4(f!=U&&f.I>b.v){c=e[j];11}j--}t.18[b.6]=\'0\';5 g=2.x(c);4(c)2.K(c,t,g,0,b)}i++}2.E(b.M,3(){2.19(b)})},x:3(t){l t.L||t.1a},o:3(e,t){4(e.L)e.L=t;7 e.1a=t},K:3(c,t,a,i,b){5 h=t.J;2.o(c,a.1b(0,(b.v*-1)));4(t.J<h){4(b.6==\'Q\')2.o(c,2.x(c)+a.1b((b.v*-1)).q(/\\s/g,\'\\1F\'));7{5 d=(b.6.G(\'8\'))?(i/10):(i/1G);4(b.C==\'F\')d=d*-1;t.18[b.6]=d+\'1H\';2.o(c,a);2.K(c,t,a,i+1,b)}}7 2.o(c,a)},19:3(a){5 b="\'"+a.B.q(/[^a-1c-1I-9\\-\\.]/g,\'\')+"\'";1J(2.D[b]);2.D[b]=1K(3(){2.H(a)},1L)},E:3(e,f){4(y.1d)y.1d(\'1M\'+e,f);7 y.1N(e,f,17)},12:3(s){l s.q(/-([a-1c-Z])/,3(m){l m.q(\'-\',\'\').1e()})},16:3(t,s,n){5 r;4(t.1f)r=t.1f[s.q(/-([A-z])/1O,3(a,b){l b.1e()})];7 4(y.1g)r=13.1P.1g(t,1Q).1R(s);4(n)l 1S(r);7 l r}};',62,117,'||wt|function|if|var|method|else|padding||||||||||||case|return|||settext||replace||||opts|chars|spacing|text|window|||elements|dir|to|bind|neg|match|hunter|length|offsetHeight|tamer|innerText|event|new|init|right|nbsp|left|word|letter|undefined|console|log|Invalid|use|||break|fixmethod|document||while|getstyle|true|style|onevent|textContent|slice|zA|attachEvent|toUpperCase|currentStyle|getComputedStyle|li|dd|wordSpacing|pos|orientationchange|Array|fix|load|switch|You|cannot|with|default|Please|either|or|Object|for|in|querySelectorAll|line|height|childNodes|false|u00a0|100|em|Z0|clearTimeout|setTimeout|250|on|addEventListener|gi|defaultView|null|getPropertyValue|parseFloat'.split('|'),0,{}))
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2={u:{C:\'p,1i,1j\',v:14,6:\'1k\',D:\'1l\',O:\'1m\'},E:P 1n(),1o:4(a){3(w.1p===\'1q\')2.F(a);2.G(\'1r\',4(){2.F(a)})},F:4(a){5 m=a.6;1s(m){k\'8-Q\':k\'R\':k\'8-S\':k\'T-x\':k\'U-x\':k V:3(a.D==\'H\'&&m&&m.I(\'8\')){W.X(\'Y 6. 1t 1u 11 H 1v 8.\')}7 2.J(a);12;1w:W.X(\'Y 6. 1x 11 1y 8-Q, 8-S, T-x, 1z U-x.\')}},J:4(a){5 b=P 1A();3(a){1B(i 1C 2.u){3(a[i])b[i]=(i==\'6\'&&a[i].I(\'-\'))?2.13(a[i]):a[i];7 b[i]=2.u[i]}}7 b=2.u;3(w.15){5 d=w.15(b.C),i=0;16(i<d.K){5 t=d[i];3(t.L>2.17(t,\'1D-1E\',18)){5 e=t.1F,j=e.K-1,c=1G;16(j>=0){5 f=2.y(e[j]);3(f!=V&&f.K>b.v){c=e[j];12}j--}t.19[b.6]=\'0\';5 g=2.y(c);3(c)2.M(c,t,g,0,b)}i++}2.G(b.O,4(){2.1a(b)})}},y:4(t){l t.N||t.1b},o:4(e,t){3(e.N)e.N=t;7 e.1b=t},M:4(c,t,a,i,b){5 h=t.L;2.o(c,a.1c(0,(b.v*-1)));3(t.L<h){3(b.6==\'R\')2.o(c,2.y(c)+a.1c((b.v*-1)).q(/\\s/g,\'\\1H\'));7{5 d=(b.6.I(\'8\'))?(i/10):(i/1I);3(b.D==\'H\')d=d*-1;t.19[b.6]=d+\'1J\';2.o(c,a);2.M(c,t,a,i+1,b)}}7 2.o(c,a)},1a:4(a){5 b="\'"+a.C.q(/[^a-1d-1K-9\\-\\.]/g,\'\')+"\'";1L(2.E[b]);2.E[b]=1M(4(){2.J(a)},1N)},G:4(e,f){3(B.1e)B.1e(\'1O\'+e,f);7 B.1P(e,f,18)},13:4(s){l s.q(/-([a-1d-Z])/,4(m){l m.q(\'-\',\'\').1f()})},17:4(t,s,n){5 r;3(t.1g)r=t.1g[s.q(/-([A-z])/1Q,4(a,b){l b.1f()})];7 3(B.1h)r=w.1R.1h(t,1S).1T(s);3(n)l 1U(r);7 l r}};',62,119,'||wt|if|function|var|method|else|padding||||||||||||case|return|||settext||replace||||opts|chars|document|spacing|text|||window|elements|dir|to|init|bind|neg|match|hunter|length|offsetHeight|tamer|innerText|event|new|right|nbsp|left|word|letter|undefined|console|log|Invalid|||use|break|fixmethod||querySelectorAll|while|getstyle|true|style|onevent|textContent|slice|zA|attachEvent|toUpperCase|currentStyle|getComputedStyle|li|dd|wordSpacing|pos|orientationchange|Array|fix|readyState|complete|load|switch|You|cannot|with|default|Please|either|or|Object|for|in|line|height|childNodes|false|u00a0|100|em|Z0|clearTimeout|setTimeout|250|on|addEventListener|gi|defaultView|null|getPropertyValue|parseFloat'.split('|'),0,{}))
View
65 widowtamer.js
@@ -13,7 +13,12 @@ wt = {
to : new Array(),
- fix : function (opts) { wt.bind('load', function () { wt.init(opts); }); },
+ fix : function (opts) {
+
+ if (document.readyState === 'complete') wt.init(opts);
+ wt.bind('load', function () { wt.init(opts); });
+
+ },
init : function (opts) {
@@ -54,46 +59,50 @@ wt = {
}
else opts = wt.opts;
- var eles = document.querySelectorAll(opts.elements),
- i = 0;
-
- while (i < eles.length) {
+ if (document.querySelectorAll) {
- var t = eles[i];
-
- if (t.offsetHeight > wt.getstyle(t, 'line-height', true)) {
-
- // find a textnode longer than chars
- var nodes = t.childNodes,
- j = nodes.length - 1,
- c = false;
-
- while (j >= 0) {
+ var eles = document.querySelectorAll(opts.elements),
+ i = 0;
+
+ while (i < eles.length) {
+
+ var t = eles[i];
+
+ if (t.offsetHeight > wt.getstyle(t, 'line-height', true)) {
- var ntext = wt.text(nodes[j]);
+ // find a textnode longer than chars
+ var nodes = t.childNodes,
+ j = nodes.length - 1,
+ c = false;
- if (ntext != undefined && ntext.length > opts.chars) {
- c = nodes[j];
- break;
+ while (j >= 0) {
+
+ var ntext = wt.text(nodes[j]);
+
+ if (ntext != undefined && ntext.length > opts.chars) {
+ c = nodes[j];
+ break;
+ }
+
+ j--;
+
}
- j--;
+ t.style[opts.method] = '0';
- }
+ var ctext = wt.text( c );
- t.style[opts.method] = '0';
+ if (c) wt.tamer(c, t, ctext, 0, opts);
- var ctext = wt.text( c );
-
- if (c) wt.tamer(c, t, ctext, 0, opts);
+ }
+
+ i++;
}
- i++;
+ wt.bind(opts.event, function () { wt.onevent(opts); });
}
-
- wt.bind(opts.event, function () { wt.onevent(opts); });
},

0 comments on commit 16af1eb

Please sign in to comment.
Something went wrong with that request. Please try again.