-
-
Save chocolatkey/ad0c04b0768f5fcdd3ea3c6cb089b8b2 to your computer and use it in GitHub Desktop.
| // ==UserScript== | |
| // @name EBookJapanRipper | |
| // @version 1.10 | |
| // @downloadURL https://gist.githubusercontent.com/chocolatkey/ad0c04b0768f5fcdd3ea3c6cb089b8b2/raw | |
| // @supportURL https://gist.github.com/chocolatkey/ad0c04b0768f5fcdd3ea3c6cb089b8b2 | |
| // @description Send my regards to "t-hamaguchi" lol | |
| // @author chocolatkey | |
| // @homepage https:/github.com/chocolatkey | |
| // @include http://*br.ebookjapan.jp* | |
| // @include https://*br.ebookjapan.jp* | |
| // @run-at document-start | |
| // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js | |
| // @require https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.min.js | |
| // ==/UserScript== | |
| var min = 1; | |
| var max = 0; | |
| (function (unsafeWindow) { | |
| var already = false; | |
| $( document ).ready(function() { | |
| console.log( "Ripper available" ); | |
| }); | |
| $(document).on("keydown", function(e) { | |
| if((e.shiftKey && e.keyCode == 68) && !already) | |
| { | |
| console.log( "Ripper shown" ); | |
| already = true; | |
| max = BR_slider.maxNum + 1; | |
| $( "#viewArea" ).append( "\ | |
| <div style='position: fixed; top: 5px; right: 5px; width: 150px; height: auto; background: #e2e2e2; padding: 5px; z-index: 999;'>\ | |
| <center><b><h3 id='ebjrp-title'>==== Ripper ====</h3></b></center>\ | |
| <button id='ebjrp-start' style='width: 150px;'>Rip!</button><br>\ | |
| First:<input type='number' id='eb1' style='width: 40px;' name='quantity' min='1' max='" + (BR_slider.maxNum + 1) + "' value='1'> \ | |
| Last:<input type='number' id='eb2' style='width: 40px;' name='quantity' min='1' max='" + (BR_slider.maxNum + 1) + "' value='" + (BR_slider.maxNum + 1) + "'>\ | |
| </div>\ | |
| " ); | |
| $( "#eb1" ).change(function() { | |
| min = $(this).val(); | |
| }); | |
| $( "#eb2" ).change(function() { | |
| max = $(this).val(); | |
| }); | |
| $( "#ebjrp-start" ).click(function() { | |
| console.log( "Rippin' " + min + "-" + max); | |
| $("#ebjrp-title").html("<i>This may take a while...</i>"); | |
| for (i = (min-1); i <= (max-1); i++) { | |
| worker(i); | |
| } | |
| }); | |
| } | |
| }); | |
| function worker(i) { | |
| __get_image(i, function(c) { | |
| console.log("p" + i + " ready"); | |
| $("#ebjrp-title").html("Latest: p" + (i+1) + " ready"); | |
| var cname = "ebjrp-c-" + i; | |
| BR_ROOT.BR_global.BR_ViewerGlobal.BR_inner.append('<canvas id="' + cname + '" style="top:-9999px;"></canvas>'); | |
| var f = document.getElementById(cname); | |
| f.height = BR_page.jsonData.pif[i].Height; | |
| f.width = BR_page.jsonData.pif[i].Width; | |
| var h = f.getContext("2d"); | |
| h.clearRect(0, 0, BR_page.jsonData.pif[i].Width, BR_page.jsonData.pif[i].Height); | |
| h.strokeStyle = "rgba(0,0,0,0)"; //Last page ;) | |
| var im = new Image; | |
| im.onload = function() { | |
| Module.__xx(h, im, i, false); | |
| console.log("p" + i + " drawn"); | |
| $( "#" + cname ).each(function() { | |
| $( this )[0].toBlob(function(blob) { | |
| console.log("p" + i + " saving"); | |
| saveAs(blob, pad((i+1), 3) + ".png"); | |
| $( "#" + cname ).remove(); | |
| console.log("p" + i + " done"); | |
| $("#ebjrp-title").html("Latest: p" + (i+1) + " done"); | |
| }); | |
| }); | |
| }; | |
| im.src = c; | |
| }); | |
| } | |
| function pad (str, max) { | |
| str = str.toString(); | |
| return str.length < max ? pad("0" + str, max) : str; | |
| } | |
| })(); |
Shift + d don,t work anymore.
@DENISBruno Fixed
Which browser are you using?
I can't seem to make this work in FF 51. Looks like the key pressed check function is faulty somehow.
Oh I found it.
In Greasemonkey, the "keypress" event doesn't receive a keyCode, I changed it to "keydown" and it works perfectly, thanks.
@Flynn95 update with your fix. I never use FF so I didn't know, thanks.
Not working anymore? Just saves blank images now.
Works again, they changed a var name
Hello,
The script worked until around 10 pm EST. After then it froze at "This may take a while...". Here is the console error message I got:
(unknown) Ripper available
VM96:40 Ripper shown
VM96:60 Rippin' 1-5
VM107:1 Uncaught TypeError: Cannot read property 'done' of null
at eval (eval at (:1:1), :1:1973)
at Array.forEach (native)
at __get_image (eval at (:1:1), :1:1908)
at worker (eval at E_c (:1:1), :69:9)
at HTMLButtonElement.eval (eval at E_c (:1:1), :63:21)
at HTMLButtonElement.dispatch (eval at E_c (:1:1), :7:10315)
(anonymous) @ VM107:1
__get_image @ VM107:1
worker @ VM96:69
(anonymous) @ VM96:63
dispatch @ VM96:7
Any news on the problem ??
All old versions of EBookJapanRipper.user.js can not download EBJ(EbookJapan) now. Can you update this script?
Hi o/
Got this error when I press Shift+D :
Uncaught ReferenceError: BR_slider is not defined
at HTMLDocument.eval (eval at E_c (:3:221), <anonymous>:42:13)
at HTMLDocument.dispatch (eval at E_c (:3:221), <anonymous>:7:10315)
at HTMLDocument.q.handle (eval at E_c (:3:221), <anonymous>:7:8342)
Seems the BR_slider variable is not defined anymore.
Not working for me anymore.
I'm also using Google Chrome
Nothing happens when I press Shift + D
I'm getting the same error as Etshy in my logs.
Also, if I go into the code in Tampermonkey, for lines 32-38 there's an error that says "Bad escaping of EOL. Use option multistr if needed."
Don't forget to press Shift+D to show