(scrollInStart = null, scrollInEnd = null)
| 847 | let prevChangeHeaderButtons = {}; |
| 848 | |
| 849 | function changeHeaderButtons(scrollInStart = null, scrollInEnd = null) |
| 850 | { |
| 851 | let canGoPrev = true, canGoNext = true, prevIsPrevComic = false, nextIsNextComic = false; |
| 852 | |
| 853 | let barHeader = template._barHeader(); |
| 854 | |
| 855 | let lastPage = barHeader.querySelector('.button-last-page'); |
| 856 | let next = barHeader.querySelector('.button-next'); |
| 857 | let prev = barHeader.querySelector('.button-prev'); |
| 858 | let firstPage = barHeader.querySelector('.button-first-page'); |
| 859 | |
| 860 | if((scrollInStart === null || scrollInStart) && currentIndex == 1 && !((readingViewIs('scroll') && (_config.readingViewAdjustToWidth || _config.readingWebtoon)) && currentPageVisibility > 0)) |
| 861 | { |
| 862 | if(readingManga()) |
| 863 | { |
| 864 | prevIsPrevComic = true; |
| 865 | canGoPrev = dom.nextComic(); |
| 866 | } |
| 867 | else |
| 868 | { |
| 869 | prevIsPrevComic = true; |
| 870 | canGoPrev = dom.previousComic(); |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | if((scrollInEnd === null || scrollInEnd) && currentIndex == indexNum && !((readingViewIs('scroll') && (_config.readingViewAdjustToWidth || _config.readingWebtoon)) && currentPageVisibility < maxPageVisibility)) |
| 875 | { |
| 876 | if(readingManga()) |
| 877 | { |
| 878 | nextIsNextComic = true; |
| 879 | canGoNext = dom.previousComic(); |
| 880 | } |
| 881 | else |
| 882 | { |
| 883 | nextIsNextComic = true; |
| 884 | canGoNext = dom.nextComic(); |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | let currentChangeHeaderButtons = { |
| 889 | prevIsPrevComic: prevIsPrevComic, |
| 890 | nextIsNextComic: nextIsNextComic, |
| 891 | canGoPrev: canGoPrev, |
| 892 | canGoNext: canGoNext, |
| 893 | readingManga: readingManga(), |
| 894 | }; |
| 895 | |
| 896 | if(!isEqual(prevChangeHeaderButtons, currentChangeHeaderButtons)) |
| 897 | { |
| 898 | changeHeaderButtonsDelay = false; |
| 899 | |
| 900 | dom.this([prev, firstPage]).class(!canGoPrev, 'disable-pointer'); |
| 901 | dom.this([next, lastPage]).class(!canGoNext, 'disable-pointer'); |
| 902 | |
| 903 | firstPage.innerHTML = prevIsPrevComic ? 'skip_previous' : 'first_page'; |
| 904 | lastPage.innerHTML = nextIsNextComic ? 'skip_next' : 'last_page'; |
| 905 | |
| 906 | prev.setAttribute('hover-text', readingManga() ? language.reading.next : language.reading.previous); |
no test coverage detected