aboutsummaryrefslogtreecommitdiffstats
path: root/pixiv.js
diff options
context:
space:
mode:
authormitsugu oyama2011-12-24 14:38:18 +0900
committermitsugu oyama2011-12-26 17:54:41 +0900
commit0077ab8c1711c0ee473d92c70e9bf37850b76f1e (patch)
treeb317bd0b289e30efa99b4afa5b84b59bbe6610a5 /pixiv.js
parentc6031151548173d17a8d83bccca5244d449002b0 (diff)
downloadvimperator-plugins-0077ab8c1711c0ee473d92c70e9bf37850b76f1e.tar.bz2
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
Diffstat (limited to 'pixiv.js')
-rw-r--r--pixiv.js51
1 files changed, 24 insertions, 27 deletions
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 =
-<plugin name="pixiv.js" version="0.7.2"
+<plugin name="pixiv.js" version="0.7.3"
summary="Download image from pixiv"
href="http://github.com/vimpr/vimperator-plugins/blob/master/pixiv.js"
xmlns="http://vimperator.org/namespaces/liberator">
@@ -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);