Added prettier (#661)

* Added prettier

* Added prettier

* Added prettier
This commit is contained in:
Daniël van Noord
2021-03-14 18:57:07 +01:00
committed by GitHub
parent f3e7964262
commit 932509a877
132 changed files with 7143 additions and 4894 deletions

View File

@@ -9,58 +9,58 @@ import { ColorBackPre, ColorBlue, ColorTextPre } from '../VariablesAndData';
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
*/
export function CreateTimer(id, name, bars) {
const timerBar = document.createElement('div');
timerBar.id = id;
timerBar.style.height = '12px';
timerBar.style.margin = '0px 10px';
timerBar.style.position = 'relative';
const timerBar = document.createElement('div');
timerBar.id = id;
timerBar.style.height = '12px';
timerBar.style.margin = '0px 10px';
timerBar.style.position = 'relative';
const div = document.createElement('div');
div.style.width = '100%';
div.style.height = '10px';
div.style.margin = 'auto';
div.style.position = 'absolute';
div.style.left = '0px';
div.style.top = '0px';
div.style.right = '0px';
div.style.bottom = '0px';
const div = document.createElement('div');
div.style.width = '100%';
div.style.height = '10px';
div.style.margin = 'auto';
div.style.position = 'absolute';
div.style.left = '0px';
div.style.top = '0px';
div.style.right = '0px';
div.style.bottom = '0px';
const type = document.createElement('span');
type.style.display = 'inline-block';
type.style.textAlign = 'right';
type.style.fontSize = '10px';
type.style.width = '108px';
type.style.marginRight = '5px';
type.style.verticalAlign = 'text-top';
type.textContent = name;
div.appendChild(type);
const type = document.createElement('span');
type.style.display = 'inline-block';
type.style.textAlign = 'right';
type.style.fontSize = '10px';
type.style.width = '108px';
type.style.marginRight = '5px';
type.style.verticalAlign = 'text-top';
type.textContent = name;
div.appendChild(type);
for (let i = 0; i < bars.length; i++) {
const colorBar = document.createElement('span');
colorBar.id = bars[i].id;
colorBar.style.display = 'inline-block';
colorBar.style.height = '10px';
colorBar.style.verticalAlign = 'text-top';
colorBar.style.textAlign = 'center';
if (bars.length - 1 === i) {
colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px';
}
if (typeof bars[i].color !== 'undefined') {
colorBar.className = ColorBackPre + bars[i].color;
}
div.appendChild(colorBar);
}
for (let i = 0; i < bars.length; i++) {
const colorBar = document.createElement('span');
colorBar.id = bars[i].id;
colorBar.style.display = 'inline-block';
colorBar.style.height = '10px';
colorBar.style.verticalAlign = 'text-top';
colorBar.style.textAlign = 'center';
if (bars.length - 1 === i) {
colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px';
}
if (typeof bars[i].color !== 'undefined') {
colorBar.className = ColorBackPre + bars[i].color;
}
div.appendChild(colorBar);
}
const timer = document.createElement('span');
timer.id = `${id}Time`;
timer.style.marginLeft = '5px';
timer.style.verticalAlign = 'text-top';
div.appendChild(timer);
const timer = document.createElement('span');
timer.id = `${id}Time`;
timer.style.marginLeft = '5px';
timer.style.verticalAlign = 'text-top';
div.appendChild(timer);
timerBar.appendChild(div);
timerBar.appendChild(div);
return timerBar;
return timerBar;
}
/**
@@ -68,22 +68,26 @@ export function CreateTimer(id, name, bars) {
* @param {string} buildingName Objectname to be added (e.g., "Cursor")
*/
export function CreateBotBarBuildingColumn(buildingName) {
if (l('CMBotBar') !== null) {
const type = l('CMBotBar').firstChild.firstChild.childNodes[0];
const bonus = l('CMBotBar').firstChild.firstChild.childNodes[1];
const pp = l('CMBotBar').firstChild.firstChild.childNodes[2];
const time = l('CMBotBar').firstChild.firstChild.childNodes[3];
if (l('CMBotBar') !== null) {
const type = l('CMBotBar').firstChild.firstChild.childNodes[0];
const bonus = l('CMBotBar').firstChild.firstChild.childNodes[1];
const pp = l('CMBotBar').firstChild.firstChild.childNodes[2];
const time = l('CMBotBar').firstChild.firstChild.childNodes[3];
const i = buildingName;
const header = type.appendChild(document.createElement('td'));
header.appendChild(document.createTextNode(`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`));
const i = buildingName;
const header = type.appendChild(document.createElement('td'));
header.appendChild(
document.createTextNode(
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
),
);
const span = header.appendChild(document.createElement('span'));
span.className = ColorTextPre + ColorBlue;
const span = header.appendChild(document.createElement('span'));
span.className = ColorTextPre + ColorBlue;
header.appendChild(document.createTextNode(')'));
bonus.appendChild(document.createElement('td'));
pp.appendChild(document.createElement('td'));
time.appendChild(document.createElement('td'));
}
header.appendChild(document.createTextNode(')'));
bonus.appendChild(document.createElement('td'));
pp.appendChild(document.createElement('td'));
time.appendChild(document.createElement('td'));
}
}