github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/public/static/js/directives/directives.github.js (about) 1 var directives = directives || {}; 2 3 directives.github = angular.module('directives.github', ['filters.common', 'directives.visualization']); 4 5 directives.github.directive('gravatar', function(md5) { 6 return { 7 restrict : 'A', 8 link: function(scope, element, attrs) { 9 // use protocol relative url to avoid mixed-content warning 10 var gravatarUrl = "//www.gravatar.com/avatar/"; 11 var gravatarQuery = "?s=50&d=https%3A%2F%2Fi2.wp.com%2Fa248.e.akamai.net%2Fassets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png%3Fssl%3D1"; 12 13 scope.$watch(attrs.gravatar, function(v) { 14 element.attr('src', gravatarUrl + md5.createHash(v.toLowerCase()) + gravatarQuery); 15 }); 16 } 17 }; 18 }); 19 20 directives.github.directive('githubCommitPanel', function() { 21 return { 22 scope : true, 23 restrict : 'E', 24 templateUrl : '/static/partials/github_commit_panel.html', 25 link : function(scope, element, attrs) { 26 scope.commit = {}; 27 scope.$parent.$watch(attrs.commit, function(v) { 28 scope.commit = v; 29 }); 30 scope.timezone = attrs.timezone; 31 } 32 }; 33 });