50 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| (function() {
 | |
|   // Hide Save button if the feed link contains "/feed/830/entries"
 | |
|   function hideSaveButtonInArticle(article) {
 | |
|     const feedLink = article.querySelector("li.item-meta-info-title a");
 | |
|     if (feedLink && feedLink.href.indexOf("/feed/830/entries") !== -1) {
 | |
|       const btn = article.querySelector("button[data-save-entry]");
 | |
|       if (btn) btn.style.display = "none";
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   // Process list articles
 | |
|   function processArticles() {
 | |
|     document.querySelectorAll("article.item.entry-item").forEach(hideSaveButtonInArticle);
 | |
|   }
 | |
| 
 | |
|   // Observe mutations in the container of articles (for dynamic content)
 | |
|   const itemsContainer = document.querySelector(".items");
 | |
|   if (itemsContainer) {
 | |
|     // Process articles already in the DOM
 | |
|     processArticles();
 | |
| 
 | |
|     const observer = new MutationObserver(mutations => {
 | |
|       mutations.forEach(mutation => {
 | |
|         mutation.addedNodes.forEach(node => {
 | |
|           if (node.nodeType === Node.ELEMENT_NODE && node.matches("article.item.entry-item")) {
 | |
|             hideSaveButtonInArticle(node);
 | |
|           }
 | |
|         });
 | |
|       });
 | |
|     });
 | |
|     observer.observe(itemsContainer, { childList: true, subtree: true });
 | |
|   } else {
 | |
|     // Fallback if container is not found
 | |
|     window.addEventListener("load", processArticles);
 | |
|   }
 | |
| 
 | |
|   // Hide the Save button on the open article page
 | |
|   function hideSaveButtonInEntry() {
 | |
|     const entryPage = document.querySelector("section.entry");
 | |
|     if (entryPage) {
 | |
|       const websiteAnchor = entryPage.querySelector(".entry-meta .entry-website a");
 | |
|       if (websiteAnchor && websiteAnchor.href.indexOf("/feed/830/entries") !== -1) {
 | |
|         const btn = entryPage.querySelector("button[data-save-entry]");
 | |
|         if (btn) btn.style.display = "none";
 | |
|       }
 | |
|     }
 | |
|   }
 | |
|   window.addEventListener("load", hideSaveButtonInEntry);
 | |
| })();
 |