您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Rewrite new style manga view to be more like the old style, uses full size images.
// ==UserScript== // @name Pixiv Old Manga Viewer (renew) // @namespace d24193d9-3b5f-43d8-a625-49e32c476534 // @description Rewrite new style manga view to be more like the old style, uses full size images. // @version 1.0.22 // @author ixzkn // @icon https://www.pixiv.net/favicon.ico // @include https://www.pixiv.net/member_illust.php?mode=* // @include https://www.pixiv.net/artworks/* // @run-at document-start // @grant GM_log // ==/UserScript== (function() { // Config: Always just go straight to the manga page (even in medium mode) var alwaysLoadManga = true; // use original size images or 1200 size var useOriginalImageSize = true; 'use strict'; document.addEventListener('DOMContentLoaded', function() { var metas = document.getElementsByTagName('meta'); for (let i = 0; i < metas.length; i++) { if (metas[i].getAttribute('name') === 'preload-data') { //GM_log(metas[i].getAttribute('name')+' : '+metas[i].getAttribute('content')); globalInitData = JSON.parse('{ "preload":'+metas[i].getAttribute('content')+'}'); } } if(typeof globalInitData == 'undefined') { return false; } function apply(){ function getProp(obj){ for (var i in obj){if(obj.hasOwnProperty(i)){return i;}} } // using Pixiv's own globalInitData, reconstruct all of the full URLs of the // manga's images function allFullURLs(original){ let tzoffset = 9; // pixiv's timezone offset let baseurl = original ? "https://i.pximg.net/img-original/img/" : "https://i.pximg.net/img-master/img/"; let filepostfix = original ? "" : "_master1200"; function pad(n, width, z) { z = z || '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; } function fileType(url) { return url.substring(url.lastIndexOf(".")) } // derive the image list from init data: // could also derive from original url function pixivOriginalURL(createDate,id,page,url){ //GM_log('createDate='+createDate+', id='+id+', page='+page+', url='+url); let d = new Date((new Date(createDate)).getTime() + (3600000*tzoffset)); let durl = d.getUTCFullYear() + "/" + pad(d.getUTCMonth()+1,2,"0") + "/" + pad(d.getUTCDate(),2,"0") + "/" + pad(d.getUTCHours(),2,"0") + "/" + pad(d.getUTCMinutes(),2,"0") + "/" + pad(d.getUTCSeconds(),2,"0") + "/"; //GM_log('durl='+durl); return baseurl + durl + id + "_p" + page + filepostfix + fileType(url); } var id = getProp(globalInitData.preload.illust); var pages = globalInitData.preload.illust[id].pageCount; var results = []; var urlBase = original ? globalInitData.preload.illust[id].urls.original : globalInitData.preload.illust[id].urls.regular; for(var i = 0; i < pages; i++) { results.push(pixivOriginalURL(globalInitData.preload.illust[id].userIllusts[id].updateDate,id,i,urlBase)); } return results; } let user = getProp(globalInitData.preload.user); var images = allFullURLs(useOriginalImageSize); var imagesOrig = allFullURLs(true); var result = `<style type="text/css">body{overflow-x:hidden;}</style><div id="base"><div id="back" style="position:fixed;top:1vh;left:1vw;font-size:2em;height:2.5vh;color:rgba(10,10,40,50);">⬅</div>`; // User info: result += `<a style="z-index:5;position:fixed;top:2vh;right:1vw;font-weight:bold;display:flex;align-items:center;" href="https://www.pixiv.net/member.php?id=`+user+`">`; result += `<img style="width:30px;height:30px;border-radius:30px;margin-top:0.5em;" src="`+globalInitData.preload.user[user].image+`"/>`; result += `<span>`+globalInitData.preload.user[user].name+`</span></a>`; // Manga images: for (var i = 0; i < images.length; i++) { result += `<div style="height:2.5vh;width:100vw;" id="pomv-`+i+`"></div><div style="z-index:0;position:relative;height:95vh;width:100vw;">`; let href = images[i]; result += `<img onclick="document.getElementById('pomv-`+(i+1)+`').scrollIntoView()" style="width:100%;height:100%;object-fit:scale-down;object-position:center center;" src="`+href+`"/>`; result += `<div class="position" style="position:absolute;right:2vw;top:3vh;background-color:#EEE;border-radius:5px;font-weight:bold;padding:2px;">`+(i+1)+`/`+images.length+` <a style="width:100%;text-align:center;font-weight:bold;display:block;font-size:2em;" href="`+imagesOrig[i]+`">⤡</a></div>`; result += `</div><div style="width:100vw;height:2.5vh;"></div>`; } result += `<div style="width:100vw;height:75vh;" id="pomv-`+(images.length)+`"></div></div>`; let original = document.body.innerHTML; let id = getProp(globalInitData.preload.illust); if(images.length > 1) { document.body.innerHTML = result; document.getElementById("back").addEventListener("click",function(e){ window.location.assign("https://www.pixiv.net/member_illust.php?mode=medium&illust_id="+id); }); let currentOffset = 0; document.body.addEventListener("keydown",function(e){ if(e.key == 'j'){ currentOffset++; window.scroll(0,currentOffset*document.documentElement.clientHeight); } if(e.key == 'k') { currentOffset--; window.scroll(0,currentOffset*document.documentElement.clientHeight); } }); } } if(alwaysLoadManga) { apply(); } else { if(window.location.search.toString().indexOf("mode=manga") != -1) { apply(); } else { var observer = undefined; var targetNode = document.getElementById("root"); if(targetNode == undefined){ return false; } var callback = function(mutationsList) { var search = document.querySelector("article > div > figure a"); var search2 = document.querySelector("article > div > figure > div > div > button"); if(search != undefined && search2 != undefined) { if(observer){ observer.disconnect(); } search.addEventListener('click',function(e){ apply(); e.preventDefault(); return false; }); search2.addEventListener('click',function(e){ apply(); e.preventDefault(); return false; }); } }; var observer = new MutationObserver(callback); observer.observe(targetNode, { attributes: true, childList: true, subtree: true }); } } }, this); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址