diff --git a/dist/extendedPlayerProfile.js b/dist/extendedPlayerProfile.js index 8f758a3..02650ba 100644 --- a/dist/extendedPlayerProfile.js +++ b/dist/extendedPlayerProfile.js @@ -352,7 +352,7 @@ var _default = function _default() { }; exports.default = _default; -},{}],"m41w":[function(require,module,exports) { +},{}],"fCHX":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -706,7 +706,7 @@ var _subDays = _interopRequireDefault(require("date-fns/subDays")); var _requestCreator = _interopRequireDefault(require("./libs/requestCreator")); -var _pagination = require("./libs/pagination"); +var _pagination = require("./utils/pagination"); var _getIDFromURL = _interopRequireDefault(require("./utils/getIDFromURL")); @@ -735,7 +735,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/extendedPlayerProfile.js // @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js -// @version 0.5 +// @version 0.6 // @description Extended Player Profile // @author Kichiyaki http://dawid-wysokinski.pl/ // @match *://*.plemiona.pl/game.php*&screen=info_player* @@ -877,6 +877,13 @@ const renderPlayerOtherNames = player => { }).join(''), "\n \n \n "); }; +const getTodaysStatsTdStyle = value => { + const statIncreaseStyle = 'color: #000; background-color: #0f0'; + const statDecreaseStyle = 'color: #000; background-color: #f00'; + const defaultStyle = 'color: #000; background-color: #808080'; + return value > 0 ? statIncreaseStyle : value < 0 ? statDecreaseStyle : defaultStyle; +}; + const renderTodaysStats = stats => { let todaysStats = document.querySelector('#todaysStats'); @@ -887,9 +894,7 @@ const renderTodaysStats = stats => { otherElementsContainer.prepend(todaysStats); } - const statIncreaseStyle = 'color: #000; background-color: #0f0'; - const statDecreaseStyle = 'color: #000; background-color: #f00'; - todaysStats.innerHTML = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Today's stats\n
\n Points:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.points).toLocaleString(), "\n
\n Rank:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rank), "\n
\n Villages:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.villages).toLocaleString(), "\n
\n ODA:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreAtt).toLocaleString(), "\n
\n ODA Rank:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankAtt), "\n
\n ODD:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreDef).toLocaleString(), "\n
\n ODD Rank:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankDef), "\n
\n ODS:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreSup).toLocaleString(), "\n
\n ODS Rank:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankSup), "\n
\n OD:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreTotal).toLocaleString(), "\n
\n OD Rank:\n 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankTotal), "\n
\n "); + todaysStats.innerHTML = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Today's stats\n
\n Points:\n \n ").concat(Math.abs(stats.points).toLocaleString(), "\n
\n Rank:\n \n ").concat(Math.abs(stats.rank), "\n
\n Villages:\n \n ").concat(Math.abs(stats.villages).toLocaleString(), "\n
\n ODA:\n \n ").concat(Math.abs(stats.scoreAtt).toLocaleString(), "\n
\n ODA Rank:\n \n ").concat(Math.abs(stats.rankAtt), "\n
\n ODD:\n \n ").concat(Math.abs(stats.scoreDef).toLocaleString(), "\n
\n ODD Rank:\n \n ").concat(Math.abs(stats.rankDef), "\n
\n ODS:\n \n ").concat(Math.abs(stats.scoreSup).toLocaleString(), "\n
\n ODS Rank:\n \n ").concat(Math.abs(stats.rankSup), "\n
\n OD:\n \n ").concat(Math.abs(stats.scoreTotal).toLocaleString(), "\n
\n OD Rank:\n \n ").concat(Math.abs(stats.rankTotal), "\n
\n "); }; const renderInADayRanks = player => { @@ -1136,4 +1141,4 @@ const renderActions = () => { console.log('extended player profile', error); } })(); -},{"date-fns/subDays":"mRRL","./libs/requestCreator":"Ph2E","./libs/pagination":"m41w","./utils/getIDFromURL":"tQUs","./utils/getCurrentServer":"DMkL","./utils/formatDate":"V6Mf","./utils/renderPopup":"P4rL","./utils/twstats":"Syko","./utils/tribalwars":"fHHP","./utils/localStorage":"KWxH"}]},{},["yRop"], null) \ No newline at end of file +},{"date-fns/subDays":"mRRL","./libs/requestCreator":"Ph2E","./utils/pagination":"fCHX","./utils/getIDFromURL":"tQUs","./utils/getCurrentServer":"DMkL","./utils/formatDate":"V6Mf","./utils/renderPopup":"P4rL","./utils/twstats":"Syko","./utils/tribalwars":"fHHP","./utils/localStorage":"KWxH"}]},{},["yRop"], null) \ No newline at end of file diff --git a/src/extendedPlayerProfile.js b/src/extendedPlayerProfile.js index 24183d3..283d166 100644 --- a/src/extendedPlayerProfile.js +++ b/src/extendedPlayerProfile.js @@ -295,6 +295,18 @@ const renderPlayerOtherNames = (player) => { `; }; +const getTodaysStatsTdStyle = (value) => { + const statIncreaseStyle = 'color: #000; background-color: #0f0'; + const statDecreaseStyle = 'color: #000; background-color: #f00'; + const defaultStyle = 'color: #000; background-color: #808080'; + + return value > 0 + ? statIncreaseStyle + : value < 0 + ? statDecreaseStyle + : defaultStyle; +}; + const renderTodaysStats = (stats) => { let todaysStats = document.querySelector('#todaysStats'); if (!todaysStats) { @@ -303,8 +315,6 @@ const renderTodaysStats = (stats) => { todaysStats.width = '100%'; otherElementsContainer.prepend(todaysStats); } - const statIncreaseStyle = 'color: #000; background-color: #0f0'; - const statDecreaseStyle = 'color: #000; background-color: #f00'; todaysStats.innerHTML = ` @@ -318,9 +328,7 @@ const renderTodaysStats = (stats) => { - @@ -328,9 +336,7 @@ const renderTodaysStats = (stats) => { - @@ -338,9 +344,7 @@ const renderTodaysStats = (stats) => { - @@ -348,9 +352,7 @@ const renderTodaysStats = (stats) => { - @@ -358,9 +360,7 @@ const renderTodaysStats = (stats) => { - @@ -368,9 +368,7 @@ const renderTodaysStats = (stats) => { - @@ -378,9 +376,7 @@ const renderTodaysStats = (stats) => { - @@ -388,9 +384,7 @@ const renderTodaysStats = (stats) => { - @@ -398,9 +392,7 @@ const renderTodaysStats = (stats) => { - @@ -408,9 +400,7 @@ const renderTodaysStats = (stats) => { - @@ -418,9 +408,7 @@ const renderTodaysStats = (stats) => { -
Points: + ${Math.abs(stats.points).toLocaleString()}
Rank: + ${Math.abs(stats.rank)}
Villages: + ${Math.abs(stats.villages).toLocaleString()}
ODA: + ${Math.abs(stats.scoreAtt).toLocaleString()}
ODA Rank: + ${Math.abs(stats.rankAtt)}
ODD: + ${Math.abs(stats.scoreDef).toLocaleString()}
ODD Rank: + ${Math.abs(stats.rankDef)}
ODS: + ${Math.abs(stats.scoreSup).toLocaleString()}
ODS Rank: + ${Math.abs(stats.rankSup)}
OD: + ${Math.abs(stats.scoreTotal).toLocaleString()}
OD Rank: + ${Math.abs(stats.rankTotal)}