From 01d28deadfd70c87f5b88bc7b91dda1432e0d4a1 Mon Sep 17 00:00:00 2001 From: mitsugu oyama Date: Wed, 21 Sep 2011 12:58:40 +0900 Subject: refactoring for illastration ID --- pixiv.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'pixiv.js') diff --git a/pixiv.js b/pixiv.js index 2dddfda..f91e5ea 100644 --- a/pixiv.js +++ b/pixiv.js @@ -1,6 +1,6 @@ // INFO // var INFO = - @@ -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); -- cgit v1.2.3