paginar 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -9635,7 +9635,8 @@ const useEstimatePages = {
9635
9635
  const state = reactive({
9636
9636
  currentPage: 1,
9637
9637
  nextTry: 0,
9638
- prevTry: 0
9638
+ prevTry: 0,
9639
+ willRedirect: false
9639
9640
  });
9640
9641
 
9641
9642
  const currentPage = computed(() => state.currentPage);
@@ -9671,20 +9672,24 @@ watch(totalPages, () => {
9671
9672
  });
9672
9673
 
9673
9674
  // navigate by increase/decrease value
9674
- function next() {
9675
+ function next(usingScroll = false) {
9675
9676
  if (!useReaderSettings.blocked.value) {
9676
9677
  if ((state.currentPage + 1) <= totalPages.value) {
9677
9678
  state.currentPage = state.currentPage + 1;
9678
9679
  } else {
9679
9680
  // prevent going too fast to next chapter on
9680
9681
  // stronger scroll
9681
- if (state.nextTry < 4) {
9682
+ if (usingScroll && state.nextTry < 4) {
9682
9683
  state.nextTry += 1;
9683
9684
  return
9684
9685
  }
9685
- const context = useTextContent.context.value;
9686
- if (context.surround?.after) {
9687
- window.location.href = context.surround.after.link + (`?origin=prev`);
9686
+
9687
+ if (state.willRedirect === false) {
9688
+ const context = useTextContent.context.value;
9689
+ if (context.surround?.after) {
9690
+ window.location.href = context.surround.after.link + (`?origin=prev`);
9691
+ state.willRedirect = true;
9692
+ }
9688
9693
  }
9689
9694
  }
9690
9695
  }
@@ -9696,25 +9701,29 @@ onKeyStroke('ArrowRight', (e) => {
9696
9701
 
9697
9702
  function onWheel(event) {
9698
9703
  if (event.wheelDelta < 0) {
9699
- next();
9704
+ next(true);
9700
9705
  } else {
9701
- prev();
9706
+ prev(true);
9702
9707
  }
9703
9708
  }
9704
- function prev() {
9709
+ function prev(usingScroll = false) {
9705
9710
  if (!useReaderSettings.blocked.value) {
9706
9711
  if ((state.currentPage - 1) > 0) {
9707
9712
  state.currentPage = state.currentPage - 1;
9708
9713
  } else {
9709
9714
  // prevent going too fast to prev chapter on
9710
9715
  // stronger scroll
9711
- if (state.prevTry < 4) {
9716
+ if (usingScroll && state.prevTry < 4) {
9712
9717
  state.prevTry += 1;
9713
9718
  return
9714
9719
  }
9715
- const context = useTextContent.context.value;
9716
- if (context.surround?.before) {
9717
- window.location.href = context.surround.before.link + (`?origin=next`);
9720
+
9721
+ if (state.willRedirect === false) {
9722
+ const context = useTextContent.context.value;
9723
+ if (context.surround?.before) {
9724
+ window.location.href = context.surround.before.link + (`?origin=next`);
9725
+ }
9726
+ state.willRedirect = true;
9718
9727
  }
9719
9728
  }
9720
9729
  }