您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto-download all pics
当前为
// ==UserScript== // @name KMImgDLer // @version 2.0 // @grant GM_addStyle // @grant GM_download // @include https://www.kaufmich.com/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js // @namespace https://greasyfork.org/users/290665 // @description Auto-download all pics // ==/UserScript== $("head").append ( '<link ' + 'href="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css" ' + 'rel="stylesheet" type="text/css">' ); addStyle(); var myVersion = GM_info.script.version; var username = document.baseURI.replace(/.*\.com\//,'').replace(/#$/,''); function artistname() { var name = $('h2.user-name').clone().children().remove().end().text(); name = name.replace(/(^\s+|\s+$)/g,''); return name; } $(function() { var name = artistname(); if (name.length) { $('.content:first').css('position','relative'); var myspace = $('<div id="KMImgDLer"></div>').appendTo('.content:first'); $('<div class="KMImgDLerLogo">powered by KMImgDLer '+myVersion+'</div>').appendTo(myspace); $('<a class="kmButton" href="#">Download all photos</a>').on('click', startDLALL).appendTo(myspace); var searchButton = $('<a class="kmButton" target="_blank">search LH</a>').appendTo(myspace); var searchQuery = (username.toLowerCase() == name.toLowerCase()) ? `"${name}"` : `("${username}" OR "${name}")`; $(searchButton).attr('href',`https://www.google.de/search?as_sitesearch=lusthaus.cc&q=${searchQuery}`); } }); function startDLALL() { var downloadlist = []; $(preload_images).each(function() { var link = $(this).attr('src'); if (1) { downloadlist.push(link); console.log(link); } }); var name = artistname(); var path = name; if (name.toLowerCase() != username.toLowerCase()) path += `,${username}` dlAll(path,downloadlist.filter( function (value, index, self) { return self.indexOf(value) === index; } )); } function dlAll(path,downloadlist) { var dialog = $('<div id="dialog"></div>').dialog({ title: 'Download to '+path+' ...', modal: true, width: 600, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); for (let URL of downloadlist) { var name = URL.replace(/.*\//,''); var file = path.replace(/[^\w-\(\)]/g,'')+'/'+name; URL = URL.replace(/^\/\//,'https://'); var line = $('<div class="RLDL" data-name="'+name+'">'+name+'</div>\n').appendTo(dialog); console.log([URL,file]); (function(url,filepath,filename,linediv) { var dl = GM_download({ url: url, name: filepath, saveAs: false, onerror: function(){ $(linediv).append('<span class="download_error">ERROR: '+err.error+'<br>'+err.details+'</span>'); }, onload: function() { $(linediv).append('<span class="download_ok">✓</span>'); } }); })(URL,file,name,line); } } function addStyle() { GM_addStyle(` .download_error { color: white; background-color: #880010; padding: 1px 4px; border-radius: 2px; margin: 0px 4px; } .download_ok { color: white; background-color: #10a020; padding: 1px 4px; border-radius: 2px; margin: 0px 4px; } #KMImgDLer { position: absolute; top: 12px; right: 236px; overflow: visible; z-index: 10000; text-align:right; } #KMImgDLer .kmButton { margin-left:4px; } .KMImgDLerLogo { position: absolute; color: #e1025d; font-size: 9px; top: -15px; right:0px; } `); }