Greasy Fork is available in English.

HWM_Log_2_Table

HWM mod - converts log to table

< Обсуждения HWM_Log_2_Table

Вопрос/комментарий

// ==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}

`;

Ответить

Войдите, чтобы ответить.