微件:Extract collapsed navbox list:修订间差异

来自Hyacinth
跳转到导航 跳转到搜索
删除的内容 添加的内容
草awa留言 | 贡献
无编辑摘要
草awa留言 | 贡献
无编辑摘要
第6行: 第6行:
if (elements.length !== 0) {
if (elements.length !== 0) {
function extract(element) {
function extract(element) {
let styles = getComputedStyle(element);
let styles = getComputedStyle(element, index, array);
if (styles.display == 'hidden' || styles.display == 'none' ) {
if (styles.display == 'hidden' || styles.display == 'none' ) {
const list = lists[i];
const list = lists[index];
const cloned = list.cloneNode(true);
const cloned = list.cloneNode(true);
const extracter = extracters[i];
const extracter = extracters[index];
extracter.appendChild(cloned);
extracter.appendChild(cloned);
element.remove();
element.remove();

2024年4月18日 (四) 17:40的版本

<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) {
    	let styles = getComputedStyle(element, index, array);
        if (styles.display == 'hidden' || styles.display == 'none' ) {
            const list = lists[index];
            const cloned = list.cloneNode(true);
            const extracter = extracters[index];
            extracter.appendChild(cloned);
            element.remove();
        }
    }
    
	Array.from(elements).forEach(extract);
}
</script>