RSS Feed Finder

Find and display RSS feed links on webpages.

  1. // ==UserScript==
  2. // @name RSS Feed Finder
  3. // @namespace http://tampermonkey.net/
  4. // @author iamnobody
  5. // @version 1.3
  6. // @description Find and display RSS feed links on webpages.
  7. // @match *://*/*
  8. // @license MIT
  9. // @grant GM_setClipboard
  10. // ==/UserScript==
  11. // ==UserScript==
  12. // @name RSS Feed Finder
  13. // @namespace http://tampermonkey.net/
  14. // @version 1.5
  15. // @description Find and display RSS feed links on webpages.
  16. // @author iamnobody
  17. // @license MIT
  18. // @match *://*/*
  19. // @grant GM_setClipboard
  20. // ==/UserScript==
  21.  
  22. (function() {
  23. 'use strict';
  24.  
  25. // Create and style the floating button
  26. const rssButton = document.createElement('button');
  27. rssButton.innerHTML = '<img id="rss-icon" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Feed-icon.svg/20px-Feed-icon.svg.png">';
  28. rssButton.style.position = 'fixed';
  29. rssButton.style.top = 'calc(20px + 2cm)';
  30. rssButton.style.right = '20px';
  31. rssButton.style.backgroundColor = 'transparent';
  32. rssButton.style.border = 'none';
  33. rssButton.style.cursor = 'pointer';
  34. rssButton.style.zIndex = '9999';
  35. document.body.appendChild(rssButton);
  36.  
  37. // Function to find and display RSS feed links
  38. function findAndDisplayRSSFeeds() {
  39. const feedLinks = document.querySelectorAll('link[type="application/rss+xml"], link[type="application/atom+xml"], a[href$=".xml"]');
  40. if (feedLinks.length > 0) {
  41. const feedList = document.createElement('ul');
  42. feedList.style.listStyleType = 'none';
  43. feedList.style.backgroundColor = '#ffffff';
  44. feedList.style.padding = '10px';
  45. feedList.style.border = '1px solid #007bff';
  46. feedList.style.borderRadius = '5px';
  47. feedList.style.position = 'fixed';
  48. feedList.style.top = '50px';
  49. feedList.style.right = '20px';
  50. feedList.style.zIndex = '9999';
  51. feedLinks.forEach(link => {
  52. const listItem = document.createElement('li');
  53. listItem.textContent = link.href;
  54. feedList.appendChild(listItem);
  55. });
  56. document.body.appendChild(feedList);
  57. rssButton.style.display = 'block';
  58. } else {
  59. rssButton.style.display = 'none';
  60. alert('No RSS feeds found on this page.');
  61. }
  62. }
  63.  
  64. // Add click event listener to the RSS button
  65. rssButton.addEventListener('click', function() {
  66. findAndDisplayRSSFeeds();
  67. let feedLinkFound = false;
  68. const feedLinks = document.querySelectorAll('link[type="application/rss+xml"], link[type="application/atom+xml"], a[href$=".xml"]');
  69. feedLinks.forEach(link => {
  70. GM_setClipboard(link.href);
  71. feedLinkFound = true;
  72. });
  73. if (feedLinkFound) {
  74. alert('Link copied!');
  75. }
  76. });
  77.  
  78. // Check if there are any RSS feed links on page load
  79. window.addEventListener('load', function() {
  80. const feedLinks = document.querySelectorAll('link[type="application/rss+xml"], link[type="application/atom+xml"], a[href$=".xml"]');
  81. if (feedLinks.length > 0) {
  82. const rssNotification = document.createElement('div');
  83. rssNotification.id = 'rss-notification';
  84. rssNotification.style.width = '10px';
  85. rssNotification.style.height = '10px';
  86. rssNotification.style.backgroundColor = 'red';
  87. rssNotification.style.borderRadius = '50%';
  88. rssNotification.style.position = 'absolute';
  89. rssNotification.style.top = '0';
  90. rssNotification.style.right = '0';
  91. rssButton.appendChild(rssNotification);
  92. }
  93. });
  94. })();
  95.  
  96. (function() {
  97. 'use strict';
  98.  
  99. // Create and style the floating button
  100. const rssButton = document.createElement('button');
  101. rssButton.innerHTML = '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Feed-icon.svg/20px-Feed-icon.svg.png">';
  102. rssButton.style.position = 'fixed';
  103. rssButton.style.top = '20px';
  104. rssButton.style.right = '20px';
  105. rssButton.style.backgroundColor = 'transparent';
  106. rssButton.style.border = 'none';
  107. rssButton.style.cursor = 'pointer';
  108. rssButton.style.zIndex = '9999';
  109. document.body.appendChild(rssButton);
  110.  
  111. // Function to find and display RSS feed links
  112. function findAndDisplayRSSFeeds() {
  113. const feedLinks = document.querySelectorAll('link[type="application/rss+xml"], link[type="application/atom+xml"], a[href$=".xml"]');
  114. if (feedLinks.length > 0) {
  115. const feedList = document.createElement('ul');
  116. feedList.style.listStyleType = 'none';
  117. feedList.style.backgroundColor = '#ffffff';
  118. feedList.style.padding = '10px';
  119. feedList.style.border = '1px solid #007bff';
  120. feedList.style.borderRadius = '5px';
  121. feedList.style.position = 'fixed';
  122. feedList.style.top = '50px';
  123. feedList.style.right = '20px';
  124. feedList.style.zIndex = '9999';
  125. feedLinks.forEach(link => {
  126. const listItem = document.createElement('li');
  127. listItem.textContent = link.href;
  128. feedList.appendChild(listItem);
  129. });
  130. document.body.appendChild(feedList);
  131. } else {
  132. alert('No RSS feeds found on this page.');
  133. }
  134. }
  135.  
  136. // Add click event listener to the RSS button
  137. rssButton.addEventListener('click', function() {
  138. findAndDisplayRSSFeeds();
  139. GM_setClipboard(window.location.href);
  140. alert('Link copied!');
  141. });
  142. })();