Free javascript Hosting


fotocomentarista_midiaesporte.js

Uploaded on Oct 18 2009 14:03 by otomilas

/* -Exibir fotos dos comentaristas nos comentarios do Blogger-
Script por Stephen Paul Weber a.k.a. Singpolyma (http://singpolyma-tech.blogspot.com/)
Baseado no trabalho de Johan Sundstrom (http://ecmanaut.blogspot.com/2005/10/blogger-hack-inline-comment-faces.html)
Atualizado por PurpleMoggy (http://purplemoggy.blogspot.com/)
Distribuido e atualizado por iceBreaker (http://www.icebreaker.com.br/)

*/

if( document.all && !document.getElementsByTagName )
document.getElementsByTagName = function( nodeName )
{
if( nodeName == '*' ) return document.all;
var result = [], rightName = new RegExp( nodeName, 'i' ), i;
for( i=0; i<document.all.length; i++ )
if( rightName.test( document.all[i].nodeName ) )
result.push( document.all[i] );
return result;
};
document.getElementsByClassName = function( className, nodeName )
{
var result = [], tag = nodeName||'*', node, seek, i;
var rightClass = new RegExp( '(^| )'+ className +'( |$)' );
seek = document.getElementsByTagName( tag );
for( i=0; i<seek.length; i++ )
if( rightClass.test( (node = seek[i]).className ) )
result.push( seek[i] );
return result;
};
function writeScript(src) {
var thescript = document.createElement("script");
thescript.type = "text/javascript";
thescript.src = src;
document.body.appendChild(thescript);
}//end function writeScript
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}//end if
}//end function addLoadEvent
BloggerProfiles = {};
BloggerProfiles.callbacks = {};
//BloggerProfiles.noimage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAMFBMVEUAAAD%2FAIT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FV4HBuAAAAAnRSTlP%2FAOW3MEoAAAFZSURBVHja7ZhZDsQgCIYJNygnUO5%2FyAFcutkqfWhmMpIuyQxf9EdAU2D2GrgJQcBpD5HFZROZyER%2BAqEoD%2BboQALqAxwIgXp7EXwFEXdDiHkYQUMoSG8cQzAjAWzAIUT85ZLhOKiuMSRRmCM%2BgNSBGpG7QMTxAQJehPyIDuOTnxBXkHM6e5ZyWZwJY7lI7EjLjk3k25HWQveQU8r%2BNiIJLztRSf5SA6RvrtE5INJatYOB%2BFmP0SJDK7a1PI9IsWg1nJpTKWm8QLQ%2FsCG8ecmfXLrTaWK540fZL2VS4m6NI%2F2I94ioV015P9PBuIvks3pBoIq5npiFbo%2FcaxFfjmE%2FsbwyN0iSj1U%2BBewgGu5DkPtaVDBtlrK3LnpeYIjbhOHT6os6vfWEVO8lMKedqZWWTaPG0aTXLkz%2BvpD6yJrCg4iWDUYXohEZ2F47NpGJTOSPkVe%2BXL3xFe4D3BFIBtihCWMAAAAASUVORK5CYII%3D';
BloggerProfiles.noimage =
'http://i.imagehost.org/0043/icebreaker_noimage3.png';
BloggerProfiles.imageWidth = 60;
BloggerProfiles.imageHeight = 60;
BloggerProfiles.callbacks.profile = function(data) {
if(data.photo) {
node = document.createElement('img');
node.alt = 'Autor';
if(!data.photo.url)
data.photo.url = BloggerProfiles.noimage;
node.src = data.photo.url;
if(data.photo.width)
node.width = data.photo.width;
if(data.photo.height)
node.height = data.photo.height;
if (node.width > BloggerProfiles.imageWidth) {
node.height = (BloggerProfiles.imageWidth * node.height) / node.width;
node.width = BloggerProfiles.imageWidth;
}
if (node.height > BloggerProfiles.imageHeight) {
node.width = (BloggerProfiles.imageHeight * node.width) / node.height;
node.height = BloggerProfiles.imageHeight;
}
thecomments = document.getElementsByClassName('commentphoto-'+escape(data.url));
for(var i=0; i<thecomments.length; i++)
thecomments[i].appendChild(node.cloneNode(false));
if(data.blogs) {
for(var i=0; i<data.blogs.length; i++) {
if(data.blogs[i].url == BloggerProfiles.blogurl) {
thecomments = document.getElementsByClassName('commentblock-'+escape(data.url));
for(var i2=0; i2<thecomments.length; i2++) {
thecomments[i2].style.color = BloggerProfiles.color;
thecomments[i2].style.backgroundColor = BloggerProfiles.bgcolor;
}//end for thecomments
}//end if blogs.url == blogurl
}//end for blogs
}//end if data.blogs
}//end if data.photo
else {
node = document.createElement('img');
node.alt = 'Autor';
node.src = BloggerProfiles.noimage;
if (node.width > BloggerProfiles.imageWidth) {
node.height = (BloggerProfiles.imageWidth * node.height) / node.width;
node.width = BloggerProfiles.imageWidth;
}
if (node.height > BloggerProfiles.imageHeight) {
node.width = (BloggerProfiles.imageHeight * node.width) / node.height;
node.height = BloggerProfiles.imageHeight;
}
thecomments = document.getElementsByClassName('commentphoto-'+escape(data.url));
for(var i=0; i<thecomments.length; i++)
thecomments[i].appendChild(node.cloneNode(false));
if(data.blogs) {
for(var i=0; i<data.blogs.length; i++) {
if(data.blogs[i].url == BloggerProfiles.blogurl) {
thecomments = document.getElementsByClassName('commentblock-'+escape(data.url));
for(var i2=0; i2<thecomments.length; i2++) {
thecomments[i2].style.color = BloggerProfiles.color;
thecomments[i2].style.backgroundColor = BloggerProfiles.bgcolor;
}//end for thecomments
}//end if blogs.url == blogurl
}//end for blogs
}//end if data.blogs
}//end else
}//end callback
function showCommentPhotos(photoclass,linkclass,linknum,fullclass,blogurl,color,bgcolor) {
var comments, comlinks, i, node, re, by, blocks;
BloggerProfiles.blogurl = blogurl;
BloggerProfiles.color = color;
BloggerProfiles.bgcolor = bgcolor;
re = new RegExp( '^http://www.blogger.com/profile/\\d+', 'i' );
comments = document.getElementsByClassName(photoclass);
comlinks = document.getElementsByClassName(linkclass);
if(fullclass)
blocks = document.getElementsByClassName(fullclass);
else
blocks = [];
var profilesobj = {};
var profileurls = [];
for(i=0; i<comments.length; i++) {
by = comlinks[i].getElementsByTagName('a').item(linknum);
if(by && re.test(by.href)) {
comments[i].className += ' commentphoto-'+escape(by.href);
if(blocks && blocks[i])
blocks[i].className += ' commentblock-'+escape(by.href);
} else {
comments[i].className += ' commentphoto-nophoto'+i;
}//end if-else
if( !by || !re.test( by.href ) ) {BloggerProfiles.callbacks.profile({'url':'nophoto'+i,'photo':{'url':BloggerProfiles.noimage}});continue;}
if(!profilesobj[by.href])
profileurls.push(by.href);
profilesobj[by.href] = true;
}//end for
for(i=0; i<profileurls.length; i++)
writeScript('http://singpolymaplay.ning.com/bloggerProfile.php?xn_auth=no&url='+encodeURIComponent(profileurls[i]));
}//end function showCommentPhotos

Back to list