Zyntr

Injects UI tools into i-Ready (skip lesson, show answers, learning games editor, custom frame, etc.)

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         Zyntr
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Injects UI tools into i-Ready (skip lesson, show answers, learning games editor, custom frame, etc.)
// @author       You
// @license      MIT
// @match        https://*.i-ready.com/mspro/dashboard/home
// @run-at       document-idle
// @grant        none
// ==/UserScript==

/*
MIT License

Copyright (c) 2025 YourName

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

(function() {
    (()=>{var y={getStore(){return Object.values(document.querySelector("#middle-school-app"))[0].return.alternate.return.memoizedProps.value.store},makeDraggable(e,t=e){let n=!1,o={x:0,y:0};t.style.cursor="grab",t.addEventListener("mousedown",a=>{n=!0,o.x=a.clientX-e.getBoundingClientRect().left,o.y=a.clientY-e.getBoundingClientRect().top,t.style.cursor="grabbing",a.preventDefault()}),document.addEventListener("mousemove",a=>{n&&(e.style.left=`${a.clientX-o.x}px`,e.style.top=`${a.clientY-o.y}px`)}),document.addEventListener("mouseup",()=>{n=!1,t.style.cursor="grab"})}};var w={cupcake:{name:"Cupcake",version:"4.16.0",versionWeb:"4.16.0-3-web",config:"cupcakeconfig=4.16.0.0;tutorialconfig=4.16.0.0;fanaticsconfig=4.16.0.0;commonstringsconfig=0.22.0.0;kitchenconfig=4.16.0.0;initialplayerconfig=4.16.0.0;townconfig=4.16.0.0;marketconfig=4.16.0.0;bakeryconfig=4.16.0.0;cupcakestringsconfig=4.16.0.0;",gameId:"agm1oxafGhoA1LUyTb4SHvBfdbD4Tu-unity"},bounce:{name:"Bounce",version:"2.11.0",versionWeb:"2.11.0-3-web",config:"commonstringsconfig=0.22.0.0;bouncestringsconfig=2.11.0.0;bounceconfig=2.11.0.0;",gameId:"GzCt2m7AmXmJpi8XcFJe-unity"},hungryFish:{name:"Hungry Fish",version:"2.22.0",versionWeb:"2.22.0-3-web",config:"commonstringsconfig=0.22.0.0;endlevelconfig=2.22.0.0;customizeconfig=2.22.0.0;hungryfishstringsconfig=2.22.0.0;hungryfishconfig=2.22.0.0;",gameId:"YHL2HJElNsdYOotWBGG5-unity"},cloudMachine:{name:"Cloud Machine",version:"2.7.0",versionWeb:"2.7.0-3-web",config:"namegeneratorconfig=2.7.0.0;namegeneratorspanishconfig=2.7.0.0;colorconfig=2.7.0.0;cloudmachineconfig=2.7.0.0;cloudmachinestringsconfig=2.7.0.0;commonstringsconfig=0.22.0.0;leveldataconfig=2.7.0.0;",gameId:"sUY4V9ug9ztKsJXIOMHi4O8tYStbPt-unity"},zoom:{name:"Zoom",version:"2.22.0",versionWeb:"2.22.0-2-web",config:"zoomconfig=2.22.0.0;commonstringsconfig=0.22.0.0;zoomstringsconfig=2.22.0.0;",gameId:"Mecm6oWJMDuWE4tSmMXQ-unity"},match:{name:"Match",version:"4.10.0",versionWeb:"4.10.0-2-web",config:"endlevelconfig=4.10.0.0;matchstringsconfig=4.10.0.0;customizeconfig=4.10.0.0;commonstringsconfig=0.22.0.0;matchconfig=4.10.0.0;",gameId:"eP9fRXokkDhUUC0FwhAe-unity"}};async function k(){let t=Object.values(document.querySelector("#middle-school-app"))[0].return.alternate.return.memoizedProps.value.store.getState(),n=t.profile.environmentSettings.LEARNING_GAMES_CLIENT_ID,o=t.profile.environmentSettings.LEARNING_GAMES_REDIRECT_URL;return(await fetch(`https://login.i-ready.com/oauth/authorize?response_type=code&client_id=${n}&redirect_uri=${o}`).then(a=>a.json())).location.split("token=")[1]}function A(e,t,n){let o=document.getElementById("json-edit-panel");o&&o.remove();let a=document.createElement("div");a.id="json-edit-panel",a.style=`
        position: fixed;
        top: 50px;
        left: 50px;
        width: 700px;
        height: 600px;
        background: #0f0f11;
        color: #eee;
        border: 1px solid #333;
        z-index: 999999;
        display: flex;
        flex-direction: column;
        box-shadow: 0 0 25px rgba(0,0,0,0.65);
        font-family: "Sofia Pro", sans-serif;
    `;let i=document.createElement("div");i.style=`
        padding: 10px;
        background: #151517;
        border-bottom: 1px solid #222;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    `;let s=document.createElement("div");s.style.fontSize="14px",s.textContent="Learning Games Editor",i.appendChild(s);let c=document.createElement("select");for(let f in w){let h=document.createElement("option");h.value=f,h.textContent=w[f].name,f===n&&(h.selected=!0),c.appendChild(h)}c.style.padding="2px 6px",c.style.background="rgb(12, 12, 13)",c.style.color="white",c.style.border="none",c.style.outline="none",i.appendChild(c);let r=document.createElement("button");r.textContent="x",r.style="cursor: pointer; padding: 4px 10px; background: transparent; border: none; color: rgb(204, 204, 204);",r.onclick=()=>a.remove(),i.appendChild(r);let l=document.createElement("textarea");l.autocorrect="off",l.autocapitalize="off",l.spellcheck=!1,l.style=`
        flex: 1;
        width: 100%;
        padding: 10px;
        background: #0c0c0d;
        color: #eee;
        border: none;
        outline: none;
        resize: none;
        font-size: 13px;
        font-family: monospace;
        scrollbar-color: #151517 #0c0c0d;
        scrollbar-width: thin;
    `,l.value=JSON.stringify(e,null,2);let d=document.createElement("div");d.style=`
        padding: 10px;
        background: #151517;
        border-top: 1px solid #222;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    `;let u=document.createElement("button");u.textContent="Save",u.style="cursor:pointer;padding:6px 16px;background:#333;color:#eee;border:none;",u.onclick=async()=>{try{let f=JSON.parse(l.value),h=w[c.value];f.metadata=[{name:"version",value:h.version},{name:"extendedVersion",value:h.versionWeb},{name:"configVersion",value:h.config}],await t(f,h)}catch{alert("Invalid JSON")}},d.appendChild(u),a.appendChild(i),a.appendChild(l),a.appendChild(d),document.body.appendChild(a),y.makeDraggable(a,s),c.onchange=async()=>{let f=w[c.value],h=await E(f);l.value=JSON.stringify(h,null,2)}}async function E(e){let t=await k(),n=await fetch(`https://g-api.i-ready.com/v1/mm/students/validate/token/${t}`).then(s=>s.json()),o={"x-lg-onboard-id":n.data.onboardPublicId,"x-lg-state-id":n.data.stateId,"x-mm-app-version":e.version,"x-mm-app-version-extended":e.versionWeb,"x-mm-config-version":e.config,"x-mm-grade-level":n.data.gradeLevel,"x-mm-token":n.accessToken,"x-mpact-user":n.userId},a=`https://g-api.i-ready.com/v2/games/${e.gameId}/data`,i=await fetch(a,{headers:o}).then(s=>s.text());return i=="Student data not found"?{error:"No data found for this game. Play the game at least once to generate data."}:JSON.parse(i)}async function T(){let e=w.cupcake,t=await E(e);A(t,async(n,o)=>{let a=await k(),i=await fetch(`https://g-api.i-ready.com/v1/mm/students/validate/token/${a}`).then(d=>d.json()),s={"x-lg-onboard-id":i.data.onboardPublicId,"x-lg-state-id":i.data.stateId,"x-mm-app-version":o.version,"x-mm-app-version-extended":o.versionWeb,"x-mm-config-version":o.config,"x-mm-grade-level":i.data.gradeLevel,"x-mm-token":i.accessToken,"x-mpact-user":i.userId},c=`https://g-api.i-ready.com/v2/games/${o.gameId}/data`;await fetch(c,{method:"PUT",headers:{...s,"content-type":"application/json"},body:JSON.stringify(n)});let r=await k(),l=document.getElementById("learning-games-frame");l&&(l.src="https://g.i-ready.com/?token="+r)},"cupcake")}var L={utf8ToHex(e){return Array.from(new TextEncoder().encode(e)).map(t=>t.toString(16).padStart(2,"0")).join("")},hexToUtf8(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substr(n,2),16);return new TextDecoder().decode(t)},strToUint8(e){return new TextEncoder().encode(e)},bufToHex(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")},bufToBase64(e){let t=String.fromCharCode.apply(null,new Uint8Array(e));return btoa(t)},async sha256(e){let t=typeof e=="string"?this.strToUint8(e):e;return await crypto.subtle.digest("SHA-256",t)},async hmacSha256(e,t){let n=typeof e=="string"?this.strToUint8(e):e,o=typeof t=="string"?this.strToUint8(t):t,a=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await crypto.subtle.sign("HMAC",a,o)}},g=L;var x={version:"release-16.5/2",secret:"Wait, did Pixel actually unlock the secret level?!",secret2:"8dj3jjdkaed9g8"},b={decodeTransferKey(){let e=g.utf8ToHex(x.secret),t=[...x.ip].reduce((o,a)=>o+a.charCodeAt(0),0),n=g.hexToUtf8(x.transferKey).split(".")[t%16];this.decodedTransferKey=[...n].map((o,a)=>{let i=e[a%e.length];return((parseInt(o,16)-parseInt(i,16)+16)%16).toString(16)}).join("")},async generateSignature(e,t,n){let a=`hmac-sha256=${g.bufToBase64(await g.sha256(JSON.stringify(n)||""))},jsessionid=${x.jsessionId}`;return g.bufToBase64(await g.hmacSha256(this.decodedTransferKey,`(request-target): ${e} ${t} digest: ${a}`))},async generateAuthorization(){let e=await g.sha256(x.jsessionId),t=await g.hmacSha256(x.secret2,e),n=await g.sha256(g.bufToHex(t));return`${x.jsessionId}/${g.bufToHex(n)}`},async generateRequestID(){let e=await g.sha256(Date.now().toString());return g.bufToHex(e)},async fetch(e,t,n){let o=await this.generateSignature(e,t,n),a=await this.generateAuthorization(),i=await this.generateRequestID();return new Promise((s,c)=>{let r=new XMLHttpRequest;r.open(e,t,!0),r.setRequestHeader("Accept","application/json, text/plain, */*"),r.setRequestHeader("Accept-Language","en-US,en;q=0.9"),r.setRequestHeader("Authorization",a),r.setRequestHeader("Content-Type","application/json;charset=UTF-8"),r.setRequestHeader("Dashboard-Type","SD"),r.setRequestHeader("Dashboard-Version",x.version),r.setRequestHeader("Request-Id",i),r.setRequestHeader("Signature",`keyId="algo_1", signature="${o}"`),r.setRequestHeader("X-Signature",'keyId="algo_1", signature="0x000000"'),r.onreadystatechange=()=>{if(r.readyState!==4)return;let l=r.responseText,d=l;try{d=JSON.parse(l)}catch{}s(d)},r.send(JSON.stringify(n))})},async init(){let e=await fetch(location.href).then(t=>t.text());x.transferKey=e.match(/var transferKey = "([^"]+)"/)?.[1],x.ip=e.match(/var ip = "([^"]+)"/)?.[1],x.jsessionId=getCookie("CA.SESSION.NAME"),this.decodeTransferKey()}};var C={async start(){let e=y.getStore().getState().features.lessonMSPro.selectedLesson.assignmentId;document.getElementById("ms-html5Iframe").outerHTML=`
                <div style="
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: 100vw;
                    height: 100vh;
                    z-index: 999;
                    background: black;
                    color: white;
                    font-size: 64px;
                    font-weight: 900;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    text-align: center;
                    font-family: 'Sofia Pro', sans-serif;
                ">
                    <div>farming minutes...</div>
                    <div style="font-size: 32px; margin-top: 20px; font-weight: 400;">
                        you can safely switch to another tab
                    </div>
                </div>
        `,await b.fetch("post",`/learning-delivery/student/lesson-assignment/${e}/start`)},async stop(){let e=y.getStore().getState().features.lessonMSPro.selectedLesson.assignmentId;await b.fetch("post",`/learning-delivery/student/lesson-assignment/${e}/close`,{}),y.getStore().dispatch({type:"router/navigateRoute",payload:"/dashboard/my-path",meta:{}})}};function R(){let e=document.createElement("div");Object.assign(e.style,{position:"fixed",top:"50px",left:"50px",width:"280px",background:"rgba(0, 0, 0, 0.8)",border:"1px solid rgb(68, 68, 68)",borderRadius:"6px",fontFamily:"'Sofia Pro', sans-serif",fontSize:"14px",color:"#ddd",zIndex:999999,boxShadow:"rgba(0, 0, 0, 0.5) 2px 2px 10px",backdropFilter:"blur(4px)"});let t=document.createElement("div");t.textContent="Pro Lesson Answers",Object.assign(t.style,{background:"#111",color:"#fff",padding:"6px 8px",cursor:"move",fontWeight:"bold",borderTopLeftRadius:"6px",borderTopRightRadius:"6px",userSelect:"none"});let n=document.createElement("div");n.style.padding="8px",e.appendChild(t),e.appendChild(n),document.body.appendChild(e),y.makeDraggable(e,t);function o(s,c){let r=document.createElement("div");r.innerHTML=s,Object.assign(r.style,{background:c%2===0?"rgba(20, 20, 20, 0.75)":"rgba(20, 20, 20, 0.50)",margin:"4px 0",padding:"6px 8px",borderRadius:"4px",border:"1px solid #444"}),n.appendChild(r)}function a(s){n.innerHTML="";let c=0;s.screens[0].template[0].parts.forEach(r=>r.elements.forEach(l=>{l?.interaction?.inputs?.forEach&&l.interaction.inputs.forEach(d=>{d.choices&&d.choices.forEach(u=>{u.is_correct&&o(u.title,c++)}),d?.draggable_group&&d.draggable_group.forEach(u=>{u.title.includes("Match Card")&&o(u.title,c++)})}),l?.interaction?.evaluation?.[0]?.matchers&&l.interaction.inputs.word_bank&&l.interaction.evaluation[0].matchers.forEach(d=>{let u=parseInt(d.select.replace("CHOICE_",""))-1,f=l.interaction.inputs.word_bank.selectable_card.card_content[u];o(f.ckeditor_4,c++)})}))}let i=JSON.parse;JSON.parse=(...s)=>{let c=s[0];return c?.includes?.("_documentId")&&a(i(c)),i(...s)},JSON.parse.toString=i.toString.bind(i)}function j(e,t){return e.mapQ(n=>({id:n.id,maxPoints:4,numPoints:4,...t}))}async function I(){let e=Object.values(document.querySelector("#middle-school-app"))[0].return.alternate.return.memoizedProps.value.store,t=e.getState().features.lessonMSPro.selectedLesson.assignmentId,n=await b.fetch("get",`/learning-delivery/student/lesson-assignment/${t}/attempt/context`),o={},a=j(n.reportingSkills,o);await b.fetch("post",`/learning-delivery/student/lesson-assignment/${t}/start`);let i=await b.fetch("post",`/learning-delivery/student/lesson-assignment/${t}/complete?allowTopicCompletion=false`,{pldClaims:[],reportingSkills:a,itemResults:[],prerequisitesRefreshed:null,analyticsRecords:[]}),s=i?.error_description||"";s.includes("receivedInstructionAndPractice must be true on first attempt")||s.includes("receivedInstructionAndPractice cannot be null for foundational skills")?o.receivedInstructionAndPractice=!0:s.includes("receivedInstructionAndPractice must be null")?o.receivedInstructionAndPractice=null:i?.error_description&&alert(i.error_description),i.error_description&&(a=j(n.reportingSkills,o),i=await b.fetch("post",`/learning-delivery/student/lesson-assignment/${t}/complete?allowTopicCompletion=false`,{pldClaims:[],reportingSkills:a,itemResults:[],prerequisitesRefreshed:null,analyticsRecords:[]})),e.dispatch({type:"router/navigateRoute",payload:"/dashboard/my-path",meta:{}})}location.pathname=="/mspro/dashboard/home"?b.init():alert("Inject in the dashboard");var p=document.createElement("div");p.style.position="fixed";p.style.width="200px";p.style.height="auto";p.style.border="1px solid #444";p.style.backgroundColor="rgba(0, 0, 0, 0.80)";p.style.backdropFilter="blur(4px)";p.style.color="#FFF";p.style.padding="10px";p.style.boxShadow="2px 2px 10px rgba(0, 0, 0, 0.5)";p.style.borderRadius="8px";p.style.zIndex="999999";p.style.left="100px";p.style.top="100px";p.style.userSelect="none";p.style.fontFamily='"Sofia Pro", sans-serif';document.body.appendChild(p);var m=document.createElement("div");m.style.margin="0";m.style.textAlign="center";m.style.fontSize="30px";m.style.color="#FFF";m.style.display="flex";m.style.alignItems="center";m.style.justifyContent="center";m.style.gap="5px";m.style.paddingBottom="5px";m.innerHTML=`
  <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 20 20">
    <g>
      <path d="M9.47,10.72a.47.47,0,0,1,.23-.41L17.26,6a.44.44,0,0,1,.47,0,.46.46,0,0,1,.24.4v8.73a.47.47,0,0,1-.24.41l-7.56,4.36a.44.44,0,0,1-.47,0,.47.47,0,0,1-.23-.41Z" fill="white"></path>
      <path d="M.24,15.49A.47.47,0,0,1,0,15.08V6.35a.47.47,0,0,1,.24-.41.49.49,0,0,1,.47,0l7.55,4.37a.46.46,0,0,1,.24.41v8.72a.46.46,0,0,1-.24.41.44.44,0,0,1-.47,0Z" fill="white"></path>
      <path d="M1.19,5.24a.46.46,0,0,1,0-.81L8.75.06a.49.49,0,0,1,.47,0l7.56,4.37a.47.47,0,0,1,0,.81L9.22,9.61a.49.49,0,0,1-.47,0Z" fill="white"></path>
    </g>
  </svg>
  <span style="font-weight: 600;">Zyntr</span>
  <span style="font-weight: 600; padding-bottom: 15px; font-size: 15px;">v1</span>
`;p.appendChild(m);function v(e,t){let n=document.createElement("button");n.textContent=e,n.className="button",n.style.padding="8px 12px",n.style.width="100%",n.style.border="none",n.style.outline="none",n.style.borderRadius="5px",n.style.cursor="pointer",n.style.margin="5px 0",n.style.backgroundColor="rgba(20, 20, 20, 0.75)",n.style.color="white",n.addEventListener("click",()=>t(n)),p.appendChild(n)}y.makeDraggable(p,m);v("Skip Lesson",I);v("Custom Background",()=>{let e=document.querySelector("#root > div > div > img");if(!e){let n=document.querySelector("#root > div > div > svg");n.outerHTML="<img width='100%' height='100%' style='position:fixed;'>"}e=document.querySelector("#root > div > div > img");let t=document.createElement("input");t.type="file",t.accept="image/*",t.onchange=n=>{let o=n.target.files[0];o&&(e.src=URL.createObjectURL(o))},t.click()});v("Learning Games Editor",T);v("Show PRO Answers",R);v("Skip Question",function(){let e=document.getElementById("ms-html5Iframe");if(e.src.includes("universe"))return alert("This is a PRO lesson, use the skipper or show answers feature.");let n=e.contentWindow,o=Object.keys(n).find(s=>s.includes("webpack")),a=n.document.body.children["ifabric-react-root"].children.container.children.lesson,i=Object.values(a)[0].memoizedProps.children[1]._owner.stateNode._screenContainerRef._screenControllerViewRef.component;n[o].push([[Symbol()],{},s=>{Object.values(s.m).forEach((c,r)=>{if(Function.prototype.toString.apply(c).replace(/\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/g,d=>{let u=d.slice(2);return String.fromCharCode(parseInt(u,16))}).includes("secret01")){let d=Object.values(s(Object.keys(s.m)[r]))[0];i.api.screen.complete({raw:1,max:1},d),i.api.screen.enableNext(1,d)}})}])});v("Farm minutes",function(e){e.textContent=="Stop farming"&&(C.stop(),e.textContent="Farm minutes"),C.start(),e.textContent="Stop farming"});var S=!1;v("Admin Menu",function(){S=!S;let e=y.getStore();if(!S){let t=document.querySelector('[aria-label="Testing Tools"]');t&&Object.values(t)[1].onClick()}e.dispatch({type:"profile/GET_SECURITY_CONTEXT_SUCCESS",payload:{privileges:e.getState().profile.privileges,isSwitchedUser:S,basalContext:null}}),setTimeout(()=>{let t=document.querySelector('[aria-label="Testing Tools"]');t&&Object.values(t)[1].onClick()},100)});v("Discord",()=>window.open("https://discord.gg/KFwhFdnj26","_blank"));})();

})();