2
dist/CookieMonsterDev.js
vendored
2
dist/CookieMonsterDev.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonsterDev.js.map
vendored
2
dist/CookieMonsterDev.js.map
vendored
File diff suppressed because one or more lines are too long
18
src/Disp/Buildings/CreateBuildingLockButtons.js
Normal file
18
src/Disp/Buildings/CreateBuildingLockButtons.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import ToggleBuildingLock from './ToggleBuildingLock';
|
||||
|
||||
/**
|
||||
* This function adds a lock button to the "building view" in the middle section
|
||||
*/
|
||||
export default function CreateBuildingLockButtons() {
|
||||
Object.keys(l('rows').children).forEach((index) => {
|
||||
const productButtons = l('rows').children[index].children[1];
|
||||
const button = document.createElement('div');
|
||||
button.id = `productLock${Number(index) + 1}`;
|
||||
button.className = 'productButton';
|
||||
button.innerHTML = 'Unlocked';
|
||||
button.onclick = function () {
|
||||
ToggleBuildingLock(Number(index) + 1);
|
||||
};
|
||||
productButtons.appendChild(button);
|
||||
});
|
||||
}
|
||||
13
src/Disp/Buildings/ToggleBuildingLock.js
Normal file
13
src/Disp/Buildings/ToggleBuildingLock.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* This function toggle the locked state of a building
|
||||
* @param {number} index Index of the row to change
|
||||
*/
|
||||
export default function ToggleBuildingLock(index) {
|
||||
if (l(`productLock${index}`).innerHTML === 'Unlocked') {
|
||||
l(`productLock${index}`).innerHTML = 'Locked';
|
||||
l(`row${index}`).children[3].style.pointerEvents = 'none';
|
||||
} else {
|
||||
l(`productLock${index}`).innerHTML = 'Unlocked';
|
||||
l(`row${index}`).children[3].style.pointerEvents = 'auto';
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { LatestReleaseNotes, ModDescription } from '../../../Data/Moddata.ts';
|
||||
|
||||
/**
|
||||
* This function adds stats created by CookieMonster to the stats page
|
||||
* This function adds info about by CookieMonster to the info page
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuInfo(title) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import ReplaceTooltips from './ReplaceGameElements/Tooltips';
|
||||
import ReplaceNative from './ReplaceGameFunctions/ReplaceNative';
|
||||
import { LastModCount } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea';
|
||||
import CreateBuildingLockButtons from '../Disp/Buildings/CreateBuildingLockButtons';
|
||||
|
||||
/**
|
||||
* Initialization loop of Cookie Monster
|
||||
@@ -47,6 +48,7 @@ export default function InitializeCookieMonster() {
|
||||
});
|
||||
CreateWrinklerButtons();
|
||||
UpdateBuildingUpgradeStyle();
|
||||
CreateBuildingLockButtons();
|
||||
|
||||
ReplaceTooltips();
|
||||
AddWrinklerAreaDetect();
|
||||
|
||||
Reference in New Issue
Block a user