Advertisement
englishextra

adapt.js

Sep 5th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * $shimansky.biz
  3.  *
  4.  * http://adapt.960.gs/
  5.  * https://github.com/nathansmith/adapt/tree/master/assets/css
  6.  *
  7.  * original code:
  8.  *
  9.  * (function(a,b,c,d){function e(){clearTimeout(i);for(var c=a.innerWidth||b.documentElement.clientWidth||b.body.clientWidth||0,e,f,o,p,q=m,u=m-1;q--;){g="",e=l[q].split("="),f=e[0],p=e[1]?e[1].replace(/\s/g,""):d,e=(o=f.match("to"))?parseInt(f.split("to")[0],10):parseInt(f,10),f=o?parseInt(f.split("to")[1],10):d;if(!f&&q===u&&c>e||c>e&&c<=f){p&&(g=k+p);break}}h?h!==g&&(h=n.href=g,j&&j(q,c)):(h=n.href=g,j&&j(q,c),k&&(b.head||b.getElementsByTagName("head")[0]).appendChild(n))}function f(){clearTimeout(i),i=setTimeout(e,16)}if(c){var g,h,i,j=typeof c.callback=="function"?c.callback:d,k=c.path?c.path:"",l=c.range,m=l.length,n=b.createElement("link");n.rel="stylesheet",n.media="screen",e(),c.dynamic&&(a.addEventListener?a.addEventListener("resize",f,!1):a.attachEvent?a.attachEvent("onresize",f):a.onresize=f)}}(this,this.document,ADAPT_CONFIG));
  10.  *
  11.  * DIFF:
  12.  *  1       - (function (a, b, c, d) {
  13.  *  1   + var sbizFnAdaptCSS = function (a, b, c, d) {
  14.  *  2   + "use strict";
  15.  * 2    3   function e() {
  16.  * 3    4   clearTimeout(i);
  17.  * 4    5   for (var c = a.innerWidth || b.documentElement.clientWidth || b.body.clientWidth || 0, e, f, o, p, q = m, u = m - 1; q--; ) {
  18.  * 5    6   g = "",
  19.  * 6    7   e = l[q].split("="),
  20.  * 7    8   f = e[0],
  21.  * 8    9   p = e[1] ? e[1].replace(/\s/g, "") : d,
  22.  * 9    10  e = (o = f.match("to")) ? parseInt(f.split("to")[0], 10) : parseInt(f, 10),
  23.  * 10   11  f = o ? parseInt(f.split("to")[1], 10) : d;
  24.  * 11   12  if (!f && q === u && c > e || c > e && c <= f) {
  25.  * 12   13  p && (g = k + p);
  26.  * 13   14  break
  27.  * 14   15  }
  28.  * 15   16  }
  29.  * 16   17  h ? h !== g && (h = n.href = g, j && j(q, c)) : (h = n.href = g, j && j(q, c), k && (b.head || b.getElementsByTagName("head")[0]).appendChild(n))
  30.  * 17   18  }
  31.  * 18   19  function f() {
  32.  * 19   20  clearTimeout(i),
  33.  * 20   21  i = setTimeout(e, 16)
  34.  * 21   22  }
  35.  * 22   23  if (c) {
  36.  * 23   24  var g,
  37.  * 24   25  h,
  38.  * 25   26  i,
  39.  * 26   27  j = typeof c.callback == "function" ? c.callback : d,
  40.  * 27   28  k = c.path ? c.path : "",
  41.  * 28   29  l = c.range,
  42.  * 29   30  m = l.length,
  43.  * 30   31  n = b.createElement("link");
  44.  * 31   32  n.rel = "stylesheet",
  45.  * 32   33  n.media = "screen",
  46.  * 33   34  e(),
  47.  * 34   35  c.dynamic && (a.addEventListener ? a.addEventListener("resize", f, !1) : a.attachEvent ? a.attachEvent("onresize", f) : a.onresize = f)
  48.  * 35   36  }
  49.  * 36       - }
  50.  *      37  - (this, this.document, ADAPT_CONFIG));
  51.  *  37  + };
  52.  *
  53.  * initialising:
  54.  *
  55.  *  var ADAPT_CONFIG={path:"/css/",dynamic:!0,range:"0px to 760px = 480.css,760px to 980px = 720.css,980px to 1280px = 960.css,1280px to 1600px = 1200.css,1600px to 1920px = 1200.css,1940px to 2540px = 1200.css,2540px = 1200.css".split(",")};
  56.  *  sbizFnAdaptCSS(this, this.document, ADAPT_CONFIG);
  57.  */
  58.  var sbizFnAdaptCSS = function(a,b,c,d){"use strict";function e(){clearTimeout(i);for(var c=a.innerWidth||b.documentElement.clientWidth||b.body.clientWidth||0,e,f,o,p,q=m,u=m-1;q--;){g="",e=l[q].split("="),f=e[0],p=e[1]?e[1].replace(/\s/g,""):d,e=(o=f.match("to"))?parseInt(f.split("to")[0],10):parseInt(f,10),f=o?parseInt(f.split("to")[1],10):d;if(!f&&q===u&&c>e||c>e&&c<=f){p&&(g=k+p);break}}h?h!==g&&(h=n.href=g,j&&j(q,c)):(h=n.href=g,j&&j(q,c),k&&(b.head||b.getElementsByTagName("head")[0]).appendChild(n))}function f(){clearTimeout(i),i=setTimeout(e,16)}if(c){var g,h,i,j=typeof c.callback=="function"?c.callback:d,k=c.path?c.path:"",l=c.range,m=l.length,n=b.createElement("link");n.rel="stylesheet",n.media="screen",e(),c.dynamic&&(a.addEventListener?a.addEventListener("resize",f,!1):a.attachEvent?a.attachEvent("onresize",f):a.onresize=f)}};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement