Created
July 7, 2022 22:31
-
-
Save WillMoggridge/dab7f1874d734cff381509bba604ca16 to your computer and use it in GitHub Desktop.
Autoload full articles in Inoreader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Autoload full articles in Inoreader | |
// @description Autoload full articles in Inoreader | |
// @version 1.0 | |
// @namespace WillMoggridge | |
// @author WillMoggridge | |
// @match https://www.inoreader.com/* | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
const whitelistFolderName = "_autoload"; | |
function autoloadFullArticle() { | |
const articleFeedName = document.querySelector('.feed_name_menu span a').innerHTML.trim(); | |
const loadFullArticleLink = document.querySelector('.icon-article_topbar_mobilize_empty'); | |
const folderNodes = document.querySelectorAll('#tree .parent_div.ld0'); | |
let whitelistNode = [...folderNodes].filter( | |
node => node.querySelector(".tree_link_folder").innerHTML.trim() == whitelistFolderName | |
)[0]; | |
if (whitelistNode) { | |
let feedLinks = whitelistNode.querySelectorAll(".child_div .tree_link"); | |
let whitelistFeedNames = [...feedLinks].map(link => link.innerHTML.trim()) | |
if (whitelistFeedNames.includes(articleFeedName)) { | |
loadFullArticleLink.click(); | |
} | |
} | |
} | |
function tryAutoloadFullArticle() { | |
if (window.location.pathname.includes('article/')) { | |
setTimeout(() => { | |
try { | |
autoloadFullArticle(); | |
} catch (err) { | |
console.log('Error autoloading full content'); | |
} | |
}, 200); | |
} | |
} | |
tryAutoloadFullArticle() | |
window.onpopstate = tryAutoloadFullArticle | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment