Bilibili-Evolved/min/image-resolution.min.js
2019-02-19 01:09:13 +08:00

1 line
604 B
JavaScript

(()=>{return(e,t)=>{const r=/(.*?)@(.*)\./;const o=["certify-img1","certify-img2"];function s(e){if(o.includes(e.id)){return}const t=new Observer(e,()=>{const o=e.getAttribute("src");const s=o.match(r);if(s&&s[1]){t.stop();e.setAttribute("src",s[1])}});t.options={childList:false,attributes:true,subtree:false};t.start()}document.querySelectorAll("img").forEach(e=>s(e));Observer.childListSubtree("body",e=>{for(const t of e){for(const e of t.addedNodes){if(e.nodeName.toLowerCase()==="img"){s(e)}e.querySelectorAll&&e.querySelectorAll("img").forEach(e=>s(e))}}});return{export:{imageResolution:s}}}})();