title: SO: what does this js mean? I am studying SO source code
body: <p>(some code)(jQuery);</p>
  
  <p>What does this mean?</p>
  
  <pre><code>(function (a) {
      function d(g) {
          return typeof g == "object" ? g : {
              top: g,
              left: g
          }
      }
      var b = a.scrollTo = function (g, e, f) {
          a(window).scrollTo(g, e, f)
      };
      b.defaults = {
          axis: "xy",
          duration: parseFloat(a.fn.jquery) &gt;= 1.3 ? 0 : 1
      };
      b.window = function () {
          return a(window)._scrollable()
      };
      a.fn._scrollable = function () {
          return this.map(function () {
              if (!(!this.nodeName || a.inArray(this.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1)) return this;
              var g = (this.contentWindow || this).document || this.ownerDocument || this;
              return a.browser.safari || g.compatMode == "BackCompat" ? g.body : g.documentElement
          })
      };
      a.fn.scrollTo = function (g, e, f) {
          if (typeof e == "object") {
              f = e;
              e = 0
          }
          if (typeof f == "function") f = {
              onAfter: f
          };
          if (g == "max") g = 9E9;
          f = a.extend({}, b.defaults, f);
          e = e || f.speed || f.duration;
          f.queue = f.queue &amp;&amp; f.axis.length &gt; 1;
          if (f.queue) e /= 2;
          f.offset = d(f.offset);
          f.over = d(f.over);
          return this._scrollable().each(function () {
              function k(w) {
                  j.animate(r, e, f.easing, w &amp;&amp;
                  function () {
                      w.call(this, g, f)
                  })
              }
              var h = this,
                  j = a(h),
                  i = g,
                  m, r = {},
                  u = j.is("html,body");
              switch (typeof i) {
              case "number":
              case "string":
                  if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(i)) {
                      i =
                      d(i);
                      break
                  }
                  i = a(i, this);
              case "object":
                  if (i.is || i.style) m = (i = a(i)).offset()
              }
              a.each(f.axis.split(""), function (w, v) {
                  var q = v == "x" ? "Left" : "Top",
                      s = q.toLowerCase(),
                      y = "scroll" + q,
                      D = h[y],
                      H = b.max(h, v);
                  if (m) {
                      r[y] = m[s] + (u ? 0 : D - j.offset()[s]);
                      if (f.margin) {
                          r[y] -= parseInt(i.css("margin" + q)) || 0;
                          r[y] -= parseInt(i.css("border" + q + "Width")) || 0
                      }
                      r[y] += f.offset[s] || 0;
                      if (f.over[s]) r[y] += i[v == "x" ? "width" : "height"]() * f.over[s]
                  } else {
                      q = i[s];
                      r[y] = q.slice &amp;&amp; q.slice(-1) == "%" ? parseFloat(q) / 100 * H : q
                  }
                  if (/^\d+$/.test(r[y])) r[y] = r[y] &lt;= 0 ? 0 : Math.min(r[y], H);
                  if (!w &amp;&amp; f.queue) {
                      D != r[y] &amp;&amp; k(f.onAfterFirst);
                      delete r[y]
                  }
              });
              k(f.onAfter)
          }).end()
      };
      b.max = function (g, e) {
          var f = e == "x" ? "Width" : "Height",
              k = "scroll" + f;
          if (!a(g).is("html,body")) return g[k] - a(g)[f.toLowerCase()]();
          f = "client" + f;
          var h = g.ownerDocument.documentElement,
              j = g.ownerDocument.body;
          return Math.max(h[k], j[k]) - Math.min(h[f], j[f])
      }
  })(jQuery);
  </code></pre>