today's stats: if stats value = 0, background color is gray
This commit is contained in:
parent
f1e5d4c2e7
commit
c958f615cf
19
dist/extendedPlayerProfile.js
vendored
19
dist/extendedPlayerProfile.js
vendored
|
@ -352,7 +352,7 @@ var _default = function _default() {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.default = _default;
|
exports.default = _default;
|
||||||
},{}],"m41w":[function(require,module,exports) {
|
},{}],"fCHX":[function(require,module,exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
@ -706,7 +706,7 @@ var _subDays = _interopRequireDefault(require("date-fns/subDays"));
|
||||||
|
|
||||||
var _requestCreator = _interopRequireDefault(require("./libs/requestCreator"));
|
var _requestCreator = _interopRequireDefault(require("./libs/requestCreator"));
|
||||||
|
|
||||||
var _pagination = require("./libs/pagination");
|
var _pagination = require("./utils/pagination");
|
||||||
|
|
||||||
var _getIDFromURL = _interopRequireDefault(require("./utils/getIDFromURL"));
|
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
|
// @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 0.5
|
// @version 0.6
|
||||||
// @description Extended Player Profile
|
// @description Extended Player Profile
|
||||||
// @author Kichiyaki http://dawid-wysokinski.pl/
|
// @author Kichiyaki http://dawid-wysokinski.pl/
|
||||||
// @match *://*.plemiona.pl/game.php*&screen=info_player*
|
// @match *://*.plemiona.pl/game.php*&screen=info_player*
|
||||||
|
@ -877,6 +877,13 @@ const renderPlayerOtherNames = player => {
|
||||||
}).join(''), "\n </tbody>\n </table>\n ");
|
}).join(''), "\n </tbody>\n </table>\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 => {
|
const renderTodaysStats = stats => {
|
||||||
let todaysStats = document.querySelector('#todaysStats');
|
let todaysStats = document.querySelector('#todaysStats');
|
||||||
|
|
||||||
|
@ -887,9 +894,7 @@ const renderTodaysStats = stats => {
|
||||||
otherElementsContainer.prepend(todaysStats);
|
otherElementsContainer.prepend(todaysStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
const statIncreaseStyle = 'color: #000; background-color: #0f0';
|
todaysStats.innerHTML = "\n <table width=\"100%\" class=\"vis\">\n <tbody>\n <tr>\n <th colspan=\"2\">\n Today's stats\n </th>\n </tr>\n <tr>\n <td>\n Points:\n </td>\n <td style=\"".concat(getTodaysStatsTdStyle(stats.points), "\">\n ").concat(Math.abs(stats.points).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n Rank:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.rank), "\">\n ").concat(Math.abs(stats.rank), "\n </td>\n </tr>\n <tr>\n <td>\n Villages:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.villages), "\">\n ").concat(Math.abs(stats.villages).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODA:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.scoreAtt), "\">\n ").concat(Math.abs(stats.scoreAtt).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODA Rank:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.rankAtt), "\">\n ").concat(Math.abs(stats.rankAtt), "\n </td>\n </tr>\n <tr>\n <td>\n ODD:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.scoreDef), "\">\n ").concat(Math.abs(stats.scoreDef).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODD Rank:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.rankDef), "\">\n ").concat(Math.abs(stats.rankDef), "\n </td>\n </tr>\n <tr>\n <td>\n ODS:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.scoreSup), "\">\n ").concat(Math.abs(stats.scoreSup).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODS Rank:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.rankSup), "\">\n ").concat(Math.abs(stats.rankSup), "\n </td>\n </tr>\n <tr>\n <td>\n OD:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.scoreTotal), "\">\n ").concat(Math.abs(stats.scoreTotal).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n OD Rank:\n </td>\n <td style=\"").concat(getTodaysStatsTdStyle(stats.rankTotal), "\">\n ").concat(Math.abs(stats.rankTotal), "\n </td>\n </tr>\n </tbody>\n </table>\n ");
|
||||||
const statDecreaseStyle = 'color: #000; background-color: #f00';
|
|
||||||
todaysStats.innerHTML = "\n <table width=\"100%\" class=\"vis\">\n <tbody>\n <tr>\n <th colspan=\"2\">\n Today's stats\n </th>\n </tr>\n <tr>\n <td>\n Points:\n </td>\n <td style=\"".concat(stats.points > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.points).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n Rank:\n </td>\n <td style=\"").concat(stats.rank > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rank), "\n </td>\n </tr>\n <tr>\n <td>\n Villages:\n </td>\n <td style=\"").concat(stats.villages > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.villages).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODA:\n </td>\n <td style=\"").concat(stats.scoreAtt > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreAtt).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODA Rank:\n </td>\n <td style=\"").concat(stats.rankAtt > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankAtt), "\n </td>\n </tr>\n <tr>\n <td>\n ODD:\n </td>\n <td style=\"").concat(stats.scoreDef > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreDef).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODD Rank:\n </td>\n <td style=\"").concat(stats.rankDef > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankDef), "\n </td>\n </tr>\n <tr>\n <td>\n ODS:\n </td>\n <td style=\"").concat(stats.scoreSup > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreSup).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n ODS Rank:\n </td>\n <td style=\"").concat(stats.rankSup > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankSup), "\n </td>\n </tr>\n <tr>\n <td>\n OD:\n </td>\n <td style=\"").concat(stats.scoreTotal > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.scoreTotal).toLocaleString(), "\n </td>\n </tr>\n <tr>\n <td>\n OD Rank:\n </td>\n <td style=\"").concat(stats.rankTotal > 0 ? statIncreaseStyle : statDecreaseStyle, "\">\n ").concat(Math.abs(stats.rankTotal), "\n </td>\n </tr>\n </tbody>\n </table>\n ");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderInADayRanks = player => {
|
const renderInADayRanks = player => {
|
||||||
|
@ -1136,4 +1141,4 @@ const renderActions = () => {
|
||||||
console.log('extended player profile', error);
|
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)
|
},{"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)
|
|
@ -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) => {
|
const renderTodaysStats = (stats) => {
|
||||||
let todaysStats = document.querySelector('#todaysStats');
|
let todaysStats = document.querySelector('#todaysStats');
|
||||||
if (!todaysStats) {
|
if (!todaysStats) {
|
||||||
|
@ -303,8 +315,6 @@ const renderTodaysStats = (stats) => {
|
||||||
todaysStats.width = '100%';
|
todaysStats.width = '100%';
|
||||||
otherElementsContainer.prepend(todaysStats);
|
otherElementsContainer.prepend(todaysStats);
|
||||||
}
|
}
|
||||||
const statIncreaseStyle = 'color: #000; background-color: #0f0';
|
|
||||||
const statDecreaseStyle = 'color: #000; background-color: #f00';
|
|
||||||
|
|
||||||
todaysStats.innerHTML = `
|
todaysStats.innerHTML = `
|
||||||
<table width="100%" class="vis">
|
<table width="100%" class="vis">
|
||||||
|
@ -318,9 +328,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
Points:
|
Points:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.points)}">
|
||||||
stats.points > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.points).toLocaleString()}
|
${Math.abs(stats.points).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -328,9 +336,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
Rank:
|
Rank:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.rank)}">
|
||||||
stats.rank > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.rank)}
|
${Math.abs(stats.rank)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -338,9 +344,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
Villages:
|
Villages:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.villages)}">
|
||||||
stats.villages > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.villages).toLocaleString()}
|
${Math.abs(stats.villages).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -348,9 +352,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODA:
|
ODA:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.scoreAtt)}">
|
||||||
stats.scoreAtt > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.scoreAtt).toLocaleString()}
|
${Math.abs(stats.scoreAtt).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -358,9 +360,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODA Rank:
|
ODA Rank:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.rankAtt)}">
|
||||||
stats.rankAtt > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.rankAtt)}
|
${Math.abs(stats.rankAtt)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -368,9 +368,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODD:
|
ODD:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.scoreDef)}">
|
||||||
stats.scoreDef > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.scoreDef).toLocaleString()}
|
${Math.abs(stats.scoreDef).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -378,9 +376,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODD Rank:
|
ODD Rank:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.rankDef)}">
|
||||||
stats.rankDef > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.rankDef)}
|
${Math.abs(stats.rankDef)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -388,9 +384,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODS:
|
ODS:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.scoreSup)}">
|
||||||
stats.scoreSup > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.scoreSup).toLocaleString()}
|
${Math.abs(stats.scoreSup).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -398,9 +392,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
ODS Rank:
|
ODS Rank:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.rankSup)}">
|
||||||
stats.rankSup > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.rankSup)}
|
${Math.abs(stats.rankSup)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -408,9 +400,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
OD:
|
OD:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.scoreTotal)}">
|
||||||
stats.scoreTotal > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.scoreTotal).toLocaleString()}
|
${Math.abs(stats.scoreTotal).toLocaleString()}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -418,9 +408,7 @@ const renderTodaysStats = (stats) => {
|
||||||
<td>
|
<td>
|
||||||
OD Rank:
|
OD Rank:
|
||||||
</td>
|
</td>
|
||||||
<td style="${
|
<td style="${getTodaysStatsTdStyle(stats.rankTotal)}">
|
||||||
stats.rankTotal > 0 ? statIncreaseStyle : statDecreaseStyle
|
|
||||||
}">
|
|
||||||
${Math.abs(stats.rankTotal)}
|
${Math.abs(stats.rankTotal)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Reference in New Issue
Block a user