[BZ Fresh UI] Added formatting for ticket changes

This commit is contained in:
Sagi Dayan 2021-08-04 16:02:23 +03:00
parent a518799fff
commit f99af36f48
Signed by: sagi
GPG key ID: FAB96BFC63B46458

View file

@ -103,7 +103,26 @@
img.src = userAvatar;
wrapper.appendChild(img);
header.insertBefore(wrapper, header.firstChild);
})
});
const historyChanges = [...document.getElementsByClassName('ih_history_change')];
log(`Found ${historyChanges.length} changes sections to format.`);
historyChanges.forEach(h => {
const lines = h.innerText.split('\n');
const newLines = [];
lines.forEach(l => {
const tab = newLines.length ? '               ' : '';
if (l.indexOf('→') != -1) {
newLines.push(`${tab}🔀 ${l.replace('→', '🢧')}`);
}
else if (l.indexOf('CC') != -1) {
newLines.push(`${tab}🙋 ${l}`);
}
else {
newLines.push(`${tab}🔼 ${l}`);
}
});
h.innerHTML = newLines.join('<hr>')
});
}