text: // Generated by CoffeeScript 1.10.0
  (function() {
    var ButtonAnchor, ButtonForm, ButtonFrame, ButtonFrameContent, Code, Config, Element, FlatObject, Form, Frame, GitHubAPIStatus, Hash, PreviewAnchor, PreviewFrame, QueryString, StaticFrame, document, iframe, j, len, ref, window,
      slice = [].slice,
      extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
      hasProp = {}.hasOwnProperty;
  
    window = this;
  
    document = window.document;
  
    Config = {
      api: "https://api.github.com",
      anchorClass: "github-button",
      iconClass: "octicon",
      icon: "octicon-mark-github",
      scriptId: "github-bjs",
      styles: ["default", "mega"]
    };
  
    if (Config.script = document.getElementById(Config.scriptId)) {
      Config.url = Config.script.src.replace(/[^\/]*([?#].*)?$/, "");
    }
  
    FlatObject = (function() {
      var index;
  
      function FlatObject() {}
  
      FlatObject.flatten = function(obj) {
        var flatten, result;
        flatten = function(object, flat_key) {
          var index, item, j, key, len, value;
          switch (Object.prototype.toString.call(object)) {
            case "[object Object]":
              for (key in object) {
                value = object[key];
                flatten(value, flat_key ? flat_key + "." + key : key);
              }
              break;
            case "[object Array]":
              for (index = j = 0, len = object.length; j < len; index = ++j) {
                item = object[index];
                flatten(item, flat_key + "[" + index + "]");
              }
              break;
            default:
              result[flat_key] = object;
          }
        };
        result = {};
        flatten(obj, "");
        return result;
      };
  
      FlatObject.expand = function(obj) {
        var flat_key, key, keys, namespace, target, value;
        namespace = [];
        for (flat_key in obj) {
          value = obj[flat_key];
          keys = flat_key.match(/((?!\[\d+\])[^.])+|\[\d+\]/g);
          target = namespace;
          key = 0;
          while (keys.length) {
            if (target[key] == null) {
              target[key] = keys[0] === index(keys[0]) ? {} : [];
            }
            target = target[key];
            key = index(keys.shift());
          }
          target[key] = value;
        }
        return namespace[0];
      };
  
      index = function(str) {
        var match;
        if (match = str.match(/^\[(\d+)\]$/)) {
          return Number(match[1]);
        } else {
          return str;
        }
      };
  
      return FlatObject;
  
    })();
  
    QueryString = (function() {
      function QueryString() {}
  
      QueryString.stringify = function(obj) {
        var key, results, value;
        results = [];
        for (key in obj) {
          value = obj[key];
          results.push(key + "=" + (value != null ? value : ""));
        }
        return results.join("&");
      };
  
      QueryString.parse = function(str) {
        var j, key, len, obj, pair, ref, ref1, value;
        obj = {};
        ref = str.split("&");
        for (j = 0, len = ref.length; j < len; j++) {
          pair = ref[j];
          if (!(pair !== "")) {
            continue;
          }
          ref1 = pair.split("="), key = ref1[0], value = 2 <= ref1.length ? slice.call(ref1, 1) : [];
          if (key !== "") {
            obj[key] = value.join("=");
          }
        }
        return obj;
      };
  
      return QueryString;
  
    })();
  
    Hash = (function() {
      function Hash() {}
  
      Hash.encode = function(data) {
        return "#" + encodeURIComponent(QueryString.stringify(FlatObject.flatten(data)));
      };
  
      Hash.decode = function(data) {
        if (data == null) {
          data = document.location.hash;
        }
        return (FlatObject.expand(QueryString.parse(decodeURIComponent(data.replace(/^#/, ""))))) || {};
      };
  
      return Hash;
  
    })();
  
    Element = (function() {
      var addClass, addEventListener, hasClass, r_whitespace, removeClass, removeEventListener;
  
      function Element(element, callback) {
        this.$ = element && element.nodeType === 1 ? element : document.createElement(element);
        if (callback) {
          callback.call(this, this.$);
        }
      }
  
      Element.prototype.get = function() {
        return this.$;
      };
  
      Element.prototype.on = function() {
        var callback, eventName, events, func, j, k, len;
        events = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), func = arguments[j++];
        callback = (function(_this) {
          return function(event) {
            return func.call(_this, event || window.event);
          };
        })(this);
        for (k = 0, len = events.length; k < len; k++) {
          eventName = events[k];
          addEventListener(this.$, eventName, callback);
        }
      };
  
      Element.prototype.once = function() {
        var callback, eventName, events, func, j, k, len;
        events = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), func = arguments[j++];
        callback = (function(_this) {
          return function(event) {
            var eventName, k, len;
            for (k = 0, len = events.length; k < len; k++) {
              eventName = events[k];
              removeEventListener(_this.$, eventName, callback);
            }
            return func.call(_this, event || window.event);
          };
        })(this);
        for (k = 0, len = events.length; k < len; k++) {
          eventName = events[k];
          addEventListener(this.$, eventName, callback);
        }
      };
  
      Element.prototype.addClass = function(className) {
        if (!hasClass(this.$, className)) {
          addClass(this.$, className);
        }
      };
  
      Element.prototype.removeClass = function(className) {
        if (hasClass(this.$, className)) {
          removeClass(this.$, className);
        }
      };
  
      Element.prototype.hasClass = function(className) {
        return hasClass(this.$, className);
      };
  
      addEventListener = function(element, event, func) {
        if (element.addEventListener) {
          element.addEventListener("" + event, func);
        } else {
          element.attachEvent("on" + event, func);
        }
      };
  
      removeEventListener = function(element, event, func) {
        if (element.removeEventListener) {
          element.removeEventListener("" + event, func);
        } else {
          element.detachEvent("on" + event, func);
        }
      };
  
      r_whitespace = /[ \t\n\f\r]+/g;
  
      addClass = function(element, className) {
        element.className += " " + className;
      };
  
      removeClass = function(element, className) {
        element.className = (" " + element.className + " ").replace(r_whitespace, " ").replace(" " + className + " ", "").replace(/^ | $/, "");
      };
  
      hasClass = function(element, className) {
        return (" " + element.className + " ").replace(r_whitespace, " ").indexOf(" " + className + " ") >= 0;
      };
  
      return Element;
  
    })();
  
    Frame = (function(superClass) {
      var devicePixelRatio, roundPixel;
  
      extend(Frame, superClass);
  
      function Frame(callback) {
        Frame.__super__.constructor.call(this, "iframe", function(iframe) {
          var key, ref, ref1, value;
          ref = {
            allowtransparency: true,
            scrolling: "no",
            frameBorder: 0
          };
          for (key in ref) {
            value = ref[key];
            iframe.setAttribute(key, value);
          }
          ref1 = {
            border: "none",
            height: "0",
            width: "1px"
          };
          for (key in ref1) {
            value = ref1[key];
            iframe.style[key] = value;
          }
          if (callback) {
            callback.call(this, iframe);
          }
        });
      }
  
      Frame.prototype.html = function(html) {
        var contentDocument;
        try {
          contentDocument = this.$.contentWindow.document;
          contentDocument.open();
          contentDocument.write(html);
          contentDocument.close();
        } catch (undefined) {}
      };
  
      Frame.prototype.load = function(src) {
        this.$.src = src;
      };
  
      Frame.prototype.size = function() {
        var body, boundingClientRect, contentDocument, height, html, width;
        try {
          contentDocument = this.$.contentWindow.document;
          html = contentDocument.documentElement;
          body = contentDocument.body;
          html.style.overflow = body.style.overflow = window.opera ? "scroll" : "visible";
          width = body.scrollWidth;
          height = body.scrollHeight;
          if (body.getBoundingClientRect) {
            body.style.display = "inline-block";
            boundingClientRect = body.getBoundingClientRect();
            width = Math.max(width, roundPixel(boundingClientRect.width));
            height = Math.max(height, roundPixel(boundingClientRect.height));
            body.style.display = "";
          }
          html.style.overflow = body.style.overflow = "";
          return {
            width: width + "px",
            height: height + "px"
          };
        } catch (undefined) {}
      };
  
      Frame.prototype.resize = function(arg) {
        var height, ref, width;
        ref = arg != null ? arg : this.size() || {}, width = ref.width, height = ref.height;
        if (width) {
          this.$.style.width = width;
        }
        if (height) {
          this.$.style.height = height;
        }
      };
  
      devicePixelRatio = window.devicePixelRatio || 1;
  
      roundPixel = function(px) {
        if (devicePixelRatio > 1) {
          return Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 || 0;
        } else {
          return Math.ceil(px);
        }
      };
  
      return Frame;
  
    })(Element);
  
    ButtonAnchor = (function() {
      var filter_js;
  
      function ButtonAnchor() {}
  
      ButtonAnchor.parse = function(element) {
        var api, icon, label, style;
        return {
          href: filter_js(element.href),
          text: element.getAttribute("data-text") || element.textContent || element.innerText || "",
          data: {
            count: {
              api: (api = element.getAttribute("data-count-api")) && (~api.indexOf("#")) ? api.replace(/^(?!\/)/, "/") : void 0,
              href: (filter_js(element.getAttribute("data-count-href"))) || (filter_js(element.href)),
              aria: {
                label: (label = element.getAttribute("data-count-aria-label")) ? label : void 0
              }
            },
            style: (style = element.getAttribute("data-style")) ? style : void 0,
            icon: (icon = element.getAttribute("data-icon")) ? icon : void 0
          },
          aria: {
            label: (label = element.getAttribute("aria-label")) ? label : void 0
          }
        };
      };
  
      filter_js = function(href) {
        if (/^\s*javascript:/i.test(href)) {
          return "";
        } else {
          return href;
        }
      };
  
      return ButtonAnchor;
  
    })();
  
    ButtonFrame = (function(superClass) {
      extend(ButtonFrame, superClass);
  
      function ButtonFrame(hash, callback, onload) {
        var reload;
        ButtonFrame.__super__.constructor.call(this, callback);
        reload = (function(_this) {
          return function() {
            var size;
            size = _this.size();
            _this.once("load", function() {
              this.resize(size);
              if (onload) {
                onload.call(this, this.$);
              }
            });
            _this.load(Config.url + "buttons.html" + hash);
          };
        })(this);
        this.once("load", function() {
          if (callback = this.$.contentWindow.callback) {
            new Element(callback.script, function(script) {
              this.on("load", "error", reload);
              if (script.readyState) {
                this.on("readystatechange", function() {
                  if (!/i/.test(script.readyState)) {
                    reload();
                  }
                });
              }
            });
          } else {
            reload();
          }
        });
        this.html("<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title></title>\n<base target=\"_blank\"><!--[if lte IE 6]></base><![endif]-->\n<link rel=\"stylesheet\" href=\"" + Config.url + "assets/css/buttons.css\">\n<script>document.location.hash = \"" + hash + "\";</script>\n</head>\n<body>\n<script src=\"" + Config.script.src + "\"></script>\n</body>\n</html>");
      }
  
      return ButtonFrame;
  
    })(Frame);
  
    ButtonFrameContent = (function() {
      var Button, Count;
  
      function ButtonFrameContent(options) {
        if (options && options.data) {
          document.body.className = ((function() {
            var j, len, ref, style;
            ref = Config.styles;
            for (j = 0, len = ref.length; j < len; j++) {
              style = ref[j];
              if (style === options.data.style) {
                return style;
              }
            }
          })()) || Config.styles[0];
          if (options.href) {
            document.getElementsByTagName("base")[0].href = options.href;
          }
          new Button(options, function(buttonElement) {
            document.body.appendChild(buttonElement);
          });
          new Count(options.data.count, function(countElement) {
            document.body.appendChild(countElement);
          });
        }
      }
  
      Button = (function(superClass) {
        extend(Button, superClass);
  
        function Button(options, callback) {
          Button.__super__.constructor.call(this, "a", function(a) {
            a.className = "button";
            if (options.href) {
              a.href = options.href;
            }
            if (options.aria.label) {
              a.setAttribute("aria-label", options.aria.label);
            }
            new Element("i", function(icon) {
              icon = document.createElement("i");
              icon.className = (options.data.icon || Config.icon) + (Config.iconClass ? " " + Config.iconClass : "");
              icon.setAttribute("aria-hidden", "true");
              a.appendChild(icon);
            });
            new Element("span", function(text) {
              text.appendChild(document.createTextNode(" "));
              a.appendChild(text);
            });
            new Element("span", function(text) {
              if (options.text) {
                text.appendChild(document.createTextNode(options.text));
              }
              a.appendChild(text);
            });
            if (callback) {
              callback(a);
            }
          });
        }
  
        return Button;
  
      })(Element);
  
      Count = (function(superClass) {
        extend(Count, superClass);
  
        function Count(options, callback) {
          if (options && options.api) {
            Count.__super__.constructor.call(this, "a", function(a) {
              a.className = "count";
              if (options.href) {
                a.href = options.href;
              }
              new Element("b", function(b) {
                a.appendChild(b);
              });
              new Element("i", function(i) {
                a.appendChild(i);
              });
              new Element("span", function(span) {
                var endpoint;
                a.appendChild(span);
                endpoint = (function() {
                  var query, url;
                  url = options.api.split("#")[0];
                  query = QueryString.parse(url.split("?").slice(1).join("?"));
                  query.callback = "callback";
                  return (url.split("?")[0]) + "?" + (QueryString.stringify(query));
                })();
                new Element("script", function(script) {
                  var head;
                  script.async = true;
                  script.src = "" + Config.api + endpoint;
                  window.callback = function(json) {
                    var data;
                    window.callback = null;
                    if (json.meta.status === 200) {
                      data = FlatObject.flatten(json.data)[options.api.split("#").slice(1).join("#")];
                      if ("[object Number]" === Object.prototype.toString.call(data)) {
                        data = ("" + data).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                      }
                      span.appendChild(document.createTextNode(" " + data + " "));
                      if (options.aria.label) {
                        a.setAttribute("aria-label", options.aria.label.replace("#", data));
                      }
                      if (callback) {
                        callback(a);
                      }
                    }
                  };
                  window.callback.script = script;
                  this.on("error", function() {
                    window.callback = null;
                  });
                  if (script.readyState) {
                    this.on("readystatechange", function() {
                      if (script.readyState === "loaded" && script.children && script.readyState === "loading") {
                        window.callback = null;
                      }
                    });
                  }
                  head = document.getElementsByTagName("head")[0];
                  head.insertBefore(script, head.firstChild);
                });
              });
            });
          }
        }
  
        return Count;
  
      })(Element);
  
      return ButtonFrameContent;
  
    })();
  
    GitHubAPIStatus = (function() {
      function GitHubAPIStatus() {}
  
      GitHubAPIStatus.low_rate_limit = false;
  
      window.callback = function(json) {
        GitHubAPIStatus.rate_limit = json.data;
        GitHubAPIStatus.low_rate_limit = GitHubAPIStatus.rate_limit.resources.core.remaining < 16;
      };
  
      GitHubAPIStatus.update = function() {
        if (!window.callback.script) {
          new Element("script", function(script) {
            var head;
            script.async = true;
            script.src = "https://api.github.com/rate_limit?callback=callback";
            window.callback.script = script;
            this.on("readystatechange", "load", "error", function() {
              if (!script.readyState || /loaded|complete/.test(script.readyState)) {
                script.parentNode.removeChild(script);
                window.callback.script = null;
              }
            });
            head = document.getElementsByTagName("head")[0];
            head.insertBefore(script, head.firstChild);
          });
        }
      };
  
      GitHubAPIStatus.update();
  
      return GitHubAPIStatus;
  
    })();
  
    Form = (function(superClass) {
      extend(Form, superClass);
  
      function Form() {
        return Form.__super__.constructor.apply(this, arguments);
      }
  
      Form.prototype.on = function() {
        var callback, element, events, func, j, k, len, ref;
        events = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), func = arguments[j++];
        if (events.indexOf("change") >= 0) {
          callback = (function(_this) {
            return function(event) {
              return func.call(_this, event || window.event);
            };
          })(this);
          ref = this.get().elements;
          for (k = 0, len = ref.length; k < len; k++) {
            element = ref[k];
            new Element(element).on("change", "input", callback);
          }
        }
        return Form.__super__.on.apply(this, arguments);
      };
  
      Form.prototype.serialize = function() {
        var data, j, len, node, ref;
        data = {};
        ref = this.get().elements;
        for (j = 0, len = ref.length; j < len; j++) {
          node = ref[j];
          if (node.name) {
            switch (node.type) {
              case "radio":
              case "checkbox":
                if (node.checked) {
                  data[node.name] = node.value;
                }
                break;
              default:
                data[node.name] = node.value;
            }
          }
        }
        return data;
      };
  
      return Form;
  
    })(Element);
  
    StaticFrame = (function(superClass) {
      extend(StaticFrame, superClass);
  
      function StaticFrame() {
        StaticFrame.__super__.constructor.apply(this, arguments);
        this.on("load", function() {
          var a, base, contentDocument, j, len, ref;
          contentDocument = this.get().contentWindow.document;
          base = contentDocument.head.getElementsByTagName("base")[0];
          base.parentNode.removeChild(base);
          ref = contentDocument.getElementsByTagName("a");
          for (j = 0, len = ref.length; j < len; j++) {
            a = ref[j];
            a.href = "#";
            a.style["pointer-events"] = "none";
          }
          new Element("div", function(div) {
            var key, ref1, value;
            ref1 = {
              position: "fixed",
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
              cursor: "pointer",
              background: "transparent",
              opacity: 0,
              filter: "alpha(opacity=0)"
            };
            for (key in ref1) {
              value = ref1[key];
              div.style[key] = value;
            }
            contentDocument.body.appendChild(div);
          });
          new Element(contentDocument.body).on("click", (function(_this) {
            return function() {
              _this.get().parentNode.click();
            };
          })(this));
        });
      }
  
      return StaticFrame;
  
    })(Element);
  
    PreviewAnchor = (function(superClass) {
      extend(PreviewAnchor, superClass);
  
      function PreviewAnchor(arg, callback) {
        var aria, data, href, text;
        href = arg.href, text = arg.text, data = arg.data, aria = arg.aria;
        PreviewAnchor.__super__.constructor.call(this, "a", function(a) {
          var name, value;
          a.className = Config.anchorClass;
          a.href = href;
          a.appendChild(document.createTextNode("" + text));
          for (name in data) {
            value = data[name];
            a.setAttribute("data-" + name, value);
          }
          for (name in aria) {
            value = aria[name];
            a.setAttribute("aria-" + name, value);
          }
          if (callback) {
            callback(a);
          }
        });
      }
  
      return PreviewAnchor;
  
    })(Element);
  
    PreviewFrame = (function(superClass) {
      extend(PreviewFrame, superClass);
  
      function PreviewFrame(preview) {
        PreviewFrame.__super__.constructor.call(this, function(iframe) {
          preview.appendChild(iframe);
          iframe.src = "buttons.html";
        });
        this.on("load", function() {
          var callback, script;
          if (callback = this.get().contentWindow.callback) {
            script = callback.script;
            if (script.readyState) {
              new Element(script).on("readystatechange", function() {
                if (/loaded|complete/.test(script.readyState)) {
                  this.resize();
                }
              });
            } else {
              new Element(script).on("load", "error", function() {
                this.resize();
              });
            }
          } else {
            this.resize();
          }
        });
      }
  
      PreviewFrame.prototype.load = function(config) {
        this.get().parentNode.style.height = ((config.data.style === "mega" ? 28 : 20) + 2) + "px";
        this.get().style.width = "1px";
        this.get().style.height = "0";
        this.get().src = "buttons.html" + (Hash.encode(config));
        this.get().contentWindow.document.location.reload();
      };
  
      return PreviewFrame;
  
    })(Frame);
  
    Code = (function(superClass) {
      extend(Code, superClass);
  
      function Code() {
        Code.__super__.constructor.apply(this, arguments);
        this.on("focus", function() {
          this.get().select();
        });
        this.on("click", function() {
          this.get().select();
        });
        this.on("mouseup", function(event) {
          event.preventDefault();
          return false;
        });
      }
  
      return Code;
  
    })(Element);
  
    ButtonForm = (function(superClass) {
      extend(ButtonForm, superClass);
  
      function ButtonForm($, arg) {
        var button, callback, code, content, frame, ref, snippet, user_repo, warning;
        this.$ = $;
        content = arg.content, (ref = arg.preview, button = ref.button, frame = ref.frame, code = ref.code, warning = ref.warning), snippet = arg.snippet, user_repo = arg.user_repo;
        snippet.get().value = "<!-- Place this tag right after the last button or just before your close body tag. -->\n<script async defer id=\"github-bjs\" src=\"https://buttons.github.io/buttons.js\"></script>";
        callback = (function(_this) {
          return function(arg1) {
            var cache, force, j, k, len, len1, name, options, ref1, ref2;
            force = arg1.force;
            options = _this.serialize();
            if (options.type) {
              content.removeClass("hidden");
              ref1 = ["repo", "standard-icon"];
              for (j = 0, len = ref1.length; j < len; j++) {
                name = ref1[j];
                _this.get().elements[name].disabled = options.type === "follow";
              }
              ref2 = ["show-count"];
              for (k = 0, len1 = ref2.length; k < len1; k++) {
                name = ref2[k];
                _this.get().elements[name].disabled = options.type === "download";
              }
              if (!((!options.user || /^[a-z0-9][a-z0-9-]*$/i.test(options.user)) && (options.type === "follow" || !options.repo || (/^[\w.-]+$/.test(options.repo) && !/^\.\.?$/.test(options.repo))))) {
                user_repo.addClass("has-error");
              } else {
                user_repo.removeClass("has-error");
                if (options.user === "" || (options.type !== "follow" && options.repo === "")) {
                  user_repo.addClass("has-warning");
                } else {
                  user_repo.removeClass("has-warning");
                }
              }
              if ((user_repo.hasClass("has-error")) || (user_repo.hasClass("has-warning"))) {
                options.user = "ntkme";
                options.repo = "github-buttons";
              }
              if (_this.cache !== (cache = Hash.encode(options)) || force) {
                _this.cache = cache;
                new PreviewAnchor(_this.parse(options), function(a) {
                  var reset;
                  code.get().value = "<!-- Place this tag where you want the button to render. -->\n" + a.outerHTML;
                  button.addClass("hidden");
                  if ((options["show-count"] != null) && options.type !== "download") {
                    GitHubAPIStatus.update();
                    if (GitHubAPIStatus.low_rate_limit) {
                      button.removeClass("hidden");
                      reset = new Date(GitHubAPIStatus.rate_limit.resources.core.reset * 1000);
                      if (!_this.reset || reset > _this.reset) {
                        _this.reset = reset;
                        warning.removeClass("hidden");
                      }
                      if (force) {
                        warning.addClass("hidden");
                      } else {
                        a.removeAttribute("data-count-api");
                      }
                    }
                  }
                  frame.load(ButtonAnchor.parse(a));
                  a = null;
                });
              }
            }
          };
        })(this);
        button.on("click", function(event) {
          event.preventDefault();
          callback({
            force: true
          });
          return false;
        });
        this.on("change", callback);
      }
  
      ButtonForm.prototype.parse = function(options) {
        var config, repo, type, user;
        if (options == null) {
          options = this.serialize();
        }
        type = options.type, user = options.user, repo = options.repo;
        config = {
          className: "github-button",
          href: (function() {
            switch (type) {
              case "follow":
                return "https://github.com/" + user;
              case "watch":
              case "star":
                return "https://github.com/" + user + "/" + repo;
              case "fork":
                return "https://github.com/" + user + "/" + repo + "/fork";
              case "issue":
                return "https://github.com/" + user + "/" + repo + "/issues";
              case "download":
                return "https://github.com/" + user + "/" + repo + "/archive/master.zip";
              default:
                return "https://github.com/";
            }
          })(),
          text: (function() {
            switch (type) {
              case "follow":
                return "Follow @" + user;
              default:
                return type.charAt(0).toUpperCase() + type.slice(1).toLowerCase();
            }
          })(),
          data: {
            icon: (function() {
              switch (type) {
                case "watch":
                  return "octicon-eye";
                case "star":
                  return "octicon-star";
                case "fork":
                  return "octicon-repo-forked";
                case "issue":
                  return "octicon-issue-opened";
                case "download":
                  return "octicon-cloud-download";
                default:
                  return "octicon-mark-github";
              }
            })()
          },
          aria: {
            label: (function() {
              switch (type) {
                case "follow":
                  return "Follow @" + user + " on GitHub";
                case "watch":
                case "star":
                case "fork":
                case "issue":
                case "download":
                  return (type.charAt(0).toUpperCase() + type.slice(1).toLowerCase()) + " " + user + "/" + repo + " on GitHub";
                default:
                  return "GitHub";
              }
            })()
          }
        };
        if (options["large-button"] != null) {
          config.data.style = "mega";
        }
        if (options["show-count"] != null) {
          switch (type) {
            case "follow":
              config.data["count-href"] = "/" + user + "/followers";
              config.data["count-api"] = "/users/" + user + "#followers";
              config.data["count-aria-label"] = "# followers on GitHub";
              break;
            case "watch":
              config.data["count-href"] = "/" + user + "/" + repo + "/watchers";
              config.data["count-api"] = "/repos/" + user + "/" + repo + "#subscribers_count";
              config.data["count-aria-label"] = "# watchers on GitHub";
              break;
            case "star":
              config.data["count-href"] = "/" + user + "/" + repo + "/stargazers";
              config.data["count-api"] = "/repos/" + user + "/" + repo + "#stargazers_count";
              config.data["count-aria-label"] = "# stargazers on GitHub";
              break;
            case "fork":
              config.data["count-href"] = "/" + user + "/" + repo + "/network";
              config.data["count-api"] = "/repos/" + user + "/" + repo + "#forks_count";
              config.data["count-aria-label"] = "# forks on GitHub";
              break;
            case "issue":
              config.data["count-api"] = "/repos/" + user + "/" + repo + "#open_issues_count";
              config.data["count-aria-label"] = "# issues on GitHub";
          }
        }
        if ((options["standard-icon"] != null) || config.data.icon === "octicon-mark-github") {
          delete config.data.icon;
        }
        return config;
      };
  
      return ButtonForm;
  
    })(Form);
  
    ref = document.getElementsByTagName("iframe");
    for (j = 0, len = ref.length; j < len; j++) {
      iframe = ref[j];
      new StaticFrame(iframe);
    }
  
    new ButtonForm(document.getElementById("button-config"), {
      content: new Element(document.getElementById("content")),
      user_repo: new Element(document.getElementById("user-repo")),
      preview: {
        button: new Element(document.getElementById("preview-button")),
        frame: new PreviewFrame(document.getElementById("preview")),
        code: new Code(document.getElementById("code")),
        warning: new Element(document.getElementById("preview-warning"))
      },
      snippet: new Code(document.getElementById("snippet"))
    });
  
    this.onbeforeunload = function() {};
  
  }).call(this);
  