Teachwiki

Html Sitemap Page Code For Bologger Blog

Jul 22nd, 2018
1,533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. <script type='text/javascript'>
  2.  
  3. var postTitle = new Array();
  4. var postUrl = new Array();
  5. var postPublished = new Array();
  6. var postDate = new Array();
  7. var postLabels = new Array();
  8. var postRecent = new Array();
  9. var sortBy = "titleasc";
  10. var numberfeed = 0;
  11.  
  12. function bloggersitemap(a) {
  13. function b() {
  14. if ("entry" in a.feed) {
  15. var d = a.feed.entry.length;
  16. numberfeed = d;
  17. ii = 0;
  18. for (var h = 0; h < d; h++) {
  19. var n = a.feed.entry[h];
  20. var e = n.title.$t;
  21. var m = n.published.$t.substring(0, 10);
  22. var j;
  23. for (var g = 0; g < n.link.length; g++) {
  24. if (n.link[g].rel == "alternate") {
  25. j = n.link[g].href;
  26. break
  27. }
  28. }
  29. var o = "";
  30. for (var g = 0; g < n.link.length; g++) {
  31. if (n.link[g].rel == "enclosure") {
  32. o = n.link[g].href;
  33. break
  34. }
  35. }
  36. var c = "";
  37. if ("category" in n) {
  38. for (var g = 0; g < n.category.length; g++) {
  39. c = n.category[g].term;
  40. var f = c.lastIndexOf(";");
  41. if (f != -1) {
  42. c = c.substring(0, f)
  43. }
  44. postLabels[ii] = c;
  45. postTitle[ii] = e;
  46. postDate[ii] = m;
  47. postUrl[ii] = j;
  48. postPublished[ii] = o;
  49. if (h < 10) {
  50. postRecent[ii] = true
  51. } else {
  52. postRecent[ii] = false
  53. }
  54. ii = ii + 1
  55. }
  56. }
  57. }
  58. }
  59. }
  60. b();
  61. sortBy = "titledesc";
  62. sortPosts(sortBy);
  63. sortlabel();
  64. displayToc();
  65. }
  66.  
  67. function sortPosts(d) {
  68. function c(e, g) {
  69. var f = postTitle[e];
  70. postTitle[e] = postTitle[g];
  71. postTitle[g] = f;
  72. var f = postDate[e];
  73. postDate[e] = postDate[g];
  74. postDate[g] = f;
  75. var f = postUrl[e];
  76. postUrl[e] = postUrl[g];
  77. postUrl[g] = f;
  78. var f = postLabels[e];
  79. postLabels[e] = postLabels[g];
  80. postLabels[g] = f;
  81. var f = postPublished[e];
  82. postPublished[e] = postPublished[g];
  83. postPublished[g] = f;
  84. var f = postRecent[e];
  85. postRecent[e] = postRecent[g];
  86. postRecent[g] = f
  87. }
  88. for (var b = 0; b < postTitle.length - 1; b++) {
  89. for (var a = b + 1; a < postTitle.length; a++) {
  90. if (d == "titleasc") {
  91. if (postTitle[b] > postTitle[a]) {
  92. c(b, a)
  93. }
  94. }
  95. if (d == "titledesc") {
  96. if (postTitle[b] < postTitle[a]) {
  97. c(b, a)
  98. }
  99. }
  100. if (d == "dateoldest") {
  101. if (postDate[b] > postDate[a]) {
  102. c(b, a)
  103. }
  104. }
  105. if (d == "datenewest") {
  106. if (postDate[b] < postDate[a]) {
  107. c(b, a)
  108. }
  109. }
  110. if (d == "orderlabel") {
  111. if (postLabels[b] > postLabels[a]) {
  112. c(b, a)
  113. }
  114. }
  115. }
  116. }
  117. }
  118.  
  119. function sortlabel() {
  120. sortBy = "orderlabel";
  121. sortPosts(sortBy);
  122. var a = 0;
  123. var b = 0;
  124. while (b < postTitle.length) {
  125. temp1 = postLabels[b];
  126. firsti = a;
  127. do {
  128. a = a + 1
  129. } while (postLabels[a] == temp1);
  130. b = a;
  131. sortPosts2(firsti, a);
  132. if (b > postTitle.length) {
  133. break
  134. }
  135. }
  136. }
  137.  
  138. function sortPosts2(d, c) {
  139. function e(f, h) {
  140. var g = postTitle[f];
  141. postTitle[f] = postTitle[h];
  142. postTitle[h] = g;
  143. var g = postDate[f];
  144. postDate[f] = postDate[h];
  145. postDate[h] = g;
  146. var g = postUrl[f];
  147. postUrl[f] = postUrl[h];
  148. postUrl[h] = g;
  149. var g = postLabels[f];
  150. postLabels[f] = postLabels[h];
  151. postLabels[h] = g;
  152. var g = postPublished[f];
  153. postPublished[f] = postPublished[h];
  154. postPublished[h] = g;
  155. var g = postRecent[f];
  156. postRecent[f] = postRecent[h];
  157. postRecent[h] = g
  158. }
  159. for (var b = d; b < c - 1; b++) {
  160. for (var a = b + 1; a < c; a++) {
  161. if (postTitle[b] > postTitle[a]) {
  162. e(b, a)
  163. }
  164. }
  165. }
  166. }
  167.  
  168.  
  169.  
  170. function displayToc() {
  171. var a = 0;
  172. var b = 0;
  173. while (b < postTitle.length) {
  174. temp1 = postLabels[b];
  175. document.write("");
  176. document.write('<div class="post-archive"><h4>' + temp1 + '</h4><div class="ct-columns">');
  177. firsti = a;
  178. do {
  179. document.write("<p>");
  180. document.write('<a " href="' + postUrl[a] + '">' + postTitle[a] + "");
  181. if (postRecent[a] == true) {
  182. document.write(' - <strong><span>New!</span></strong>')
  183. }
  184. document.write("</a></p>");
  185. a = a + 1
  186. } while (postLabels[a] == temp1);
  187. b = a;
  188. document.write("</div></div>");
  189. sortPosts2(firsti, a);
  190. if (b > postTitle.length) {
  191. break
  192. }
  193. }
  194. }
  195.  
  196. </script>
  197.  
  198. <script src="http://yourblog.blogspot.com/feeds/posts/default?max-results=9999&amp;alt=json-in-script&amp;callback=bloggersitemap"></script>
Add Comment
Please, Sign In to add comment