inoreader full in iframe

Fixed https://gf.qytechs.cn/en/scripts/441956-inoreader-full - inoreader full content in iframe (需要配合辅助插件修改响应头,允许跨域iframe展示,例如 ignore-x-frame-headers 在tagArr,数组添加想要注入脚本文件夹名)

  1. // ==UserScript==
  2. // @name inoreader full in iframe
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Fixed https://gf.qytechs.cn/en/scripts/441956-inoreader-full - inoreader full content in iframe (需要配合辅助插件修改响应头,允许跨域iframe展示,例如 ignore-x-frame-headers 在tagArr,数组添加想要注入脚本文件夹名)
  6. // @author henryxrl
  7. // @match https://www.inoreader.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=inoreader.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const tagArr=['feeddd-wechat-rss','github']//允许跨域的文件夹名放这里
  16. function includesTags(){
  17. const firstTag=document.querySelector('.article_tags').firstChild.textContent
  18. return tagArr.includes(firstTag)
  19. }
  20. let lastUrl
  21. setInterval(interval,500)
  22. function interval(){
  23.  
  24. const articleTitle=document.querySelector('.article_title ')
  25. if(!articleTitle) {
  26. lastUrl = undefined
  27. return
  28. }
  29. const articleLocation=document.querySelector('.article_title a')
  30. const articleUrl=articleLocation.href
  31.  
  32. if (articleLocation.protocol !== 'https:') {
  33. articleLocation.protocol = 'https';
  34. }
  35.  
  36. const articleArr = document.querySelector('#reader_pane').querySelectorAll('.article')
  37. if(lastUrl!=articleUrl){
  38. lastUrl=articleUrl
  39. console.log('正在替换iframe:',articleUrl)
  40. let articleContent=document.querySelector('.article_content')
  41. const frame=createFrame(articleUrl,articleContent)
  42. Array.from(articleContent.childNodes).forEach((i)=>articleContent.removeChild(i))
  43. articleContent.appendChild(frame)
  44. }else{
  45. //todo 实时调整下高度?跨域好像不太行
  46. }
  47. }
  48. function getNextArrHeight(element){
  49. let arr=[]
  50. let next=element.nextElementSibling
  51. while (next!=null){
  52. arr.push(next)
  53. next=next.nextElementSibling
  54. }
  55. return arr.reduce((previousValue, currentValue) => previousValue + currentValue.clientHeight ,0)
  56. }
  57.  
  58. function createFrame(url,articleContent){
  59. // console.log('click',url)
  60. const iframeElement = document.createElement(`iframe`);
  61. iframeElement.className = `articleEmbed`;
  62. iframeElement.src = url
  63. iframeElement.style.width="100%";
  64. iframeElement.style.maxWidth="100%";
  65. iframeElement.style.height=`calc(100vh - ${getNextArrHeight(articleContent)}px)`;//没啥意义,就先这样吧
  66. iframeElement.style.height="100vh";
  67. iframeElement.sandbox="allow-scripts allow-same-origin allow-popups"//用sandbox属性禁止跳转,reddit这种就没办法了
  68. //iframeElement.security="restricted"//IE的禁止js的功能
  69. return iframeElement
  70. }
  71.  
  72. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址