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

Function read

scripts/reading.js:5077–5786  ·  view source on GitHub ↗
(path, index = 1, end = false, isCanvas = false, isEbook = false, imagePath = false)

Source from the content-addressed store, hash-verified

5075
5076//It starts with the reading of a comic, events, argar images, counting images ...
5077async function read(path, index = 1, end = false, isCanvas = false, isEbook = false, imagePath = false)
5078{
5079 images = {}, imagesData = {}, imagesDataClip = {}, imagesPath = {}, imagesNum = 0, contentNum = 0, imagesNumLoad = 0, currentIndex = index, foldersPosition = {}, currentScale = 1, currentZoomIndex = false, previousScrollTop = 0, scalePrevData = {tranX: 0, tranX2: 0, tranY: 0, tranY2: 0, scale: 1, scrollTop: 0}, originalRect = false, scrollInStart = false, scrollInEnd = false, prevChangeHeaderButtons = {}, trackingCurrent = false, pageRangeHistory = [], showComicSkip = false;
5080
5081 isLoaded = false;
5082 magnifyingGlassPosition.mode = false;
5083
5084 loadReadingConfig(currentReadingConfigKey);
5085
5086 if(!fromSkip)
5087 progress.activeSave(false);
5088
5089 fromSkip = false;
5090
5091 readingCurrentPath = path;
5092
5093 const bookmarks = relative.get('bookmarks');
5094 readingCurrentBookmarks = bookmarks?.[dom.history.mainPath] ?? undefined;
5095
5096 filters.setImagesPath(false);
5097
5098 $(window).off('keydown touchstart touchend mouseup mousemove touchmove mouseleave click');
5099 template.contentRight().off('mousewheel');
5100 $('.reading-body, .reading-lens').off('mousemove');
5101 $('.reading-lens').off('mousemove');
5102 $('.reading-body').off('mouseleave mouseenter mousedown touchstart touchmove');
5103 $('.content-right > div > div').off('scroll');
5104
5105 events.eventHover();
5106
5107 onReading = _onReading = true;
5108
5109 let resolve = false;
5110 let promise = new Promise(function(_resolve){
5111 resolve = _resolve;
5112 });
5113 onLoadPromise = {promise: promise, resolve: resolve};
5114
5115 const contentRight = template._contentRight();
5116 const readingLens = contentRight.querySelector('.reading-lens');
5117
5118 app.event(contentRight, 'mousewheel', function(event) {
5119
5120 if(onReading && isLoaded)
5121 {
5122 if(readingViewIs('scroll') && !event.altKey && !event.metaKey && !event.ctrlKey && !event.shiftKey && reading.scrollNextOrPrevComic(event.wheelDelta / 120 > 0, true))
5123 {
5124 event.preventDefault();
5125 }
5126 }
5127
5128 });
5129
5130 app.event(readingLens, 'mousewheel', function(event) {
5131
5132 if(onReading && isLoaded && (!haveZoom || !event.ctrlKey) && readingViewIs('scroll'))
5133 {
5134 event.preventDefault();

Callers 1

reloadFunction · 0.70

Calls 15

loadReadingConfigFunction · 0.85
readingViewIsFunction · 0.85
dragZoomFunction · 0.85
dragZoomEndFunction · 0.85
goPreviousFunction · 0.85
goNextFunction · 0.85
magnifyingGlassControlFunction · 0.85
disableOnScrollFunction · 0.85
addHtmlImagesFunction · 0.85
disposeImagesFunction · 0.85
calculateViewFunction · 0.85
readingMangaFunction · 0.85

Tested by

no test coverage detected