new eslint fixes run
This commit is contained in:
		
							parent
							
								
									5a1987f77b
								
							
						
					
					
						commit
						b12cf2c4f1
					
				
					 2 changed files with 39 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
        "quote-props": ["warn", "as-needed"],
 | 
			
		||||
        "no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
 | 
			
		||||
        "max-len" : ["warn", {"code": 88}],
 | 
			
		||||
        "capitalized-comments": "off"
 | 
			
		||||
        "capitalized-comments": "off",
 | 
			
		||||
        "operator-linebreak": ["warn", "before"]
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										55
									
								
								melpomene.js
									
										
									
									
									
								
							
							
						
						
									
										55
									
								
								melpomene.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -91,11 +91,11 @@ function pageMaxHeight()
 | 
			
		|||
{
 | 
			
		||||
    let maxHeight = 0;
 | 
			
		||||
 | 
			
		||||
    for (let i = 0; i < READER_PAGES.children.length; i += 1)
 | 
			
		||||
    for (let pageIdx = 0; pageIdx < READER_PAGES.children.length; pageIdx += 1)
 | 
			
		||||
    {
 | 
			
		||||
        if(READER_PAGES.children[i].naturalHeight > maxHeight)
 | 
			
		||||
        if (READER_PAGES.children[pageIdx].naturalHeight > maxHeight)
 | 
			
		||||
        {
 | 
			
		||||
            maxHeight = READER_PAGES.children[i].naturalHeight;
 | 
			
		||||
            maxHeight = READER_PAGES.children[pageIdx].naturalHeight;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ function pageMaxHeight()
 | 
			
		|||
 | 
			
		||||
function pageVerticalOffset(pageNumber)
 | 
			
		||||
{
 | 
			
		||||
    return ( pageMaxHeight() - pageOriginalHeight(pageNumber) ) / 2;
 | 
			
		||||
    return (pageMaxHeight() - pageOriginalHeight(pageNumber)) / 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function previousPagesWidth(pageNumber)
 | 
			
		||||
| 
						 | 
				
			
			@ -169,9 +169,9 @@ function loadZoomsFromImgTagsIfRequired()
 | 
			
		|||
            // ";" separates zooms data, "," separates values
 | 
			
		||||
            // We add the page number (adding 1 because of indexing)
 | 
			
		||||
            const zooms = zoomsRawData.split(";").map(
 | 
			
		||||
                zoom => [idx + 1].concat(
 | 
			
		||||
                (zoom) => [idx + 1].concat(
 | 
			
		||||
                    zoom.split(",").map(
 | 
			
		||||
                        value => parseFloat(value)
 | 
			
		||||
                        (value) => parseFloat(value)
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
| 
						 | 
				
			
			@ -190,16 +190,18 @@ function getFirstZoomOfPage(pageNumber)
 | 
			
		|||
            return zoomIdx;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getZoomCountForPage(pageNumber)
 | 
			
		||||
{
 | 
			
		||||
    return PAGES_ZOOMS.filter(zoom => zoom[0] === pageNumber).length;
 | 
			
		||||
    return PAGES_ZOOMS.filter((zoom) => zoom[0] === pageNumber).length;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getCurrentZoomIndexForPage()
 | 
			
		||||
{
 | 
			
		||||
    const previousZoomsCount = PAGES_ZOOMS.filter(zoom => zoom[0] < CURRENT_PAGE).length;
 | 
			
		||||
    const previousZoomsCount = PAGES_ZOOMS.filter((zoom) => zoom[0] < CURRENT_PAGE).length;
 | 
			
		||||
    return CURRENT_ZOOM - previousZoomsCount + 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -214,14 +216,16 @@ function getReadingProgressPercent()
 | 
			
		|||
 | 
			
		||||
    const progressPerZoom = progressPerPage / getZoomCountForPage(CURRENT_PAGE);
 | 
			
		||||
 | 
			
		||||
    const readingProgress = (CURRENT_PAGE - 1) * progressPerPage + getCurrentZoomIndexForPage() * progressPerZoom;
 | 
			
		||||
 | 
			
		||||
    let readingProgress = (CURRENT_PAGE - 1) * progressPerPage;
 | 
			
		||||
    readingProgress += getCurrentZoomIndexForPage() * progressPerZoom;
 | 
			
		||||
 | 
			
		||||
    return 100 * readingProgress;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function updateProgressBar()
 | 
			
		||||
{
 | 
			
		||||
    PROGRESS_BAR.style.width = getReadingProgressPercent() + "%";
 | 
			
		||||
    PROGRESS_BAR.style.width = `${getReadingProgressPercent()}%`;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// =========
 | 
			
		||||
| 
						 | 
				
			
			@ -265,7 +269,7 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
 | 
			
		|||
        posx = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((posx + width) > pageOriginalWidth(pageNumber))
 | 
			
		||||
    if (posx + width > pageOriginalWidth(pageNumber))
 | 
			
		||||
    {
 | 
			
		||||
        width = pageOriginalWidth(pageNumber) - posx;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -277,7 +281,7 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
 | 
			
		|||
        posy = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((posy + height) > pageOriginalHeight(pageNumber))
 | 
			
		||||
    if (posy + height > pageOriginalHeight(pageNumber))
 | 
			
		||||
    {
 | 
			
		||||
        height = pageOriginalHeight(pageNumber) - posy;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -342,7 +346,13 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
 | 
			
		|||
 | 
			
		||||
function refreshReaderDisplay()
 | 
			
		||||
{
 | 
			
		||||
    moveReaderDisplayToArea(CURRENT_PAGE, CURRENT_WIDTH, CURRENT_HEIGHT, CURRENT_X, CURRENT_Y);
 | 
			
		||||
    moveReaderDisplayToArea(
 | 
			
		||||
        CURRENT_PAGE,
 | 
			
		||||
        CURRENT_WIDTH,
 | 
			
		||||
        CURRENT_HEIGHT,
 | 
			
		||||
        CURRENT_X,
 | 
			
		||||
        CURRENT_Y
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function moveReaderDisplayToPage(pageNumber)
 | 
			
		||||
| 
						 | 
				
			
			@ -352,7 +362,13 @@ function moveReaderDisplayToPage(pageNumber)
 | 
			
		|||
 | 
			
		||||
function moveReaderDisplayToZoom(index)
 | 
			
		||||
{
 | 
			
		||||
    moveReaderDisplayToArea(PAGES_ZOOMS[index][0], PAGES_ZOOMS[index][1], PAGES_ZOOMS[index][2], PAGES_ZOOMS[index][3], PAGES_ZOOMS[index][4]);
 | 
			
		||||
    moveReaderDisplayToArea(
 | 
			
		||||
        PAGES_ZOOMS[index][0],
 | 
			
		||||
        PAGES_ZOOMS[index][1],
 | 
			
		||||
        PAGES_ZOOMS[index][2],
 | 
			
		||||
        PAGES_ZOOMS[index][3],
 | 
			
		||||
        PAGES_ZOOMS[index][4]
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    CURRENT_ZOOM = index;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -445,12 +461,15 @@ function initReader()
 | 
			
		|||
                }
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        { root: READER_CONTENT_FRAME, rootMargin: "-10px" }
 | 
			
		||||
        {
 | 
			
		||||
            root: READER_CONTENT_FRAME,
 | 
			
		||||
            rootMargin: "-10px"
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    for (let i = 0; i < READER_PAGES.children.length; i += 1)
 | 
			
		||||
    for (let pageIndex = 0; pageIndex < READER_PAGES.children.length; pageIndex += 1)
 | 
			
		||||
    {
 | 
			
		||||
        const img = READER_PAGES.children[i];
 | 
			
		||||
        const img = READER_PAGES.children[pageIndex];
 | 
			
		||||
        visibilityObserver.observe(img);
 | 
			
		||||
 | 
			
		||||
        PROGRESS_BAR_PAGES.appendChild(document.createElement("div"));
 | 
			
		||||
| 
						 | 
				
			
			@ -459,7 +478,7 @@ function initReader()
 | 
			
		|||
    READER_PAGES.style.display = "flex";
 | 
			
		||||
 | 
			
		||||
    setTimeout(
 | 
			
		||||
        () => { READER_PAGES.hidden = false },
 | 
			
		||||
        () => { READER_PAGES.hidden = false; },
 | 
			
		||||
        "300"
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue