extendedTribeProfile: make membersGrowthPopup table more readable

This commit is contained in:
Dawid Wysokiński 2020-07-18 11:35:23 +02:00
parent 1192531afc
commit bbf699d021
2 changed files with 17 additions and 8 deletions

View File

@ -1638,7 +1638,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @version 0.7.5
// @version 0.8
// @description Extended Tribe Profile
// @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*&screen=info_ally*
@ -1933,10 +1933,10 @@ const buildMembersGrowthTBody = stats => {
}
total += val;
tds.push("<td style=\"".concat(getMembersGrowthTdStyle(val), "\">").concat(val, "</td>"));
tds.push("<td style=\"".concat(getMembersGrowthTdStyle(val), "\">").concat(val.toLocaleString(), "</td>"));
}
return "<tr>\n <td>\n ".concat(player ? "<a href=\"".concat((0, _tribalwars.formatPlayerURL)(id), "\">").concat(player.name, "</a>") : '-', "\n </td>\n ").concat(tds.join(''), "\n <td style=\"").concat(getMembersGrowthTdStyle(total), "\">").concat(total, "</td>\n </tr>");
return "<tr>\n <td>\n ".concat(player ? "<a href=\"".concat((0, _tribalwars.formatPlayerURL)(id), "\">").concat(player.name, "</a>") : '-', "\n </td>\n ").concat(tds.join(''), "\n <td style=\"").concat(getMembersGrowthTdStyle(total), "\"><strong>").concat(total.toLocaleString(), "</strong></td>\n </tr>");
}).join(''), "\n </tbody>\n ");
};
@ -1950,7 +1950,7 @@ const createChangeTypeHandler = stats => e => {
};
const renderMembersGrowthPopup = (e, stats) => {
const formOptions = [['points', 'Points'], ['villages', 'Villages'], ['od', 'Opponents defeated'], ['oda', 'Opponents defeated as attacker'], ['odd', 'Opponents defeated as defender'], ['ods', 'Opponents defeated as supporter']].map(v => "<option value=\"".concat(v[0], "\">").concat(v[1], "</option>"));
const formOptions = [['points', 'Points'], ['villages', 'Villages'], ['od', 'Opponents defeated'], ['oda', 'Opponents defeated as attacker'], ['odd', 'Opponents defeated as defender'], ['ods', 'Opponents defeated as supporter']].map(v => "<option ".concat(MEMBERS_GROWTH_MODE === v[0] ? 'selected="selected"' : '', " value=\"").concat(v[0], "\">").concat(v[1], "</option>"));
const html = "\n <form id=\"".concat(MEMBERS_GROWTH_FORM, "\">\n <select>\n ").concat(formOptions.join(''), "\n </select>\n <button type=\"submit\">Change</button>\n </form>\n <table id=\"").concat(MEMBERS_GROWTH_TABLE_ID, "\" class=\"vis\" style=\"border-collapse: separate; border-spacing: 2px; width: 100%;\">\n ").concat(buildMembersGrowthTBody(stats), "\n </table>\n ");
(0, _renderPopup.default)({
e,

View File

@ -18,7 +18,7 @@ import { formatPlayerURL as formatPlayerURLTribalWars } from './utils/tribalwars
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @version 0.7.5
// @version 0.8
// @description Extended Tribe Profile
// @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*&screen=info_ally*
@ -449,7 +449,9 @@ const buildMembersGrowthTBody = (stats) => {
}
total += val;
tds.push(
`<td style="${getMembersGrowthTdStyle(val)}">${val}</td>`
`<td style="${getMembersGrowthTdStyle(
val
)}">${val.toLocaleString()}</td>`
);
}
return `<tr>
@ -463,7 +465,9 @@ const buildMembersGrowthTBody = (stats) => {
}
</td>
${tds.join('')}
<td style="${getMembersGrowthTdStyle(total)}">${total}</td>
<td style="${getMembersGrowthTdStyle(
total
)}"><strong>${total.toLocaleString()}</strong></td>
</tr>`;
})
.join('')}
@ -490,7 +494,12 @@ const renderMembersGrowthPopup = (e, stats) => {
['oda', 'Opponents defeated as attacker'],
['odd', 'Opponents defeated as defender'],
['ods', 'Opponents defeated as supporter'],
].map((v) => `<option value="${v[0]}">${v[1]}</option>`);
].map(
(v) =>
`<option ${
MEMBERS_GROWTH_MODE === v[0] ? 'selected="selected"' : ''
} value="${v[0]}">${v[1]}</option>`
);
const html = `
<form id="${MEMBERS_GROWTH_FORM}">
<select>