-
Notifications
You must be signed in to change notification settings - Fork 0
/
gravagrabber.html
45 lines (45 loc) · 2.19 KB
/
gravagrabber.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!doctype html>
<html>
<head>
<title>Gravagrabber 0.1</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="md5.js"></script>
<script type="text/javascript">
(function($) {
$.gravatar = function(emailAddress, overrides) {
var options = $.extend({
size: '512',
rating: '',
image: '',
secure: true,
classes: ''
}, overrides);
var baseUrl = options.secure ? 'https://secure.gravatar.com/avatar/' : 'http://www.gravatar.com/avatar/';
return $('<pre>Gravatar Profile URL: https://www.gravatar.com/profile/' + hex_md5(emailAddress) + '</pre> <a href="https://www.gravatar.com/profile/' + hex_md5(emailAddress) + '" target="_blank"><img src="' + baseUrl + hex_md5(emailAddress) + '.jpg?' + (options.size ? 's=' + options.size + '&' : '') + (options.rating ? 'r=' + options.rating + '&' : '') + (options.image ? 'd=' + encodeURIComponent(options.image) : '') + '"' + (options.classes ? ' class="' + options.classes + '"' : '') + ' /></a>').bind('error', function() {
$(this).remove()
})
}
})(jQuery);
$(document).ready(function() {
var inputBox = document.getElementById('gremail');
inputBox.onkeyup = function() {
$('#gravatar').empty().append($.gravatar(inputBox.value));
}
});
</script>
<style>
html { margin: 0; padding: 0; height: 100%; }
body { background: url('cookies.png') no-repeat bottom right; font-family: sans-serif; }
h1 { color: #0a76b7; }
input { margin: 0 1em 1em 0; font-size: large; padding: 0.3em; }
</style>
</head>
<body>
<h1>Gravagrabber 0.2</h1>
<h2>Type or paste email and get the associated gravatar:</h2>
<form id="gremailform">
<input type='text' name='gremail' class='gremail' id='gremail'>
<div id="gravatar">...</div>
</form>
</body>
</html>