[Map Coords Picker] rename setVillageBgColor -> setVillageBorder

This commit is contained in:
Dawid Wysokiński 2021-01-03 13:33:07 +01:00
parent 56e194fd56
commit f65bd7697b
3 changed files with 11 additions and 11 deletions

View File

@ -203,7 +203,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/mapCoordsPicker.js
// @version 0.7.3
// @description Map coords picker
// @author Kichiyaki http://dawid-wysokinski.pl/
// @author Kichiyaki https://dawid-wysokinski.pl/
// @match *://*/game.php*screen=map*
// @grant none
// ==/UserScript==
@ -240,7 +240,7 @@ const villageIDByCoords = (x, y) => {
return NaN;
};
const setVillageBgColor = function setVillageBgColor(x, y) {
const setVillageBorder = function setVillageBorder(x, y) {
let color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'transparent';
const id = villageIDByCoords(x, y);
if (isNaN(id)) return;
@ -266,14 +266,14 @@ const handleMapClick = (x, y, e) => {
if (selected) {
config.groups[config.selectedGroup].villages = config.groups[config.selectedGroup].villages.filter(village => village.key !== key);
setVillageBgColor(x, y);
setVillageBorder(x, y, 'transparent');
} else {
config.groups[config.selectedGroup].villages = [...config.groups[config.selectedGroup].villages, {
x,
y,
key
}];
setVillageBgColor(x, y, config.groups[config.selectedGroup].color);
setVillageBorder(x, y, config.groups[config.selectedGroup].color);
deleteVillageFromOtherGroups(key);
}
};
@ -411,7 +411,7 @@ const handleButtonClick = () => {
const colorizeGroupVillages = function colorizeGroupVillages(name) {
let bgColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
config.groups[name].villages.forEach(village => {
setVillageBgColor(village.x, village.y, bgColor ? bgColor : config.groups[name].color);
setVillageBorder(village.x, village.y, bgColor ? bgColor : config.groups[name].color);
});
};

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ import { getItem, setItem } from './utils/localStorage';
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/mapCoordsPicker.js
// @version 0.7.3
// @description Map coords picker
// @author Kichiyaki http://dawid-wysokinski.pl/
// @author Kichiyaki https://dawid-wysokinski.pl/
// @match *://*/game.php*screen=map*
// @grant none
// ==/UserScript==
@ -44,7 +44,7 @@ const villageIDByCoords = (x, y) => {
return NaN;
};
const setVillageBgColor = (x, y, color = 'transparent') => {
const setVillageBorder = (x, y, color = 'transparent') => {
const id = villageIDByCoords(x, y);
if (isNaN(id)) return;
const village = document.querySelector('#map_village_' + id);
@ -75,7 +75,7 @@ const handleMapClick = (x, y, e) => {
config.groups[config.selectedGroup].villages = config.groups[
config.selectedGroup
].villages.filter((village) => village.key !== key);
setVillageBgColor(x, y);
setVillageBorder(x, y, 'transparent');
} else {
config.groups[config.selectedGroup].villages = [
...config.groups[config.selectedGroup].villages,
@ -85,7 +85,7 @@ const handleMapClick = (x, y, e) => {
key,
},
];
setVillageBgColor(x, y, config.groups[config.selectedGroup].color);
setVillageBorder(x, y, config.groups[config.selectedGroup].color);
deleteVillageFromOtherGroups(key);
}
};
@ -241,7 +241,7 @@ const handleButtonClick = () => {
const colorizeGroupVillages = (name, bgColor = '') => {
config.groups[name].villages.forEach((village) => {
setVillageBgColor(
setVillageBorder(
village.x,
village.y,
bgColor ? bgColor : config.groups[name].color