inoreader full

inoreader full content in iframe

Versione datata 23/03/2022. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         inoreader full
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  inoreader full content in iframe
// @author       You
// @match        https://www.inoreader.com/*
// @include      *
// @icon         https://www.google.com/s2/favicons?sz=64&domain=inoreader.com
// @grant        none
// @license           Apache-2.0
// ==/UserScript==

(function() {
    'use strict';
    const tagArr=['morss-wechat-rss']//允许跨域的文件夹放这里
    function includesTags(){
        const firstTag=document.querySelector('.article_tags').firstChild.textContent
        return tagArr.includes(firstTag)
    }
    let lastUrl
    setInterval(interval,500)
    function interval(){
        const articleTitle=document.querySelector('.article_title ')
        if(!articleTitle) return
        if (!includesTags()) return
        const articleUrl=document.querySelector('.article_title a').href
        const articleArr = document.querySelector('#reader_pane').querySelectorAll('.article')
        if(lastUrl!=articleUrl){
            lastUrl=articleUrl
            console.log('正在替换iframe:',articleUrl)
            let articleContent=document.querySelector('.article_content')
            const frame=createFrame(articleUrl,articleContent)
            Array.from(articleContent.childNodes).forEach((i)=>articleContent.removeChild(i))
            articleContent.appendChild(frame)
        }else{
            //实时调整下高度?跨域好像不太行
        }
    }
    function getNextArrHeight(element){
        let arr=[]
        let next=element.nextElementSibling
        while (next!=null){
            arr.push(next)
            next=next.nextElementSibling
        }
        return arr.reduce(  (previousValue, currentValue) => previousValue + currentValue.clientHeight ,0)
    }

    function createFrame(url,articleContent){
        console.log('click',url)
        const iframeElement = document.createElement(`iframe`);
        iframeElement.className = `articleEmbed`;
        iframeElement.src = url
        iframeElement.style.width="100%";
        iframeElement.style.height=`calc(100vh - ${getNextArrHeight(articleContent)}px)`;//没啥意义,就先这样吧
        iframeElement.style.height="100vh";
        return iframeElement
    }

    const articleTitle=document.querySelector('.article_title ')
    const articleArr = document.querySelector('#reader_pane').querySelectorAll('.article')
    articleArr.forEach((i)=>{
        i.onclick=()=>(console.log(1234))
        const frame=createFrame(i)

        let articleContent=document.querySelector('.article_content')
        Array.from(articleContent.children).forEach((i)=>articleContent.removeChild(i))
        articleContent.appendChild(overlayContainerElement)
    })


})();