MaGuitarDownloadImage

try to take over the world!

当前为 2019-11-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         MaGuitarDownloadImage
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.zeczec.com/projects/mashushu-rock/updates/*
// @grant        none
// @require http://code.jquery.com/jquery-1.9.1.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/downloadjs/1.4.8/download.js
// @run-at        document-end
// ==/UserScript==

(function() {
    $(document).ready(function(){
        var images = GetImages();
        $("label:contains('搜尋')").parent().prepend("<input id=\"downloadImgs\" type=\"button\" value=\"下載教學圖片\">");

        $("#downloadImgs").click(function(){
            downloadAll(images);
        });
     });
})();

function GetImages(){
    var result = [];
    $("img").each(function(index, element) {
         if($(element).attr("src").indexOf("amazonaws") != -1){
              result.push($(element).attr("src"));
         }
    });
    return result;
}
String.prototype.filename=function(extension){
    var s= this.replace(/\\/g, '/');
    s= s.substring(s.lastIndexOf('/')+ 1);
    return extension? s.replace(/[?#].+$/, ''): s.split('.')[0];
}

function downloadAll(images) {
    $(images).each(function(index, element) {
        download(element,element.filename(),"image/png");
    });
}


QingJ © 2025

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