kernel.org's libravatar lua script
Konstantin Ryabitsev
mricon at kernel.org
Fri Mar 14 16:37:56 CET 2014
Hi, all:
We upgraded to 0.10.1 on kernel.org with libravatar support:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
As you'll notice, it's slightly different from the default gravatar
script, so here are our changes (using lua-md5 instead of luacrypto):
email-libravatar-korg.lua:
----
local md5 = require("md5")
function filter_open(email, page)
buffer = ""
hexdigest = md5.sumhexa(email:sub(2, -2):lower())
end
function filter_close()
html("<span class='libravatar'><img class='inline'
src='//seccdn.libravatar.org/avatar/" .. hexdigest ..
"?s=13&d=retro' /><img class='onhover'
src='//seccdn.libravatar.org/avatar/" .. hexdigest ..
"?s=128&d=retro' /></span>" .. buffer)
return 0
end
function filter_write(str)
buffer = buffer .. str
end
----
The following css additions are required for the hover effect:
----
div#cgit span.libravatar img.onhover {
display: none;
border: 1px solid gray;
padding: 0px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
width: 128px;
height: 128px;
}
div#cgit span.libravatar img.inline {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
width: 13px;
height: 13px;
margin-right: 0.2em;
opacity: 0.4;
}
div#cgit span.libravatar:hover > img.onhover {
display: block;
position: absolute;
margin-left: 1.5em;
background-color: #eeeeee;
box-shadow: 5px 5px 3px #bbb;
}
----
Best,
--
Konstantin Ryabitsev
Senior Systems Administrator
Linux Foundation Collab Projects
Montréal, Québec
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 713 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140314/1910242e/attachment.asc>
More information about the CGit
mailing list