微件:Extract collapsed navbox list:修订间差异
跳转到导航
跳转到搜索
删除的内容 添加的内容
Cao awa将页面Widget:Extract collapsed navbox list的内容模型从“wikitext”更改为“JavaScript” |
小无编辑摘要 |
||
第7行: | 第7行: | ||
for (let i = 0; i < elements.length; i++) { |
for (let i = 0; i < elements.length; i++) { |
||
const element = elements[i]; |
const element = elements[i]; |
||
let styles = getComputedStyle(element); |
|||
if ( |
if (styles.display == 'hidden' || styles.display == 'none' ) { |
||
const list = lists[i]; |
const list = lists[i]; |
||
const cloned = list.cloneNode(true); |
const cloned = list.cloneNode(true); |
2024年4月17日 (三) 23:06的版本
<script>
const elements = document.getElementsByClassName('collapsed-navbox-list-base');
const lists = document.getElementsByClassName('collapsed-navbox-list');
const extracters = document.getElementsByClassName('collapsed-navbox-list-extracter');
if (elements.length !== 0) {
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
let styles = getComputedStyle(element);
if (styles.display == 'hidden' || styles.display == 'none' ) {
const list = lists[i];
const cloned = list.cloneNode(true);
const extracter = extracters[i];
extracter.appendChild(cloned);
element.remove();
}
}
}
</script>