Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <b:if cond='data:blog.pageType == "item"'>
- <script type='text/javascript'>
- //<![CDATA[
- // Author box after post, with post count, for Blogger by MS-potilas 2012.
- // see http://yabtb.blogspot.fi/2012/06/customizable-author-box-with-post-count.html
- //
- var aut_desc = {};
- var auth_url = {};
- // CONFIGURATION
- var multiAuthor = true; // for multi author blogs set this to true
- var onePost = "post";
- var manyPosts = "posts";
- // you _should_ give description for each author, can use html with formatting, contact links, etc.:
- aut_desc['MS-potilas'] = 'I am a retired programmer who has multiple sclerosis. In my <a href="http://yabtb.blogspot.com/">YABTB blog</a> I share some of my Blogger hacks I have made.<br>Some links: <a class="authorinfolink">My Blogger Profile</a> - <a href="http://www.youtube.com/user/mspotilas">My YouTube channel</a> - <a href="http://pipes.yahoo.com/mspotilas">My Yahoo! Pipes</a>.';
- aut_desc['some other'] = 'Description of this other person.';
- // you _can_ override author links, but it is not necessary:
- auth_url['MS-potilas'] = 'http://www.blogger.com/profile/05137522196636058302';
- auth_url['some other'] = 'http://www.somelink.com/';
- // Configure CSS:
- //]]>
- </script>
- <style type='text/css'>
- .post-author-block {
- display: none;
- margin: 20px 0 0;
- padding: 5px 10px;
- background-color: #f0f0f0;
- border: 1px solid #e0e0e0;
- line-height: 1.6;
- font-size: 90%;
- }
- .authorinfoname { font-weight: bold; }
- .authorinfoimage { float: left; margin-right: 8px; width:48px;}
- </style>
- <!-- Customize this div, which contains the author box: -->
- <div class='post-author-block'>
- <h2>This post was written by</h2>
- <a class='authorinfolink'><img border='0' class='authorinfoimage' src=''/></a>
- <div><a class='authorinfolink'><span class='authorinfoname'/></a> &ndash; who has written <span class='authorinfopostcount'>0</span> great <span class='authorinfopostpost'>posts</span> on <a href="http://yabtb-demo1.blogspot.com/">YABTB demo blog</a>.</div>
- <div><span class='authorinfodescription'></span></div>
- <div style='clear:both;'/>
- </div>
- <script type='text/javascript'>
- //<![CDATA[
- var authors = {};
- var ndxbase = 1;
- var auname = "";
- function getAuthorInfo(json) {
- var authorName = "";
- for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
- var entry = json.feed.entry[i];
- authorName = entry.author[0].name.$t;
- if(authors[authorName])
- authors[authorName].count++;
- else {
- var aut = new Object();
- aut.author = entry.author[0];
- aut.count = 1;
- authors[authorName] = aut;
- }
- if(!multiAuthor) break;
- }
- if(multiAuthor && json.feed.entry.length == 500) {
- ndxbase += 500;
- document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&start-index='+ndxbase+'&alt=json-in-script&callback=getAuthorInfo"></'+'script>');
- return;
- }
- if(!multiAuthor)
- authors[authorName].count = json.feed.openSearch$totalResults.$t;
- au = auname;
- if(authors[au]) {
- if(aut_desc[au] && aut_desc[au] != "")
- $(".authorinfodescription").html(aut_desc[au]);
- $(".authorinfopostpost").text(parseInt(authors[au].count) == 1 ? onePost : manyPosts);
- $(".authorinfopostcount").text(authors[au].count);
- if(authors[au].author.gd$image)
- $(".authorinfoimage").attr("src", authors[au].author.gd$image.src);
- $(".authorinfoimage").attr("title", au);
- $(".authorinfolink").attr("title", au);
- $(".authorinfoname").text(au);
- if(authors[au].author.uri && authors[au].author.uri.$t != "")
- $(".authorinfolink").attr("href", authors[au].author.uri.$t);
- if(auth_url[au] && auth_url[au] != "")
- $(".authorinfolink").attr("href", auth_url[au]);
- $(".post-author-block").show();
- }
- }
- //]]>
- auname = "<data:post.author/>";
- //<![CDATA[
- document.write('<script type="text/javascript" src="http://'+window.location.hostname+'/feeds/posts/default?redirect=false&max-results=500&alt=json-in-script&callback=getAuthorInfo"></'+'script>');
- //]]>
- </script>
- </b:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement