Fixed edit prompts in settings #732
This commit is contained in:
@@ -9,6 +9,7 @@ module.exports = {
|
|||||||
b64_to_utf8: 'readonly',
|
b64_to_utf8: 'readonly',
|
||||||
utf8_to_b64: 'readonly',
|
utf8_to_b64: 'readonly',
|
||||||
BeautifyAll: 'readonly',
|
BeautifyAll: 'readonly',
|
||||||
|
PlaySound: 'readonly',
|
||||||
},
|
},
|
||||||
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
|
|||||||
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
23
src/Disp/MenuSections/Prompt.js
Normal file
23
src/Disp/MenuSections/Prompt.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* eslint-disable no-return-assign */
|
||||||
|
/** Creates a Prompt similar to the base game without some of the stuff breaking them */
|
||||||
|
export default function CookieMonsterPrompt(content, options) {
|
||||||
|
Game.promptWrapL.className = 'framed';
|
||||||
|
const str = content;
|
||||||
|
Game.promptL.innerHTML = `${str}<div class="optionBox"></div>`;
|
||||||
|
Object.keys(options).forEach((i) => {
|
||||||
|
const option = document.createElement('a');
|
||||||
|
option.id = `promptOption${i}`;
|
||||||
|
option.className = 'option';
|
||||||
|
option.onclick = function () {
|
||||||
|
PlaySound('snd/tick.mp3');
|
||||||
|
options[i][1]();
|
||||||
|
};
|
||||||
|
option.textContent = options[i][0];
|
||||||
|
Game.promptL.children[1].appendChild(option);
|
||||||
|
});
|
||||||
|
Game.promptAnchorL.style.display = 'block';
|
||||||
|
Game.darkenL.style.display = 'block';
|
||||||
|
Game.promptL.focus();
|
||||||
|
Game.promptOn = 1;
|
||||||
|
Game.UpdatePrompt();
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ import RefreshScale from '../HelperFunctions/RefreshScale';
|
|||||||
import UpdateColours from '../HelperFunctions/UpdateColours';
|
import UpdateColours from '../HelperFunctions/UpdateColours';
|
||||||
import Flash from '../Notifications/Flash';
|
import Flash from '../Notifications/Flash';
|
||||||
import PlaySound from '../Notifications/Sound';
|
import PlaySound from '../Notifications/Sound';
|
||||||
|
import CookieMonsterPrompt from './Prompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a header-object for the options page
|
* This function creates a header-object for the options page
|
||||||
@@ -147,17 +148,22 @@ function CreatePrefOption(config) {
|
|||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.className = 'option';
|
a.className = 'option';
|
||||||
a.onclick = function () {
|
a.onclick = function () {
|
||||||
Game.Prompt(inputPrompt.outerHTML, [
|
CookieMonsterPrompt(inputPrompt.outerHTML, [
|
||||||
[
|
[
|
||||||
'Save',
|
'Save',
|
||||||
function () {
|
function () {
|
||||||
CMOptions[`${config}`] = l(`${ConfigPrefix}${config}Prompt`).value;
|
CMOptions[config] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
Game.ClosePrompt();
|
Game.ClosePrompt();
|
||||||
Game.UpdateMenu();
|
Game.UpdateMenu();
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'Cancel',
|
[
|
||||||
|
'Cancel',
|
||||||
|
function () {
|
||||||
|
Game.ClosePrompt();
|
||||||
|
},
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
a.textContent = 'Edit';
|
a.textContent = 'Edit';
|
||||||
|
|||||||
Reference in New Issue
Block a user