101arrowz 4 years ago committed by GitHub
parent 09a3f440b4
commit 55aa4719d2

@ -0,0 +1,7 @@
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"vsCR":[function(require,module,exports) {
"use strict";function e(e,s){return s=s||{},new Promise((t,o)=>{const r=new XMLHttpRequest,n=[],a=[],l={},u=()=>({ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:()=>Promise.resolve(r.responseText),json:()=>Promise.resolve(JSON.parse(r.responseText)),blob:()=>Promise.resolve(new Blob([r.response])),clone:u,headers:{keys:()=>n,entries:()=>a,get:e=>l[e.toLowerCase()],has:e=>e.toLowerCase()in l}});r.open(s.method||"get",e,!0),r.onload=(()=>{r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(e,s,t)=>{n.push(s=s.toLowerCase()),a.push([s,t]),l[s]=l[s]?`${l[s]},${t}`:t}),t(u())}),r.onerror=o,r.withCredentials="include"==s.credentials;for(const e in s.headers)r.setRequestHeader(e,s.headers[e]);r.send(s.body||null)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"EM64":[function(require,module,exports) {
"use strict";var e=t(require("../src/index.mjs"));function t(e){return e&&e.__esModule?e:{default:e}}self.fetch||(self.fetch=e.default);
},{"../src/index.mjs":"vsCR"}],"Focm":[function(require,module,exports) {
"use strict";function e(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=t(e))){var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a,c=!0,i=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return c=e.done,e},e:function(e){i=!0,a=e},f:function(){try{c||null==o.return||o.return()}finally{if(i)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t,n,r,o,a,c){try{var i=e[a](c),l=i.value}catch(s){return void n(s)}i.done?t(l):Promise.resolve(l).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,a){var c=e.apply(t,n);function i(e){r(c,o,a,i,l,"next",e)}function l(e){r(c,o,a,i,l,"throw",e)}i(void 0)})}}require("unfetch/polyfill");var a=document.createElement("script");a.src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.3.0/jszip.min.js",document.head.appendChild(a);var c=function(){var t=o(regeneratorRuntime.mark(function t(){var n,r,o,a,c,i,l,s,u,d,f,p,h,m,v,b,x;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,alert("This is the McGraw-Hill Education Textbook Downloader. Click OK to start downloading the files."),t.next=4,fetch("https://player-api.mheducation.com/lti",{credentials:"include"});case 4:return t.next=6,t.sent.json();case 6:return n=t.sent.custom_epub_url,r=new JSZip,o=r.folder("META-INF"),t.t0=o,t.next=12,fetch(n+"META-INF/container.xml",{credentials:"include"});case 12:return t.next=14,t.sent.text();case 14:return t.t1=t.sent,t.t0.file.call(t.t0,"container.xml",t.t1),a=r.folder("OPS"),t.next=19,fetch(n+"OPS/content.opf",{credentials:"include"});case 19:return t.next=21,t.sent.text();case 21:c=t.sent,a.file("content.opf",c),i=(new DOMParser).parseFromString(c,"application/xml"),l=e(i.querySelector("manifest").children),t.prev=25,l.s();case 27:if((s=l.n()).done){t.next=45;break}return u=s.value,d=u.getAttribute("href"),t.prev=30,t.next=33,fetch("".concat(n,"OPS/").concat(d),{credentials:"include"});case 33:return t.next=35,t.sent.arrayBuffer();case 35:f=t.sent,a.file(d,f),console.log("Finished downloading",d),t.next=43;break;case 40:throw t.prev=40,t.t2=t.catch(30),"Failed to download ".concat(d,": ").concat(t.t2);case 43:t.next=27;break;case 45:t.next=50;break;case 47:t.prev=47,t.t3=t.catch(25),l.e(t.t3);case 50:return t.prev=50,l.f(),t.finish(50);case 53:return alert("Finished downloading data! Click OK to start compression."),window.__savedTextbook=r,p=0,t.next=58,r.generateInternalStream({type:"blob"}).accumulate(function(e){var t=e.percent,n=Math.floor(t);n>p&&(console.log(n+"% complete"),p=n)});case 58:h=t.sent,alert("Finished compressing textbook! Click OK to start download."),window.__savedTextbookEpub=h,m=URL.createObjectURL(h),(v=document.createElement("a")).href=m,b=i.querySelector("metadata title"),x=b?b.innerHTML:"textbook",v.download=x+".epub",v.click(),URL.revokeObjectURL(m),t.next=74;break;case 71:t.prev=71,t.t4=t.catch(0),alert("Textbook download failed because an error occurred: "+t.t4);case 74:case"end":return t.stop()}},t,null,[[0,71],[25,47,50,53],[30,40]])}));return function(){return t.apply(this,arguments)}}();c();
},{"unfetch/polyfill":"EM64"}]},{},["Focm"], null)
Loading…
Cancel
Save