打开/关闭菜单
32
302
27
963
植物大战僵尸杂交版Wiki
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
本Wiki为杂交版民间Wiki,不对杂交版官方产生影响
Wiki制作组招募群号:633922116

MediaWiki:Common.js:修订间差异

MediaWiki界面页面
无编辑摘要
Operator留言 | 贡献
无编辑摘要
 
(未显示2个用户的5个中间版本)
第1行: 第1行:
// 等待页面完全加载后再执行
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
$(function() {
 
     // 如果已经添加过,则不再重复添加
// 自动加载 MediaWiki:Footer 页面内容,并插入到每个页面底部
     if (document.getElementById('global-footer-links')) {
 
$(document).ready(function() {
     const namespace = mw.config.get('wgNamespaceNumber');
     const action = mw.config.get('wgAction');
   
    if (namespace !== 0 || action !== 'view') {
         return;
         return;
     }
     }


     var footerHtml = '<div id="global-footer-links" style="width:100%; margin-top:20px; padding:15px 0; display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; border-top:1px solid #ccc;">' +
     fetch("/api.php?action=parse&page=MediaWiki:Footer&format=json")
        '<div><a href="https://new.pvzhe.wiki/index.php?title=特殊:创建账户&returnto=首页">加入我们</a></div>' +
         .then(res => res.json())
         '<div><a href="https://www.pvzhe.com/new">前往官网以了解更多游戏信息</a></div>' +
         .then(data => {
         '</div>';
            if (data.parse && data.parse.text) {
   
                const html = data.parse.text['*'];
    // 查找页脚元素(PC和手机端通用的选择器)
                $('#mw-content-text').append('<div class="global-footer">' + html + '</div>');
    var $footer = $('#footer, #mw-footer, footer, .footer');
            }
   
        });
    if ($footer.length) {
        // 在页脚之前插入
        $footer.before(footerHtml);
    } else {
        // 如果找不到页脚,才尝试追加到内容区末尾
        $('#mw-content-text, .mw-body-content, #content').append(footerHtml);
    }
});
});

2026年3月27日 (五) 11:25的最新版本

/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */

// 自动加载 MediaWiki:Footer 页面内容,并插入到每个页面底部

$(document).ready(function() {
    const namespace = mw.config.get('wgNamespaceNumber');
    const action = mw.config.get('wgAction');
    
    if (namespace !== 0 || action !== 'view') {
        return;
    }

    fetch("/api.php?action=parse&page=MediaWiki:Footer&format=json")
        .then(res => res.json())
        .then(data => {
            if (data.parse && data.parse.text) {
                const html = data.parse.text['*'];
                $('#mw-content-text').append('<div class="global-footer">' + html + '</div>');
            }
        });
});