跳转到内容

MediaWiki:Gadget-temp-svgFix.js:修订间差异

来自萌娘共享
代码变动:103d1a56 - feat: rename (#594) by U:AnnAngela, co-authored-by: GH:github-actions[bot]
标签由机器人或全自动脚本执行的操作
代码变动:103d1a56 - feat: rename (#594) by U:AnnAngela, co-authored-by: GH:github-actions[bot]
标签由机器人或全自动脚本执行的操作
 
第8行: 第8行:
/* <pre> */
/* <pre> */


"use strict";
"use strict";$(()=>{const s=Array.from(document.querySelectorAll('img[src$=".svg.png"], img[data-lazy-src$=".svg.png"]'));for(const t of s)try{const s=t.src||t.dataset.lazySrc;if("img.moegirl.org.cn"!==new mw.Uri(s).host)continue;t.src=s.replace("/thumb/","/").replace(/\.svg\/[^/]+\.svg\.png$/,".svg"),t.removeAttribute("srcset"),t.removeAttribute("data-lazy-src"),t.removeAttribute("data-lazy-srcset"),t.removeAttribute("data-lazy-state"),t.classList.remove("lazyload"),t.after(t.cloneNode(!0)),t.remove()}catch{}});  
$(() => {
    const svgs = Array.from(document.querySelectorAll('img[src$=".svg.png"], img[data-lazy-src$=".svg.png"]'));
    for (const img of svgs) {
        try {
            const src = img.src || img.dataset.lazySrc;
            const url = new mw.Uri(src);
            if (url.host !== "img.moegirl.org.cn") {
                continue;
            }
            img.src = src.replace("/thumb/", "/").replace(/\.svg\/[^/]+\.svg\.png$/, ".svg");
            img.removeAttribute("srcset");
            img.removeAttribute("data-lazy-src");
            img.removeAttribute("data-lazy-srcset");
            img.removeAttribute("data-lazy-state");
            img.classList.remove("lazyload");
            img.after(img.cloneNode(true));
            img.remove();
        }
        catch { }
    }
});  


/* </pre> */
/* </pre> */

2025年7月26日 (六) 00:34的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/temp-svgFix/Gadget-temp-svgFix.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=103d1a563ea4ccc8ff29fb55c9bcd88329a56eb5|shortId=103d1a56|summary=feat: rename (#594)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";$(()=>{const s=Array.from(document.querySelectorAll('img[src$=".svg.png"], img[data-lazy-src$=".svg.png"]'));for(const t of s)try{const s=t.src||t.dataset.lazySrc;if("img.moegirl.org.cn"!==new mw.Uri(s).host)continue;t.src=s.replace("/thumb/","/").replace(/\.svg\/[^/]+\.svg\.png$/,".svg"),t.removeAttribute("srcset"),t.removeAttribute("data-lazy-src"),t.removeAttribute("data-lazy-srcset"),t.removeAttribute("data-lazy-state"),t.classList.remove("lazyload"),t.after(t.cloneNode(!0)),t.remove()}catch{}}); 

/* </pre> */