微件:Extract collapsed navbox list:修订间差异
跳转到导航
跳转到搜索
删除的内容 添加的内容
小无编辑摘要 |
小无编辑摘要 |
||
第7行: | 第7行: | ||
function extract(element, index, array) { |
function extract(element, index, array) { |
||
let styles = getComputedStyle(element); |
let styles = getComputedStyle(element); |
||
if (styles.display == 'hidden' |
if (styles.display !== 'hidden' && styles.display !== 'none' ) { |
||
const list = lists[index]; |
const list = lists[index]; |
||
const cloned = list.cloneNode(true); |
const cloned = list.cloneNode(true); |
||
const extracter = extracters[index]; |
const extracter = extracters[index]; |
||
list.appendChild(cloned); |
|||
extracter.remove(); |
|||
} else { |
|||
element.remove(); |
|||
} |
} |
||
} |
} |
2024年4月18日 (四) 17:53的版本
<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) {
function extract(element, index, array) {
let styles = getComputedStyle(element);
if (styles.display !== 'hidden' && styles.display !== 'none' ) {
const list = lists[index];
const cloned = list.cloneNode(true);
const extracter = extracters[index];
list.appendChild(cloned);
extracter.remove();
} else {
element.remove();
}
}
Array.from(elements).forEach(extract);
}
</script>