Advertisement
abuiyad

customizable-author-box-with-post-count Code

Nov 15th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <b:if cond='data:blog.pageType == &quot;item&quot;'>
  2. <script type='text/javascript'>
  3. //<![CDATA[
  4. // طريقة ظهور عدد موضوعات الكاتب داخل تعريفه
  5. //
  6. var aut_desc = {};
  7. var auth_url = {};
  8.  
  9. // اعدادات يمكنك استخدامها والتعديل عليها عند توفر أكثر من كاتب
  10.  
  11. var multiAuthor = false;        // اذا كان هناك أكثر من مؤلف يمكنك تغيير كلمة false الى true
  12. var onePost = "موضوع";
  13. var manyPosts = "موضوعات";
  14.  
  15. // يمكنك تغيير الاسماء على حسب اسم الكاتب أو المؤلف وكذلك التعديل على البيانات الخاصة به
  16.  
  17. aut_desc['اسم الأدمن'] = 'INFO <a href="BLOG URL">BLOG NAME</a> INFO.<br>روابط مفضلة: &nbsp; <a class="authorinfolink">رابط حسابه</a> &nbsp; - &nbsp; <a href="YOUTUBE CHANNEL">اسم قناته على اليوتيوب</a> &nbsp; - &nbsp; <a href="TWITTER ACCOUNT">اسم حسابه على تويتر</a>.';
  18.  
  19. aut_desc['اسم المؤلف الأول'] = 'INFO.';
  20. aut_desc['اسم المؤلف الثانى'] = 'INFO.';
  21. aut_desc['اسم المؤلف الثالث'] = 'INFO.';
  22.  
  23.  
  24. // يمكنك تغيير الرابط الذى يتضمن اسم الكاتب أو المؤلف
  25.  
  26. auth_url['سم الأدمن'] = 'LINK';
  27.  
  28. auth_url['اسم المؤلف الأول'] = 'LINK';
  29. auth_url['اسم المؤلف الثانى'] = 'LINK';
  30. auth_url['اسم المؤلف الثالث'] = 'LINK';
  31.  
  32.  
  33. // Configure CSS:
  34. //]]>
  35. </script>
  36. <style type='text/css'>
  37. .post-author-block {
  38.   display: none;
  39.   margin: 20px 0 0;
  40.   padding: 5px 10px;
  41.   background-color: #f0f0f0;
  42.   border: 1px solid #e0e0e0;
  43.   line-height: 1.6;
  44.   font-size: 120%;
  45. }
  46. .authorinfoname { font-weight: bold; }
  47. .authorinfoimage { float: right; margin-left: 8px; width:52px;}
  48. </style>
  49. <!-- Customize this div, which contains the author box: -->
  50. <div class='post-author-block'> <a class='authorinfolink'><img border='0' class='authorinfoimage' src='http://lh5.googleusercontent.com/-UQ9nUDFOVt0/AAAAAAAAAAI/AAAAAAAAI3I/f9E7vHvQ90Q/s512-c/photo.jpg'/></a>
  51.   <div><a class='authorinfolink'><span class='authorinfoname'/></a> &amp;ndash; كتب <span class='authorinfopostcount'>0</span> موضوعات <span class='authorinfopost'>مميزة</span> على <a href="http://abu-iyad.com/">مدونة أبو إياد</a>.</div>
  52.   <h2>مهندس مصري ومتابع جيد للأخبار والمستجدات التقنية والاعلام الاجتماعى. أحب القراءة والترجمة. كاتب فى مدونة عالم الإبداع ومشرف سابق بموقع نقطة التطوير. تابعنى على تويتر</h2>
  53.  
  54.   <div><span class='authorinfodescription'></span></div>
  55.   <div style='clear:both;'/>
  56. </div>
  57. <script type='text/javascript'>
  58. //<![CDATA[
  59. var authors = {};
  60. var ndxbase = 1;
  61. var auname = "";
  62. function getAuthorInfo(json) {
  63.   var authorName = "";
  64.   for(var i = 0 ; i < json.feed.entry.length ; i++ ) {
  65.     var entry = json.feed.entry[i];
  66.     authorName = entry.author[0].name.$t;
  67.     if(authors[authorName])
  68.       authors[authorName].count++;
  69.     else {
  70.       var aut = new Object();
  71.       aut.author = entry.author[0];
  72.       aut.count = 1;
  73.       authors[authorName] = aut;
  74.     }
  75.     if(!multiAuthor) break;
  76.   }
  77.   if(multiAuthor && json.feed.entry.length == 500) {
  78.     ndxbase += 500;
  79.     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>');
  80.     return;
  81.   }
  82.   if(!multiAuthor)
  83.     authors[authorName].count = json.feed.openSearch$totalResults.$t;
  84.   au = auname;
  85.   if(authors[au]) {
  86.     if(aut_desc[au] && aut_desc[au] != "")
  87.       $(".authorinfodescription").html(aut_desc[au]);
  88.     $(".authorinfopostpost").text(parseInt(authors[au].count) == 1 ? onePost : manyPosts);
  89.     $(".authorinfopostcount").text(authors[au].count);
  90.     if(authors[au].author.gd$image)
  91.       $(".authorinfoimage").attr("src", authors[au].author.gd$image.src);
  92.     $(".authorinfoimage").attr("title", au);
  93.     $(".authorinfolink").attr("title", au);
  94.     $(".authorinfoname").text(au);
  95.     if(authors[au].author.uri && authors[au].author.uri.$t != "")
  96.       $(".authorinfolink").attr("href", authors[au].author.uri.$t);
  97.     if(auth_url[au] && auth_url[au] != "")
  98.       $(".authorinfolink").attr("href", auth_url[au]);
  99.     $(".post-author-block").show();
  100.   }
  101. }
  102. //]]>
  103. auname = &quot;<data:post.author/>&quot;;
  104. //<![CDATA[
  105. 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>');
  106. //]]>
  107. </script>
  108. </b:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement