{"size": 1776, "ext": "js", "max_stars_repo_path": ".config/.config/google-chrome/Default/Extensions/dpdmhfocilnekecfjgimjdeckachfbec/1.0.0_0/util.js", "max_stars_repo_name": "daurenm/dotfiles", "max_stars_repo_stars_event_min_datetime": "2021-02-17T15:16:24.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T15:16:24.000Z", "max_issues_repo_path": ".config/.config/google-chrome/Default/Extensions/dpdmhfocilnekecfjgimjdeckachfbec/1.0.0_0/util.js", "max_issues_repo_name": "daurenm/dotfiles", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": ".config/.config/google-chrome/Default/Extensions/dpdmhfocilnekecfjgimjdeckachfbec/1.0.0_0/util.js", "max_forks_repo_name": "daurenm/dotfiles", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.6206896552, "max_line_length": 150, "alphanum_fraction": 0.5731981982}
// Generated by CoffeeScript 1.9.1
var Util,
  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

Util = {
  get_filename: function(path) {
    return path.split('/').pop();
  },
  get_ext: function(path) {
    var ext_split, filename;
    filename = this.get_filename(path);
    ext_split = filename.split('.');
    if (ext_split.length === 1 || (ext_split.length === 2 && !ext_split[0])) {
      return "";
    } else {
      return ext_split.pop();
    }
  },
  is_photo: function(path) {
    var photo_exts, ref;
    photo_exts = ['jpg', 'jpeg', 'png', 'tiff', 'tif', 'gif', 'bmp'];
    return ref = this.get_ext(path).toLowerCase(), indexOf.call(photo_exts, ref) >= 0;
  },
  generate_guid: function() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
      var r, v;
      r = Math.random() * 16 | 0;
      v = c === 'x' ? r : r & 0x3 | 0x8;
      return v.toString(16);
    });
  },
  log: function(event_name, guid, key, version, extra, callback) {
    var data, xhr;
    if (extra == null) {
      extra = {};
    }
    data = new FormData();
    data.append("event_name", event_name || "");
    data.append("guid", guid || "");
    data.append("key", key || "");
    data.append("version", version || "");
    data.append("extra", JSON.stringify(extra));
    xhr = new XMLHttpRequest();
    xhr.withCredentials = true;
    if (callback) {
      xhr.onload = callback;
    }
    xhr.open("POST", DROPBOX_BASE + "/gmail_extension_log", true);
    xhr.send(data);
  },
  is_dropbox_domain: function(url) {
    var parser;
    parser = document.createElement('a');
    parser.href = url;
    return parser.origin === DROPBOX_BASE;
  }
};
