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

Function changePagesView

scripts/reading.js:3162–3441  ·  view source on GitHub ↗
(mode, value, save)

Source from the content-addressed store, hash-verified

3160
3161//Controls the page view
3162function changePagesView(mode, value, save)
3163{
3164 if(currentScale != 1)
3165 reading.resetZoom(true, false, false);
3166
3167 const imageIndex = reloadIndex();
3168
3169 if(mode == 0)
3170 {
3171 let selectTab = document.querySelector('#reading-pages .tabs > div > div.active').dataset.name;
3172 loadReadingPages(false, false, selectTab);
3173
3174 if(readingIsEbook) handlebarsContext.loading = true;
3175 template.loadContentRight('reading.content.right.html', true);
3176
3177 reading.reload(false, imageIndex);
3178 }
3179 else if(mode == 1) // Set the scroll mode
3180 {
3181 updateReadingPagesConfig('readingView', value);
3182
3183 dom.queryAll('.reading-view .chip.active').removeClass('active');
3184 dom.query('.reading-view-'+value).addClass('active');
3185
3186 if(value != 'scroll')
3187 template.globalElement('.reading-ajust-to-width, .reading-force-single-page').addClass('disable-pointer');
3188 else
3189 template.globalElement('.reading-ajust-to-width, .reading-force-single-page').removeClass('disable-pointer');
3190
3191 if(readingIsEbook) handlebarsContext.loading = true;
3192 template.loadContentRight('reading.content.right.html', true);
3193
3194 reading.reload(false, imageIndex);
3195 }
3196 else if(mode == 2) // Sets the margin of the pages
3197 {
3198 disposeImages({margin: value});
3199 calculateView();
3200 stayInLine();
3201
3202 if(save) updateReadingPagesConfig('readingMargin', {margin: value, top: value, bottom: value, left: value, right: value});
3203 updateEbook(save);
3204 }
3205 else if(mode == 3) // Set width adjustment
3206 {
3207 updateReadingPagesConfig('readingViewAdjustToWidth', value);
3208
3209 if(readingIsEbook) handlebarsContext.loading = true;
3210 template.loadContentRight('reading.content.right.html', true);
3211
3212 reading.reload(false, imageIndex);
3213 }
3214 else if(mode == 4) // Set the speed of the animation when changing pages
3215 {
3216 if(save) updateReadingPagesConfig('readingViewSpeed', value);
3217 }
3218 else if(mode == 5) // Set the delay when skip from comic
3219 {

Callers 1

Calls 8

loadReadingPagesFunction · 0.85
updateReadingPagesConfigFunction · 0.85
disposeImagesFunction · 0.85
calculateViewFunction · 0.85
stayInLineFunction · 0.85
updateEbookFunction · 0.85
addHtmlImagesFunction · 0.85
reloadIndexFunction · 0.70

Tested by

no test coverage detected