Bonk Host

Makes hosting rooms in bonk.io better

< 腳本Bonk Host的回應

評論:正評 - 腳本一切正常

§
發表於:2024-01-15
編輯:2024-01-15

There's a bug when using freejoin in teams it keeps adding empty lines to the score board.

Here is a hacky fix to just not display the empty lines (only works for those who have the mod):

let scoresObserver = new MutationObserver((mutations, me) => {
    const scores_left = document.getElementById('ingamewinner_scores_left');
    const scores_right = document.getElementById('ingamewinner_scores_right');
    const left_corrected = scores_left.textContent.split('\r\n').filter(x => x !== ':');
    const right_corrected = scores_right.textContent.split('\r\n').splice(0, left_corrected.length);
    scores_left.textContent = left_corrected.join('\r\n');
    scores_right.textContent = right_corrected.join('\r\n');
});
scoresObserver.observe(document.getElementById('ingamewinner_scores'), { childList: true, subtree: true });

發表回覆

登入以回復