mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix avatar img size
This commit is contained in:
parent
b6ade5eb05
commit
36c40c45bb
2
min/image-resolution.min.js
vendored
2
min/image-resolution.min.js
vendored
@ -1 +1 @@
|
||||
(()=>(t,e)=>{const o=/@(\d+)[Ww]_(\d+)[Hh]/;const n=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseFloat(t.imageResolutionScale);const i=["#certify-img1","#certify-img2"];const r=(t,e)=>{const o=document.createNodeIterator(t,NodeFilter.SHOW_ELEMENT,null);let n=o.nextNode();while(n){if(n instanceof HTMLElement){e(n)}n=o.nextNode()}};async function a(t){const e=(e,r)=>{const a=e(t);if(a===null){return}if(i.some((e=>t.matches(e)))){return}const s=a.match(o);if(!s){return}let[,c,u]=s;let l=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(c)>=l&&l!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",c)}c=Math.round(n*parseInt(c)).toString();u=Math.round(n*parseInt(u)).toString();t.setAttribute("data-resolution-width",c);r(t,a.replace(o,`@${c}w_${u}h`))};Observer.attributes(t,(()=>{e((t=>t.getAttribute("src")),((t,e)=>t.setAttribute("src",e)));e((t=>t.style.backgroundImage),((t,e)=>t.style.backgroundImage=e))}))}const s=async()=>{r(document.body,(t=>a(t)));Observer.childListSubtree(document.body,(t=>{for(const e of t){for(const t of e.addedNodes){if(t instanceof HTMLElement){a(t);if(t.nodeName.toUpperCase()!=="IMG"){r(t,(t=>a(t)))}}}}}))};s();e.applyStyleFromText(`.favInfo-box .favInfo-cover img {width: 100% !important object-position: left !important}`,"image-resolution-fix");return{export:{imageResolution:a}}})();
|
||||
(()=>(t,e)=>{const n=/@(\d+)[Ww]_(\d+)[Hh]/;const o=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseFloat(t.imageResolutionScale);const i=["#certify-img1","#certify-img2"];const r=(t,e)=>{const n=document.createNodeIterator(t,NodeFilter.SHOW_ELEMENT,null);let o=n.nextNode();while(o){if(o instanceof HTMLElement){e(o)}o=n.nextNode()}};async function a(t){const e=(e,r)=>{const a=e(t);if(a===null){return}if(i.some((e=>t.matches(e)))){return}const s=a.match(n);if(!s){return}let[,c,l]=s;let u=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(c)>=u&&u!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",c)}c=Math.round(o*parseInt(c)).toString();l=Math.round(o*parseInt(l)).toString();t.setAttribute("data-resolution-width",c);r(t,a.replace(n,`@${c}w_${l}h`))};Observer.attributes(t,(()=>{e((t=>t.getAttribute("src")),((t,e)=>t.setAttribute("src",e)));e((t=>t.style.backgroundImage),((t,e)=>t.style.backgroundImage=e))}))}const s=async()=>{r(document.body,(t=>a(t)));Observer.childListSubtree(document.body,(t=>{for(const e of t){for(const t of e.addedNodes){if(t instanceof HTMLElement){a(t);if(t.nodeName.toUpperCase()!=="IMG"){r(t,(t=>a(t)))}}}}}))};s();e.applyStyleFromText(`\n.favInfo-box .favInfo-cover img {\n width: 100% !important;\n object-position: left !important;\n}\n.bili-avatar-img {\n width: 100% !important;\n}\n`,"image-resolution-fix");return{export:{imageResolution:a}}})();
|
||||
@ -61,7 +61,15 @@ const startResolution = async () => {
|
||||
})
|
||||
}
|
||||
startResolution()
|
||||
resources.applyStyleFromText(`.favInfo-box .favInfo-cover img {width: 100% !important object-position: left !important}`, 'image-resolution-fix')
|
||||
resources.applyStyleFromText(`
|
||||
.favInfo-box .favInfo-cover img {
|
||||
width: 100% !important;
|
||||
object-position: left !important;
|
||||
}
|
||||
.bili-avatar-img {
|
||||
width: 100% !important;
|
||||
}
|
||||
`, 'image-resolution-fix')
|
||||
export default {
|
||||
export: { imageResolution }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user