translate extendedTribeProfile into Polish

This commit is contained in:
Dawid Wysokiński 2020-07-22 17:31:27 +02:00
parent 7b84baf0d4
commit c3e9e7433e
6 changed files with 224 additions and 54 deletions

View File

@ -187,6 +187,7 @@ const translations = {
resourcesGathered: 'Zebrane surowce', resourcesGathered: 'Zebrane surowce',
villagesConquered: 'Podbite wioski', villagesConquered: 'Podbite wioski',
exportedVillages: 'Wyeksportowane wioski', exportedVillages: 'Wyeksportowane wioski',
tribeChanges: 'Zmiany plemion',
action: { action: {
showTribeChanges: 'Pokaż zmiany plemion', showTribeChanges: 'Pokaż zmiany plemion',
showEnnoblements: 'Pokaż przejęcia', showEnnoblements: 'Pokaż przejęcia',
@ -215,6 +216,7 @@ const translations = {
resourcesGathered: 'Resources gathered', resourcesGathered: 'Resources gathered',
villagesConquered: 'Villages conquered', villagesConquered: 'Villages conquered',
exportedVillages: 'Exported villages', exportedVillages: 'Exported villages',
tribeChanges: 'Tribe changes',
action: { action: {
showTribeChanges: 'Show tribe changes', showTribeChanges: 'Show tribe changes',
showEnnoblements: 'Show ennoblements', showEnnoblements: 'Show ennoblements',
@ -1129,7 +1131,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
// @namespace https://github.com/tribalwarshelp/scripts // @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js // @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @version 1.1.0 // @version 1.1.1
// @description Extended Player Profile // @description Extended Player Profile
// @author Kichiyaki http://dawid-wysokinski.pl/ // @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*screen=info_player* // @match *://*/game.php*screen=info_player*
@ -1353,7 +1355,7 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
}).join(''), "\n </tbody>\n </table>\n "); }).join(''), "\n </tbody>\n </table>\n ");
(0, _showPopup.default)({ (0, _showPopup.default)({
e, e,
title: "Tribe changes", title: translations.tribeChanges,
id: 'tribeChanges', id: 'tribeChanges',
html html
}); });

View File

@ -892,7 +892,88 @@ function differenceInDays(dirtyDateLeft, dirtyDateRight) {
return result === 0 ? 0 : result; return result === 0 ? 0 : result;
} }
},{"../toDate/index.js":"KYJg","../differenceInCalendarDays/index.js":"ieRm","../_lib/requiredArgs/index.js":"kK6Q"}],"Ph2E":[function(require,module,exports) { },{"../toDate/index.js":"KYJg","../differenceInCalendarDays/index.js":"ieRm","../_lib/requiredArgs/index.js":"kK6Q"}],"iFDG":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const translations = {
pl_PL: {
date: 'Data',
createdAt: 'Data założenia',
dominance: 'Dominacja',
bestRank: 'Najlepszy ranking',
mostPoints: 'Najwięcej punktów',
mostVillages: 'Najwięcej wiosek',
player: 'Gracz',
points: 'Punkty',
villages: 'Wioski',
opponentsDefeated: 'Pokonani przeciwnicy',
opponentsDefeatedAsAttacker: 'Pokonani przeciwnicy jako agresor',
opponentsDefeatedAsDefender: 'Pokonani przeciwnicy jako obrońca',
opponentsDefeatedAsSupporter: 'Pokonani przeciwnicy jako wspierający',
change: 'Zmień',
left: 'Opuścił',
joined: 'Dołączył',
tribeChanges: 'Zmiany plemion',
membersGrowth: 'Rozwój graczy',
act: 'Akcja',
total: 'Razem',
oda: 'RA',
odd: 'RO',
ods: 'RW',
od: 'Pokonani ogólnie',
dailyGrowth: 'Dzienny przyrost',
playerLinks: 'Linki',
action: {
showTribeChanges: 'Pokaż zmiany plemion',
showEnnoblements: 'Pokaż przejęcia',
showMembersGrowth: 'Pokaż rozwój graczy',
showHistory: 'Pokaż historię'
}
},
en_DK: {
date: 'Date',
createdAt: 'Created at',
dominance: 'Dominance',
bestRank: 'Best rank',
mostPoints: 'Most points',
mostVillages: 'Most villages',
player: 'Player',
points: 'Points',
villages: 'Villages',
opponentsDefeated: 'Opponents defeated',
opponentsDefeatedAsAttacker: 'Opponents defeated as attacker',
opponentsDefeatedAsDefender: 'Opponents defeated as defender',
opponentsDefeatedAsSupporter: 'Opponents defeated as supporter',
change: 'Change',
membersGrowth: 'Members growth',
tribeChanges: 'Tribe changes',
left: 'Left',
joined: 'Joined',
act: 'Action',
total: 'Total',
oda: 'ODA',
odd: 'ODD',
ods: 'ODS',
od: 'OD',
dailyGrowth: 'Daily growth',
playerLinks: 'Player links',
action: {
showTribeChanges: 'Show tribe changes',
showEnnoblements: 'Show ennoblements',
showMembersGrowth: 'Show members growth',
showHistory: 'Show history'
}
}
};
var _default = () => translations[window.game_data.locale] || translations.en_DK;
exports.default = _default;
},{}],"Ph2E":[function(require,module,exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
@ -1725,6 +1806,8 @@ var _isURL = _interopRequireDefault(require("validator/lib/isURL"));
var _differenceInDays = _interopRequireDefault(require("date-fns/differenceInDays")); var _differenceInDays = _interopRequireDefault(require("date-fns/differenceInDays"));
var _extendedTribeProfile = _interopRequireDefault(require("./i18n/extendedTribeProfile"));
var _requestCreator = _interopRequireDefault(require("./libs/requestCreator")); var _requestCreator = _interopRequireDefault(require("./libs/requestCreator"));
var _pagination = require("./utils/pagination"); var _pagination = require("./utils/pagination");
@ -1762,7 +1845,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
// @namespace https://github.com/tribalwarshelp/scripts // @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js // @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @version 0.9.6 // @version 1.0.0
// @description Extended Tribe Profile // @description Extended Tribe Profile
// @author Kichiyaki http://dawid-wysokinski.pl/ // @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*screen=info_ally* // @match *://*/game.php*screen=info_ally*
@ -1786,6 +1869,7 @@ const profileInfoTBody = document.querySelector('#content_value > table:nth-chil
const actionsContainer = profileInfoTBody; const actionsContainer = profileInfoTBody;
const otherElementsContainer = document.querySelector('#content_value > table:nth-child(3) > tbody > tr > td:nth-child(2)'); const otherElementsContainer = document.querySelector('#content_value > table:nth-child(3) > tbody > tr > td:nth-child(2)');
const membersContainer = document.querySelector('#content_value > table.vis > tbody'); const membersContainer = document.querySelector('#content_value > table.vis > tbody');
const translations = (0, _extendedTribeProfile.default)();
const loadDataFromCache = () => { const loadDataFromCache = () => {
return (0, _localStorage.getItem)(LOCAL_STORAGE_KEY); return (0, _localStorage.getItem)(LOCAL_STORAGE_KEY);
@ -1856,7 +1940,7 @@ const extendMembersData = players => {
const heading = membersContainer.querySelector('tr:first-child'); const heading = membersContainer.querySelector('tr:first-child');
if (heading.children.length !== 11) { if (heading.children.length !== 11) {
['ODA', 'ODD', 'ODS', 'OD', 'Daily growth', 'Player links'].forEach(v => { [translations.oda, translations.odd, translations.ods, translations.od, translations.dailyGrowth, translations.playerLinks].forEach(v => {
const th = document.createElement('th'); const th = document.createElement('th');
th.innerHTML = v; th.innerHTML = v;
heading.appendChild(th); heading.appendChild(th);
@ -1886,7 +1970,7 @@ const extendMembersData = players => {
if (typeof data[0] === 'number') { if (typeof data[0] === 'number') {
td.innerHTML = "".concat(data[0].toLocaleString(), " (<strong>").concat(data[1], "</strong>)"); td.innerHTML = "".concat(data[0].toLocaleString(), " (<strong>").concat(data[1], "</strong>)");
} else if ((0, _isURL.default)(data[0])) { } else if ((0, _isURL.default)(data[0])) {
td.innerHTML = "<a href=\"".concat(data[0], "\">").concat(data[1], "</a>"); td.innerHTML = "<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"".concat(data[0], "\">").concat(data[1], "</a>");
} }
} else if (typeof data === 'number') { } else if (typeof data === 'number') {
td.innerHTML = data.toLocaleString(); td.innerHTML = data.toLocaleString();
@ -1903,23 +1987,23 @@ const render = (_ref2) => {
players players
} = _ref2; } = _ref2;
[{ [{
title: 'Created at:', title: translations.createdAt + ':',
data: (0, _formatDate.default)(tribe.createdAt), data: (0, _formatDate.default)(tribe.createdAt),
id: 'created_at' id: 'created_at'
}, { }, {
title: 'Dominance:', title: translations.dominance + ':',
data: tribe.dominance.toFixed(2) + '%', data: tribe.dominance.toFixed(2) + '%',
id: 'dominance' id: 'dominance'
}, { }, {
title: 'Best rank:', title: translations.bestRank + ':',
data: tribe.bestRank + ' ' + "(".concat((0, _formatDate.default)(tribe.bestRankAt), ")"), data: tribe.bestRank + ' ' + "(".concat((0, _formatDate.default)(tribe.bestRankAt), ")"),
id: 'best_rank' id: 'best_rank'
}, { }, {
title: 'Most points:', title: translations.mostPoints + ':',
data: tribe.mostPoints.toLocaleString() + ' ' + "(".concat((0, _formatDate.default)(tribe.mostPointsAt), ")"), data: tribe.mostPoints.toLocaleString() + ' ' + "(".concat((0, _formatDate.default)(tribe.mostPointsAt), ")"),
id: 'most_points' id: 'most_points'
}, { }, {
title: 'Most villages:', title: translations.mostVillages + ':',
data: tribe.mostVillages + ' ' + "(".concat((0, _formatDate.default)(tribe.mostVillagesAt), ")"), data: tribe.mostVillages + ' ' + "(".concat((0, _formatDate.default)(tribe.mostVillagesAt), ")"),
id: 'most_villages' id: 'most_villages'
}].forEach(data => { }].forEach(data => {
@ -2034,13 +2118,13 @@ const mapMembersGrowthTdValue = i => {
const buildMembersGrowthTBody = stats => { const buildMembersGrowthTBody = stats => {
const dates = [...new Set(stats.items.map(item => item.createDate))].reverse(); const dates = [...new Set(stats.items.map(item => item.createDate))].reverse();
return "\n <tbody>\n <tr>\n <th>Player</th>\n ".concat(dates.map(date => { return "\n <tbody>\n <tr>\n <th>".concat(translations.player, "</th>\n ").concat(dates.map(date => {
return "<th>".concat((0, _formatDate.default)(date, { return "<th>".concat((0, _formatDate.default)(date, {
year: 'numeric', year: 'numeric',
month: '2-digit', month: '2-digit',
day: '2-digit' day: '2-digit'
}), "</th>"); }), "</th>");
}).join(''), "\n <th>Total</th>\n </tr>\n ").concat(getMembersIDs().map(id => { }).join(''), "\n <th>").concat(translations.total, "</th>\n </tr>\n ").concat(getMembersIDs().map(id => {
const filtered = stats.items.filter(item => item.player && item.player.id === id).reverse(); const filtered = stats.items.filter(item => item.player && item.player.id === id).reverse();
let player = undefined; let player = undefined;
@ -2077,11 +2161,11 @@ const createChangeTypeHandler = stats => e => {
}; };
const renderMembersGrowthPopup = (e, stats) => { 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 ".concat(MEMBERS_GROWTH_MODE === v[0] ? 'selected="selected"' : '', " value=\"").concat(v[0], "\">").concat(v[1], "</option>")); const formOptions = [['points', translations.points], ['villages', translations.villages], ['od', translations.opponentsDefeated], ['oda', translations.opponentsDefeatedAsAttacker], ['odd', translations.opponentsDefeatedAsDefender], ['ods', translations.opponentsDefeatedAsSupporter]].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 "); const html = "\n <form id=\"".concat(MEMBERS_GROWTH_FORM, "\">\n <select>\n ").concat(formOptions.join(''), "\n </select>\n <button type=\"submit\">").concat(translations.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, _showPopup.default)({ (0, _showPopup.default)({
e, e,
title: "Members growth", title: translations.membersGrowth,
id: 'mg', id: 'mg',
html html
}); });
@ -2129,7 +2213,7 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
limit: TRIBE_CHANGES_PER_PAGE, limit: TRIBE_CHANGES_PER_PAGE,
currentPage currentPage
}); });
const html = "\n <div style=\"".concat((0, _pagination.getContainerStyles)(), "\" id=\"").concat(TRIBE_CHANGES_PAGINATION_CONTAINER_ID, "\">\n ").concat(paginationItems.join(''), "\n </div>\n <table class=\"vis\" style=\"border-collapse: separate; border-spacing: 2px; width: 100%;\">\n <tbody>\n <tr>\n <th>\n Date\n </th>\n <th>\n Player\n </th>\n <th>\n Action\n </th>\n </tr>\n ").concat(tribeChanges.items.map(tribeChange => { const html = "\n <div style=\"".concat((0, _pagination.getContainerStyles)(), "\" id=\"").concat(TRIBE_CHANGES_PAGINATION_CONTAINER_ID, "\">\n ").concat(paginationItems.join(''), "\n </div>\n <table class=\"vis\" style=\"border-collapse: separate; border-spacing: 2px; width: 100%;\">\n <tbody>\n <tr>\n <th>\n ").concat(translations.date, "\n </th>\n <th>\n ").concat(translations.player, "\n </th>\n <th>\n ").concat(translations.act, "\n </th>\n </tr>\n ").concat(tribeChanges.items.map(tribeChange => {
let rowHTML = '<tr>' + "<td>".concat((0, _formatDate.default)(tribeChange.createdAt), "</td>"); let rowHTML = '<tr>' + "<td>".concat((0, _formatDate.default)(tribeChange.createdAt), "</td>");
if (tribeChange.player) { if (tribeChange.player) {
@ -2138,12 +2222,12 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
rowHTML += '<td>-</td>'; rowHTML += '<td>-</td>';
} }
rowHTML += "<td><strong>".concat(tribeChange.newTribe && tribeChange.newTribe.id === TRIBE_ID ? 'Joined' : 'Left', "</strong></td>"); rowHTML += "<td><strong>".concat(tribeChange.newTribe && tribeChange.newTribe.id === TRIBE_ID ? translations.joined : translations.left, "</strong></td>");
return rowHTML + '</tr>'; return rowHTML + '</tr>';
}).join(''), "\n </tbody>\n </table>\n "); }).join(''), "\n </tbody>\n </table>\n ");
(0, _showPopup.default)({ (0, _showPopup.default)({
e, e,
title: "Tribe changes", title: translations.tribeChanges,
id: 'tribeChanges', id: 'tribeChanges',
html html
}); });
@ -2189,24 +2273,24 @@ const renderActions = () => {
const showEnnoblements = document.createElement('a'); const showEnnoblements = document.createElement('a');
showEnnoblements.href = '#'; showEnnoblements.href = '#';
(0, _pagination.setPage)(showEnnoblements, '1'); (0, _pagination.setPage)(showEnnoblements, '1');
showEnnoblements.innerHTML = 'Show ennoblements'; showEnnoblements.innerHTML = translations.action.showEnnoblements;
showEnnoblements.addEventListener('click', handleShowTribeEnnoblementsClick); showEnnoblements.addEventListener('click', handleShowTribeEnnoblementsClick);
actionsContainer.appendChild(wrapAction(showEnnoblements)); actionsContainer.appendChild(wrapAction(showEnnoblements));
const showHistory = document.createElement('a'); const showHistory = document.createElement('a');
showHistory.href = '#'; showHistory.href = '#';
(0, _pagination.setPage)(showHistory, '1'); (0, _pagination.setPage)(showHistory, '1');
showHistory.innerHTML = 'Show history'; showHistory.innerHTML = translations.action.showHistory;
showHistory.addEventListener('click', handleShowTribeHistoryClick); showHistory.addEventListener('click', handleShowTribeHistoryClick);
actionsContainer.appendChild(wrapAction(showHistory)); actionsContainer.appendChild(wrapAction(showHistory));
const showTribeChanges = document.createElement('a'); const showTribeChanges = document.createElement('a');
showTribeChanges.href = '#'; showTribeChanges.href = '#';
(0, _pagination.setPage)(showTribeChanges, '1'); (0, _pagination.setPage)(showTribeChanges, '1');
showTribeChanges.innerHTML = 'Show tribe changes'; showTribeChanges.innerHTML = translations.action.showTribeChanges;
showTribeChanges.addEventListener('click', handleShowTribeChangesClick); showTribeChanges.addEventListener('click', handleShowTribeChangesClick);
actionsContainer.appendChild(wrapAction(showTribeChanges)); actionsContainer.appendChild(wrapAction(showTribeChanges));
const showMembersGrowth = document.createElement('a'); const showMembersGrowth = document.createElement('a');
showMembersGrowth.href = '#'; showMembersGrowth.href = '#';
showMembersGrowth.innerHTML = 'Show members growth'; showMembersGrowth.innerHTML = translations.action.showMembersGrowth;
showMembersGrowth.addEventListener('click', handleShowMembersGrowthClick); showMembersGrowth.addEventListener('click', handleShowMembersGrowthClick);
actionsContainer.appendChild(wrapAction(showMembersGrowth)); actionsContainer.appendChild(wrapAction(showMembersGrowth));
}; };
@ -2230,4 +2314,4 @@ const renderActions = () => {
console.log('extended tribe profile', error); console.log('extended tribe profile', error);
} }
})(); })();
},{"validator/lib/isURL":"XMVV","date-fns/differenceInDays":"mdVI","./libs/requestCreator":"Ph2E","./utils/pagination":"fCHX","./common/renderTodaysStats":"yrCm","./common/showEnnoblementsPopup":"vNT1","./common/showHistoryPopup":"kEDU","./utils/showPopup":"chDM","./utils/getIDFromURL":"tQUs","./utils/getCurrentServer":"DMkL","./utils/localStorage":"KWxH","./utils/formatDate":"V6Mf","./utils/twstats":"Syko","./utils/tribalwars":"fHHP"}]},{},["r4nF"], null) },{"validator/lib/isURL":"XMVV","date-fns/differenceInDays":"mdVI","./i18n/extendedTribeProfile":"iFDG","./libs/requestCreator":"Ph2E","./utils/pagination":"fCHX","./common/renderTodaysStats":"yrCm","./common/showEnnoblementsPopup":"vNT1","./common/showHistoryPopup":"kEDU","./utils/showPopup":"chDM","./utils/getIDFromURL":"tQUs","./utils/getCurrentServer":"DMkL","./utils/localStorage":"KWxH","./utils/formatDate":"V6Mf","./utils/twstats":"Syko","./utils/tribalwars":"fHHP"}]},{},["r4nF"], null)

View File

@ -22,7 +22,7 @@ import { setItem, getItem } from './utils/localStorage';
// @namespace https://github.com/tribalwarshelp/scripts // @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js // @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @version 1.1.0 // @version 1.1.1
// @description Extended Player Profile // @description Extended Player Profile
// @author Kichiyaki http://dawid-wysokinski.pl/ // @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*screen=info_player* // @match *://*/game.php*screen=info_player*
@ -524,7 +524,7 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
showPopup({ showPopup({
e, e,
title: `Tribe changes`, title: translations.tribeChanges,
id: 'tribeChanges', id: 'tribeChanges',
html, html,
}); });

View File

@ -1,5 +1,6 @@
import isURL from 'validator/lib/isURL'; import isURL from 'validator/lib/isURL';
import differenceInDays from 'date-fns/differenceInDays'; import differenceInDays from 'date-fns/differenceInDays';
import getTranslations from './i18n/extendedTribeProfile';
import requestCreator from './libs/requestCreator'; import requestCreator from './libs/requestCreator';
import { import {
setPage, setPage,
@ -23,7 +24,7 @@ import { formatPlayerURL as formatPlayerURLTribalWars } from './utils/tribalwars
// @namespace https://github.com/tribalwarshelp/scripts // @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js // @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @version 0.9.6 // @version 1.0.0
// @description Extended Tribe Profile // @description Extended Tribe Profile
// @author Kichiyaki http://dawid-wysokinski.pl/ // @author Kichiyaki http://dawid-wysokinski.pl/
// @match *://*/game.php*screen=info_ally* // @match *://*/game.php*screen=info_ally*
@ -197,6 +198,7 @@ const otherElementsContainer = document.querySelector(
const membersContainer = document.querySelector( const membersContainer = document.querySelector(
'#content_value > table.vis > tbody' '#content_value > table.vis > tbody'
); );
const translations = getTranslations();
const loadDataFromCache = () => { const loadDataFromCache = () => {
return getItem(LOCAL_STORAGE_KEY); return getItem(LOCAL_STORAGE_KEY);
@ -257,7 +259,14 @@ const extendMembersData = (players) => {
membersContainer.parentElement.style.width = '100%'; membersContainer.parentElement.style.width = '100%';
const heading = membersContainer.querySelector('tr:first-child'); const heading = membersContainer.querySelector('tr:first-child');
if (heading.children.length !== 11) { if (heading.children.length !== 11) {
['ODA', 'ODD', 'ODS', 'OD', 'Daily growth', 'Player links'].forEach((v) => { [
translations.oda,
translations.odd,
translations.ods,
translations.od,
translations.dailyGrowth,
translations.playerLinks,
].forEach((v) => {
const th = document.createElement('th'); const th = document.createElement('th');
th.innerHTML = v; th.innerHTML = v;
heading.appendChild(th); heading.appendChild(th);
@ -290,7 +299,7 @@ const extendMembersData = (players) => {
data[1] data[1]
}</strong>)`; }</strong>)`;
} else if (isURL(data[0])) { } else if (isURL(data[0])) {
td.innerHTML = `<a href="${data[0]}">${data[1]}</a>`; td.innerHTML = `<a target="_blank" rel="noopener noreferrer" href="${data[0]}">${data[1]}</a>`;
} }
} else if (typeof data === 'number') { } else if (typeof data === 'number') {
td.innerHTML = data.toLocaleString(); td.innerHTML = data.toLocaleString();
@ -303,22 +312,22 @@ const extendMembersData = (players) => {
const render = ({ tribe, dailyTribeStats, players }) => { const render = ({ tribe, dailyTribeStats, players }) => {
[ [
{ {
title: 'Created at:', title: translations.createdAt + ':',
data: formatDate(tribe.createdAt), data: formatDate(tribe.createdAt),
id: 'created_at', id: 'created_at',
}, },
{ {
title: 'Dominance:', title: translations.dominance + ':',
data: tribe.dominance.toFixed(2) + '%', data: tribe.dominance.toFixed(2) + '%',
id: 'dominance', id: 'dominance',
}, },
{ {
title: 'Best rank:', title: translations.bestRank + ':',
data: tribe.bestRank + ' ' + `(${formatDate(tribe.bestRankAt)})`, data: tribe.bestRank + ' ' + `(${formatDate(tribe.bestRankAt)})`,
id: 'best_rank', id: 'best_rank',
}, },
{ {
title: 'Most points:', title: translations.mostPoints + ':',
data: data:
tribe.mostPoints.toLocaleString() + tribe.mostPoints.toLocaleString() +
' ' + ' ' +
@ -326,7 +335,7 @@ const render = ({ tribe, dailyTribeStats, players }) => {
id: 'most_points', id: 'most_points',
}, },
{ {
title: 'Most villages:', title: translations.mostVillages + ':',
data: tribe.mostVillages + ' ' + `(${formatDate(tribe.mostVillagesAt)})`, data: tribe.mostVillages + ' ' + `(${formatDate(tribe.mostVillagesAt)})`,
id: 'most_villages', id: 'most_villages',
}, },
@ -443,7 +452,7 @@ const buildMembersGrowthTBody = (stats) => {
return ` return `
<tbody> <tbody>
<tr> <tr>
<th>Player</th> <th>${translations.player}</th>
${dates ${dates
.map((date) => { .map((date) => {
return `<th>${formatDate(date, { return `<th>${formatDate(date, {
@ -453,7 +462,7 @@ const buildMembersGrowthTBody = (stats) => {
})}</th>`; })}</th>`;
}) })
.join('')} .join('')}
<th>Total</th> <th>${translations.total}</th>
</tr> </tr>
${getMembersIDs() ${getMembersIDs()
.map((id) => { .map((id) => {
@ -513,12 +522,12 @@ const createChangeTypeHandler = (stats) => (e) => {
const renderMembersGrowthPopup = (e, stats) => { const renderMembersGrowthPopup = (e, stats) => {
const formOptions = [ const formOptions = [
['points', 'Points'], ['points', translations.points],
['villages', 'Villages'], ['villages', translations.villages],
['od', 'Opponents defeated'], ['od', translations.opponentsDefeated],
['oda', 'Opponents defeated as attacker'], ['oda', translations.opponentsDefeatedAsAttacker],
['odd', 'Opponents defeated as defender'], ['odd', translations.opponentsDefeatedAsDefender],
['ods', 'Opponents defeated as supporter'], ['ods', translations.opponentsDefeatedAsSupporter],
].map( ].map(
(v) => (v) =>
`<option ${ `<option ${
@ -530,7 +539,7 @@ const renderMembersGrowthPopup = (e, stats) => {
<select> <select>
${formOptions.join('')} ${formOptions.join('')}
</select> </select>
<button type="submit">Change</button> <button type="submit">${translations.change}</button>
</form> </form>
<table id="${MEMBERS_GROWTH_TABLE_ID}" class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;"> <table id="${MEMBERS_GROWTH_TABLE_ID}" class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">
${buildMembersGrowthTBody(stats)} ${buildMembersGrowthTBody(stats)}
@ -539,7 +548,7 @@ const renderMembersGrowthPopup = (e, stats) => {
showPopup({ showPopup({
e, e,
title: `Members growth`, title: translations.membersGrowth,
id: 'mg', id: 'mg',
html, html,
}); });
@ -596,13 +605,13 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
<tbody> <tbody>
<tr> <tr>
<th> <th>
Date ${translations.date}
</th> </th>
<th> <th>
Player ${translations.player}
</th> </th>
<th> <th>
Action ${translations.act}
</th> </th>
</tr> </tr>
${tribeChanges.items ${tribeChanges.items
@ -618,8 +627,8 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
} }
rowHTML += `<td><strong>${ rowHTML += `<td><strong>${
tribeChange.newTribe && tribeChange.newTribe.id === TRIBE_ID tribeChange.newTribe && tribeChange.newTribe.id === TRIBE_ID
? 'Joined' ? translations.joined
: 'Left' : translations.left
}</strong></td>`; }</strong></td>`;
return rowHTML + '</tr>'; return rowHTML + '</tr>';
}) })
@ -630,7 +639,7 @@ const renderTribeChanges = (e, currentPage, tribeChanges) => {
showPopup({ showPopup({
e, e,
title: `Tribe changes`, title: translations.tribeChanges,
id: 'tribeChanges', id: 'tribeChanges',
html, html,
}); });
@ -678,27 +687,27 @@ const renderActions = () => {
const showEnnoblements = document.createElement('a'); const showEnnoblements = document.createElement('a');
showEnnoblements.href = '#'; showEnnoblements.href = '#';
setPage(showEnnoblements, '1'); setPage(showEnnoblements, '1');
showEnnoblements.innerHTML = 'Show ennoblements'; showEnnoblements.innerHTML = translations.action.showEnnoblements;
showEnnoblements.addEventListener('click', handleShowTribeEnnoblementsClick); showEnnoblements.addEventListener('click', handleShowTribeEnnoblementsClick);
actionsContainer.appendChild(wrapAction(showEnnoblements)); actionsContainer.appendChild(wrapAction(showEnnoblements));
const showHistory = document.createElement('a'); const showHistory = document.createElement('a');
showHistory.href = '#'; showHistory.href = '#';
setPage(showHistory, '1'); setPage(showHistory, '1');
showHistory.innerHTML = 'Show history'; showHistory.innerHTML = translations.action.showHistory;
showHistory.addEventListener('click', handleShowTribeHistoryClick); showHistory.addEventListener('click', handleShowTribeHistoryClick);
actionsContainer.appendChild(wrapAction(showHistory)); actionsContainer.appendChild(wrapAction(showHistory));
const showTribeChanges = document.createElement('a'); const showTribeChanges = document.createElement('a');
showTribeChanges.href = '#'; showTribeChanges.href = '#';
setPage(showTribeChanges, '1'); setPage(showTribeChanges, '1');
showTribeChanges.innerHTML = 'Show tribe changes'; showTribeChanges.innerHTML = translations.action.showTribeChanges;
showTribeChanges.addEventListener('click', handleShowTribeChangesClick); showTribeChanges.addEventListener('click', handleShowTribeChangesClick);
actionsContainer.appendChild(wrapAction(showTribeChanges)); actionsContainer.appendChild(wrapAction(showTribeChanges));
const showMembersGrowth = document.createElement('a'); const showMembersGrowth = document.createElement('a');
showMembersGrowth.href = '#'; showMembersGrowth.href = '#';
showMembersGrowth.innerHTML = 'Show members growth'; showMembersGrowth.innerHTML = translations.action.showMembersGrowth;
showMembersGrowth.addEventListener('click', handleShowMembersGrowthClick); showMembersGrowth.addEventListener('click', handleShowMembersGrowthClick);
actionsContainer.appendChild(wrapAction(showMembersGrowth)); actionsContainer.appendChild(wrapAction(showMembersGrowth));
}; };

View File

@ -20,6 +20,7 @@ const translations = {
resourcesGathered: 'Zebrane surowce', resourcesGathered: 'Zebrane surowce',
villagesConquered: 'Podbite wioski', villagesConquered: 'Podbite wioski',
exportedVillages: 'Wyeksportowane wioski', exportedVillages: 'Wyeksportowane wioski',
tribeChanges: 'Zmiany plemion',
action: { action: {
showTribeChanges: 'Pokaż zmiany plemion', showTribeChanges: 'Pokaż zmiany plemion',
showEnnoblements: 'Pokaż przejęcia', showEnnoblements: 'Pokaż przejęcia',
@ -48,6 +49,7 @@ const translations = {
resourcesGathered: 'Resources gathered', resourcesGathered: 'Resources gathered',
villagesConquered: 'Villages conquered', villagesConquered: 'Villages conquered',
exportedVillages: 'Exported villages', exportedVillages: 'Exported villages',
tribeChanges: 'Tribe changes',
action: { action: {
showTribeChanges: 'Show tribe changes', showTribeChanges: 'Show tribe changes',
showEnnoblements: 'Show ennoblements', showEnnoblements: 'Show ennoblements',

View File

@ -0,0 +1,73 @@
const translations = {
pl_PL: {
date: 'Data',
createdAt: 'Data założenia',
dominance: 'Dominacja',
bestRank: 'Najlepszy ranking',
mostPoints: 'Najwięcej punktów',
mostVillages: 'Najwięcej wiosek',
player: 'Gracz',
points: 'Punkty',
villages: 'Wioski',
opponentsDefeated: 'Pokonani przeciwnicy',
opponentsDefeatedAsAttacker: 'Pokonani przeciwnicy jako agresor',
opponentsDefeatedAsDefender: 'Pokonani przeciwnicy jako obrońca',
opponentsDefeatedAsSupporter: 'Pokonani przeciwnicy jako wspierający',
change: 'Zmień',
left: 'Opuścił',
joined: 'Dołączył',
tribeChanges: 'Zmiany plemion',
membersGrowth: 'Rozwój graczy',
act: 'Akcja',
total: 'Razem',
oda: 'RA',
odd: 'RO',
ods: 'RW',
od: 'Pokonani ogólnie',
dailyGrowth: 'Dzienny przyrost',
playerLinks: 'Linki',
action: {
showTribeChanges: 'Pokaż zmiany plemion',
showEnnoblements: 'Pokaż przejęcia',
showMembersGrowth: 'Pokaż rozwój graczy',
showHistory: 'Pokaż historię',
},
},
en_DK: {
date: 'Date',
createdAt: 'Created at',
dominance: 'Dominance',
bestRank: 'Best rank',
mostPoints: 'Most points',
mostVillages: 'Most villages',
player: 'Player',
points: 'Points',
villages: 'Villages',
opponentsDefeated: 'Opponents defeated',
opponentsDefeatedAsAttacker: 'Opponents defeated as attacker',
opponentsDefeatedAsDefender: 'Opponents defeated as defender',
opponentsDefeatedAsSupporter: 'Opponents defeated as supporter',
change: 'Change',
membersGrowth: 'Members growth',
tribeChanges: 'Tribe changes',
left: 'Left',
joined: 'Joined',
act: 'Action',
total: 'Total',
oda: 'ODA',
odd: 'ODD',
ods: 'ODS',
od: 'OD',
dailyGrowth: 'Daily growth',
playerLinks: 'Player links',
action: {
showTribeChanges: 'Show tribe changes',
showEnnoblements: 'Show ennoblements',
showMembersGrowth: 'Show members growth',
showHistory: 'Show history',
},
},
};
export default () =>
translations[window.game_data.locale] || translations.en_DK;