Sleazy Fork is available in English.
寂月神社图片预览下使用的是复用页面,分辨率为300x300,本脚本为自动访问分辨率高的地址并下载图片。
当前为
// ==UserScript==
// @name 寂月download
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 寂月神社图片预览下使用的是复用页面,分辨率为300x300,本脚本为自动访问分辨率高的地址并下载图片。
// @description 进入页面后点击“获取”按钮,提示获取完成后点击“下载”按钮;目前仅能同时下载58张以下的图片。
// @description 本脚本不可用于商业行为,仅限交流自用!
// @author 香香不吃饭
// @match https://www.jiyue.pro/*
// @require http://code.jquery.com/jquery-1.11.0.min.js
// @require https://cdn.bootcss.com/FileSaver.js/1.3.8/FileSaver.min.js
// @grant GM_info
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_download
// ==/UserScript==
(function() {
'use strict';
//创建隐藏a标签
//var elea = document.createElement("a");
//elea.setAttribute("id", "a");
//elea.textContent="值";
//elea.setAttribute("href", "www.baidu.com");
//创建一个img标签
//var eleimg = document.createElement("img");
//eleimg.setAttribute("id", "img");
// eleimg.textContent="值";
//eleimg.setAttribute("class", "img-fluid lazyloaded");
//创建数组来存储每张图片对应的src
var imgUrl = [];
var button = document.createElement("button"); //创建一个获取图片url按钮
button.setAttribute("id", "btn");
button.setAttribute("type", "button");
button.textContent="获取";
button.style.background = "#b46300";
button.style.color = "white";
button.style.cssText="padding:4px 0;position: absolute;top:-1px;right:45px;width:40px;height:35px";
var button2 = document.createElement("button"); //创建一个下载图片按钮
button2.setAttribute("id", "btn2");
button2.setAttribute("type", "button");
button2.textContent="下载";
button2.style.background = "#b46300";
button2.style.color = "white";
button2.style.cssText="padding:4px 0;position: absolute;top:-1px;right:0px;width:40px;height:35px";
var testdiv = document.getElementById("navbarNav");
testdiv.appendChild(button);
testdiv.appendChild(button2);
//testdiv.appendChild(elea);
//elea.appendChild(eleimg);
//eleimg.style.display="none";
//document.getElementById("elea").style.display="none";
var newurl = "";
var pagenum = 0; //图片页数
var imgname = ''; //漫画名称
//拿到当前页面所有预览图片对应的URL
var baseUrl = window.location.href;
button.onclick = function getimgurl(){
pagenum = document.getElementsByClassName('badge badge-pill badge-secondary float-right')[0].innerText;
pagenum = pagenum.substr(0,pagenum.length-1);
imgname = document.getElementsByClassName('h4 font-weight-bold title mb-2')[0].innerText;
//eleimg.setAttribute("alt",imgname);
for(var i = 1;i<=pagenum;i++) {
newurl = baseUrl + '/'+i
geturl();
}
i = i-1
alert("共获取"+i+"页!点击下载按钮即可下载!")
//console.log(imgUrl)
}
//ajax同步请求获取url
function geturl(){
$.ajax({
type:'get',
url:newurl,//这里是url
async: false,
//data就是内容了,也就是url网页中的内容
success:function(data){
//正则表达式截取图片url
var srcReg = /"(.*?)"/g
var arr = data.match(srcReg)[162]
arr = arr.substr(1,arr.length-2)
imgUrl.push(arr)
}
});
}
button2.onclick = function downloadimg(){
alert("开始下载!")
for(let a=0;a<=imgUrl.length-1;a++){
GM_download(imgUrl[a],"picture"+a);
}
//GM_download(imgUrl[0],"aaa");
}
//alert("获取完成!")
// Your code here...
})();