feat(miniflux): hide Save button for feed 830
This commit is contained in:
parent
ba8e8f5fb8
commit
c5786412ea
49
miniflux_scripts/hide_feed_save_btn.js
Normal file
49
miniflux_scripts/hide_feed_save_btn.js
Normal file
@ -0,0 +1,49 @@
|
||||
(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);
|
||||
})();
|
Loading…
x
Reference in New Issue
Block a user