微件:External demands:修订间差异
删除的内容 添加的内容
小无编辑摘要 |
小 Remove redundant console print. |
||
(未显示同一用户的45个中间版本) | |||
第2行:
const elements = document.getElementsByClassName('external_demand_span');
if (elements.length == 0) {
const appendTo = document.getElementById('external_demand');▼
const externalDemandShell = document.getElementById('external_demand_shell');
externalDemandShell.remove();
} else {
▲ const appendTo = document.getElementById('external_demand');
const cats = new Map();
function makeMap(element, index, array) {
const clone = element.cloneNode(true);▼
element.parentNode.removeChild(element);
cats.set(clone.title,new Array());
}▼
clone.style.display = 'inline';
clone.classList.remove('external_demand_span');▼
}
Array.from(elements).forEach(makeMap);
const
p.innerText = '来自' + key + '的条目:';▼
▲ const clone = element.cloneNode(true);
appendTo.appendChild(p);▼
▲ if (!cats.has(clone.external_demand_from)) {
const displayed = new Map();
▲ }
▲ cats[clone.external_demand_from].push(clone);
const externalTargetData = s.lastChild;
▲ clone.classList.remove('external_demand_span')
const externalTarget = externalTargetData.title;
const displayName = externalTargetData.lastChild.title;
if (duplicates.has(externalTarget)) {
const displayNames = displayed.get(externalTarget);
if (displayNames != null && displayNames.indexOf(displayName) == -1) {
const duplicatedUl = document.createElement('ul');
const duplicatedLi = document.createElement('li');
const duplicatedAlias = s.lastChild.cloneNode(true);
duplicatedAlias.style.display = 'inline';
duplicatedUl.appendChild(duplicatedLi);
duplicates.get(externalTarget).appendChild(duplicatedUl);
displayed.get(externalTarget).push(displayName);
}
} else {
const li = document.createElement('li');
duplicates.set(externalTarget, li);
displayed.set(externalTarget, [displayName]);
li.appendChild(s);
ul.appendChild(li);
})
appendTo.appendChild(ul);
}
cats.forEach(handler);
}
▲cats.forEach((value, key, map) => {
▲ const p = document.createElement('p');
▲ p.innerText = key;
▲ appendTo.appendChild(p);
▲ appendTo.appendChild(s);
▲ })
</script>
|