“MediaWiki:Gadget-temp-svgFix.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
1个标签由机器人或全自动脚本执行的操作
1个标签由机器人或全自动脚本执行的操作
 
第4行: 第4行:
 
  * -------------------------------------------------------------------------
 
  * -------------------------------------------------------------------------
 
  */
 
  */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/temp-svgFix/MediaWiki:Gadget-temp-svgFix.js|user=[[U:AnnAngela]]|co-authors=|longId=ec2fbee17f83ab700b67b0a8898e660d137c23f4|shortId=ec2fbee|summary=feat(Gadget-temp-svgFix): update SVG image selector to include lazy-loaded images|body=<nowiki>The selector for SVG images was updated to include images that are loaded lazily. This will ensure that all affected SVG images receive appropriate processing.</nowiki>}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/temp-svgFix/MediaWiki:Gadget-temp-svgFix.js|user=[[U:AnnAngela]]|co-authors=|longId=ec2fbee17f83ab700b67b0a8898e660d137c23f4|shortId=ec2fbee1|summary=feat(Gadget-temp-svgFix): update SVG image selector to include lazy-loaded images|body=<nowiki>The selector for SVG images was updated to include images that are loaded lazily. This will ensure that all affected SVG images receive appropriate processing.</nowiki>}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月16日 (二) 09:15的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/temp-svgFix/MediaWiki:Gadget-temp-svgFix.js|user=[[U:AnnAngela]]|co-authors=|longId=ec2fbee17f83ab700b67b0a8898e660d137c23f4|shortId=ec2fbee1|summary=feat(Gadget-temp-svgFix): update SVG image selector to include lazy-loaded images|body=<nowiki>The selector for SVG images was updated to include images that are loaded lazily. This will ensure that all affected SVG images receive appropriate processing.</nowiki>}}'; 

/* <pre> */

"use strict";
var __values = (this && this.__values) || function(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
$(function () {
    var e_1, _a;
    var svgs = Array.from(document.querySelectorAll('img[src$=".svg.png"], img[data-lazy-src$=".svg.png"]'));
    try {
        for (var svgs_1 = __values(svgs), svgs_1_1 = svgs_1.next(); !svgs_1_1.done; svgs_1_1 = svgs_1.next()) {
            var img = svgs_1_1.value;
            try {
                var src = img.src || img.dataset.lazySrc;
                var 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 (_b) { }
        }
    }
    catch (e_1_1) { e_1 = { error: e_1_1 }; }
    finally {
        try {
            if (svgs_1_1 && !svgs_1_1.done && (_a = svgs_1["return"])) _a.call(svgs_1);
        }
        finally { if (e_1) throw e_1.error; }
    }
}); 

/* </pre> */