diff options
author | mitsugu oyama | 2011-09-21 12:58:40 +0900 |
---|---|---|
committer | mitsugu oyama | 2011-09-21 12:58:40 +0900 |
commit | 01d28deadfd70c87f5b88bc7b91dda1432e0d4a1 (patch) | |
tree | 17082e2399d6b68361b3b5bcf349165d8d10bdca /pixiv.js | |
parent | e2b4d256228843d738985048ed6da3840372909a (diff) | |
download | vimperator-plugins-01d28deadfd70c87f5b88bc7b91dda1432e0d4a1.tar.bz2 |
refactoring for illastration ID
Diffstat (limited to 'pixiv.js')
-rw-r--r-- | pixiv.js | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,6 +1,6 @@ // INFO // var INFO = -<plugin name="pixiv.js" version="0.7.1" +<plugin name="pixiv.js" version="0.7.2" summary="Download image from pixiv" href="http://github.com/vimpr/vimperator-plugins/blob/master/pixiv.js" xmlns="http://vimperator.org/namespaces/liberator"> @@ -30,7 +30,8 @@ commands.addUserCommand( liberator.echoerr('This page is not pixiv.'); return false; } - if(contents.URL.search(/medium&illust_id=/i)==-1){ + if((contents.URL.search(/illust_id=/i)==-1)|| + (contents.URL.search(/mode=medium/i)==-1)){ liberator.echoerr("This page is not pixiv's image page."); return false; } @@ -86,12 +87,12 @@ commands.addUserCommand( },false); let id; - if(-1==contents.URL.search(/\&from_sid=/i)){ - id=contents.URL.substr(contents.URL.lastIndexOf('=')+1); + 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{ - let st=contents.URL.search(/illust_id=/i)+'illust_id='.length; - let end=contents.URL.lastIndexOf('&'); - id=contents.URL.substr(st,end-st); + id=idTmp[1]; } let baseInfo; @@ -292,6 +293,7 @@ commands.addUserCommand( return false; }; +alert(baseInfo+id+scroll); let xhrImgInfo; xhrImgInfo=Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); xhrImgInfo.QueryInterface(Ci.nsIDOMEventTarget); |