manojVivek / medium-unlimited

A browser extension to read medium.com articles for free without membership.
https://manojvivek.github.io/medium-unlimited/
GNU General Public License v3.0
5.43k stars 458 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'scrollIntoView') #182

Open lucarinaorg opened 3 years ago

lucarinaorg commented 3 years ago

Browser Brave on Windows 10

Uncaught TypeError: Cannot read properties of undefined (reading 'scrollIntoView')

Context https://medium.com/enrique-dans/drones-are-a-perfect-example-of-technological-progress-96e683752f31 Stack Trace main.bundle.js:11 (anonymous function)

*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===i)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},144:function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"}));return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},145:function(e,t,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(e,t){return t?t.querySelector(e):document.querySelector(e)},u=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var r=l.call(this,e,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}}(),s=null,c=0,f=[],d=n(364);function p(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=i[r.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(b(r.parts[a],t))}else{var l=[];for(a=0;a<r.parts.length;a++)l.push(b(r.parts[a],t));i[r.id]={id:r.id,refs:1,parts:l}}}}function h(e,t){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],a=t.base?i[0]+t.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}function m(e,t){var n=u(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=f[f.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=u(e.insertAt.before,n);n.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function v(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){0;return n.nc}();r&&(e.attrs.nonce=r)}return g(t,e.attrs),m(e,t),t}function g(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,r,o,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=c++;n=s||(s=v(t)),r=C.bind(null,n,a,!1),o=C.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),m(e,t),t}(t),r=x.bind(null,n,t),o=function(){y(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=E.bind(null,n),o=function(){y(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return p(n,t),function(e){for(var r=[],o=0;o<n.length;o++){var a=n[o];(l=i[a.id]).refs--,r.push(l)}e&&p(h(e,t),t);for(o=0;o<r.length;o++){var l;if(0===(l=r[o]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete i[l.id]}}}};var _,w=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function C(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function E(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function x(e,t,n){var r=n.css,o=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||i)&&(r=d(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}},32:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CONTENT_SECTION_CLASSNAME="section-content",t.MEMBERSHIP_PROMPT_CLASSNAME="postFade",t.MEMBERSHIP_PROMPT_ID="paywall-background-color",t.METERED_CONTENT_CLASSNAME="meteredContent",t.USER_ID_KEY="userId",t.READ_COUNT_KEY="readCount",t.FETCH_CONTENT_MESSAGE="fetchContent",t.FETCH_USER_ID="fetchUserId"},351:function(e,t,n){"use strict";var r=u(n(352)),o=u(n(69)),i=u(n(361)),a=n(47),l=n(32);function u(e){return e&&e.__esModule?e:{default:e}}var s=window.location.href,c=void 0,f=document.createElement("div");f.setAttribute("id","mediumUnlimited"),document.body.appendChild(f);var d=!0;r.default.render(o.default.createElement(i.default,null),f),setInterval((function(){window.location.href!=s&&(s=window.location.href,window.location.href=window.location.href),(0,a.hasMembershipPrompt)(document)?d&&(d=!1,(0,a.log)("Content is hidden"),function(){var e=chrome.extension.getURL("static/loader.gif");(c=document.createElement("div")).innerHTML='\n    <div style="margin: 50px; text-align: center;">\n      Unlocking content, please wait...\n      <img\n        src="'+e+'"\n        style="width: 200px;">\n    </div>\n  ',c.src=e;var t=document.getElementById(l.MEMBERSHIP_PROMPT_ID);if(!t){var n=document.getElementsByTagName("article")[0];t=n.nextSibling.nextSibling}t.parentElement.replaceChild(c,t),document.getElementsByTagName("footer")[0]&&(document.getElementsByTagName("footer")[0].style="margin-top: 100px;")}(),fetch(window.location.href).then((function(e){return e.text()})).then((function(e){var t,n,r=function(e){var t=document.createElement("html");return t.innerHTML=e,t}(e),o=(0,a.getMeteredContentElement)(r);if(o){var i=(0,a.getMeteredContentElement)();return i.parentElement.replaceChild(o,i),o.style.marginBottom="5rem",Array.from(document.querySelectorAll("img")).filter((function(e){return!e.hasAttribute("src")&&"NOSCRIPT"===e.nextSibling.tagName})).forEach((function(e){return e.outerHTML=e.nextSibling.innerHTML})),t=c.parentElement.parentElement,(n=t.previousSibling)&&"root"!==n.parentElement.getAttribute("id")?(t.remove(),n.remove()):c.previousSibling.remove(),c.parentElement.removeChild(c),void setTimeout((function(){return document.getElementsByTagName("h1")[0].scrollIntoView({behavior:"smooth"})}),100)}}))):(0,a.log)("Content is open, nothing to do")}),1500)},352:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}}(),e.exports=n(353)},353:function(e,t,n){"use strict";