RSS+ : Show Site All RSS

Show All RSS Of The Site (If Any)

// ==UserScript==
// @name         RSS+ : Show Site All RSS
// @name:zh      RSS+ : 显示当前网站所有的 RSS
// @name:zh-CN   RSS+ : 显示当前网站所有的 RSS
// @name:zh-TW   RSS+ : 顯示當前網站所有的 RSS
// @name:ja      RSS+ : 現在のサイトのRSSを表示
// @name:ko      RSS+ : 현재 사이트의 RSS 표시
// @name:pt-PT   RSS+ : Mostrar todos os RSS do site
// @name:pt-BR   RSS+ : Mostrar todos os RSS do site
// @name:fr      RSS+ : Afficher tous les flux RSS du site
// @description         Show All RSS Of The Site (If Any)
// @description:zh      显示当前网站的所有 RSS(如果有的话)
// @description:zh-CN   显示当前网站的所有 RSS(如果有的话)
// @description:zh-TW   顯示當前網站的所有 RSS(如果有的话)
// @description:ja      サイトのすべてのRSSを表示します (あれば)
// @description:ko      웹 사이트의 모든 RSS 를 표시합니다 (있는 경우)
// @description:pt-PT   Mostra todos os feeds RSS do site (se houver)
// @description:pt-BR   Mostra todos os feeds RSS do site (se houver)
// @description:fr      Montre tous les flux RSS du site (s'il y en a)
// @license      GPL3.0
// @version      1.1.1

// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAgAElEQVR4Xu1dC5hbVbX+18m0w6sCnZxMefkAlOKDV5XmpC23KCAPLyiviw9QQCm0zUkLIg/1WpWnRdqctGCRl1cUBHy0iEVA4dI2JwUrCKJFQRS40MnJlEIRmOnkrPvtTGaYSZOZZO99MplOzvf5gczea6299vmz99l7rX8Rmk/TA00PVPQANX3T9EDTA5U90ARI8+1oemAIDzQBEuDrkbvW2gMhTAYw2TewBxgTDNBOIH+CzzQBEP8fO4l/+sAEYoj/BiZsNoDNADb7wBvinwbxZrCx2Qe/AfF3H/8HYD3yWB8+3xX/3nwC8EATIBqcmktZk/M+9idgMgiTDWAyM/YH9b7wgT+MzUT4qy8Aw1jPwPqQgb+G4+76wHVv4wqaAKlxgr2bpk3gN3pmGI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mQWj02su2bAKmz/5sAqbPDFdU1AaLowFq7NwFSq8dGtn0TIHX2fxMgdXa4oromQBQdWGv3rGNlCTBr7SfaM+BFbDci07fZR84DTYDI+U26l2xqcVHhw6btqhJcSNs+Fjs2AVLnWfdS1jIwzpFSS7jBjLsiaLP51MkDTYDUydF9arKOdRYBN8moZeDsiO3eLNO32UfOA02AyPlNqZfnRJcDdHxtQniFaWdOqK1Ps7WqB5oAUfWgZP9aT7NM223OlaSvVbo1na7iPcW+HcnoAoPoW0OJ8Zm/3Z7ILFBU1ewu6YEmQCQdp6ub50Q/T6CPM7AfQPv1yuVnCHiGwb8fbSXmdPmlUeQ0AdIoM9G0oyE90ARIQ05L06hG8UATII0yE007GtID/w/Jiqv1e0ZE2QAAAABJRU5ErkJggg==
// @author       Wizos
// @namespace    https://blog.wizos.me
// @supportURL   wizos@qq.com
// @match        http://*/*
// @match        https://*/*
// @require      https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.4.4/qrcode.min.js
// @resource     RulerJs  https://fastly.jsdelivr.net/gh/wizos/rssplus@2.0.3/Ruler.js
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant        GM_setClipboard
// @grant        GM_notification
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @grant        unsafeWindow
// @connect      rssplus.vercel.app
// @noframes
// @run-at     document-idle
// ==/UserScript==

// 2024.10.20_1.1.1  1.修复未开启远程规则的问题。2.增加更多的网站适配。
// 2024.10.08_1.0.9  1.增加支持葡萄牙语和法语(感谢Filipe Mota (BlackSpirits)提供的翻译)。2.支持 RSSHub 访问密钥。3.重构代码。
// 2022.10.18_1.0.8  1.修复 TinyTinyRSS 订阅地址错误问题。2.修复 Bug。
// 2022.07.04_1.0.7  支持用Miniflux订阅(感谢Sevichecc提供的代码https://gist.github.com/Sevichecc/f5608c4ad52e71d98f6fcf74110369df)
// 2022.07.04_1.0.6  修复火狐上因为GSAP库导致无法使用问题
// 2022.05.20_1.0.5  1.解决 jsdelivr 在中国被墙的问题。2.修复bilibili video页面获取feed标题异常问题。
// 2022.04.18_1.0.4  修复导致网页加载卡顿的问题。
// 2022.04.05_1.0.2  1.受unsafe-eval影响,无法本地执行规则时使用远程规则,改用 rssplus.vercel.app 接口。2.调整 UI,每次获取到新 RSS 都同步到 UI 中。3.精简设置项。4.监听 URL 变化,同步获取新的 RSS。
// 2022.04.02_1.0.0  1.将远程规则放到 GitHub。2.修复订阅 RSS 网址的转义问题。
// 2021.12.17_0.9.2  1.支持设置 FreshRSS 一键订阅。2.支持设置带端口的网址。
// 2021.02.24_0.9.1  1.支持开启/关闭二维码。
// 2021.02.19_0.9.0  1.支持鼠标悬停在订阅链接上时展示其二维码,方便扫码订阅。
// 2021.02.05_0.8.1  1.url参数用base64编码,防止服务端获取url参数时,漏掉query部分的数据。
// 2021.02.03_0.8.0  1.支持小屏幕展示。2.支持设置 TinyTinyRSS 服务的域名。
// 2021.01.05_0.7.3  1.改用 GM_xmlhttpRequest。2.改用 rssfinder.vercel.app 接口。
// 2020.12.16_0.7.2  1.修复 bug。
// 2020.12.06_0.7.1  1.调整搞定。2.优化代码。
// 2020.11.16_0.7.0  1.支持设置 InoReader 服务的域名。2.在打印页面时隐藏。3.修复影响页面样式的问题。
// 2020.09.11_0.6.4  1.支持 RSSHub 服务器为 IP 地址。2.被识别的 RSS 地址不再转换为小写(因为 news.google.com 的小写地址打不开)
// 2020.04.28_0.6.3  修复改了脚本name导致无法更新的bug。
// 2020.04.27_0.6.2  修复rsshub domain默认为undefined的bug。
// 2020.04.26_0.6.1  支持设置 RSSHub 服务的域名。
// 2020.03.01_0.6    1.可设置点击“订阅”时打开的rss服务商(feedly,inoreadly)。2.修复火狐浏览器下无法展示的问题。
// 2019.09.29_0.5    增加hexo站点的rss嗅探规则。
// 2019.04.26_0.4.2  1.修复默认圆圈状态下宽度太宽,导致遮挡下层页面事件触发的问题。2.将icon由字体改为svg形式,修复部分站点无法显示icon的问题。3.优化RSS没有title时的默认名称。
// 2018.11.10_0.4.1  关闭发现RSS后的h5通知
// 2018.10.29_0.4    1.在无法链接服务器时也能展示本地的RSS;2.针对开启 Content-Security-Policy 的网站直接展示本地的RSS;3.发现RSS后,进行h5通知
// 2018.10.23_0.4    1.增加识别为 wordpress 站点时,尝试使用/feed后缀;2.增加多语言支持
// 2018.10.16_0.3    1.改为iframe方式显示,兼容性更好;2.改为post方式传递页面地址;
// 2018.10.14_0.2    第一版 RSS+ 成型;
// 2018.09.16_0.1    在 RSS+Atom Feed Subscribe Button Generator 脚本基础上增加连接后端获取feed的方式;

(function() {
    'use strict';

    // 过滤掉明确不包含 RSS 源的URL
    if (location.href.match(/(api\.wizos\.me)|(feedly\.com\/i\/subscription)|(inoreader\.com\/feed\/http)/i)) {
        return;
    }

    // 国际化文本
    const i18n = {
        zh: {
            noTitle: "无标题",
            copied: "已复制",
            copy: "复制",
            copySucceeded: "复制成功",
            follow: "订阅",
            found: "发现 ",
            feed: "订阅源数量:",
            clickToView: "点击右下角的数字查看",
            useFeedly: "使用 Feedly 订阅",
            useInoreader: "使用 Inoreader 订阅",
            useTinytinyrss: "使用 Tiny Tiny RSS 订阅",
            useFreshrss: "使用 FreshRSS 订阅",
            useMiniflux: "使用 Miniflux 订阅",
            settingRSShubDomain: "设置 RSSHub 的域名",
            settingRSShubAccessKey: "设置 RSSHub 的访问密钥",
            settingInoreaderDomain: "设置 Inoreader 的域名",
            settingTinytinyrssDomain: "设置 Tiny Tiny RSS 的域名",
            settingFreshrssDomain: "设置 FreshRSS 的域名",
            settingMinifluxDomain: "设置 Miniflux 的域名",
            domainIsWrong: "服务器地址格式有误,请检查",
            enableQRCode: "启用/禁用二维码",
            enabled: "已启用",
            disabled: "已禁用",
            close: "关闭"
        },
        zhtw: {
            noTitle: "無標題",
            copied: "已複製",
            copy: "複製",
            copySucceeded: "複製成功",
            follow: "訂閱",
            found: "發現 ",
            feed: "訂閱源數量:",
            clickToView: "點擊右下角的數字查看",
            useFeedly: "使用 Feedly 訂閱",
            useInoreader: "使用 Inoreader 訂閱",
            useTinytinyrss: "使用 Tiny Tiny RSS 訂閱",
            useFreshrss: "使用 FreshRSS 訂閱",
            useMiniflux: "使用 Miniflux 訂閱",
            settingRSShubDomain: "設定 RSSHub 的網域",
            settingRSShubAccessKey: "設定 RSSHub 的存取密鑰",
            settingInoreaderDomain: "設定 Inoreader 的網域",
            settingTinytinyrssDomain: "設定 Tiny Tiny RSS 的網域",
            settingFreshrssDomain: "設定 FreshRSS 的網域",
            settingMinifluxDomain: "設定 Miniflux 的網域",
            domainIsWrong: "伺服器位址格式有誤,請檢查",
            enableQRCode: "啟用/停用 QR 碼",
            enabled: "已啟用",
            disabled: "已停用",
            close: "關閉"
        },
        en: {
            noTitle: "Untitled",
            copied: "Copied",
            copy: "Copy",
            copySucceeded: "Copy succeeded",
            follow: "Subscribe",
            found: "Found ",
            feed: "Number of feeds: ",
            clickToView: "Click the number in the bottom right to view",
            useFeedly: "Use Feedly subscription",
            useInoreader: "Use Inoreader subscription",
            useTinytinyrss: "Use Tiny Tiny RSS subscription",
            useFreshrss: "Use FreshRSS subscription",
            useMiniflux: "Use Miniflux subscription",
            settingRSShubDomain: "Set RSSHub domain",
            settingRSShubAccessKey: "Set RSSHub access key",
            settingInoreaderDomain: "Set Inoreader domain",
            settingTinytinyrssDomain: "Set Tiny Tiny RSS domain",
            settingFreshrssDomain: "Set FreshRSS domain",
            settingMinifluxDomain: "Set Miniflux domain",
            domainIsWrong: "Error in domain name format. Please check",
            enableQRCode: "Enable/disable QR code",
            enabled: "Enabled",
            disabled: "Disabled",
            close: "Close"
        },
        ja: {
            noTitle: "無題",
            copied: "コピーしました",
            copy: "コピー",
            copySucceeded: "コピーに成功しました",
            follow: "購読",
            found: "見つかりました ",
            feed: "フィード数:",
            clickToView: "右下の数字をクリックして表示",
            useFeedly: "Feedly で購読",
            useInoreader: "Inoreader で購読",
            useTinytinyrss: "Tiny Tiny RSS で購読",
            useFreshrss: "FreshRSS で購読",
            useMiniflux: "Miniflux で購読",
            settingRSShubDomain: "RSSHub のドメインを設定",
            settingRSShubAccessKey: "RSSHub のアクセスキーを設定",
            settingInoreaderDomain: "Inoreader のドメインを設定",
            settingTinytinyrssDomain: "Tiny Tiny RSS のドメインを設定",
            settingFreshrssDomain: "FreshRSS のドメインを設定",
            settingMinifluxDomain: "Miniflux のドメインを設定",
            domainIsWrong: "サーバーアドレスの形式に問題があります。確認してください",
            enableQRCode: "QRコードの有効/無効を切り替え",
            enabled: "有効",
            disabled: "無効",
            close: "閉じる"
        },
        ko: {
            noTitle: "제목 없음",
            copied: "복사됨",
            copy: "복사",
            copySucceeded: "복사 성공",
            follow: "구독",
            found: "발견 ",
            feed: "피드 수: ",
            clickToView: "오른쪽 하단의 숫자를 클릭하여 보기",
            useFeedly: "Feedly로 구독",
            useInoreader: "Inoreader로 구독",
            useTinytinyrss: "Tiny Tiny RSS로 구독",
            useFreshrss: "FreshRSS로 구독",
            useMiniflux: "Miniflux로 구독",
            settingRSShubDomain: "RSSHub 도메인 설정",
            settingRSShubAccessKey: "RSSHub 액세스 키 설정",
            settingInoreaderDomain: "Inoreader 도메인 설정",
            settingTinytinyrssDomain: "Tiny Tiny RSS 도메인 설정",
            settingFreshrssDomain: "FreshRSS 도메인 설정",
            settingMinifluxDomain: "Miniflux 도메인 설정",
            domainIsWrong: "서버 주소 형식에 문제가 있습니다. 확인해 주세요",
            enableQRCode: "QR 코드 활성화/비활성화",
            enabled: "활성화됨",
            disabled: "비활성화됨",
            close: "닫기"
        },
        ptpt: {
            noTitle: "Sem título",
            copied: "Copiado",
            copy: "Copiar",
            copySucceeded: "Cópia bem-sucedida",
            follow: "Seguir",
            found: "Encontrado ",
            feed: "Número de feeds: ",
            clickToView: "Clique no número no canto inferior direito para visualizar",
            useFeedly: "Utilizar a subscrição do Feedly",
            useInoreader: "Utilizar a subscrição do InoReader",
            useTinytinyrss: "Utilizar a subscrição do TinyTinyRSS",
            useFreshrss: "Utilizar a subscrição do FreshRSS",
            useMiniflux: "Utilizar a subscrição do Miniflux",
            settingRSShubDomain: "Definir o domínio do RSSHub",
            settingRSShubAccessKey: "Definir a chave de acesso do RSSHub",
            settingInoreaderDomain: "Definir o domínio do InoReader",
            settingTinytinyrssDomain: "Definir o domínio do TinyTinyRSS",
            settingFreshrssDomain: "Definir o domínio do FreshRSS",
            settingMinifluxDomain: "Definir o domínio do Miniflux",
            domainIsWrong: "Erro no formato do nome do domínio. Por favor, verifica-o",
            enableQRCode: "Ativar/desativar o código QR",
            enabled: "Ativado",
            disabled: "Desativado",
            close: "Fechar"
        },
        ptbr: {
            noTitle: "Sem título",
            copied: "Copiado",
            copy: "Copiar",
            copySucceeded: "Copiado com sucesso",
            follow: "Seguir",
            found: "Encontrado ",
            feed: "Número de feeds: ",
            clickToView: "Clique no número no canto inferior direito para visualizá-lo",
            useFeedly: "Usar assinatura do Feedly",
            useInoreader: "Usar assinatura do Inoreader",
            useTinytinyrss: "Usar assinatura do Tiny Tiny RSS",
            useFreshrss: "Usar assinatura do FreshRSS",
            useMiniflux: "Usar assinatura do Miniflux",
            settingRSShubDomain: "Configurar domínio do RSSHub",
            settingRSShubAccessKey: "Configurar chave de acesso do RSSHub",
            settingInoreaderDomain: "Configurar domínio do Inoreader",
            settingTinytinyrssDomain: "Configurar domínio do Tiny Tiny RSS",
            settingFreshrssDomain: "Configurar domínio do FreshRSS",
            settingMinifluxDomain: "Configurar domínio do Miniflux",
            domainIsWrong: "Erro no formato do nome de domínio. Por favor, verifique",
            enableQRCode: "Ativar/desativar código QR",
            enabled: "Ativado",
            disabled: "Desativado",
            close: "Fechar"
        },
        fr: {
            noTitle: "Sans titre",
            copied: "Copié",
            copy: "Copier",
            copySucceeded: "Copie réussie",
            follow: "S'abonner",
            found: "Trouvé ",
            feed: "Nombre de flux : ",
            clickToView: "Cliquer sur le numéro en bas à droite pour le visualiser",
            useFeedly: "Utiliser l'abonnement Feedly",
            useInoreader: "Utiliser l'abonnement Inoreader",
            useTinytinyrss: "Utiliser l'abonnement Tiny Tiny RSS",
            useFreshrss: "Utiliser l'abonnement FreshRSS",
            useMiniflux: "Utiliser l'abonnement Miniflux",
            settingRSShubDomain: "Configuration du domaine RSSHub",
            settingRSShubAccessKey: "Configuration la clé d'accès de RSSHub",
            settingInoreaderDomain: "Configuration du domaine Inoreader",
            settingTinytinyrssDomain: "Configuration du domaine TinyTinyRSS",
            settingFreshrssDomain: "Configuration du domaine FreshRSS",
            settingMinifluxDomain: "Configuration du domaine Miniflux",
            domainIsWrong: "Erreur dans le format du nom de domaine. Veuillez vérifier",
            enableQRCode: "Activer/désactiver le code QR",
            enabled: "Activé",
            disabled: "Désactivé",
            close: "Fermer"
        }
    };

    const ICON_CLOSE = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'
    i18n.zhcn = i18n.zh;
    // 获取当前语言
    const lang = (navigator.language || 'en').replace('-', "").toLowerCase();
    const t = i18n[lang] || i18n.en;

    GM_registerMenuCommand(t.useFeedly, function() {
        GM_setValue("rss_service", "feedly");
    });
    GM_registerMenuCommand(t.useInoreader, function() {
        const input = window.prompt(t.settingInoreaderDomain, GM_getValue("inoreader_domain", "https://www.inoreader.com"));
        if (input !== null) {
            if (isValidUrl(input)) {
                GM_setValue("inoreader_domain", input);
                GM_setValue("rss_service", "inoreader");
            } else {
                alert(t.domainIsWrong);
            }
        }
    });
    GM_registerMenuCommand(t.useTinytinyrss, function() {
        const input = window.prompt(t.settingTinytinyrssDomain, GM_getValue("tinytinyrss_domain", "https://www.example.com"));
        if (input !== null) {
            if (isValidUrl(input)) {
                GM_setValue("tinytinyrss_domain", input);
                GM_setValue("rss_service", "tinytinyrss");
            } else {
                alert(t.domainIsWrong);
            }
        }
    });
    GM_registerMenuCommand(t.useFreshrss, function() {
        const input = window.prompt(t.settingFreshrssDomain, GM_getValue("freshrss_domain", "https://www.example.com"));
        if (input !== null) {
            if (isValidUrl(input)) {
                GM_setValue("freshrss_domain", input);
                GM_setValue("rss_service", "freshrss");
            } else {
                alert(t.domainIsWrong);
            }
        }
    });
    GM_registerMenuCommand(t.useMiniflux, function() {
        const input = window.prompt(t.settingMinifluxDomain, GM_getValue("miniflux_domain", "https://www.example.com"));
        if (input !== null) {
            if (isValidUrl(input)) {
                GM_setValue("miniflux_domain", input);
                GM_setValue("rss_service", "miniflux");
            } else {
                alert(t.domainIsWrong);
            }
        }
    });
    GM_registerMenuCommand(t.enableQRCode, function() {
        if (!GM_getValue("enable_qr_code", true)) {
            GM_setValue("enable_qr_code", true);
            GM_notification({
                text: t.enabled,
                title: t.enableQRCode,
                timeout: 2000
            });
        } else {
            GM_setValue("enable_qr_code", false);
            GM_notification({
                text: t.disabled,
                title: t.enableQRCode,
                timeout: 2000
            });
        }
    });

    GM_registerMenuCommand(t.settingRSShubDomain, function() {
        const input = window.prompt(t.settingRSShubDomain, GM_getValue("rsshub_domain", "https://rsshub.app"));
        if (input !== null) {
            if (isValidUrl(input)) {
                GM_setValue("rsshub_domain", input);
            } else {
                alert(t.domainIsWrong);
            }
        }
    });

    GM_registerMenuCommand(t.settingRSShubAccessKey, function() {
        const input = window.prompt(t.settingRSShubAccessKey, GM_getValue("rsshub_access_key"));
        if (input !== null) {
            GM_setValue("rsshub_access_key", input);
        }
    });

    // 主要功能类
    const feeds = new Set();
    let rpDiv;
    let rpStyle;
    let rpIframe;
    let rpDocument;
    let rpBadge;
    let rpDialog;
    let rpDialogTitle;
    let rpDialogFeeds;

    // 检测Feed
    function detectFeeds() {
        detectKnownFeeds();
        detectPotentialFeeds();
        findCloudFeeds();
    }

    // 检测已知的Feed
    // 获取在<head>的<link>元素中,已经声明为RSS的链接
    function detectKnownFeeds() {
        const links = document.getElementsByTagName('link');
        for (const link of links) {
            if (link.type && (link.type.match(/.+\/(rss|rdf|atom)/i) || link.type.match(/^text\/xml$/i))) {
                addFeed(link.title || document.title, link.href);
            }
        }
    }

    // 检测潜在的Feed
    function detectPotentialFeeds() {
        // links 属性返回一个文档中所有具有 href 属性值的 <area> 元素与 <a> 元素的集合
        let links = document.links;
        for (const link of links) {
            const href = link.href;
            //if (href.match(/\/(rss|feed|atom)(\.(xml|rss|atom))?$/i)) {
            //addFeed(link.textContent || document.title, href);
            //}
            if (
                href.match(/^(https|http|ftp|feed).*([\.\/]rss([\.\/]xml|\.aspx|\.jsp|\/)?$|\/node\/feed$|\/feed(\.xml|\/$|$)|\/rss\/[a-z0-9]+$|[?&;](rss|xml)=|[?&;]feed=rss[0-9.]*$|[?&;]action=rss_rc$|feeds\.feedburner\.com\/[\w\W]+$)/i)
                || href.match(/^(https|http|ftp|feed).*\/atom(\.xml|\.aspx|\.jsp|\/)?$|[?&;]feed=atom[0-9.]*$/i)
                || href.match(/^(https|http|ftp|feed).*(\/feeds?\/[^.\/]*\.xml$|.*\/index\.xml$|feed\/msgs\.xml(\?num=\d+)?$)/i)
                || href.match(/^(https|http|ftp|feed).*\.rdf$/i)
                || href.match(/^(rss|feed):\/\//i)
                || href.match(/^(https|http):\/\/feed\./i)
            ) {
                addFeed(link.title || link.textContent || link.innerText || document.title, href);
            }
        }

        links = document.querySelectorAll("html > head > link");
        for (const link of links) {
            if (link.href.match(/(wp-content)/i)) {
                checkFeed(document.location.protocol + '//' + document.domain);
                break;
            }
        }

        links = document.querySelectorAll("html > body footer a");
        for (const link of links) {
            if (link.href.match(/(bitcron\.com|typecho\.org|hexo\.io)/i)) {
                checkFeed(document.location.protocol + '//' + document.domain);
                break;
            }
        }
    }

    function findCloudFeeds() {
        const url = optimizeLink(location.href);
        const res = document.documentElement.outerHTML;
        return function(jsStr, url, res) {
            try {
                if (isEmpty(jsStr)) {
                    showWithCloudFeeds(url);
                    return;
                }
                const Ruler = Function(`"use strict";return (${jsStr})`)(); //looseJsonParse(jsStr);

                const list = Ruler.find(url, res);
                if (!list) {
                    return;
                }
                list.forEach(element => {
                    addFeed(element.title || document.title, element.link);
                });
            } catch (e) {
                console.error("报错:", e);
                showWithCloudFeeds(url);
            }
        }.call(window, GM_getResourceText('RulerJs'), url, res);
    }

    function showWithCloudFeeds(url) {
        console.log("请求远程:" + url);
        GM_xmlhttpRequest({
            method: "get",
            url: `https://rssplus.vercel.app/api/find.js?url=${encodeURIComponent(url)}`,
            onload: response => {
                if (response.status !== 200) {
                    return;
                }

                const obj = JSON.parse(response.responseText);

                if (!obj) {
                    return;
                }
                obj.forEach(element => {
                    addFeed(element.title || document.title, element.link);
                });
            }
        });
    }

    function checkFeed(href) {
        ['/feed', '/rss', '/rss.xml', '/atom.xml', '/feed.xml', '/?feed=rss2', '/?feed=rss'].forEach(suffix => {
            GM_xmlhttpRequest({
                method: "HEAD",
                url: href + suffix,
                onload: response => {
                    if (response.status === 200) {
                        addFeed(document.title, href + suffix);
                    }
                }
            });
        });
    }

    function optimizeLink(link) {
        if (link.match(/douban\.com\/people/i)) {
            const src = document.querySelector("#profile > div > div.bd > div.basic-info > div.uhead-wrap > img.userface").src;
            const m = src.match(/ul(\d+)-/i);
            link = "https://www.douban.com/people/" + m[1];
        }
        return link;
    }

    function isEmpty(str) {
        return str.trim().length === 0;
    }

    // 添加Feed
    function addFeed(title, url) {
        if (url.match(/(api\.wizos\.me)|(feedly\.com\/i\/subscription)|(inoreader\.com\/feed\/http)/i)) {
            return;
        }

        if (feeds.size === 0){
            initUI();
        }
        const forDetectionUrl = url.toLowerCase();
        // console.log("发现RSS:" + title + " => " + url + ", 是否包含:" + feeds.has(forDetectionUrl));

        if (!feeds.has(forDetectionUrl)) {
            feeds.add(forDetectionUrl);
            if(url.match(/^https*:\/\/rsshub.app/)){
                const rsshubDomain = GM_getValue("rsshub_domain");
                if(rsshubDomain != null && rsshubDomain !== ""){
                    url = url.replace(/^https*:\/\/rsshub.app/, rsshubDomain);
                }

                const rsshubAccessKey = GM_getValue("rsshub_access_key");
                if(rsshubAccessKey != null && rsshubAccessKey !== ""){
                    const uri = new URL(url);
                    uri.searchParams.set('key', rsshubAccessKey);
                    url = uri.href;
                }
            }

            updateBadge();
            updateDialog(title || t.noTitle, url);
        }
    }
    // 初始化UI
    function initUI() {
        rpStyle = document.createElement('style');
        rpStyle.textContent = `
@media print {
    #rss-plus {
        display: none;
    }
}

#rss-plus {
    position: fixed;
    bottom: 60px;
    right: 5px;
    z-index: 9999;
}

#rss-plus > iframe {
    display: block !important;
    max-width: 100% !important;
    border: 0px !important;
    border-radius: 5px !important;
    margin: 0px !important;
}
            `;
        document.head.appendChild(rpStyle);

        rpDiv = document.createElement('div');
        rpDiv.id = 'rss-plus';
        document.body.appendChild(rpDiv);

        rpIframe = document.createElement("iframe");
        rpIframe.id = "rss-plus-iframe";
        //rpIframe.name = "rssPlusEnvironment";
        rpIframe.allowTransparency = "true";
        if (navigator.userAgent.indexOf("Firefox") !== -1) {
            rpIframe.src = "javascript:";
        }
        rpDiv.appendChild(rpIframe);
        rpDocument = rpIframe.contentDocument || rpIframe.contentWindow.document;// || rssPlusEnvironment.window.document;

        const rpBoxStyle = rpDocument.createElement("style");
        rpBoxStyle.innerHTML = `
.hover-reveal {
    position: fixed;
    width: 80px;
    height: 80px;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0
}

.hover-reveal__inner,.hover-reveal__img {
    width: 100%;
    height: 100%;
    position: relative
}

.hover-reveal__deco {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #181314
}

.hover-reveal__img {
    background-size: cover;
    background-position: 50% 50%
}

body {
    margin: 0px;
}

#rp-box, #rp-badge, #rp-dialog {
    width: 100%;
    position: fixed;
    z-index: 99999;
    bottom: 0px;
    right: 0px;
}

#rp-badge {
    background: #4b5979;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    float: right;
    min-width: 20px;
    border: 1px solid #fff;
    white-space: nowrap;
}

#rp-badge:hover {
    border-color: #e9eaec;
}

#rp-dialog {
    display: none;
    height: 100%;
}

#rp-dialog-container {
    font-size: 14px;
    height: 100%;
    background: white;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
}

#rp-dialog-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-radius: 5px 5px 0 0;
    padding: 5px 10px 5px 10px;
    background-color: #f8f8f9;
}

#rp-dialog-feeds-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 0px;
    overflow-y: auto;
}

#rp-dialog-feeds {
    list-style-type: none;
    padding: 0px 10px 5px 10px;
    margin: 0;
}

.rss-title {
    font-weight: bold;
    margin: 5px 0 5px 0;
}

.rss-link {
    color: #666;
    font-size: 0.9em;
    word-break: break-all;
    margin: 5 0 5 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
}

.rss-actions {
    display: flex;
    justify-content: space-between;
}

.rss-btn {
    background: #4b5979;
    color: white;
    border: none;
    padding: 3px 8px;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 3px;
}

.rp-dialog-count {
    font-weight: bold;
    color: #ed3f14;
}

.rp-badge-count {
    position: relative;
    display: inline-block;
    width: 26px;
    height: 26px;
    color: #fff;
    text-align: center;
    font-size: 12px;
    line-height: 26px;
}

.rp-badge-count a,.rp-badge-count a:hover {
    color: #fff
}

.rp-btn {
    cursor: pointer;
    display: inline-block;
    border: 1px solid transparent;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    font-weight: 400;
}

.rp-btn>.rp-icon {
    line-height: 1
}

.rp-btn:hover {
    color: #6d7380;
    background-color: #f9f9f9;
    border-color: #e4e5e7
}

.rp-btn>.rp-icon+span,.rp-btn>span+.rp-icon {
    margin-left: 4px
}

.rp-btn-primary {
    color: #fff;
    background-color: #2d8cf0;
    border-color: #2d8cf0;
}

.rp-btn-primary:hover {
    color: #fff;
    background-color: #57a3f3;
    border-color: #57a3f3
}

.rp-btn-small {
    padding: 2px 7px;
    font-size: 12px;
    border-radius: 3px;
    margin: 5px;
    color: #495060;
    background-color: #f7f7f7;
}

.rss-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}
        `;
        rpDocument.head.appendChild(rpBoxStyle);

        const rpBadgeDiv = rpDocument.createElement("div");
        rpBadgeDiv.id = "rp-badge";
        rpBadgeDiv.innerHTML = `<span class="rp-badge-count rp-count""></span>`;
        rpDocument.body.appendChild(rpBadgeDiv);

        rpDialog = rpDocument.createElement("div");
        rpDialog.id = "rp-dialog";
        rpDialog.innerHTML = `
<div id="rp-dialog-container">
<div id="rp-dialog-title">
<div>${t.feed}<span class="rp-dialog-count rp-count"></span></div>
<button type="button" id="rp-close-btn" class="rp-btn rp-btn-small" title="${t.close}"><span>${ICON_CLOSE}</span></button>
</div>
<div id="rp-dialog-feeds-container">
<ul id="rp-dialog-feeds"></ul>
</div>
</div>
`;
        rpDocument.body.appendChild(rpDialog);

        rpBadge = rpDocument.getElementById("rp-badge");
        rpDialog = rpDocument.getElementById("rp-dialog");
        rpDialogTitle = rpDocument.getElementById("rp-dialog-title");
        rpDialogFeeds = rpDocument.getElementById("rp-dialog-feeds");

        rpIframe.style.width = rpBadge.getBoundingClientRect().width + "px";
        rpIframe.style.height = rpBadge.getBoundingClientRect().height + "px";

        addEventHandler(rpDocument.getElementById("rp-close-btn"), "click", function () {
            rpDialog.style.display = "none";
            rpBadge.style.display = "block";
            rpIframe.style.width = rpBadge.getBoundingClientRect().width + "px";
            rpIframe.style.height = rpBadge.getBoundingClientRect().height + "px";
        });

        rpDocument.getElementById("rp-badge").addEventListener("click", () => {
            if (feeds.size === 0) {
                return
            }
            rpDialog.style.display = "block";
            rpBadge.style.display = "none";

            resizeIframe();
        });

        window.addEventListener('resize', resizeIframe);
        window.addEventListener('load', resizeIframe);
    }

    function resizeIframe() {
        if (rpDialog.style.display === "block"){
            if (window.innerWidth < 400){
                rpIframe.style.width = `${window.innerWidth}px`;
            } else {
                rpIframe.style.width = "400px";
            }
            const dialogHeight = rpDialogFeeds.getBoundingClientRect().height + rpDialogTitle.getBoundingClientRect().height;
            const availableHeight = rpIframe.getBoundingClientRect().bottom;
            if (dialogHeight < availableHeight) {
                rpIframe.style.height = `${dialogHeight}px`;
            } else {
                rpIframe.style.height = `${availableHeight}px`;
            }
        }
    }

    // 更新徽章
    function updateBadge() {
        Array.from(rpDocument.getElementsByClassName("rp-count")).forEach(el => {el.textContent = feeds.size});
    }

    // 更新对话框内容
    function updateDialog(title, url) {
        const li = rpDocument.createElement('li');
        li.className = 'rss-item';
        li.innerHTML = `
                    <div class="rss-info">
                        <h5 class="rss-title">${title}</h5>
                        <a class="rss-link" href="${url}" target="_blank">${url}</a>
                    </div>
                    <div class="rss-actions">
                        <button class="rss-btn rss-copy rp-btn-primary">${t.copy}</button>
                        <button class="rss-btn rss-follow rp-btn-primary">${t.follow}</button>
                    </div>
                `;
        li.querySelector('.rss-copy').addEventListener('click', () => copyToClipboard(url));
        li.querySelector('.rss-follow').addEventListener('click', () => followFeed(url));
        rpDialogFeeds.appendChild(li);
        new HoverImgFx2(li.querySelector('.rss-link'));
    }

    // 复制到剪贴板
    function copyToClipboard(url) {
        GM_setClipboard(url);
        GM_notification({
            text: t.copied,
            title: t.copySucceeded,
            timeout: 2000
        });
    }

    // 关注Feed
    function followFeed(url) {
        // 这里可以根据用户设置的RSS阅读器来打开相应的订阅链接
        const rssService = GM_getValue("rss_service", "feedly");
        if (rssService === "feedly") {
            window.open(`https://feedly.com/i/subscription/feed/${encodeURIComponent(url)}`, '_blank');
        } else if (rssService === "inoreader") {
            window.open(GM_getValue("inoreader_domain", "https://www.inoreader.com") + `/?add_feed=${encodeURIComponent(url)}`, "_blank");
        } else if (rssService === "tinytinyrss") {
            window.open(GM_getValue("tinytinyrss_domain") + `/public.php?op=bookmarklets--subscribe&feed_url=${url}`, "_blank");
        } else if (rssService === "freshrss") {
            window.open(GM_getValue("freshrss_domain") + `/i/?c=feed&a=add&url_rss=${encodeURIComponent(url)}`, "_blank");
        } else if (rssService === "newsblur") {
            window.open(`http://www.newsblur.com/?url=${encodeURIComponent(url)}`, "_blank");
        } else if (rssService === "miniflux") {
            window.open(GM_getValue("miniflux_domain") + `/bookmarklet?uri=${encodeURIComponent(url)}`, "_blank");
        }
    }


    function addEventHandler(target, eventName, eventHandler, scope) {
        let f = scope ? function() {
            eventHandler.apply(scope, arguments);
        } : eventHandler;
        if (target.addEventListener) {
            target.addEventListener(eventName, f, true);
        } else if (target.attachEvent) {
            target.attachEvent("on" + eventName, f);
        }
        return f;
    }

    function initUrlChangeListener() {
        const _historyWrap = function(type) {
            const orig = history[type];
            const e = new Event(type);
            return function() {
                const rv = orig.apply(this, arguments);
                e.arguments = arguments;
                window.dispatchEvent(e);
                return rv;
            };
        };
        history.pushState = _historyWrap('pushState');
        history.replaceState = _historyWrap('replaceState');

        window.addEventListener('pushState', () =>  {
            window.dispatchEvent(new Event('locationchange'));
        });
        window.addEventListener('replaceState', () =>  {
            window.dispatchEvent(new Event('locationchange'));
        });
        window.addEventListener('popstate', () => {
            window.dispatchEvent(new Event('locationchange'));
        });
        window.addEventListener('hashchange', function() {
            window.dispatchEvent(new Event('locationchange'));
        }, false);
    }
    function reset() {
        if (rpDiv){
            rpDiv.remove();
        }
        if (rpStyle){
            rpStyle.remove();
        }
        feeds.clear();
    }
    function isValidUrl(url) {
        return url && (url.match(/^https*:\/\/.*?\.\w+(:\d+)?(\/|$)/) || url.match(/^https*:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:\d+)*(:\d+)?(\/|$)/));
    }

    class HoverImgFx2 {
        constructor(el) {
            this.DOM = {el: el};
            this.DOM.reveal = document.createElement('div');
            this.DOM.reveal.className = 'hover-reveal';

            const qr = qrcode(4, 'L');
            qr.addData(this.DOM.el.href);
            qr.make();
            const url = qr.createDataURL();

            const thisDOM = this.DOM;
            thisDOM.reveal.innerHTML = `<div class="hover-reveal__inner"><div class="hover-reveal__img" style="background-image:url(${url})"></div></div>`;
            thisDOM.revealInner = thisDOM.reveal.querySelector('.hover-reveal__inner');
            thisDOM.revealInner.style.overflow = 'hidden';
            thisDOM.revealImg = thisDOM.revealInner.querySelector('.hover-reveal__img');
            thisDOM.el.appendChild(thisDOM.reveal);

            this.initEvents();
        }
        getMousePos (e) {
            let posx = 0;
            let posy = 0;
            if (!e) e = window.event;
            if (e.pageX || e.pageY) {
                posx = e.pageX;
                posy = e.pageY;
            } else if (e.clientX || e.clientY) {
                posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
                posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
            }
            return {
                x: posx,
                y: posy
            }
        }
        initEvents() {
            this.positionElement = (ev) => {
                const mousePos = this.getMousePos(ev);
                const docScrolls = {
                    left: rpDocument.body.scrollLeft + rpDocument.documentElement.scrollLeft,
                    top: rpDocument.body.scrollTop + rpDocument.documentElement.scrollTop
                };
                this.DOM.reveal.style.top = `${mousePos.y-70-docScrolls.top}px`;
                this.DOM.reveal.style.left = `${mousePos.x+10-docScrolls.left}px`;
            };
            this.mouseenterFn = (ev) => {
                if (!GM_getValue("enable_qr_code", true)) return;
                this.positionElement(ev);
                this.DOM.revealInner.style.overflow = 'visible';
                this.DOM.reveal.style.opacity = 1;
            };
            this.mousemoveFn = ev => requestAnimationFrame(() => {
                if (!GM_getValue("enable_qr_code", true)) return;
                this.positionElement(ev);
            });
            this.mouseleaveFn = () => {
                if (!GM_getValue("enable_qr_code", true)) return;
                this.DOM.revealInner.style.overflow = 'hidden';
                this.DOM.reveal.style.opacity = 0;
            };
            this.DOM.el.addEventListener('mouseenter', this.mouseenterFn);
            this.DOM.el.addEventListener('mousemove', this.mousemoveFn);
            this.DOM.el.addEventListener('mouseleave', this.mouseleaveFn);
        }
    }

    // 当页面加载完成后初始化
    initUrlChangeListener();
    window.addEventListener('locationchange', ()=> {
        reset();
        detectFeeds();
    });
    detectFeeds();
})();