From ff8c16d0c321f91f3b736275457981df6bbafe7a Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Sat, 14 Mar 2020 18:05:38 +0100 Subject: [PATCH] make budget table it's own css class --- src/003-assets/CSS/table.css | 16 +++++- src/uncategorized/costsBudget.js | 85 ++++++++++++++------------------ 2 files changed, 53 insertions(+), 48 deletions(-) diff --git a/src/003-assets/CSS/table.css b/src/003-assets/CSS/table.css index 4aaed76f67b..260ffb48b22 100644 --- a/src/003-assets/CSS/table.css +++ b/src/003-assets/CSS/table.css @@ -9,4 +9,18 @@ table.wardrobe { table.wardrobe td { width: 50%; border: 1px solid white; -} \ No newline at end of file +} + +table.budget { + text-align: right; + border-collapse: separate; + width: 90%; + border-style: solid; + border-width: 1px; + border-color: white; + padding: 5px; + font-family: "monospace"; +} +table.budget tr.colored { + background-color: #001700; +} diff --git a/src/uncategorized/costsBudget.js b/src/uncategorized/costsBudget.js index f0b71a9d333..454230f8bc9 100644 --- a/src/uncategorized/costsBudget.js +++ b/src/uncategorized/costsBudget.js @@ -1,6 +1,7 @@ App.UI.Budget.Cost = function() { let el = document.createElement('p'); let table = document.createElement("TABLE"); + table.classList.add("budget"); let node; let subNode; let subSubNode; @@ -8,18 +9,9 @@ App.UI.Budget.Cost = function() { let array; let text; let coloredRow = true; - table.style.textAlign = "right"; - table.style.borderCollapse = "separate"; - table.style.borderStyle = "hidden"; - table.style.width = "90%"; - table.style.borderStyle = "solid"; - table.style.borderWidth = "1px"; - table.style.borderColor = "white"; - table.style.padding = "5px"; - table.style.fontFamily = "monospace"; // Set up profits column - for (let i = 0; i < V.lastWeeksCashIncome.length; i++){ + for (let i = 0; i < V.lastWeeksCashIncome.length; i++) { V.lastWeeksCashProfits[i] = (V.lastWeeksCashIncome[i] + V.lastWeeksCashExpenses[i]); } @@ -73,8 +65,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( V.brothelNameCaps, () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Brothel Advertisement" @@ -99,8 +91,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "Club ads", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Club Advertisement" @@ -158,7 +150,6 @@ App.UI.Budget.Cost = function() { structureSetup(V.pitNameCaps, "pit", V.pit, "Pit", V.fighterIDs.length); - // Weather if (V.lastWeeksCashExpenses.weather < 0 && V.weatherCladding === 0) { node = new DocumentFragment(); @@ -172,8 +163,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "upgrade", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Manage Arcology" @@ -191,8 +182,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Slave maintenance", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Costs Report Slaves" @@ -211,8 +202,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "Assistant's ", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Personal assistant options" @@ -227,8 +218,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "Assistant's ", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Personal assistant options" @@ -243,8 +234,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "Assistant's ", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Personal assistant options" @@ -261,8 +252,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Menials", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Buy Slaves" @@ -279,8 +270,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Recruiter", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Recruiter Select" @@ -332,8 +323,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( text, () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Personal Attention Select" @@ -356,8 +347,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( "rents", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Manage Arcology" @@ -384,8 +375,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Policies", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Policies" @@ -397,8 +388,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Edicts", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "edicts" @@ -411,8 +402,8 @@ App.UI.Budget.Cost = function() { node = App.UI.DOM.link( "Society shaping", () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Future Society" @@ -463,8 +454,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( text[0], () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Policies" @@ -487,8 +478,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( V.mercenariesTitle, () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], "Barracks" @@ -632,7 +623,6 @@ App.UI.Budget.Cost = function() { cell.append(cashFormatColorDOM(V[profits][category])); flipColors(row); } - return; } function generateRowsFromArray(array) { @@ -659,8 +649,8 @@ App.UI.Budget.Cost = function() { App.UI.DOM.link( title, () => { - V.nextButton = "Back to Budget", - V.nextLink = "Costs Budget"; + V.nextButton = "Back to Budget"; + V.nextLink = "Costs Budget"; }, [], passage @@ -689,9 +679,10 @@ App.UI.Budget.Cost = function() { } return el; } + function flipColors(row) { if (coloredRow === true) { - row.style.backgroundColor = "#001700"; + row.classList.add("colored"); } console.log(coloredRow); coloredRow = !coloredRow; -- GitLab