Aluf

Post titles to Blogger

Jan 25th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <b:if cond='data:blog.pageType == &quot;item&quot;'>
  2. <script type='text/javascript'>
  3. // إضافة الموضوع التالى والسابق أسفل كل تدوينة
  4. // by MS-potilas 2012. See http://abu-iyad.com
  5. //<![CDATA[
  6. //
  7. // Configuration:
  8. // In these you can use [title]:
  9. var olderLink = 'السابق &gt;&gt;<div class="blog-pager-older-link-title">[title]</div>';
  10. var newerLink = '&lt;&lt; التالى<div class="blog-pager-newer-link-title">[title]</div>';
  11. // In these you can use [date], [datetime], [title]:
  12. var olderTitle = 'Older Post - posted on [date]';
  13. var newerTitle = 'Newer Post - posted on [date]';
  14. // configuration ends
  15. //
  16. function setLink(selector, link, title, entry) {
  17. var htm = link.replace("[title]", entry.title.$t);
  18. $(selector).html(htm);
  19. var date = entry.published.$t.match(/\d+/g);
  20. date = new Date(date[0],date[1]-1,date[2],date[3],date[4],date[5]); // convert iso
  21. title = title.replace('[date]', date.toLocaleDateString());
  22. title = title.replace('[datetime]', date.toLocaleString());
  23. title = title.replace("[title]", entry.title.$t);
  24. $(selector).attr("title", title);
  25. }
  26. function setOlderLink(entry) { setLink("a.blog-pager-older-link", olderLink, olderTitle, entry); }
  27. function setNewerLink(entry) { setLink("a.blog-pager-newer-link", newerLink, newerTitle, entry); }
  28. $(window).load(function() {
  29. window.setTimeout(function() {
  30. var timestamp = $(".published").attr("title");
  31. if(timestamp && timestamp != "")
  32. $.getJSON("/feeds/posts/default?alt=json-in-script&published-min="+encodeURIComponent(timestamp)+"&max-results=0&callback=?", function(resp) {
  33. var postindex = parseInt(resp.feed.openSearch$totalResults.$t);
  34. if(postindex > 1)
  35. $.getJSON("/feeds/posts/summary?alt=json-in-script&start-index="+(postindex-1)+"&max-results=3&callback=?", function(resp) {
  36. setNewerLink(resp.feed.entry[0]);
  37. var postcount = parseInt(resp.feed.openSearch$totalResults.$t);
  38. var startindex = parseInt(resp.feed.openSearch$startIndex.$t);
  39. if(postcount - startindex > 1) setOlderLink(resp.feed.entry[2]);
  40. });
  41. else
  42. $.getJSON("/feeds/posts/summary?alt=json-in-script&start-index=2&max-results=1&callback=?", function(resp) { setOlderLink(resp.feed.entry[0]); });
  43. });
  44. }, 500);
  45. });
  46. //]]>
  47. </script>
  48. </b:if>
Add Comment
Please, Sign In to add comment