跳转到内容

User:Linxingjun/RFA2025TEST/js/RFA1K.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//"这一次,我们是如此地接近未来"--重返未来:1999

// 查找所有mw-collapsible-content元素
const collapsibleContents = document.querySelectorAll('.mw-collapsible-content');

// 遍历每个匹配的元素
collapsibleContents.forEach(content => {
// 遍历当前元素的所有子元素
	Array.from(content.children).forEach(child => {
	  // 检查子元素是否为无序列表
	  if (child.tagName === 'UL') {
	    // 创建新的有序列表
	    const orderedList = document.createElement('ol');
	    
	    // 将无序列表的所有子节点转移到有序列表
	    while (child.firstChild) {
	      orderedList.appendChild(child.firstChild);
	    }
	    
	    // 用有序列表替换无序列表
	    child.replaceWith(orderedList);
		}
	});
});