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

Function goToImageCL

scripts/reading.js:923–1033  ·  view source on GitHub ↗
(index, animation = true, fromScroll = false, fromPageRange = false)

Source from the content-addressed store, hash-verified

921
922//Go to a specific comic image (Left menu)
923function goToImageCL(index, animation = true, fromScroll = false, fromPageRange = false)
924{
925 if(!onReading) return;
926
927 if(!fromPageRange)
928 {
929 render.focusIndex(index, doublePage.active());
930 filters.focusIndex(index);
931 }
932
933 let animationDurationMS = ((animation) ? _config.readingViewSpeed : 0) * 1000;
934 let contentLeft = template._contentLeft();
935
936 let leftScroll = contentLeft.firstElementChild;
937 let leftItem;
938
939 if(readingIsEbook)
940 {
941 let currentPage = index;
942 let closest = 0;
943
944 for(let i = 0, len = _ebook.tocPages.length; i < len; i++)
945 {
946 if(_ebook.tocPages[i] <= index && _ebook.tocPages[i] > closest)
947 closest = _ebook.tocPages[i];
948 }
949
950 leftItem = contentLeft.querySelector('.reading-toc-page-'+closest+' .reading-toc-title');
951
952 if(animation)
953 dom.this(contentLeft).find('.reading-toc-title.s', true).removeClass('s');
954 else
955 dom.this(contentLeft).find('.reading-toc-title.s', true).removeClass('s', 'transition');
956
957 if(leftItem)
958 {
959 leftItem.classList.add('s');
960 if(animation && _config.readingViewSpeed > 0.2) leftItem.classList.add('transition');
961 }
962 }
963 else
964 {
965 leftItem = contentLeft.querySelector('.r-l-i'+index);
966
967 if(animation)
968 dom.this(contentLeft).find('.reading-left.s', true).removeClass('s');
969 else
970 dom.this(contentLeft).find('.reading-left.s', true).removeClass('s', 'transition');
971
972 if(leftItem)
973 {
974 leftItem.classList.add('s');
975 if(animation && _config.readingViewSpeed > 0.2) leftItem.classList.add('transition');
976 }
977 }
978
979 if(leftItem)
980 {

Callers 5

goToImageFunction · 0.85
goToFolderFunction · 0.85
pageRangeFunction · 0.85
goToIndexFunction · 0.85
onScrollFunction · 0.85

Calls 2

readingViewIsFunction · 0.85
changeHeaderButtonsFunction · 0.85

Tested by

no test coverage detected