File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
2257
package-lock.json
generated
2257
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -12,12 +12,12 @@
|
||||
],
|
||||
"scripts": {
|
||||
"copy-file": "cp dist/CookieMonster.js CookieMonster.js",
|
||||
"eslint_src": "eslint src",
|
||||
"build": "run-s eslint_src pack_prod remove_comment copy-file",
|
||||
"build_test": "run-s pack_dev",
|
||||
"pack_prod": "webpack --env production",
|
||||
"pack_dev": "webpack",
|
||||
"remove_comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
||||
"eslint-src": "eslint src",
|
||||
"build": "run-s eslint-src pack-prod remove-comment copy-file",
|
||||
"build-test": "run-s pack-dev",
|
||||
"pack-prod": "webpack --env production",
|
||||
"pack-dev": "webpack",
|
||||
"remove-comment": "sed -i '' -e '/\\/\\/# sourceMappingURL.*/d' dist/CookieMonster.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
13
src/Config/Toggles/ToggleSectionHideButtons.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
|
||||
* It is called by changes in CM.Options.WrinklerButtons
|
||||
*/
|
||||
export default function ToggleSectionHideButtons() {
|
||||
if (CMOptions.HideSectionsButtons) {
|
||||
l('CMSectionHidButtons').style.display = '';
|
||||
} else {
|
||||
l('CMSectionHidButtons').style.display = 'none';
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
|
||||
import ToggleDetailedTime from '../Config/Toggles/ToggleDetailedTime';
|
||||
import ToggleGCTimer from '../Config/Toggles/ToggleGCTimer';
|
||||
import ToggleSectionHideButtons from '../Config/Toggles/ToggleSectionHideButtons';
|
||||
import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
|
||||
import ToggleUpgradeBarAndColor from '../Config/Toggles/ToggleUpgradeBarAndColor';
|
||||
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
|
||||
@@ -100,6 +101,13 @@ const Config = {
|
||||
UpdateBuildings();
|
||||
},
|
||||
),
|
||||
PPDisplayTime: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
['PP As Value (Standard)', 'PP As Time Unit'],
|
||||
'Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.',
|
||||
false,
|
||||
),
|
||||
UpBarColor: new SettingStandard(
|
||||
'bool',
|
||||
'BarsColors',
|
||||
@@ -728,13 +736,23 @@ const Config = {
|
||||
WrinklerButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Extra Buttons OFF', 'Extra Buttons ON'],
|
||||
['Extra Wrinkler Buttons OFF', 'Extra Wrinkler Buttons ON'],
|
||||
'Show buttons for popping wrinklers at bottom of cookie section',
|
||||
true,
|
||||
function () {
|
||||
ToggleWrinklerButtons();
|
||||
},
|
||||
),
|
||||
HideSectionsButtons: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
['Hide Upgrades/Buildings Button OFF', 'Hide Upgrades/Buildings Button ON'],
|
||||
'Show buttons for hiding and showing the upgrades and buildings section in the right column',
|
||||
true,
|
||||
function () {
|
||||
ToggleSectionHideButtons();
|
||||
},
|
||||
),
|
||||
BulkBuyBlock: new SettingStandard(
|
||||
'bool',
|
||||
'Miscellaneous',
|
||||
|
||||
@@ -5,6 +5,7 @@ const ConfigDefault = {
|
||||
TimerBarPos: 0,
|
||||
TimerBarOverlay: 2,
|
||||
BuildColor: 1,
|
||||
PPDisplayTime: 0,
|
||||
UpBarColor: 1,
|
||||
UpgradeBarFixedPos: 1,
|
||||
CalcWrink: 0,
|
||||
@@ -100,6 +101,7 @@ const ConfigDefault = {
|
||||
GCTimer: 1,
|
||||
Favicon: 1,
|
||||
WrinklerButtons: 1,
|
||||
HideSectionsButtons: 0,
|
||||
BulkBuyBlock: 0,
|
||||
Header: {
|
||||
BarsColors: 1,
|
||||
|
||||
@@ -96,6 +96,7 @@ export function Beautify(num, floats, forced) {
|
||||
export function FormatTime(time, longFormat) {
|
||||
let formattedTime = time;
|
||||
if (time === Infinity) return time;
|
||||
if (time < 0) return 'Negative time period';
|
||||
formattedTime = Math.ceil(time);
|
||||
const y = Math.floor(formattedTime / 31557600);
|
||||
const d = Math.floor((formattedTime % 31557600) / 86400);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
@@ -94,9 +95,13 @@ export function UpdateBotBar() {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + target[i].color;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
else PPString = Beautify(Math.round(target[i].pp), 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].textContent = Beautify(Math.round(target[i].pp), 2);
|
||||
].textContent = PPString;
|
||||
const timeColor = GetTimeColor(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
|
||||
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
38
src/Disp/Initialization/CreateSectionHideButtons.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This function creates two objects at the top of the right column that allowing hiding the upgrade and building section
|
||||
*/
|
||||
export default function CreateSectionHideButtons() {
|
||||
const div = document.createElement('div');
|
||||
div.id = 'CMSectionHidButtons';
|
||||
div.style.textAlign = 'center';
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
if (l('upgrades').style.display === 'flex') {
|
||||
l('upgrades').style.display = 'none';
|
||||
l('toggleUpgrades').style.display = 'none';
|
||||
l('techUpgrades').style.display = 'none';
|
||||
l('vaultUpgrades').style.display = 'none';
|
||||
} else {
|
||||
l('upgrades').style.display = 'flex';
|
||||
if (l('toggleUpgrades').children.length !== 0)
|
||||
l('toggleUpgrades').style.display = 'block';
|
||||
if (l('techUpgrades').children.length !== 0)
|
||||
l('techUpgrades').style.display = 'block';
|
||||
if (l('vaultUpgrades').children.length !== 0)
|
||||
l('vaultUpgrades').style.display = 'block';
|
||||
}
|
||||
};
|
||||
a.textContent = 'Hide/Show Upgrades';
|
||||
div.appendChild(a);
|
||||
const b = document.createElement('a');
|
||||
b.className = 'option';
|
||||
b.onclick = function () {
|
||||
if (l('products').style.display === 'grid')
|
||||
l('products').style.display = 'none';
|
||||
else l('products').style.display = 'grid';
|
||||
};
|
||||
b.textContent = 'Hide/Show Buildings';
|
||||
div.appendChild(b);
|
||||
l('store').insertBefore(div, l('store').childNodes[2]);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
@@ -55,7 +56,9 @@ export default function Building() {
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
if (CMOptions.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
|
||||
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
@@ -70,10 +71,15 @@ export default function Upgrade() {
|
||||
)} Clicks`;
|
||||
l('CMTooltipPP').style.color = 'white';
|
||||
} else {
|
||||
l('CMTooltipPP').textContent = Beautify(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
2,
|
||||
);
|
||||
if (CMOptions.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
);
|
||||
else
|
||||
l('CMTooltipPP').textContent = Beautify(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
2,
|
||||
);
|
||||
l('CMTooltipPP').className =
|
||||
ColorTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
|
||||
import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
|
||||
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
|
||||
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
|
||||
import CreateWrinklerButtons from '../Disp/Initialization/CreateWrinklerButton';
|
||||
import CreateCssArea from '../Disp/Initialization/CssArea';
|
||||
import UpdateBuildingUpgradeStyle from '../Disp/Initialization/UpdateBuildingUpgradeStyle';
|
||||
@@ -37,6 +38,7 @@ export default function InitializeCookieMonster() {
|
||||
CreateTimerBar();
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateSectionHideButtons();
|
||||
CreateFavicon();
|
||||
Object.keys(TooltipText).forEach((i) => {
|
||||
CreateSimpleTooltip(
|
||||
|
||||
Reference in New Issue
Block a user