Created
June 4, 2011 13:56
-
-
Save Ajnasz/1007918 to your computer and use it in GitHub Desktop.
google +1 hup.hu article titles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>A</title> | |
</head> | |
<body> | |
<a href="javascript:(function(){var doc=document,a=Array.prototype.slice.call(doc.querySelectorAll('h2.title a')).filter(function (a) {return a.href!==''&&a.parentNode.className!=='nnew';}),b=doc.createElement('span');a.forEach(function(l,i){var c=b.cloneNode(true),id='plusone'+i;c.id=id;a[i].parentNode.appendChild(c);gapi.plusone.render(id,{size:'small',count:true,href:l.href});});Array.prototype.slice.call(doc.querySelectorAll('.comment')).forEach(function(comment,i){var href=comment.previousSibling.previousSibling.id;if(href){var span=doc.createElement('span'),id='commentcount'+i;span.id=id;comment.querySelector('.submitted').appendChild(span);gapi.plusone.render(id,{href:doc.location.href+'#'+href,count:true,size:'small'});}});}()); | |
">+1</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var doc = document; | |
var a = Array.prototype.slice.call(doc.querySelectorAll('h2.title a')) | |
.filter(function (a) { | |
return a.href !== '' && a.parentNode.className !== 'nnew'; | |
}), | |
b = doc.createElement('span'); | |
a.forEach(function (l, i) { | |
var c = b.cloneNode(true), | |
id = 'plusone' + i; | |
c.id = id; | |
a[i].parentNode.appendChild(c); | |
gapi.plusone.render(id, {size:'small', count:true, href: l.href}); | |
}); | |
Array.prototype.slice.call(doc.querySelectorAll('.comment')).forEach(function (comment, i) { | |
var href = comment.previousSibling.previousSibling.id; | |
if (href) { | |
var span = doc.createElement('span'), | |
id = 'commentcount' + i; | |
span.id = id; | |
comment.querySelector('.submitted').appendChild(span); | |
gapi.plusone.render(id, {href: doc.location.href + '#' + href, count: true, size: 'small'}); | |
} | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment