(path, index = 1, end = false, isCanvas = false, isEbook = false, imagePath = false)
| 5075 | |
| 5076 | //It starts with the reading of a comic, events, argar images, counting images ... |
| 5077 | async 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(); |
no test coverage detected