巴哈-插入圖片-無限捲動

開啟「插入圖片」的視窗後,不用點「更多圖片」,就會自動一直冒出新的圖片

目前為 2018-10-05 提交的版本,檢視 最新版本

// ==UserScript==
// @name         巴哈-插入圖片-無限捲動
// @namespace    hbl917070
// @homepage     https://home.gamer.com.tw/homeindex.php?owner=hbl917070
// @version      0.1
// @description  開啟「插入圖片」的視窗後,不用點「更多圖片」,就會自動一直冒出新的圖片
// @author       hbl917070
// @include      https://forum.gamer.com.tw/C.php?bsn*
// @include      https://forum.gamer.com.tw/Co.php?bsn*
// @include      https://forum.gamer.com.tw/post1.php?bsn*
// @grant        none
// ==/UserScript==

(function() {

  function func_wheel_add_img() {
    var upHome = document.getElementsByClassName("uploadimage-home");

    if (upHome.length == 0) {
      return;
    }

    upHome = upHome[0];
    let ddd = new Date();

    //滾動事件
    upHome.addEventListener("wheel", function(e) {
      //避免點擊太快造成錯誤
      if (parseInt(new Date() - ddd) < 500) {
        return;
      }

      ddd = new Date();
      if (upHome.offsetHeight + upHome.scrollTop > upHome.scrollHeight - 400) {
        document.getElementsByClassName("uploadimage-home__btn")[0].click(); //點擊
      }
    });
  }

  var url = document.location.href;

  if ( url.indexOf("https://forum.gamer.com.tw/post1.php?") === 0 ) {

    try {
        let fci = Forum.Editor.insertImage; //原有「開啟貼圖」的函數
  
        Forum.Editor.insertImage = function(x) {
          fci(x);
          func_wheel_add_img();
        };
      } catch (e) {}

  } else {

    try {
        let fci = Forum.C.insertImage; //原有「開啟貼圖」的函數

      Forum.C.insertImage = function(x) {
        fci(x);
        func_wheel_add_img();
      };
    } catch (e) {}
  }


})();

QingJ © 2025

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