// INFO // var INFO = Mitsugu Oyama MIT

You can save image from pixiv by this plugin.

'pixiv' :pixiv

You can save image from pixiv by this plugin.

You must login pixiv.

; commands.addUserCommand( ['pixiv'], 'Save Image File from pixiv', function(){ let contents=gBrowser.selectedBrowser.contentDocument; if(contents.domain!="www.pixiv.net"){ liberator.echoerr('This page is not pixiv.'); return false; } if(contents.URL.search(/medium&illust_id=/i)==-1){ liberator.echoerr("This page is not pixiv's image page."); return false; } let Cc=Components.classes; let Ci=Components.interfaces; let id; if(-1==contents.URL.search(/\&from_sid=/i)){ id=contents.URL.substr(contents.URL.lastIndexOf('=')+1); }else{ let st=contents.URL.search(/illust_id=/i)+'illust_id='.length; let end=contents.URL.lastIndexOf('&'); id=contents.URL.substr(st,end-st); } 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); fp.init(window,'Select Directory',Ci.nsIFilePicker.modeGetFolder); let result=fp.show(); switch(result){ case Ci.nsIFilePicker.returnOK: return fp.file; default: case Ci.nsIFilePicker.returnCancel: return; } }; let saveDirectory=directoryPicker(); if(!saveDirectory) return; let getDOMHtmlDocument=function(str){ let doc; let range; try{ if(document.implementation.createHTMLDocument){ doc=document.implementation.createHTMLDocument(''); range=doc.createRange(); range.selectNodeContents(doc.documentElement); range.deleteContents(); doc.documentElement.appendChild(range.createContextualFragment(str)); }else{ let doctype=document.implementation.createDocumentType( 'html', '-//W3C//DTD HTML 4.01 Transitional//EN', 'http://www.w3.org/TR/html4/loose.dtd' ); doc=document.implementation.createDocument(null,'html',doctype); range=doc.createRange(); range.selectNodeContents(doc.documentElement); let content=doc.adoptNode(range.createContextualFragment(str)); doc.documentElement.appendChild(content); } }catch(e){ doc=null; } return doc; }; let getImageUrl=function(pageContents){ let url; let htmldoc=getDOMHtmlDocument(pageContents); if(htmldoc){ if(0