// ==UserScript== // @name 快速复制Pixiv ID // @name:en Fast copy Pixiv ID // @name:ja 急速にコピーPixiv ID // @description 对图片或链接双击右键即可复制Pixiv作品ID // @description:en Double click the right button on image or link to copy Pixiv works ID. // @description:ja 画像やリンクダブルクリックに右ボタンでコピーPixiv作品ID // @version 0.1 // @namespace https://github.com/VMatrices // @author VMatrices // @include *://www.pixiv.net/* // @include *://www.pixivision.net/* // @include *://saucenao.com/* // @include *://iqdb.org/* // @icon https://www.pixiv.net/favicon.ico // @grant GM_setClipboard // @downloadURL none // ==/UserScript== (function() { 'use strict'; var match_rules=[ /illust_id=(.+?)(?:&|$)/ , /\/(\d+)_p\d+/ ]; var preTime=0; var preElemnt=null; document.oncontextmenu=function (event) { var el = event.target; if (el != null) { var nowTime=new Date().getTime(); if(nowTime-preTime<500&&preElemnt==el){ var url; if(el.hasAttribute('href')){ url=el.attributes.href.value; } else if(el.hasAttribute('src')){ url=el.attributes.src.value; } else { var chd=el.children; for(var i=0;i1){ pid=results[1]; } } if(pid!=0){ console.log("Pixiv ID:",pid); GM_setClipboard(pid); return false; } } } preTime=nowTime; preElemnt=el; } }; })();