// ==UserScript== // @name pixiv快速打开原图 // @description 通过Ctrl+右键快速打开pixiv图片原图 // @version 0.1 // @namespace Pikaqian // @author Pikaqian // @include *://www.pixiv.net/* // @include *://www.pixivision.net/* // @icon https://www.pixiv.net/favicon.ico // @grant // @downloadURL none // ==/UserScript== (function() { 'use strict'; var match_rules=[ /([_=:;&\-\/\.\?\d\w]+?illust_id=(\d+)(?:&|$|))/i , /(http(?:s|):\/\/[_\-\/\.\d\w]+?\/(\d{4,})_p\d{1,4}[_\-\/\.\d\w]*)/i ]; var preTime=0, preElemnt=null, baseURL=document.URL.match(/(.+)\//)[1], isEdge=navigator.userAgent.indexOf("Edge")>0 window.addEventListener('contextmenu',function (event) { var el = event.target if (el != null) { var nowTime=new Date().getTime() var url,pid,HTML,results,img,imgMatch if((nowTime-preTime<500&&preElemnt==el)||event.ctrlKey){ HTML=el.outerHTML for(var i in match_rules){ results=HTML.match(match_rules[i]) if(results!=null&&results.length>1){ url=results[1] pid=results[2] break } } //`````````````````````````````````````````````````````````````````````` var HTML_1=el.parentNode.previousSibling.childNodes[1] var HTML_2="no results" if(HTML_1!=undefined){ HTML_2=HTML_1.childNodes[0].childNodes[1].childNodes[0].data for(var k=1;k<=HTML_2;k++){ var url_multiple="https://pixiv.cat/"+pid+"-"+k+".png" window.open(url_multiple) console.log(url_multiple) } } else{ var url_single="https://pixiv.cat/"+pid+".png" window.open(url_single) console.log(url_single) } event.preventDefault(); console.log(HTML_2) //`````````````````````````````````````````````````````````````````````` } preTime=nowTime; preElemnt=el; } }); })();