HEX
Server: Apache
System: Linux vps.mmtprep.com 4.18.0-477.21.1.el8_8.x86_64 #1 SMP Thu Aug 10 13:51:50 EDT 2023 x86_64
User: mmtprep (1001)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/_ExternalApp-qnPTLMTI.js
var E=Object.defineProperty;var x=(n,e,t)=>e in n?E(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var a=(n,e,t)=>(x(n,typeof e!="symbol"?e+"":e,t),t);import{c2 as m,c3 as p,c4 as f,c5 as l,c6 as w}from"./index-ajJ0B2-K.js";const S="Application externe";class b{constructor(e){a(this,"typeExercice");a(this,"numeroExercice");a(this,"sup");a(this,"titre");a(this,"container");a(this,"iframe");a(this,"url");a(this,"state");a(this,"type","app");this.url=new URL(e),this.titre=S,this.typeExercice="html",this.state="",this.container=document.createElement("div"),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("width","400px"),this.iframe.setAttribute("height","300px"),this.iframe.classList.add("my-10"),this.iframe.setAttribute("allowfullscreen",""),this.container.appendChild(this.iframe);const t=()=>{window.innerWidth>window.innerHeight?(this.iframe.setAttribute("width","100%"),this.iframe.setAttribute("height",(document.body.offsetWidth*.75).toString())):(this.iframe.setAttribute("width","100%"),this.iframe.setAttribute("height",(document.body.offsetWidth*1.5).toString()))};window.addEventListener("resize",t),window.addEventListener("orientationchange",t),this.container.addEventListener("addedToDom",t),window.addEventListener("message",i=>{var c,s;((c=i.data)==null?void 0:c.type)==="mathaleaSettings"&&((s=i.data)==null?void 0:s.numeroExercice)===this.numeroExercice&&(this.sup=i.data.urlParams,m.update(r=>(r[this.numeroExercice].sup=i.data.urlParams,r)))})}get html(){if(m.update(e=>(e[this.numeroExercice].type="app",e)),this.handleScore(),this.sup!==void 0){const e=new URLSearchParams(this.sup);for(const[t,i]of e.entries())this.url.searchParams.append(t,i)}return p(f).v==="eleve"&&this.url.searchParams.append("v","eleve"),this.url.searchParams.append("numeroExercice",this.numeroExercice.toString()),this.iframe.setAttribute("src",this.url.toString()),this.container}handleScore(){window.addEventListener("message",e=>{var t,i,c;if(((t=e.data)==null?void 0:t.numeroExercice)===this.numeroExercice){if(((i=e.data)==null?void 0:i.type)==="mathaleaSendScore"){this.state="done";const s=parseInt(e.data.score),r=parseInt(e.data.numeroExercice),d=parseInt(e.data.numberOfQuestions),u=Array.isArray(e.data.finalState)?e.data.finalState:[e.data.finalState],h="app";l.update(o=>(o[r]={numberOfPoints:s,numberOfQuestions:d,indice:r,answers:u,type:h},o)),p(f).recorder==="capytale"&&w({indiceExercice:this.numeroExercice})}else if(((c=e.data)==null?void 0:c.type)==="mathaleaHasScore"){const s=parseInt(e.data.score),r=parseInt(e.data.numeroExercice),d=parseInt(e.data.numberOfQuestions),u=Array.isArray(e.data.finalState)?e.data.finalState:[e.data.finalState];l.update(o=>(o[r]={numberOfPoints:s,numberOfQuestions:d,indice:r,answers:u},o));const h={type:"mathaleaHasScore",score:s,numeroExercice:r,numberOfQuestions:d,finalState:u};this.iframe!==null&&this.iframe.contentWindow!==null&&this.iframe.contentWindow.postMessage(h,"*")}}})}}export{b as default};
//# sourceMappingURL=_ExternalApp-qnPTLMTI.js.map