Last active
November 14, 2018 12:00
-
-
Save maple3142/a185703e6177a0a3aa2cc67c9f357ffb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d=document | |
| dl=(s,b)=>{ | |
| a=d.createElement('a') | |
| a.href=s | |
| a.download=b | |
| d.body.appendChild(a) | |
| a.onclick=e=>e.stopPropagation() | |
| a.click() | |
| a.remove() | |
| } | |
| fulpg=parseInt(d.querySelector('#pageSliderCounter').textContent.split('/').pop()) | |
| handle=u=>{ | |
| try{ | |
| const x=new URL(u) | |
| if(x.hostname!=='viewer-epubs-trial.bookwalker.jp')return | |
| fetch(u.replace(/\/xhtml\/.*\/0/,'/xhtml/cover.xhtml/0')).then(r=>r.blob()).then(URL.createObjectURL).then(x=>dl(x,1)) | |
| for(let i=2;i<=fulpg;i++){ | |
| const s=u.replace(/\d{3}\.xhtml/,i.toString().padStart(3,'0')+'.xhtml') | |
| fetch(s).then(r=>r.blob()).then(URL.createObjectURL).then(x=>dl(x,i)) | |
| } | |
| } | |
| catch(e){} | |
| } | |
| Object.defineProperty(Image.prototype,'src',{ | |
| get(){ | |
| return this._src | |
| }, | |
| set(v){ | |
| handle(v) | |
| this._src=v | |
| return v | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment