// ==UserScript== // @name pinterest // @namespace https://docs.scriptcat.org/ // @version 2025.11.24.0.1 // @description try to take over the world! // @author You // @match https://*.pinterest.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=www.pinterest.com // @require https://code.jquery.com/jquery-3.7.1.min.js // @grant GM_download // ==/UserScript== $(function(){ let move = false; $('body').on("touchmove",()=>{move = true;}).on("touchstart",()=>{move = false;};) $('body').on("click touchend mouseup mousedown","a[href*='/pin/'],div[role='group'] a",function(event){ event.stopPropagation(); event.stopImmediatePropagation(); event.preventDefault(); if(event.type!='touchend'||move) return; if(this.href.indexOf("repin")>0) { DonloadImg(); $(this).find('div').filter(ele=>ele.innerText!="").text("已下载"); } else window.open(this.href); }) CloseAd(); }) let downloadLock = false; function DonloadImg(){ if(downloadLock) return; downloadLock = true; const img = $('img[elementtiming="closeupImage"],[data-test-id="closeup-container"] img').first(); if(img.length==0) return; const src = img[0].src; const name = $('div[data-test-id="creator-profile-name"] div').text()+window.location.href.match(/\d+/g)[0]+src.match(/\.[^\.]+$/g)[0]; //$('div[data-test-id="creator-profile-name"] div').text("下载中") console.log(name); GM_download({ url:src, name:name, onload:()=>{downloadLock = false;} }); } function CloseAd(){ let check = setInterval(()=>{ $('div[data-test-id="mobile-modal-cancel-button"] button:visible').click(); },1) }