微件:External demands:修订间差异

来自Hyacinth
跳转到导航 跳转到搜索
删除的内容 添加的内容
草awa留言 | 贡献
无编辑摘要
草awa留言 | 贡献
无编辑摘要
第5行: 第5行:
const externalDemandShell = document.getElementById('external_demand_shell');
const externalDemandShell = document.getElementById('external_demand_shell');
externalDemandShell.style.display = 'none';
externalDemandShell.style.display = 'none';
} else {
return;
const appendTo = document.getElementById('external_demand');
}


const cats = new Map();
const appendTo = document.getElementById('external_demand');


for (let i = 0; i < elements.length; i++) {
const cats = new Map();
const element = elements[i];
const clone = element.cloneNode(true);
console.log(clone.title);
if (!cats.has(clone.title)) {
cats.set(clone.title,new Array());
}
cats.get(clone.title).push(clone);
clone.style.display = 'inline';
clone.classList.remove('external_demand_span')
}


function handler(value, key, map) {
for (let i = 0; i < elements.length; i++) {
console.log(key);
const element = elements[i];
console.log(value);
const clone = element.cloneNode(true);
const p = document.createElement('p');
console.log(clone.title);
p.innerText = '来自' + key + '的:';
if (!cats.has(clone.title)) {
appendTo.appendChild(p);
cats.set(clone.title,new Array());
const ul = document.createElement('ul');
}
value.forEach((s) => {
cats.get(clone.title).push(clone);
const li = document.createElement('li');
clone.style.display = 'inline';
li.appendChild(s);
clone.classList.remove('external_demand_span')
ul.appendChild(li);
}
})
appendTo.appendChild(ul);
}


cats.forEach(handler);
console.log(cats);

function handler(value, key, map) {
console.log(key);
console.log(value);
const p = document.createElement('p');
p.innerText = '来自' + key + '的:';
appendTo.appendChild(p);
const ul = document.createElement('ul');
value.forEach((s) => {
const li = document.createElement('li');
li.appendChild(s);
ul.appendChild(li);
})
appendTo.appendChild(ul);
}
}

cats.forEach(handler);

</script>
</script>

2024年4月11日 (四) 07:27的版本

<script>
const elements = document.getElementsByClassName('external_demand_span');

if (element.length == 0) {
    const externalDemandShell = document.getElementById('external_demand_shell');
    externalDemandShell.style.display = 'none';
} else {
	const appendTo = document.getElementById('external_demand');

	const cats = new Map();

	for (let i = 0; i < elements.length; i++) {
	    const element = elements[i];
	    const clone = element.cloneNode(true);
	    console.log(clone.title);
	    if (!cats.has(clone.title)) {
	    	cats.set(clone.title,new Array());
    	}
    	cats.get(clone.title).push(clone);
    	clone.style.display = 'inline';
	    clone.classList.remove('external_demand_span')
	}

	function handler(value, key, map) {
    	console.log(key);
    	console.log(value);
    	const p = document.createElement('p');
    	p.innerText = '来自' + key + '的:';
    	appendTo.appendChild(p);
    	const ul = document.createElement('ul');
    	value.forEach((s) => {
        	const li = document.createElement('li');
        	li.appendChild(s);
        	ul.appendChild(li);
    	})
	    appendTo.appendChild(ul);
	}

	cats.forEach(handler);
}
</script>