# HG changeset patch # User domruf # Date 1502631783 -7200 # Node ID d2f20f3d21170d7d5615d8d5b6532ce9ab46c0b3 # Parent f49e1b6cff90c7cefadc24d6eb7aeab1880cd853 gravatar: use background-image style instead of img element for gravatar When having several 1000 users, chrome will fail to load all the gravatar img elements on the _admin/users page (ERR_INSUFFICIENT_RESOURCES). If instead we use a background-image style, chrome will only load the images of the elements that are actually displayed. diff -r f49e1b6cff90 -r d2f20f3d2117 kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py Tue Aug 08 22:43:11 2017 +0200 +++ b/kallithea/lib/helpers.py Sun Aug 13 15:43:03 2017 +0200 @@ -878,8 +878,9 @@ if src: # here it makes sense to use style="width: ..." (instead of, say, a # stylesheet) because we using this to generate a high-res (retina) size - html = ('' - .format(cls=cls, size=size, src=src)) + html = ('').format(cls=cls, size=size, src=src) else: # if src is empty then there was no gravatar, so we use a font icon diff -r f49e1b6cff90 -r d2f20f3d2117 kallithea/public/css/contextbar.css --- a/kallithea/public/css/contextbar.css Tue Aug 08 22:43:11 2017 +0200 +++ b/kallithea/public/css/contextbar.css Sun Aug 13 15:43:03 2017 +0200 @@ -11,6 +11,7 @@ margin: -2px 0 -4px 0; /* background-color: red; /* for debugging */ } +/* Note: class 'icon-empty' can be used to get this styling without an actual glyph */ /* css classes for diff file status ... it'd be nice if css had a way to inherit from another class but alas, we must make sure this content is the diff -r f49e1b6cff90 -r d2f20f3d2117 kallithea/public/js/base.js --- a/kallithea/public/js/base.js Tue Aug 08 22:43:11 2017 +0200 +++ b/kallithea/public/js/base.js Sun Aug 13 15:43:03 2017 +0200 @@ -1083,7 +1083,9 @@ if (gravatar_lnk == 'default') { return ''.format(size, cssclass); } - return ''.format(size, gravatar_lnk, cssclass); + return ('').format(size, gravatar_lnk, cssclass); } var autocompleteGravatar = function(res, gravatar_lnk, size, group) {