Last active
September 3, 2020 21:11
-
-
Save chocolatkey/ad0c04b0768f5fcdd3ea3c6cb089b8b2 to your computer and use it in GitHub Desktop.
Doesn't work right now
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
// ==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; | |
} | |
})(); |
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."
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any news on the problem ??