“模板:Main page/featured/doc”与“MediaWiki:Mainpage.js”:页面之间的差异

来自NebulaeWiki
< 模板:Main page/featured(页面间差异)
(创建页面,内容为“{{Documentation}} This template is used on the main page. It is the featured article card in the content section. You can update the content by editing the main page settings. <includeonly>{{PAGENAME}}</includeonly>”)
 
无编辑摘要
 
第1行: 第1行:
{{Documentation}}
$(function(){
 
    /* 头图 */
This template is used on the [[首页|main page]]. It is the featured article card in the content section. You can update the content by editing the [[Template:Main page/settings|main page settings]].
    var page = document.querySelector("body");
 
    if (page.classList.contains('page-首页')) {
<includeonly>[[Category:Main page templates|{{PAGENAME}}]]</includeonly>
        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 50%), url(https://wiki.knebulae.com/images/title.png);background-size: cover;background-position: top;height: 36vh;margin-bottom: -37vh;"></div>';
        mwBody.parentNode.insertBefore(newDiv, mwBody);
    }
}());

2024年1月3日 (三) 16:23的版本

$(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 50%), url(https://wiki.knebulae.com/images/title.png);background-size: cover;background-position: top;height: 36vh;margin-bottom: -37vh;"></div>';
        mwBody.parentNode.insertBefore(newDiv, mwBody);
    }
}());