From 6b803bf21c1772ce7685aae911f0bbc3a8772046 Mon Sep 17 00:00:00 2001 From: 101arrowz Date: Tue, 7 Apr 2020 21:31:41 +0000 Subject: [PATCH] --- README.md | 9 ++++++++- script.js | 9 ++++++--- source.js | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 49cac29..3c7f9a5 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,11 @@ ANY TEXTBOOKS YOU DOWNLOAD USING THIS SCRIPT.** ## Instructions 1. Open your textbook in the McGraw-Hill Connect website (how you normally open it) -2. \ No newline at end of file +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();` +3. Follow the instructions that pop up. Be patient! +4. Your textbook will download. \ No newline at end of file diff --git a/script.js b/script.js index 23ba93b..7d284cd 100644 --- a/script.js +++ b/script.js @@ -1,7 +1,10 @@ -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=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)} +},{}],"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);np&&(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) \ No newline at end of file +"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);np&&(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(); +},{"regenerator-runtime/runtime":"KA2S","unfetch/polyfill":"EM64"}]},{},["Focm"], null) \ No newline at end of file diff --git a/source.js b/source.js index 0d21dbc..dab993e 100644 --- a/source.js +++ b/source.js @@ -1,3 +1,4 @@ +// Source code for the downloader. import('https://cdnjs.cloudflare.com/ajax/libs/jszip/3.2.2/jszip.min.js').then(async () => { alert('This is the McGraw-Hill Education Textbook Downloader. Click OK to start downloading the files.'); const IMPORT_URL = (await (await fetch('https://player-api.mheducation.com/lti', { credentials: 'include' })).json()).custom_epub_url;