101arrowz 4 years ago committed by GitHub
parent 7d5801beab
commit f01cf029c2

@ -12,7 +12,8 @@ ANY TEXTBOOKS YOU DOWNLOAD USING THIS SCRIPT.**
1. Open your textbook in the McGraw-Hill Connect website (how you normally open it)
2. Type `javascript:` into the address bar (you can't paste it in).
2. Paste the following into the address bar AFTER the `javascript:` part:
`var x=new XMLHttpRequest();x.onload=function(){eval(x.responseText)};x.open('GET','https://gist.githubusercontent.com/101arrowz/88156556326106a6ccd58ecb4526498c/raw/script.js');x.send();
`
```js
var x=new XMLHttpRequest();x.onload=function(){eval(x.responseText)};x.open('GET','https://gist.githubusercontent.com/101arrowz/88156556326106a6ccd58ecb4526498c/raw/script.js');x.send();
```
3. Follow the instructions that pop up. Be patient!
4. Your textbook will download.

@ -6,5 +6,5 @@ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="fu
},{}],"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(u){return void n(u)}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("regenerator-runtime/runtime"),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,u,s,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((u=l.n()).done){t.next=45;break}return s=u.value,d=s.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();
"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(u){return void n(u)}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("regenerator-runtime/runtime"),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,u,s,d,f,p,m,h,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((u=l.n()).done){t.next=45;break}return s=u.value,d=s.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:t.prev=40,t.t2=t.catch(30),console.error("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:m=t.sent,alert("Finished compressing textbook! Click OK to start download."),window.__savedTextbookEpub=m,h=URL.createObjectURL(m),(v=document.createElement("a")).href=h,b=i.querySelector("metadata title"),x=b?b.innerHTML:"textbook",v.download=x+".epub",v.click(),URL.revokeObjectURL(h),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();
},{"regenerator-runtime/runtime":"KA2S","unfetch/polyfill":"EM64"}]},{},["Focm"], null)
Loading…
Cancel
Save