Amazon Autopager

Loads next page of search results automatically on Amazon

  1. // ==UserScript==
  2. // @name Amazon Autopager
  3. // @version 1.03
  4. // @author XFox Prower
  5. // @namespace http://www.TailsArchive.net/
  6. // @description Loads next page of search results automatically on Amazon
  7. // @include https://www.amazon.com/s/*
  8. // @include https://smile.amazon.com/s/*
  9. // @include https://www.amazon.co.uk/s/*
  10. // @include https://www.amazon.co.jp/s/*
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. 'use strict';
  15.  
  16. function fscroll()
  17. {
  18. var next=D.getElementById('pagnNextLink'),
  19. cont,
  20. pager,
  21. req;
  22.  
  23. if(!next||lock){return;}
  24. if(next.getBoundingClientRect().bottom<innerHeight>>1)
  25. {
  26. lock=1;
  27. cont=D.getElementById('s-results-list-atf');
  28. pager=D.getElementById('pagn');
  29. req=new XMLHttpRequest();
  30. req.open('GET',next.href);
  31. req.responseType='document';
  32. req.onload=function()
  33. {
  34. var res=req.response,
  35. frag=D.createDocumentFragment(),
  36. col=res.querySelectorAll('li[id^=result_]'),
  37. len=col.length,
  38. i;
  39.  
  40. for(i=0;i<len;i++)
  41. {
  42. frag.appendChild(col.item(i));
  43. }
  44. cont.appendChild(frag);
  45. pager.parentNode.replaceChild(res.getElementById('pagn'),pager);
  46. lock=0;
  47. };
  48. req.send();
  49. }
  50. }
  51.  
  52. var D=document,
  53. lock=0;
  54.  
  55. addEventListener('scroll',fscroll);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址