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.

51 lines
1.3 KiB

4 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jquery.rss zotero example</title>
  5. <link
  6. rel="stylesheet"
  7. type="text/css"
  8. href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"
  9. />
  10. <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  11. <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  12. <script src="../dist/jquery.rss.min.js"></script>
  13. <script>
  14. var readTokenFromResponse = function (response, attr) {
  15. return $(response)
  16. .find("tr th:contains(" + attr + ")")
  17. .parent()
  18. .find("td")
  19. .text();
  20. };
  21. jQuery(function ($) {
  22. $("#rss-feeds").rss("https://www.bug.hr/rss", {
  23. entryTemplate: `<div>
  24. <h2>{title}</h2>
  25. {enclosure}
  26. </div><br>`,
  27. tokens: {
  28. year: function (entry, tokens) {
  29. return new Date(entry.publishedDate).getFullYear();
  30. },
  31. enclosure: function (entry, tokens) {
  32. if (entry.enclosure) {
  33. return `<img src="${entry.enclosure.url}" />`;
  34. }
  35. return "";
  36. },
  37. },
  38. });
  39. });
  40. </script>
  41. </head>
  42. <body>
  43. <div>
  44. <h1>jquery.rss zotero example</h1>
  45. <div id="rss-feeds"></div>
  46. </div>
  47. </body>
  48. </html>