{"size": 994, "ext": "js", "max_stars_repo_path": "BitBucket.user.js", "max_stars_repo_name": "netcharm/greasemonkey-code", "max_stars_repo_stars_event_min_datetime": "2015-01-13T14:28:07.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-28T17:09:00.000Z", "max_issues_repo_path": "BitBucket.user.js", "max_issues_repo_name": "netcharm/greasemonkey-code", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "BitBucket.user.js", "max_forks_repo_name": "netcharm/greasemonkey-code", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.1578947368, "max_line_length": 144, "alphanum_fraction": 0.6257545272}
// ==UserScript==
// @name        BitBucket
// @namespace   NetCharm
// @description Bitbucket avatar source fix
// @include     https://bitbucket.org/*
// @version     1.0.0.0
// @grant       none
// @run-at      document-end
// ==/UserScript==

function changeImageSource()
{
  // fix the commit user's avatar location
  $('img[class="avatar avatar32"]').each(function(){
    var img = $(this)
    var src_old = img.attr('src');

    var src_new = unescape(src_old.replace(/secure\.gravatar\.com\/avatar\/.*?\?d=https\%3A\%2F\%2F/, 'i0.wp.com/')).replace('&s=32', '?ssl=1');
    //alert(src_new);

    img.attr('src', src_new);
    img.attr('data', src_old);
  });

  // Get default avatar
  var src_user_avatar = $('body').attr('data-no-avatar-image');
  var user_avatar_inner = $('div.aui-avatar-inner');
  // Add avatar to user avatar container
  $('<img class="avatar" src="'+src_user_avatar+'">').appendTo(user_avatar_inner);

}

function main(loaded)
{
  changeImageSource();
}

main();