Skip to content

Instantly share code, notes, and snippets.

@oriolgual
Created June 19, 2023 06:44
Show Gist options
  • Save oriolgual/fd6f10c6efada0802f17207fe0cda2d2 to your computer and use it in GitHub Desktop.
Save oriolgual/fd6f10c6efada0802f17207fe0cda2d2 to your computer and use it in GitHub Desktop.
Download ebook from Tagus as images
IO.CS.readChunkSilent = function (a, b, c, d, e, f) {
var g = {};
Book.mode == Book.IMAGE &&
(
g = {
readMode: 'IMAGE',
imageSize: 'LARGE'
},
e = e ||
{
},
e.timeout = IO.IGNORE
),
IO.JSONP.get(
IO.CS.prefix + 'rest/epub/readChunkSilent/' + a + '/' + b + '/' + c + '/',
g,
d,
e,
f
)
}
window.counter = 0
function saveImage(data, counter) {
var a = document.createElement("a");
a.href = data
a.download = `Image${counter}.png`;
a.click();
}
function saveAndNext() {
saveImage($(".vcdl-page-text img")[0].attributes['src'].value, window.counter)
Interface.Multilayer.hide(!1), Book.Pages.change(1)
window.counter = window.counter + 1
}
function doIt() {
setTimeout(saveAndNext, 500)
setTimeout(saveAndNext, 1000)
setTimeout(saveAndNext, 1500)
setTimeout(saveAndNext, 2000)
var id=setTimeout(doIt, 7000)
console.log(`Timeout id: ${id}`)
}
// clearTimeout(id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment