自動下載凡科網站相册圖片

I can't Fix this Error "Uncaught TypeError: Cannot read property 'substring' of undefined"

// ==UserScript==
// @name         Auto download Album of FanKe's website
// @name:zh-TW   自動下載凡科網站相册圖片
// @namespace    http://WWW.NTRSN.CN/
// @description:en I can't Fix this Error "Uncaught TypeError: Cannot read property 'substring' of undefined"
// @description:zh-tw I can't Fix this Error "Uncaught TypeError: Cannot read property 'substring' of undefined"
// @version      0.1
// @author       WWW.NTRSN.CN
// @supportURL   [email protected]
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&item_name=Greasy+Fork+donation
// @include      http://*.icoc.cc/*
// @description I can't Fix this Error "Uncaught TypeError: Cannot read property 'substring' of undefined"
// ==/UserScript==
(function() {
    'use strict';
    function Download() {
        var ImgList=document.querySelectorAll(".productListForms img");
        var StringA, StringB, Src;
        for(var i in ImgList){
            Src=ImgList[i].src;
            ImgList[i].src=Src.substring(0,Src.length-11)+Src.substring(Src.length-4);
            download(ImgList[i].src);
        }
        // NextPage();
    }
    function download(src) {
        var $a = document.createElement('a');
        $a.setAttribute("href", src);
        $a.setAttribute("download", "");
        var evObj = document.createEvent('MouseEvents');
        evObj.initMouseEvent( 'click',true,true,document.defaultView,0,0,0,0,0,false,false,true,false,0,null);
        $a.dispatchEvent(evObj);
    }
    function NextPage() {
        var pageNext=document.querySelector(".pageNext a");
        if(pageNext!==null){
            pageNext.click();
        }
        else{
            console.log('下载完毕哦');
        }
    }
    window.onload=function(){
        Download();
    };
})();

QingJ © 2025

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