Bilibili-Evolved/min/image-resolution.min.js
2019-02-20 13:57:21 +08:00

1 line
650 B
JavaScript

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