From 0077ab8c1711c0ee473d92c70e9bf37850b76f1e Mon Sep 17 00:00:00 2001 From: mitsugu oyama Date: Sat, 24 Dec 2011 14:38:18 +0900 Subject: modified scratch URL for next depth page for example: from: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=23851094 to: http://www.pixiv.net/member_illust.php?mode=big&illust_id=23851094 from: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9513967 to: http://www.pixiv.net/member_illust.php?mode=manga&illust_id=9513967 --- pixiv.js | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'pixiv.js') diff --git a/pixiv.js b/pixiv.js index 8ee4db4..8edbdcd 100644 --- a/pixiv.js +++ b/pixiv.js @@ -1,6 +1,6 @@ // INFO // var INFO = - @@ -39,6 +39,16 @@ commands.addUserCommand( const Cc=Components.classes; const Ci=Components.interfaces; + let cookie=contents.cookie; + let id; + let idTmp=contents.URL.match(/illust_id=(\d+)/i); + if(idTmp===null){ + liberator.echoerr("This page is not image page and not manga page."); + return false; + }else{ + id=idTmp[1]; + } + let createWorker=function(fileName){ let ret; const resourceName="vimp-plugin"; @@ -86,31 +96,6 @@ commands.addUserCommand( liberator.echoerr(event.data.status); },false); - let id; - let idTmp=contents.URL.match(/illust_id=(\d+)/i); - if(idTmp===null){ - liberator.echoerr("This page is not image page and not manga page."); - return false; - }else{ - id=idTmp[1]; - } - - let baseInfo; - let scroll; - let type=contents.getElementsByClassName('works_display').item(0) - .firstChild.getAttribute('href'); - if(-1!=type.search(/big&illust_id=/i)){ - baseInfo="http://www.pixiv.net/member_illust.php?mode=big&illust_id="; - scroll=''; - }else if(-1!=type.search(/manga&illust_id=/i)){ - baseInfo="http://www.pixiv.net/member_illust.php?mode=manga&illust_id="; - scroll='&type=scroll'; - }else{ - liberator.echoerr("This page is not image page and not manga page."); - return false; - } - let cookie=contents.cookie; - let directoryPicker=function() { let path; let fp=Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); @@ -277,6 +262,18 @@ commands.addUserCommand( } }; + let url; + let type=contents.getElementsByClassName('works_display') + .item(0).firstChild.getAttribute('href'); + if(-1!=type.search(/big&illust_id=/i)){ + url=contents.documentURI.replace('medium','big'); + }else if(-1!=type.search(/manga&illust_id=/i)){ + url=contents.documentURI.replace('medium','manga')+'&type=scroll'; + }else{ + liberator.echoerr("This page is not image page and not manga page."); + return false; + } + let trueImgInfo=function(){ if(-1!=type.search(/big&illust_id=/i)){ saveImageFile(); @@ -299,7 +296,7 @@ commands.addUserCommand( xhrImgInfo.addEventListener("load",trueImgInfo,false); xhrImgInfo.addEventListener("error",falseImgInfo,false); xhrImgInfo.QueryInterface(Ci.nsIXMLHttpRequest); - xhrImgInfo.open("GET",baseInfo+id+scroll,true); + xhrImgInfo.open("GET",url,true); xhrImgInfo.setRequestHeader('Referer',contents.URL); xhrImgInfo.setRequestHeader('Cookie',cookie); xhrImgInfo.send(null); -- cgit v1.2.3