(screenPercent = 50, animation = true)
| 1182 | goScrollPercentST = false; |
| 1183 | |
| 1184 | function goScrollPercent(screenPercent = 50, animation = true) |
| 1185 | { |
| 1186 | if(_config.readingWebtoon || readingViewIs('scroll')) |
| 1187 | { |
| 1188 | let animationDurationMS = (animation ? _config.readingViewSpeed : 0) * 1000; |
| 1189 | |
| 1190 | const content = template._contentRight().firstElementChild; |
| 1191 | const rect = content.getBoundingClientRect(); |
| 1192 | |
| 1193 | const now = Date.now(); |
| 1194 | const prevNow = +content.dataset.now; |
| 1195 | |
| 1196 | const scrollHeight = content.scrollHeight - rect.height; |
| 1197 | let scrollTop = (+content.dataset.scrollTop || content.scrollTop) + (screenPercent / 100 * rect.height); |
| 1198 | |
| 1199 | if(scrollTop < 0) |
| 1200 | scrollTop = 0; |
| 1201 | else if(scrollTop > scrollHeight) |
| 1202 | scrollTop = scrollHeight; |
| 1203 | |
| 1204 | content.dataset.scrollTop = scrollTop; |
| 1205 | content.dataset.now = now; |
| 1206 | |
| 1207 | clearTimeout(goScrollPercentST); |
| 1208 | goScrollPercentST = setTimeout(function(){ |
| 1209 | |
| 1210 | content.dataset.scrollTop = ''; |
| 1211 | content.dataset.now = ''; |
| 1212 | |
| 1213 | }, animationDurationMS); |
| 1214 | |
| 1215 | $(content).stop(true).animate({scrollTop: scrollTop+'px'}, animationDurationMS, ((now - prevNow) < animationDurationMS ? 'linear' : 'swing')); |
| 1216 | } |
| 1217 | } |
| 1218 | |
| 1219 | //Go to a specific comic index |
| 1220 | function goToIndex(index, animation = true, nextPrevious = false, end = false) |
no test coverage detected