MediaWiki:Header.js:修订间差异

MediaWiki系统消息页面
(创建页面,内容为“// 把整个body都选上,以便下一步使用 var page = document.querySelector("body"); var url = window.location.href; // 仅修改 body class 中有 page-首页 的页面 if (url = "https://citizenwiki.cn/") { // 找到我们要插入新div之后的element var mwBody = document.getElementById('content'); // 新建一个div var newDiv = document.createElement('div'); // 给新插入的element设个class名 newDiv.setAttribute('class', 'header-hero'…”)
 
(已保护“MediaWiki:Header.js”([编辑=仅允许管理员](无限期)[移动=仅允许管理员](无限期)))
(没有差异)

2023年10月6日 (五) 22:26的版本

// 把整个body都选上,以便下一步使用
var page = document.querySelector("body");
var url = window.location.href;
// 仅修改 body class 中有 page-首页 的页面

if (url = "https://citizenwiki.cn/") {
	// 找到我们要插入新div之后的element
	var mwBody = document.getElementById('content');
	// 新建一个div
	var newDiv = document.createElement('div');
	// 给新插入的element设个class名
	newDiv.setAttribute('class', 'header-hero');
	// 加上html内容
	newDiv.innerHTML = '<div class="header-hero-image" style="background-image: linear-gradient(to top, var(--color-surface-0), transparent 150%), url(mainpage.png);background-size: cover;background-position: center center;height: 36vh;margin-bottom: -31vh;"></div>';

	// 将新 div 插入 content 之前
	mwBody.parentNode.insertBefore(newDiv, mwBody);
}