|
|
第1行: |
第1行: |
| /* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ | | /* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ |
| // 检查当前页面的标题或 URL 是否符合条件 | | // 检查当前页面的标题或 URL 是否符合条件 |
| if (mw.config.get('wgCanonicalSpecialPageName') === 'User:Selfice/sandbox/首页') { // 替换为你想限制的页面名称或条件
| |
| // 等待 DOM 完全加载
| |
| document.addEventListener("DOMContentLoaded", function() {
| |
| // 获取父元素和两个子元素
| |
| const parentElement = document.querySelector('.grid_block');
| |
| const firstChild = parentElement.children[0];
| |
| const secondChild = parentElement.children[1];
| |
|
| |
| // 获取第一个子元素的高度
| |
| const firstChildHeight = firstChild.offsetHeight;
| |
|
| |
| // 将第一个子元素的高度应用到第二个子元素的 max-height 上
| |
| secondChild.style.maxHeight = firstChildHeight + 'px';
| |
| });
| |
| }
| |
2025年1月23日 (四) 02:30的版本
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
// 检查当前页面的标题或 URL 是否符合条件