mirror of
https://github.com/sagidayan/greasemonkey-scripts.git
synced 2024-11-24 18:15:26 +00:00
[BZ Fresh UI] Added formatting for ticket changes
This commit is contained in:
parent
a518799fff
commit
f99af36f48
1 changed files with 21 additions and 2 deletions
|
@ -84,7 +84,7 @@
|
||||||
async function formatComments() {
|
async function formatComments() {
|
||||||
log('Started');
|
log('Started');
|
||||||
const headers = [...document.getElementsByClassName('bz_comment_head'),
|
const headers = [...document.getElementsByClassName('bz_comment_head'),
|
||||||
...document.getElementsByClassName('bz_first_comment_head')];
|
...document.getElementsByClassName('bz_first_comment_head')];
|
||||||
log(`Found ${headers.length} headers to add avatars to`);
|
log(`Found ${headers.length} headers to add avatars to`);
|
||||||
headers.forEach(async header => {
|
headers.forEach(async header => {
|
||||||
if ([...header.getElementsByClassName('sd_bz_user_avatar')].length) return;
|
if ([...header.getElementsByClassName('sd_bz_user_avatar')].length) return;
|
||||||
|
@ -103,7 +103,26 @@
|
||||||
img.src = userAvatar;
|
img.src = userAvatar;
|
||||||
wrapper.appendChild(img);
|
wrapper.appendChild(img);
|
||||||
header.insertBefore(wrapper, header.firstChild);
|
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>')
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue