MCPcopy
hub / github.com/ollm/OpenComic / newReadingShortcutPagesConfig

Function newReadingShortcutPagesConfig

scripts/reading.js:4048–4120  ·  view source on GitHub ↗
(save = false)

Source from the content-addressed store, hash-verified

4046}
4047
4048function newReadingShortcutPagesConfig(save = false)
4049{
4050 if(save)
4051 {
4052 var name = $('.input-config-name').val();
4053
4054 if(isEmpty(name.trim()))
4055 {
4056 events.snackbar({
4057 key: 'newReadingShortcutPagesConfig',
4058 text: language.global.valueCannotBeEmpty,
4059 duration: 6,
4060 buttons: [
4061 {
4062 text: language.buttons.dismiss,
4063 function: 'events.closeSnackbar();',
4064 },
4065 ],
4066 });
4067 }
4068 else
4069 {
4070 var readingShortcutPagesConfig = storage.get('readingShortcutPagesConfig');
4071
4072 var newKey = 0;
4073
4074 for(let key in readingShortcutPagesConfig)
4075 {
4076 if(key > newKey)
4077 newKey = key;
4078 }
4079
4080 newKey++;
4081
4082 readingShortcutPagesConfig[newKey] = {
4083 ...storage.readingPagesConfig,
4084 key: newKey,
4085 readingConfigName: name,
4086 labels: [],
4087 };
4088
4089 storage.update('readingShortcutPagesConfig', readingShortcutPagesConfig);
4090
4091 reading.setReadingShortcutPagesConfig(newKey, false);
4092
4093 events.closeDialog();
4094 }
4095 }
4096 else
4097 {
4098 handlebarsContext.readingShortcutConfigName = '';
4099
4100 events.dialog({
4101 header: language.dialog.pages.readingConfigNewHeader,
4102 width: 400,
4103 height: false,
4104 content: template.load('dialog.pages.reading.config.html'),
4105 buttons: [

Callers

nothing calls this directly

Calls 1

isEmptyFunction · 0.85

Tested by

no test coverage detected