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

Function editReadingShortcutPagesConfigName

scripts/reading.js:3969–4046  ·  view source on GitHub ↗
(key = 0, save = false)

Source from the content-addressed store, hash-verified

3967}
3968
3969function editReadingShortcutPagesConfigName(key = 0, save = false)
3970{
3971 if(save)
3972 {
3973 var name = $('.input-config-name').val();
3974
3975 if(isEmpty(name.trim()))
3976 {
3977 events.snackbar({
3978 key: 'newReadingShortcutPagesConfig',
3979 text: language.global.valueCannotBeEmpty,
3980 duration: 6,
3981 buttons: [
3982 {
3983 text: language.buttons.dismiss,
3984 function: 'events.closeSnackbar();',
3985 },
3986 ],
3987 });
3988 }
3989 else
3990 {
3991 if(key === 0)
3992 {
3993 storage.updateVar('config', 'readingConfigName', name);
3994 }
3995 else
3996 {
3997 var readingShortcutPagesConfig = storage.getKey('readingShortcutPagesConfig', key);
3998
3999 if(readingShortcutPagesConfig)
4000 {
4001 readingShortcutPagesConfig['readingConfigName'] = name;
4002
4003 storage.updateVar('readingShortcutPagesConfig', key, readingShortcutPagesConfig);
4004
4005 }
4006 }
4007
4008 let selectTab = document.querySelector('#reading-pages .tabs > div > div.active').dataset.name;
4009
4010 loadReadingPages(key, true, selectTab);
4011 }
4012 }
4013 else
4014 {
4015 if(key === 0)
4016 {
4017 handlebarsContext.readingShortcutConfigName = config.readingConfigName ? config.readingConfigName : language.reading.pages.readingGlobal;
4018 }
4019 else
4020 {
4021 var readingShortcutPagesConfig = storage.getKey('readingShortcutPagesConfig', key);
4022
4023 handlebarsContext.readingShortcutConfigName = readingShortcutPagesConfig ? readingShortcutPagesConfig.readingConfigName : '';
4024 }
4025
4026 events.dialog({

Callers

nothing calls this directly

Calls 2

isEmptyFunction · 0.85
loadReadingPagesFunction · 0.85

Tested by

no test coverage detected