if (!JSZip) { $('').attr('src', 'https://stuk.github.io/jszip/dist/jszip.js').appendTo(document.body); $('').attr('src', 'https://stuk.github.io/jszip/vendor/FileSaver.js').appendTo(document.body); } (function () { "use strict"; var cxt = {}; // If you left off on some other page, this clicks the "cancel" button for you. $('.continue-modal .button-cancel:visible').click(); // Opens the page list so we can grab all the pages, and have links by which to control the active page $('#browse-btn').click(); cxt.thumbs = [].slice.apply($('.thumbnails-list figure')); // Simple configuration for image quality; these are reasonable settings for reading on a phone or tablet. cxt.config = JSON.parse(localStorage.getItem('cxtConfig') || 'null') || { maxHeight: 1440, fileType: 'jpg', quality: 0.85 }; // Sets and stores a configuration option cxt.setConfig = function (name, value) { if (cxt.config[name] !== value) { cxt.config[name] = value; localStorage.setItem('cxtConfig', JSON.stringify(cxt.config)); } } cxt.mime = { png: 'image/png', jpg: 'image/jpeg' }; cxt.fileSystem = null; // Reads the thumbnail map off the ComiXology UI cxt.getPages = function () { return cxt.thumbs.map(function (thumb) { return $(thumb).find('figcaption').text(); }); }; // Converts a page number into a filename for storage. cxt.getFilename = function (pageNumber) { return cxt.title.replace(/[^A-Za-z0-9_ \.]/g, '_') + ' - ' + pageNumber + '.' + cxt.config.fileType; }; cxt.title = document.title.replace(' - comiXology', ''); // Get a copy of toDataURL from an off-page canvas cxt.toDataURL = (function () { var ifr = $('