We have clarified our Privacy Statement. Please have a look at our changes.
Push send, receive post.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.0KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>{0}'s Preposter.us Blog</title>
  5. <meta charset='utf-8'>
  6. <meta name="viewport" content="width=device-width; initial-scale=1.0;">
  7. <link rel="stylesheet" href="css/reset.css" media="all" />
  8. <link rel="stylesheet" href="css/single-col.css" media="all" />
  9. </head>
  10. <body>
  11. <section>
  12. <header>
  13. <h1><span>{0}'s</span> Preposter.us Blog</h1>
  14. <h2><span>Posts</span></h2>
  15. </header>
  16. <article class="cols">
  17. <ul id="postlist"></ul>
  18. </article>
  19. <br>
  20. <div class="footer">
  21. hosted by <a style="color: red; text-decoration: none" href="https://preposter.us">preposter.us</a>
  22. </div>
  23. </section>
  24. <script>
  25. var serverProtocol = location.protocol;
  26. var serverHost = location.hostname;
  27. var serverPort = location.port;
  28. //var serverURL = serverProtocol + '//' + serverHost + ':' + serverPort;
  29. //var postListURL = serverURL + '/{1}/posts.json';
  30. var postListURL = 'posts.json';
  31. var postListReq = new XMLHttpRequest();
  32. postListReq.onload = renderList;
  33. postListReq.open('GET', postListURL, true);
  34. postListReq.send();
  35. function renderList(){
  36. var posts = JSON.parse(this.responseText).posts;
  37. posts.sort(function(a,b) { return Date.parse(b.post.date) - Date.parse(a.post.date) } )
  38. var postListHTML = '';
  39. for(var i=0;i<posts.length;i++){
  40. var postDate = new Date(posts[i].post.date);
  41. var dateString = (postDate.getMonth() + 1) + '/' + postDate.getDate() + '/' + postDate.getFullYear();
  42. postListHTML = postListHTML + '<li>' + dateString + '&nbsp;<a href="' + posts[i].post.slug + '.html">' + posts[i].post.title + '</a></li>\n';
  43. }
  44. var postList = document.getElementById('postlist');
  45. postList.innerHTML = postListHTML;
  46. }
  47. </script>
  48. </body>
  49. </html>