Endless google - Auto goto next page of google result

Wait 2 second before auto switch to next result page of google search when you are botton of search page.

当前为 2018-12-27 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Endless google - Auto goto next page of google result
// @namespace    http://tampermonkey.net/
// @icon         https://scontent.fdad1-1.fna.fbcdn.net/v/t1.0-9/10346186_1645759148993427_6744387242769246115_n.jpg?_nc_cat=102&_nc_ht=scontent.fdad1-1.fna&oh=b460d464946fcbcb92d4783d903412ef&oe=5C8F4A97
// @version      0.2
// @description  Wait 2 second before auto switch to next result page of google search when you are botton of search page.
// @author       HuuKhanh
// @include      https://www.google.com*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

  console.log('goo goo');
  window.onscroll = function() {
      var doc = document.documentElement;
      var current = doc.scrollTop + window.innerHeight;
      var height = doc.offsetHeight;

      if (current == height) {
          console.log('At the bottom');
          console.log('Waiting 2 second to switch to next page')
          setTimeout(function(){
              var doc = document.documentElement;
              var current = doc.scrollTop + window.innerHeight;
              if (current == height) {
                  document.getElementById('pnnext').click();
              }
              else {
                  console.log('Next page didn\'t switch because you scrolled up');
              }
          }, 2000);
  }
};
})();