“MediaWiki:Common.js”与“MediaWiki:Mainpage.js”:页面之间的差异

MediaWiki界面页面
(页面间差异)
无编辑摘要
 
无编辑摘要
标签已被回退
 
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
$(function(){
if (mw.config.get('wgPageName') === '首页'){
    /* 头图 */
importScript( 'MediaWiki:Mainpage.js' );
    var page = document.querySelector("body");
} else {
    if (page.classList.contains('page-首页')) {
}
        var mwBody = document.getElementById('content');
        var newDiv = document.createElement('div');
        newDiv.setAttribute('class', 'header-image');
        newDiv.innerHTML = '<div class="header-image" style="background-image: linear-gradient(to top, var(--color-surface-0), transparent 150%), url(https://image.knebulae.com/data/lnl.png);background-size: cover;background-position: top;height: 36vh;"></div>';
        mwBody.parentNode.insertBefore(newDiv, mwBody);
    }
}());

2023年9月27日 (三) 19:32的版本

$(function(){
    /* 头图 */
    var page = document.querySelector("body");
    if (page.classList.contains('page-首页')) {
        var mwBody = document.getElementById('content');
        var newDiv = document.createElement('div');
        newDiv.setAttribute('class', 'header-image');
        newDiv.innerHTML = '<div class="header-image" style="background-image: linear-gradient(to top, var(--color-surface-0), transparent 150%), url(https://image.knebulae.com/data/lnl.png);background-size: cover;background-position: top;height: 36vh;"></div>';
        mwBody.parentNode.insertBefore(newDiv, mwBody);
    }
}());