Mudanças entre as edições de "Widget:Item"

De Wiki Gla
Ir para navegação Ir para pesquisar
m
m
 
Linha 387: Linha 387:
             function getThumbUrl(filename, width) {
             function getThumbUrl(filename, width) {
                 var title = "Special:Redirect/file/" + String(filename).replace(/ /g, "_");
                 var title = "Special:Redirect/file/" + String(filename).replace(/ /g, "_");
                try {
                    if (window.mw && mw.util && mw.util.getUrl) {
                        return mw.util.getUrl(title, { width: width });
                    }
                } catch (e) { /* ignore */ }
                 var scriptPath = "";
                 var scriptPath = "";
                 try {
                 try {
Linha 397: Linha 392:
                         scriptPath = mw.config.get("wgScriptPath") || "";
                         scriptPath = mw.config.get("wgScriptPath") || "";
                     }
                     }
                 } catch (e2) { /* ignore */ }
                 } catch (e) { /* ignore */ }
                /* Caminho relativo ao origin da página (HTTPS). mw.util.getUrl
                  pode gerar http://IP/… e o browser bloqueia Mixed Content. */
                 return scriptPath + "/index.php?title=" + encodeURIComponent(title) + "&width=" + width;
                 return scriptPath + "/index.php?title=" + encodeURIComponent(title) + "&width=" + width;
             }
             }
Linha 423: Linha 420:
                 }
                 }
             }
             }
            function watchIconHydration() {
                if (!window.MutationObserver) return;
                var pending = null;
                var observer = new MutationObserver(function (mutations) {
                    var need = false;
                    for (var i = 0; i < mutations.length; i++) {
                        var added = mutations[i].addedNodes;
                        for (var j = 0; j < added.length; j++) {
                            var node = added[j];
                            if (node.nodeType !== 1) continue;
                            if (node.matches && node.matches(".item-icon[data-i]")) {
                                need = true;
                                break;
                            }
                            if (node.querySelector && node.querySelector(".item-icon[data-i]")) {
                                need = true;
                                break;
                            }
                        }
                        if (need) break;
                    }
                    if (!need) return;
                    if (pending) clearTimeout(pending);
                    pending = setTimeout(function () {
                        pending = null;
                        hydrateAllIcons();
                    }, 0);
                });
                observer.observe(document.documentElement, { childList: true, subtree: true });
            }
            window.glaItemHydrateIcons = hydrateAllIcons;


             function protectItemWrapperEvents() {
             function protectItemWrapperEvents() {
Linha 453: Linha 483:
                 document.addEventListener("DOMContentLoaded", function () {
                 document.addEventListener("DOMContentLoaded", function () {
                     hydrateAllIcons();
                     hydrateAllIcons();
                    watchIconHydration();
                 });
                 });
             } else {
             } else {
                 hydrateAllIcons();
                 hydrateAllIcons();
                watchIconHydration();
             }
             }
             protectItemWrapperEvents();
             protectItemWrapperEvents();

Edição atual tal como às 22h24min de 28 de maio de 2026