HWM_Log_2_Table

HWM mod - converts log to table

< Feedback on HWM_Log_2_Table

Question/comment

§
Posted: 28.02.2024

// ==UserScript==
// @name HWM_Log_2_Table
// @description HWM mod - converts log to table
// @version 1.1
// @include https://www.heroeswm.ru/pl_transfers.php*
// @namespace https://greasyfork.org/users/165602
// ==/UserScript==

const logContainer = document.querySelectorAll('div.global_a_hover')[1];
const p_date = /(\d{2}-\d{2}-\d{2}) (\d{1,2}:\d{2}): /; // pattern
const p_user = /(.+<\/b><\/a>)/; // pattern
let isOdd = false;
let rec_table = "";
for(let rec of logContainer.innerHTML.split("\n")) {
rec = rec.replace(/
/gi, "");
rec = rec.split("  ").join(""); // trim nbsp
rec = rec.replace(p_date, "$1$2");
rec = rec.replace(p_user, "$1");
rec_table += `${rec}`;
isOdd = !isOdd;
}
logContainer.innerHTML = `${rec_table}

`;

Post reply

Sign in to post a reply.