// ==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 표시 // @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 를 표시합니다 (있는 경우) // @license GPL3.0 // @version 1.0.2 // @icon https://www.innoreader.com/favicon.ico // @author Wizos // @namespace https://blog.wizos.me // @supportURL wizos@qq.com // @match http://*/* // @match https://*/* // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @require https://cdn.jsdelivr.net/npm/js-base64@3.6.0/base64.min.js // @require https://cdn.jsdelivr.net/npm/greensock@1.20.2/dist/TweenMax.min.js // @require https://cdn.jsdelivr.net/npm/qrcode@1.4.4/build/qrcode.js // @resource RulerJs https://cdn.jsdelivr.net/gh/wizos/rssplus@2.0.0/Ruler.js?_=1624989578204 // @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 rssfinder.vercel.app // @connect rssplus.vercel.app // @noframes // @run-at document-end // @downloadURL none // ==/UserScript== // 2022.04.05_1.0.2 1.受unsafe-eval影响,无法听过本地执行规则时使用远程规则。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的方式; // 过滤掉明确不包含 RSS 源的URL if (location.href.match(/(api\.wizos\.me)|(feedly\.com\/i\/subscription)|(inoreader\.com\/feed\/http)/i)) { return; } const zhcn = { "no_title": "无名称", "copied": "已复制", "copy": "复制", "copy_succeeded": "复制成功", "follow": "订阅", "found": "发现 ", "feed": " 个订阅源", "click_the_number_to_view": "点击右下角的数字查看", "use_feedly": "使用 Feedly 订阅", "use_inoreader": "使用 InoReader 订阅", "use_tinytinyrss": "使用 TinyTinyRSS 订阅", "use_freshrss": "使用 FreshRSS 订阅", "setting_rsshub_domain": "设置 RSSHub 服务的域名", "setting_inoreader_domain": "设置 InoReader 服务的域名", "setting_tinytinyrss_domain": "设置 TinyTinyRSS 服务的域名", "setting_freshrss_domain": "设置 FreshRSS 服务的域名", "domain_is_wrong": "服务器地址格式有问题,请检查", "enable_qr_code": "启用/禁用二维码", "enabled": "已启用", "disabled": "已禁用", "close": "关闭" }; const zhtw = { "no_title": "無名稱", "copied": "已複製", "copy": "複製", "copy_succeeded": "複製成功", "follow": "訂閱", "found": "發現 ", "feed": " 個訂閱源", "click_the_number_to_view": "點擊右下角的數位查看", "use_feedly": "使用 Feedly 訂閱", "use_inoreader": "使用 InoReader 訂閱", "use_tinytinyrss": "使用 TinyTinyRSS 訂閱", "use_freshrss": "使用 FreshRSS 訂閱", "setting_rsshub_domain": "設定 RSSHub 服務的網域名稱", "setting_inoreader_domain": "設定 InoReader 服務的網域名稱", "setting_tinytinyrss_domain": "設定 TinyTinyRSS 服務的網域名稱", "setting_freshrss_domain": "設定 FreshRSS 服務的網域名稱", "domain_is_wrong": "伺服器位址格式有問題,請檢查", "enable_qr_code": "啟用/禁用二維碼", "enabled": "已啟用", "disabled": "已禁用", "close": "關閉" }; const en = { "no_title": "NO TITILE", "copied": "copied", "copy": "copy", "copy_succeeded": "copy succeeded", "follow": "follow", "found": "found ", "feed": " feed", "click_the_number_to_view": "click on the number in the lower right corner to view it", "setting": "setting", "use_feedly": "Use Feedly Subscription", "use_inoreader": "Use InoReader Subscription", "use_tinytinyrss": "Use TinyTinyRSS Subscription", "use_freshrss": "Use FreshRSS Subscription", "setting_rsshub_domain": "Setting RSSHub Domain", "setting_inoreader_domain": "Setting InoReader Domain", "setting_tinytinyrss_domain": "Setting TinyTinyRSS Domain", "setting_freshrss_domain": "Setting FreshRSS Domain", "domain_is_wrong": "Error in domain name format, please check", "enable_qr_code": "Enable/disable QR code", "enabled": "Enabled", "disabled": "Disabled", "close": "close" }; const ja = { "no_title": "名前なし", "copied": "コピーされました", "copy": "コピー", "copy_succeeded": "コピー成功", "follow": "購読", "found": "発見 ", "feed": " フィード", "click_the_number_to_view": "右下の数字をクリックして表示", "use_feedly": "Feedly で購読", "use_inoreader": "InoReader で購読", "use_tinytinyrss": "TinyTinyRSS で購読", "use_freshrss": "FreshRSS で購読", "setting_rsshub_domain": "RSSHub サービスのドメイン名を設定する", "setting_inoreader_domain": "InoReader サービスのドメイン名を設定する", "setting_freshrss_domain": "FreshRSS サービスのドメイン名を設定する", "domain_is_wrong": "サーバーのアドレス形式に問題があります。確認してください", "enable_qr_code": "QRコードを有効/無効にする", "enabled": "有効にした", "disabled": "無効にしました", "close": "閉じる" }; const ko = { "no_title": "이름 없음", "copied": "복사", "copy": "복사", "copy_succeeded": "복사 성공", "follow": "구독", "found": "발견 ", "feed": "피드", "click_the_number_to_view": "오른쪽 하단에있는 숫자를 클릭하면 볼 수 있습니다", "use_feedly": "Feedly 로 구독", "use_inoreader": "InoReader 로 구독", "use_tinytinyrss": "TinyTinyRSS 로 구독", "use_freshrss": "FreshRSS 로 구독", "setting_rsshub_domain": "RSSub 서비스의 도메인 이름 설정", "setting_inoreader_domain": "InoReader 서비스의 도메인 이름 설정", "setting_tinytinyrss_domain": "TinyTinyRSS 서비스의 도메인 이름 설정", "setting_freshrss_domain": "FreshRSS 서비스의 도메인 이름 설정", "domain_is_wrong": "서버 주소 형식에 문제가 있습니다. 확인하십시오", "enable_qr_code": "큐알(QR)코드 사용/사용 안 함", "enabled": "활성화됨", "disabled": "사용 안 함", "close": "닫기" }; var languages = { "zh": zhcn, "zhcn": zhcn, "zhtw": zhtw, "ja": ja, "ko": ko, "en": en }; var lang = navigator.language.replace('-', "").toLowerCase(); lang = languages[lang]; if (!lang) { lang = languages.en; } var feedsMap = {}; const feed_suffix = ['/feed', '/rss', '/rss.xml', '/atom.xml', '/feed.xml', '/?feed=rss2', '/?feed=rss']; setTimeout(function() { GM_registerMenuCommand(lang.use_feedly, function () { GM_setValue("rss_service", "feedly"); }); GM_registerMenuCommand(lang.use_inoreader, function () { var domain = GM_getValue("inoreader_domain"); if(!domain){ domain = "https://www.inoreader.com"; } domain = window.prompt(lang.setting_inoreader_domain, domain); if(isValidUrl(domain)){ GM_setValue("inoreader_domain", domain); GM_setValue("rss_service", "inoreader"); /* GM_notification({ title: "设置成功", text: lang.click_the_number_to_view, timeout: 3000 }); */ //alert("设置成功"); }else{ alert(lang.domain_is_wrong); } }); GM_registerMenuCommand(lang.use_tinytinyrss, function () { var domain = GM_getValue("tinytinyrss_domain"); if(!domain){ domain = "https://www.example.com"; } domain = window.prompt(lang.setting_tinytinyrss_domain, domain); if(isValidUrl(domain)){ GM_setValue("tinytinyrss_domain", domain); GM_setValue("rss_service", "tinytinyrss"); }else{ alert(lang.domain_is_wrong); } }); GM_registerMenuCommand(lang.use_freshrss, function () { var domain = GM_getValue("freshrss_domain"); if(!domain){ domain = "https://www.example.com"; } domain = window.prompt(lang.setting_freshrss_domain, domain); if(isValidUrl(domain)){ GM_setValue("freshrss_domain", domain); GM_setValue("rss_service", "freshrss"); }else{ alert(lang.domain_is_wrong); } }); GM_registerMenuCommand(lang.enable_qr_code, function () { if(!GM_getValue("enable_qr_code")){ GM_setValue("enable_qr_code", true); GM_notification({text: lang.enabled, title: lang.enable_qr_code, timeout: 2000 }); }else{ GM_setValue("enable_qr_code", false); GM_notification({text: lang.disabled, title: lang.enable_qr_code, timeout: 2000 }); } }); GM_registerMenuCommand(lang.setting_rsshub_domain, function () { var domain = GM_getValue("rsshub_domain"); if(!domain){ domain = "https://rsshub.app"; } domain = window.prompt(lang.setting_rsshub_domain, domain); if(isValidUrl(domain)){ GM_setValue("rsshub_domain", domain); }else{ alert(lang.domain_is_wrong); } }); findRSS(); 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', function(e) { console.log('change pushState'); clearRSS(); findRSS(); }); window.addEventListener('replaceState', function(e) { console.log('change replaceState'); clearRSS(); findRSS(); }); }, 0); function clearRSS() { if(!feedsView){ return; } var childs = feedsView.childNodes; for (var i = childs.length - 1; i > 0; i--) { console.log(childs[i]); feedsView.removeChild(childs[i]); } } function findRSS() { getKnowFeeds(); getUnknownFeeds(); findCloudFeeds(optimizeLink(location.href), document.documentElement.outerHTML); } function showWithCloudFeeds(url) { GM_xmlhttpRequest({ method: "get", /* data: "url=" + Base64.encode(url), headers: { "Content-Type": "application/x-www-form-urlencoded" }, */ url: "https://rssplus.vercel.app/api/find.js?url=" + encodeURIComponent(url), // https://rssplus.vercel.app/api/find.js,https://rssfinder.vercel.app/find.php onload: response => { if (response.status != 200) { return; } var obj = JSON.parse(response.responseText); if (!obj) { return; } obj.forEach(element => { addRSS(element.title, element.link); }); } }); } function looseJsonParse(obj) { return Function('"use strict";return (' + obj + ')')(); } function findCloudFeeds(url, res) { return function(jsStr, url, res) { try{ if (!jsStr) { return; } //eval(jsStr); const Ruler = looseJsonParse(jsStr); var list = Ruler.find(url, res); if (!list) { return; } list.forEach(element => { addRSS(element.title, element.link); }); }catch(e){ console.log("请求远程:" + url); //console.log(e); showWithCloudFeeds(url); } }.call(window, GM_getResourceText('RulerJs'), url, res); } function optimizeLink(link){ if(link.match(/douban\.com\/people/i)){ var src = document.querySelector("#profile > div > div.bd > div.basic-info > div.uhead-wrap > img.userface").src; var m = src.match(/ul(\d+)-/i); link = "https://www.douban.com/people/" + m[1]; } return link; } // 获取在的元素中,已经声明为RSS的链接 function getKnowFeeds() { var links = document.getElementsByTagName("link"); var link, linkHref, linkType, linkTitle; for (var i = 0, l = links.length; i < l; i++) { link = links[i]; if (!link) continue; linkHref = link.href; linkType = link.type; linkTitle = link.title; if (!linkTitle) { linkTitle = document.title; } if (linkType && linkType.match(/.+\/(rss|rdf|atom)/i)) { addRSS(linkTitle, linkHref); } else if (linkType && linkType.match(/^text\/xml$/i)) { addRSS(linkTitle, linkHref); } } } // 寻找未明确标示的RSS源 function getUnknownFeeds() { //var link, linkHref, linkType, linkTitle; var links,link,linkhref,linktitle; // links 属性返回一个文档中所有具有 href 属性值的 元素与 元素的集合 if (!document.links) { //console.log("页面内没有发现具有 href 属性值的 元素或 元素"); links = document.getElementsByTagName("a"); }else{ links = document.links; } for (var a = 0, len = links.length; a < len; a++) { link = links[a]; linkhref = link.href; linktitle = link.title; if (!linktitle) { linktitle = document.title; } else if (link.innerText) { linktitle = link.innerText; } if (linkhref.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)) { addRSS(linktitle, linkhref); } else if (linkhref.match(/^(https|http|ftp|feed).*\/atom(\.xml|\.aspx|\.jsp|\/)?$|[?&;]feed=atom[0-9.]*$/i)) { addRSS(linktitle, linkhref); } else if (linkhref.match(/^(https|http|ftp|feed).*(\/feeds?\/[^.\/]*\.xml$|.*\/index\.xml$|feed\/msgs\.xml(\?num=\d+)?$)/i)) { addRSS(linktitle, linkhref); } else if (linkhref.match(/^(https|http|ftp|feed).*\.rdf$/i)) { addRSS(linktitle, linkhref); } else if (linkhref.match(/^(rss|feed):\/\//i)) { addRSS(linktitle, linkhref); } else if (linkhref.match(/^(https|http):\/\/feed\./i)) { addRSS(linktitle, linkhref); } } links = document.querySelectorAll("html > head > link"); for (var i = 0, size = links.length; i < size; i++) { link = links[i]; if (link.href.match(/(wp-content)/i)) { checkFeed(document.location.protocol + '//' + document.domain); break; } } links = document.querySelectorAll("html > body footer a"); for (i = 0, size = links.length; i < size; i++) { link = links[i]; if (link.href.match(/(bitcron\.com|typecho\.org|hexo\.io)/i)) { checkFeed(document.location.protocol + '//' + document.domain); break; } } } 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 => { //console.log("请求api返回状态:" + response.status + " => " + href + flag); if (response.status == 200) { addRSS(document.title, href + suffix); } } }); }); } var feedsBadge; var feedsDialog; var countLabels; var feedsView; var rssPlusDocument; function addRSS(title, link){ if (link.match(/(api\.wizos\.me)|(feedly\.com\/i\/subscription)|(inoreader\.com\/feed\/http)/i)) { return; } if(Object.keys(feedsMap).length == 0){ // 安装 RSS Plus Box 和 RSS Plus Frame // console.log("RSSPlus:首次渲染"); var body = document.getElementsByTagName("body"); if (body && body[0]) body = body[0]; var rssPlusStyle = document.createElement("style"); rssPlusStyle.innerHTML = '@media print {#rss-plus {display: none;}} #rss-plus{position:fixed;bottom:60px;right:5px;z-index:9999;width:auto;height:auto;} #rss-plus > iframe{display: block!important; max-width: 100%!important;border:0px;margin:0px !important; }'; body.appendChild(rssPlusStyle); var rssPlusDiv = document.createElement("div"); rssPlusDiv.setAttribute("id", "rss-plus"); body.appendChild(rssPlusDiv); var rssPlusIFrame = document.createElement("iframe"); rssPlusIFrame.setAttribute("id", "rss-plus-iframe"); rssPlusIFrame.setAttribute("name", "rssPlusEnvironment"); rssPlusIFrame.setAttribute("allowTransparency", "true"); if(navigator.userAgent.indexOf("Firefox") !== -1){ rssPlusIFrame.setAttribute("src", "javascript:"); } rssPlusDiv.appendChild(rssPlusIFrame); rssPlusDocument = rssPlusEnvironment.window.document; var frameBody = rssPlusDocument.getElementsByTagName("body"); if (frameBody && frameBody[0]) frameBody = frameBody[0]; var styleEl = document.createElement("style"); styleEl.innerHTML = BOX_STYLE; frameBody.appendChild(styleEl); var rssPlusBoxDiv = document.createElement("div"); rssPlusBoxDiv.setAttribute("id", "rss-plus-box"); rssPlusBoxDiv.innerHTML = '
0
' + '
' + '' + "
' + ICON_LOGO + lang.found + '' + lang.feed + ' -【RSS+】
"; frameBody.appendChild(rssPlusBoxDiv); feedsBadge = rssPlusDocument.getElementById("rp-feeds-badge"); feedsDialog = rssPlusDocument.getElementById("rp-feeds-dialog"); countLabels = rssPlusDocument.getElementsByClassName("rp-feed-count"); feedsView = rssPlusDocument.getElementById("rp-table-tbody"); rssPlusIFrame.style.width = feedsBadge.offsetWidth + "px"; rssPlusIFrame.style.height = feedsBadge.offsetHeight + "px"; addEventHandler(rssPlusDocument.getElementById("rp-close-btn"), "click", function() { feedsDialog.style.display = "none"; feedsBadge.style.display = "block"; rssPlusIFrame.style.width = feedsBadge.offsetWidth + "px"; rssPlusIFrame.style.height = feedsBadge.offsetHeight + "px"; }); addEventHandler(rssPlusDocument.getElementById("rp-feeds-badge"), "click", function() { feedsDialog.style.display = "block"; feedsBadge.style.display = "none"; if(document.body.clientWidth < 600){ feedsDialog.style.width = "100%"; rssPlusIFrame.style.width = "100%"; }else{ rssPlusIFrame.style.width = rssPlusDocument.getElementById("rss-plus-box").offsetWidth + "px"; rssPlusIFrame.style.height = rssPlusDocument.getElementById("rss-plus-box").offsetHeight + "px"; } }); } //link = link.replace(/\/$/g, ""); // 防止重复,如果能查找到,证明数组元素重复了 if (!feedsMap[link.toLowerCase()]) { feedsMap[link.toLowerCase()] = 1; } console.log("发现:" + title + " -> " + link); Array.from(countLabels).forEach(label => label.innerText = Object.keys(feedsMap).length); if(link.match(/^https*:\/\/rsshub.app/)){ var rsshub_domain = GM_getValue("rsshub_domain"); if(rsshub_domain != null && rsshub_domain != ""){ link = link.replace(/^https*:\/\/rsshub.app/,rsshub_domain); } } if (!title) { title = lang.no_title; } var item = document.createElement("tr"); feedsView.appendChild(item); item.innerHTML = '
' + title + '
' + link + '
' + '' + '' + ''; var copyFeedLinkButton = item.getElementsByClassName("rp-copy-feed-link")[0]; //Array.from(copyFeedLinkButton).forEach(function (button) { //}); addEventHandler(copyFeedLinkButton, "click", function() { copy(link); }); var followFeedLinkButton = item.getElementsByClassName("rp-follow-feed-link")[0]; addEventHandler(followFeedLinkButton, "click", function() { follow(link); // .replace(/&/g,"%26") 转义&避免RSS链接识别错误 }); var feedLinkButton = item.getElementsByClassName("feed-link")[0]; new HoverImgFx1(feedLinkButton); } function isValidUrl(url) { if(url && (url.match(/^https*:\/\/.*?\.\w+(:\d+)?(\/|$)/) || url.match(/^https*:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:\d+)*(:\d+)?(\/|$)/)) ){ return true; }else{ return false; } } function addEventHandler(target, eventName, eventHandler, scope) { var 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 notification(size) { GM_notification({ title: lang.found + " " + size + " " + lang.feed, text: lang.click_the_number_to_view, timeout: 3000 }); } function copy(str) { GM_setClipboard(str); GM_notification({ text: lang.copied + ": " + str, title: lang.copy_succeeded, timeout: 2000 }); } function follow(link) { const rssService = GM_getValue("rss_service", "feedly"); if( rssService === "feedly" ){ window.open("https://feedly.com/i/subscription/feed/" + encodeURIComponent(link), "_blank"); }else if( rssService === "inoreader" ){ window.open(GM_getValue("inoreader_domain", "https://www.inoreader.com") + "/?add_feed=" + encodeURIComponent(link), "_blank"); }else if( rssService === "tinytinyrss" ){ window.open(GM_getValue("tinytinyrss_domain") + "/public.php?op=bookmarklets-subscribe&feed_url=" + link, "_blank"); }else if( rssService === "freshrss" ){ window.open(GM_getValue("freshrss_domain") + "/i/?c=feed&a=add&url_rss=" + encodeURIComponent(link), "_blank"); }else if( rssService === "NewsBlur" ){ window.open("http://www.newsblur.com/?url=" + encodeURIComponent(link), "_blank"); } // [tinytinyrss]https://example.com/public.php?op=subscribe&feed_url=https://rsshub.wizos.me/weibo/user/5261556444 // bookmarklets-subscribe // [feedly]https://feedly.com/i/subscription/feed%2Fhttp%3A%2F%2Ffeeds.howtogeek.com%2FHowToGeek // [inoreader]http://www.inoreader.com/?add_feed=https%3A%2F%2Fwww.howtogeek.com%2Ffeed%2F // [NewsBlur]http://www.newsblur.com/?url=https%3A%2F%2Ffeeds.howtogeek.com%2FHowToGeek // [theoldreader]https://theoldreader.com/feeds/subscribe?url=https://api.izgq.net/weibo/rss/1197161814 // [freshrss]https://rss.iridium.cyou/i/?c=feed&a=add&url_rss=https://rsshub.wizos.me/zhihu/question/20180238 } // Effect 1 class HoverImgFx1 { constructor(el) { this.DOM = { el: el }; this.DOM.reveal = document.createElement('div'); this.DOM.reveal.className = 'hover-reveal'; let thisDOM = this.DOM; QRCode.toDataURL(this.DOM.el.href, function(error, url) { if (error) { console.log(error); } else { thisDOM.reveal.innerHTML = `
` 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: rssPlusDocument.body.scrollLeft + rssPlusDocument.documentElement.scrollLeft, top: rssPlusDocument.body.scrollTop + rssPlusDocument.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")) return; this.positionElement(ev); this.showImage(); }; this.mousemoveFn = ev => requestAnimationFrame(() => { if (!GM_getValue("enable_qr_code")) return; this.positionElement(ev); }); this.mouseleaveFn = () => { if (!GM_getValue("enable_qr_code")) return; this.hideImage(); }; this.DOM.el.addEventListener('mouseenter', this.mouseenterFn); this.DOM.el.addEventListener('mousemove', this.mousemoveFn); this.DOM.el.addEventListener('mouseleave', this.mouseleaveFn); } showImage() { TweenMax.killTweensOf(this.DOM.revealInner); TweenMax.killTweensOf(this.DOM.revealImg); this.tl = new TimelineMax({ onStart: () => { this.DOM.reveal.style.opacity = 1; TweenMax.set(this.DOM.el, { zIndex: 1000 }); } }) .add('begin') .add(new TweenMax(this.DOM.revealInner, 0.2, { ease: Sine.easeOut, startAt: { x: '-100%' }, x: '0%' }), 'begin') .add(new TweenMax(this.DOM.revealImg, 0.2, { ease: Sine.easeOut, startAt: { x: '100%' }, x: '0%' }), 'begin'); } hideImage() { TweenMax.killTweensOf(this.DOM.revealInner); TweenMax.killTweensOf(this.DOM.revealImg); this.tl = new TimelineMax({ onStart: () => { TweenMax.set(this.DOM.el, { zIndex: 999 }); }, onComplete: () => { TweenMax.set(this.DOM.el, { zIndex: '' }); TweenMax.set(this.DOM.reveal, { opacity: 0 }); } }) .add('begin') .add(new TweenMax(this.DOM.revealInner, 0.2, { ease: Sine.easeOut, x: '100%' }), 'begin') .add(new TweenMax(this.DOM.revealImg, 0.2, { ease: Sine.easeOut, x: '-100%' }), 'begin'); } } const ICON_LOGO = '<'; const ICON_CLOSE = ''; const BOX_STYLE = '.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;}#rss-plus-box { position:fixed;z-index:99999;bottom:0px; right:0px; }div.feed-title { font-weight: bold;font-size:0.8rem; cursor: pointer;}div.feed-tips,div.feed-tips a { font-size: 0.75rem; color: rgb(158, 158, 158);}.card-title {}.rp-table-body { max-height: 400px; height: auto; overflow-x: hidden;}.table-footer { position: fixed; bottom: 0 ; padding-left: 10px; width: 100%; background-color: #fff;}.table-footer a { color: #ed3f14;}.support-box { height: 28px; line-height: 28px;}#rp-feeds-dialog{display:none;z-index:23333;box-shadow: 1px 1px 2px 2px #4242426b; width:600px;} #rp-feeds-badge{width: 28px; height: 28px; line-height: 28px; border-radius: 14px; float: right;cursor: pointer;z-index:23333;}#rp-feeds-badge:hover{border-color:#e9eaec}.badge{ top:-17px; left: -6%; width: 26px; height: 26px; line-height: 26px; border-radius: 13px;}.rp-card:hover{-webkit-box-shadow:0 1px 6px rgba(0,0,0,.2);box-shadow:0 1px 6px rgba(0,0,0,.2);border-color:#eee}.rp-card{background:#fff;border-radius:4px;font-size:14px;position:relative;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.rp-card-bordered:hover{border-color:#e9eaec}.rp-card-bordered{border:1px solid #dddee1;border-color:#e9eaec}.rp-mark-count{font-weight:bold;color: #ed3f14;}.rp-badge-count{position:relative;display:inline-block;width: 26px;height: 26px;line-height: 26px;border-radius: 15px;min-width: 20px;background:#4b5979;border: 1px solid transparent;color: #fff;text-align: center;font-size: 12px;white-space: nowrap;-webkit-transform-origin: -10% center;-ms-transform-origin: -10% center;transform-origin: -10% center;z-index: 10;-webkit-box-shadow: 0 0 0 1px #fff;box-shadow: 0 0 0 1px #fff;}.rp-badge-count a,.rp-badge-count a:hover{color:#fff}.rp-card-head{font-size: 14px;padding:10px 16px;line-height:1}.rp-tooltip{display:inline-block}.rp-tooltip-rel{display:inline-block;position:relative}.rp-btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;line-height:1.5;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:6px 15px;font-size:12px;border-radius:4px;-webkit-transition:color .2s linear,background-color .2s linear,border .2s linear,-webkit-box-shadow .2s linear;transition:color .2s linear,background-color .2s linear,border .2s linear,-webkit-box-shadow .2s linear;transition:color .2s linear,background-color .2s linear,border .2s linear,box-shadow .2s linear;transition:color .2s linear,background-color .2s linear,border .2s linear,box-shadow .2s linear,-webkit-box-shadow .2s linear;color:#495060;background-color:#f7f7f7;border-color:#dddee1}.rp-btn>.rp-icon{line-height:1}.rp-btn,.rp-btn:active,.rp-btn:focus{outline:0}.rp-btn:not([disabled]):hover{text-decoration:none}.rp-btn:not([disabled]):active{outline:0}.rp-btn.disabled,.rp-btn[disabled]{cursor:not-allowed}.rp-btn.disabled>*,.rp-btn[disabled]>*{pointer-events:none}.rp-btn>a:only-child{color:currentColor}.rp-btn>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn:hover{color:#6d7380;background-color:#f9f9f9;border-color:#e4e5e7}.rp-btn:hover>a:only-child{color:currentColor}.rp-btn:hover>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn.active,.rp-btn:active{color:#454c5b;background-color:#ebebeb;border-color:#ebebeb}.rp-btn.active>a:only-child,.rp-btn:active>a:only-child{color:currentColor}.rp-btn.active>a:only-child:after,.rp-btn:active>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn.disabled,.rp-btn.disabled.active,.rp-btn.disabled:active,.rp-btn.disabled:focus,.rp-btn.disabled:hover,.rp-btn[disabled],.rp-btn[disabled].active,.rp-btn[disabled]:active,.rp-btn[disabled]:focus,.rp-btn[disabled]:hover,fieldset[disabled] .rp-btn,fieldset[disabled] .rp-btn.active,fieldset[disabled] .rp-btn:active,fieldset[disabled] .rp-btn:focus,fieldset[disabled] .rp-btn:hover{color:#bbbec4;background-color:#f7f7f7;border-color:#dddee1}.rp-btn.disabled.active>a:only-child,.rp-btn.disabled:active>a:only-child,.rp-btn.disabled:focus>a:only-child,.rp-btn.disabled:hover>a:only-child,.rp-btn.disabled>a:only-child,.rp-btn[disabled].active>a:only-child,.rp-btn[disabled]:active>a:only-child,.rp-btn[disabled]:focus>a:only-child,.rp-btn[disabled]:hover>a:only-child,.rp-btn[disabled]>a:only-child,fieldset[disabled] .rp-btn.active>a:only-child,fieldset[disabled] .rp-btn:active>a:only-child,fieldset[disabled] .rp-btn:focus>a:only-child,fieldset[disabled] .rp-btn:hover>a:only-child,fieldset[disabled] .rp-btn>a:only-child{color:currentColor}.rp-btn.disabled.active>a:only-child:after,.rp-btn.disabled:active>a:only-child:after,.rp-btn.disabled:focus>a:only-child:after,.rp-btn.disabled:hover>a:only-child:after,.rp-btn.disabled>a:only-child:after,.rp-btn[disabled].active>a:only-child:after,.rp-btn[disabled]:active>a:only-child:after,.rp-btn[disabled]:focus>a:only-child:after,.rp-btn[disabled]:hover>a:only-child:after,.rp-btn[disabled]>a:only-child:after,fieldset[disabled] .rp-btn.active>a:only-child:after,fieldset[disabled] .rp-btn:active>a:only-child:after,fieldset[disabled] .rp-btn:focus>a:only-child:after,fieldset[disabled] .rp-btn:hover>a:only-child:after,fieldset[disabled] .rp-btn>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn:hover{color:#57a3f3;background-color:#fff;border-color:#57a3f3}.rp-btn:hover>a:only-child{color:currentColor}.rp-btn:hover>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn.active,.rp-btn:active{color:#2b85e4;background-color:#fff;border-color:#2b85e4}.rp-btn.active>a:only-child,.rp-btn:active>a:only-child{color:currentColor}.rp-btn.active>a:only-child:after,.rp-btn:active>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn:focus{-webkit-box-shadow:0 0 0 2px rgba(45,140,240,.2);box-shadow:0 0 0 2px rgba(45,140,240,.2)}.rp-btn-long{width:100%}.rp-btn>.rp-icon+span,.rp-btn>span+.rp-icon{margin-left:4px}.rp-table{width:inherit;max-height:280px;max-width:100%;overflow:auto;color:#495060;font-size:12px;background-color:#fff;-webkit-box-sizing:border-box;box-sizing:border-box}.rp-table:before{content:"";width:100%;height:1px;position:absolute;left:0;bottom:0;background-color:#dddee1;z-index:1}.rp-table:after{content:"";width:1px;height:100%;position:absolute;top:0;right:0;background-color:#dddee1;z-index:3}.rp-table-body{overflow:auto}.rp-table td,.rp-table th{min-width:0;height:48px;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:left;text-overflow:ellipsis;vertical-align:middle;border-bottom:1px solid #e9eaec}.rp-table th{height:40px;white-space:nowrap;overflow:hidden;background-color:#f8f8f9}.rp-table td{background-color:#fff;-webkit-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}//.rp-table-cell span{display:none}.rp-table-cell{display:inline-block;word-wrap:normal;vertical-align:middle}.rp-table-cell{padding-top:5px; padding-bottom:5px; padding-left:18px;padding-right:18px;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;-webkit-box-sizing:border-box;box-sizing:border-box}td.rp-table-column-end,th.rp-table-column-end{text-align: end;padding-right: 10px;}td.rp-table-column-right,th.rp-table-column-right{text-align:right}.rp-table table{table-layout:fixed;width: 100%;}.rp-btn-primary{color:#fff;background-color:#2d8cf0;border-color:#2d8cf0;}.rp-btn-primary>a:only-child{color:currentColor}.rp-btn-primary>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn-primary:hover{color:#fff;background-color:#57a3f3;border-color:#57a3f3}.rp-btn-primary:hover>a:only-child{color:currentColor}.rp-btn-primary:hover>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn-primary.active,.rp-btn-primary:active{color:#f2f2f2;background-color:#2b85e4;border-color:#2b85e4}.rp-btn-primary.active>a:only-child,.rp-btn-primary:active>a:only-child{color:currentColor}.rp-btn-primary.active>a:only-child:after,.rp-btn-primary:active>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn-primary.disabled,.rp-btn-primary.disabled.active,.rp-btn-primary.disabled:active,.rp-btn-primary.disabled:focus,.rp-btn-primary.disabled:hover,.rp-btn-primary[disabled],.rp-btn-primary[disabled].active,.rp-btn-primary[disabled]:active,.rp-btn-primary[disabled]:focus,.rp-btn-primary[disabled]:hover,fieldset[disabled] .rp-btn-primary,fieldset[disabled] .rp-btn-primary.active,fieldset[disabled] .rp-btn-primary:active,fieldset[disabled] .rp-btn-primary:focus,fieldset[disabled] .rp-btn-primary:hover{color:#bbbec4;background-color:#f7f7f7;border-color:#dddee1}.rp-btn-primary.disabled.active>a:only-child,.rp-btn-primary.disabled:active>a:only-child,.rp-btn-primary.disabled:focus>a:only-child,.rp-btn-primary.disabled:hover>a:only-child,.rp-btn-primary.disabled>a:only-child,.rp-btn-primary[disabled].active>a:only-child,.rp-btn-primary[disabled]:active>a:only-child,.rp-btn-primary[disabled]:focus>a:only-child,.rp-btn-primary[disabled]:hover>a:only-child,.rp-btn-primary[disabled]>a:only-child,fieldset[disabled] .rp-btn-primary.active>a:only-child,fieldset[disabled] .rp-btn-primary:active>a:only-child,fieldset[disabled] .rp-btn-primary:focus>a:only-child,fieldset[disabled] .rp-btn-primary:hover>a:only-child,fieldset[disabled] .rp-btn-primary>a:only-child{color:currentColor}.rp-btn-primary.disabled.active>a:only-child:after,.rp-btn-primary.disabled:active>a:only-child:after,.rp-btn-primary.disabled:focus>a:only-child:after,.rp-btn-primary.disabled:hover>a:only-child:after,.rp-btn-primary.disabled>a:only-child:after,.rp-btn-primary[disabled].active>a:only-child:after,.rp-btn-primary[disabled]:active>a:only-child:after,.rp-btn-primary[disabled]:focus>a:only-child:after,.rp-btn-primary[disabled]:hover>a:only-child:after,.rp-btn-primary[disabled]>a:only-child:after,fieldset[disabled] .rp-btn-primary.active>a:only-child:after,fieldset[disabled] .rp-btn-primary:active>a:only-child:after,fieldset[disabled] .rp-btn-primary:focus>a:only-child:after,fieldset[disabled] .rp-btn-primary:hover>a:only-child:after,fieldset[disabled] .rp-btn-primary>a:only-child:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background:0 0}.rp-btn-primary.active,.rp-btn-primary:active,.rp-btn-primary:hover{color:#fff}.rp-btn-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(45,140,240,.2);box-shadow:0 0 0 2px rgba(45,140,240,.2)}.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary:not(:first-child):not(:last-child){border-right-color:#2b85e4;border-left-color:#2b85e4}.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary:first-child:not(:last-child){border-right-color:#2b85e4}.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary:first-child:not(:last-child)[disabled]{border-right-color:#dddee1}.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary+.rp-btn,.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary:last-child:not(:first-child){border-left-color:#2b85e4}.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary+.rp-btn[disabled],.rp-btn-group:not(.rp-btn-group-vertical) .rp-btn-primary:last-child:not(:first-child)[disabled]{border-left-color:#dddee1}.rp-btn-group-vertical .rp-btn-primary:not(:first-child):not(:last-child){border-top-color:#2b85e4;border-bottom-color:#2b85e4}.rp-btn-group-vertical .rp-btn-primary:first-child:not(:last-child){border-bottom-color:#2b85e4}.rp-btn-group-vertical .rp-btn-primary:first-child:not(:last-child)[disabled]{border-top-color:#dddee1}.rp-btn-group-vertical .rp-btn-primary+.rp-btn,.rp-btn-group-vertical .rp-btn-primary:last-child:not(:first-child){border-top-color:#2b85e4}.rp-btn-group-vertical .rp-btn-primary+.rp-btn[disabled],.rp-btn-group-vertical .rp-btn-primary:last-child:not(:first-child)[disabled]{border-bottom-color:#dddee1}#card-tips{margin-top: 5px;}.rp-btn-small {padding: 2px 7px;font-size: 12px;border-radius: 3px;margin:5px;}';