���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/moodledata/filedir/38/68/3868cea90f29b5eebb1aaa5644c7792713675a44
���ѧ٧ѧ�
!function(){"use strict";let t=function(){function t(){}return t.extend=function(){for(let t=1;t<arguments.length;t++)for(let e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&("object"==typeof arguments[0][e]&&"object"==typeof arguments[t][e]?this.extend(arguments[0][e],arguments[t][e]):arguments[0][e]=arguments[t][e]);return arguments[0]},t.htmlDecode=function(t){var e=(new DOMParser).parseFromString(t,"text/html");return e.documentElement?e.documentElement.textContent:""},t.formatLanguageCode=function(t){if("string"!=typeof t)return t;const e=t.split("-");return e[0]=e[0].toLowerCase(),e.length>1&&(e[1]=e[1].toUpperCase()),t=e.join("-")},t.isTask=function(t,e){return"H5P.CoursePresentation"===e?t.isTask:t.getMaxScore&&t.getMaxScore()>0},t.addMixins=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.prototype)return;Array.isArray(e)||(e=[e]);const i=t.prototype;e.forEach((t=>{const e=t.prototype;Object.getOwnPropertyNames(e).forEach((t=>{if("constructor"!==t){if(Object.getOwnPropertyNames(i).includes(t))throw`Class ${i.constructor.name} already contains ${t}. Cannot add ${e.constructor.name}`;i[t]=e[t]}}))}))},t}();var e=t;let i=function(){function t(t,i){this.params=e.extend({l10n:{nothingToSee:""}},t||{}),this.callbacks=i||{},this.message=document.createElement("div"),this.message.classList.add("h5p-ar-scavenger-content-action-message"),this.message.innerText=e.htmlDecode(this.params.l10n.nothingToSee),this.actionWrapper=document.createElement("div"),this.actionWrapper.classList.add("h5p-ar-scavenger-content-action-library-wrapper"),this.actionWrapper.classList.add("h5p-ar-scavenger-display-none"),this.content=document.createElement("div"),this.content.classList.add("h5p-ar-scavenger-content-action"),this.content.appendChild(this.actionWrapper),this.content.appendChild(this.message),this.container=document.createElement("div"),this.container.classList.add("h5p-ar-scavenger-content-action-container"),this.container.appendChild(this.content)}var i=t.prototype;return i.resizeIframeHeight=function(t){this.container.style.maxHeight="number"==typeof t?`${t}px`:""},i.getDOM=function(){return this.container},i.show=function(){this.container.classList.remove("h5p-ar-scavenger-display-none"),this.actionWrapper.setAttribute("tabindex",0),this.actionWrapper.focus()},i.hide=function(){this.actionWrapper.setAttribute("tabindex",-1),this.container.classList.add("h5p-ar-scavenger-display-none")},i.toggleView=function(t){this.container.classList.toggle("h5p-ar-scavenger-action-mode",t)},i.attachInstance=function(t){this.content.removeChild(this.actionWrapper),this.actionWrapper=t,this.content.appendChild(this.actionWrapper)},i.showContent=function(){this.actionWrapper.classList.remove("h5p-ar-scavenger-display-none"),this.message.classList.add("h5p-ar-scavenger-display-none")},i.hideContent=function(){this.actionWrapper.classList.add("h5p-ar-scavenger-display-none"),this.message.classList.remove("h5p-ar-scavenger-display-none")},t}(),n=function(){function t(t,i){this.params=e.extend({fallbackHeight:400},t||{}),this.callbacks=i||{},this.callbacks.onResize=this.callbacks.onResize||(()=>{}),this.callbacks.onMarkerFound=this.callbacks.onMarkerFound||(()=>{}),this.callbacks.onMarkerLost=this.callbacks.onMarkerLost||(()=>{}),this.maxHeight=null,this.content=document.createElement("div"),this.content.classList.add("h5p-ar-scavenger-content-camera"),this.iframe=this.buildIframe(),this.content.appendChild(this.iframe),this.container=document.createElement("div"),this.container.classList.add("h5p-ar-scavenger-content-camera-container"),this.container.appendChild(this.content)}var i=t.prototype;return i.getDOM=function(){return this.container},i.resizeIframeHeight=function(t){this.maxHeight="number"==typeof t?t:null,this.container.style.removeProperty("max-height"),this.container.style.removeProperty("max-width");const e=this.content.currentStyle||window.getComputedStyle(this.content),i=parseInt(e.marginTop)+parseInt(e.marginBottom),n=parseInt(e.marginLeft)+parseInt(e.marginRight);this.videoRatio=this.videoRatio||this.video?this.video.offsetWidth/this.video.offsetHeight:null,this.maxHeight&&(this.container.style.maxHeight=`${this.maxHeight}px`);const s=Math.max(this.container.offsetWidth-n,document.body.offsetWidth);this.maxHeight&&s/this.videoRatio>this.maxHeight?(this.container.style.maxWidth=this.maxHeight*this.videoRatio+"px",this.iframe.style.height=this.maxHeight-i+"px"):(this.container.style.maxWidth=document.body.offsetWidth-n+"px",this.iframe.style.height=`${(this.container.offsetWidth-n)/this.videoRatio||this.params.fallbackHeight}px`),this.callbacks.onResize()},i.resize=function(){this.resizeIframeHeight(this.maxHeight)},i.show=function(){this.container.classList.remove("h5p-ar-scavenger-display-none")},i.hide=function(){this.container.classList.add("h5p-ar-scavenger-display-none")},i.setNarrowView=function(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?this.container.classList.add("h5p-ar-scavenger-narrow-screen"):this.container.classList.remove("h5p-ar-scavenger-narrow-screen")},i.toggleView=function(){this.container.classList.toggle("h5p-ar-scavenger-action-mode")},i.buildIframe=function(){const t=document.createElement("iframe");return t.classList.add("h5p-ar-scavenger-content-camera-iframe"),t.setAttribute("allow","camera *;"),t.setAttribute("tabindex",-1),t.addEventListener("load",(()=>{this.iframeLoaded||(this.handleIframeLoaded(this.iframe),this.iframeLoaded=!0)})),t},i.buildHTML=function(){const t=document.createElement("html");return t.appendChild(this.buildHeader()),t.appendChild(this.buildBody()),t},i.buildHeader=function(){const t=document.createElement("head"),e=document.createElement("style");e.setAttribute("type","text/css"),e.innerHTML="#arjsDebugUIContainer {display: none;} .a-enter-vr,.a-enter-ar {display: none;}",t.appendChild(e);const i=document.createElement("script");i.text=H5P.AFrame.toString(),t.appendChild(i);const n=document.createElement("script");n.text=H5P.AFrameAR.toString(),t.appendChild(n);const s=document.createElement("script");return s.text="H5PAFrame();",s.text+="H5PAFrameAR();",t.appendChild(s),t},i.buildBody=function(){const t=document.createElement("body");return t.style.margin="0",t.style.overflow="hidden",t.style.padding="0",t.appendChild(this.buildScene()),t},i.buildScene=function(){const t=document.createElement("a-scene");t.setAttribute("embedded",""),t.setAttribute("arjs","sourceType: webcam; sourceWidth:1920; sourceHeight:1080; debugUIEnabled: false;"),this.params.markers.forEach(((e,i)=>{const n=document.createElement("a-marker");n.setAttribute("type","pattern"),n.setAttribute("preset","custom"),n.setAttribute("id",i);const s=H5P.getPath(e.markerPattern.path,this.params.contentId);if(n.setAttribute("url",s),"model"===e.actionType){const i=e.model.file.path,s=i.split(".").slice(-1)[0],a=i.split("/").slice(-1)[0].split(".").slice(0,-1).join("-");if("gltf"===s||"glb"===s){const s=document.createElement("a-asset-item");s.setAttribute("id",a),s.setAttribute("src",H5P.getPath(i,this.params.contentId));const r=document.createElement("a-asset");r.appendChild(s),t.appendChild(r);const o=`${e.model.geometry.scale.scale/100} ${e.model.geometry.scale.scale/100} ${e.model.geometry.scale.scale/100}`,c=`${e.model.geometry.rotation.x} ${e.model.geometry.rotation.y} ${e.model.geometry.rotation.z}`,h=`${e.model.geometry.position.x} ${e.model.geometry.position.y} ${e.model.geometry.position.z}`,l=document.createElement("a-entity");l.setAttribute("gltf-model","#"+a),l.setAttribute("scale",o),l.setAttribute("rotation",c),l.setAttribute("position",h),n.appendChild(l)}}n&&t.appendChild(n)}));const e=document.createElement("a-entity");return e.setAttribute("camera",""),t.appendChild(e),t},i.handleIframeComplete=function(){"complete"!==this.iframeDocument.readyState?this.iframeDocument.addEventListener("readystatechange",(()=>{"complete"===this.iframeDocument.readyState&&this.addEventListeners()})):this.addEventListeners(),this.waitForVideo((t=>{this.video=t,this.params.fallbackHeight=parseInt(this.video.style.height),this.resize()}))},i.waitForVideo=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;if(!t)return;if(e<=0)return;const i=this.iframeDocument.querySelector("#arjs-video");i&&parseInt(i.style.height)>0?t(i):setTimeout((()=>{this.waitForVideo(t,e-100)}),100)},i.addEventListeners=function(){Array.from(this.iframeDocument.querySelectorAll("a-marker")).forEach((t=>{t.addEventListener("markerFound",(t=>{this.callbacks.onMarkerFound(t)})),t.addEventListener("markerLost",(t=>{this.callbacks.onMarkerLost(t)}))}))},i.handleIframeLoaded=function(t){try{const e=t.contentWindow;e.addEventListener("resize",this.resize),t.contentWindow.document.open(),t.contentWindow.document.write(this.buildHTML().outerHTML),t.contentWindow.document.close(),this.iframeDocument=t.contentDocument?t.contentDocument:e,this.handleIframeComplete(),setTimeout((()=>{this.resize()}),0)}catch(t){}},t}(),s=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.params=e.extend({a11y:{active:"",disabled:"",inactive:""},active:!1,classes:[],disabled:!1,type:"pulse"},t||{}),Array.isArray(this.params.classes)||(this.params.classes=[this.params.classes]),"pulse"===this.params.type&&(this.params.a11y.inactive||(this.params.a11y.inactive=this.params.a11y.active||""),this.params.a11y.active||(this.params.a11y.active=this.params.a11y.inactive||"")),this.active=this.params.active,this.disabled=this.params.disabled,this.callbacks=e.extend({onClick:()=>{}},i),this.button=document.createElement("button"),this.params.classes&&this.params.classes.forEach((t=>{this.button.classList.add(t)})),this.button.setAttribute("aria-pressed",this.params.active),this.button.setAttribute("tabindex","0"),!0===this.params.active?this.activate():this.deactivate(),!0===this.params.disabled?this.disable():this.enable(),this.button.addEventListener("click",(t=>{this.disabled||("toggle"===this.params.type&&this.toggle(),this.callbacks.onClick(t))}))}var i=t.prototype;return i.getDOM=function(){return this.button},i.show=function(){this.button.classList.remove("h5p-ar-scavenger-button-display-none")},i.hide=function(){this.button.classList.add("h5p-ar-scavenger-button-display-none")},i.focus=function(){this.button.focus()},i.enable=function(){this.disabled=!1,this.button.classList.remove("h5p-ar-scavenger-button-disabled"),this.active?this.activate():this.deactivate()},i.disable=function(){this.button.classList.add("h5p-ar-scavenger-button-disabled"),this.button.setAttribute("aria-label",this.params.a11y.disabled),this.button.setAttribute("title",this.params.a11y.disabled),this.disabled=!0},i.activate=function(){this.disabled||("toggle"===this.params.type&&(this.button.classList.add("h5p-ar-scavenger-button-active"),this.button.setAttribute("aria-pressed",!0)),this.button.setAttribute("aria-label",this.params.a11y.active),this.button.setAttribute("title",this.params.a11y.active),this.active=!0)},i.deactivate=function(){this.disabled||(this.active=!1,"toggle"===this.params.type&&(this.button.classList.remove("h5p-ar-scavenger-button-active"),this.button.setAttribute("aria-pressed",!1)),this.button.setAttribute("aria-label",this.params.a11y.inactive),this.button.setAttribute("title",this.params.a11y.inactive))},i.toggle=function(){this.disabled||(this.active?this.deactivate():this.activate())},i.isActive=function(){return this.active},i.isDisabled=function(){return this.disabled},t}(),a=function(){function t(t,i){this.params=e.extend({title:"",a11y:{}},t||{}),this.callbacks=i||{},this.callbacks.onClickButtonFullScreen=this.callbacks.onClickButtonFullScreen||(()=>{}),this.callbacks.onClickButtonQuit=this.callbacks.onClickButtonQuit||(()=>{}),this.callbacks.onClickButtonSwitchView=this.callbacks.onClickButtonSwitchView||(()=>{}),this.titleBar=document.createElement("div"),this.titleBar.classList.add("h5p-ar-scavenger-title-bar"),this.buttons={},this.buttons.switchView=new s({a11y:{inactive:this.params.a11y.buttonSwitchViewAction,active:this.params.a11y.buttonSwitchViewCamera,disabled:this.params.a11y.buttonSwitchViewDisabled},classes:["h5p-ar-scavenger-button","h5p-ar-scavenger-button-switch-view"],type:"toggle",active:!0},{onClick:this.callbacks.onClickButtonSwitchView}),this.titleBar.appendChild(this.buttons.switchView.getDOM());const n=document.createElement("div");n.classList.add("h5p-ar-scavenger-title"),n.innerHTML=this.params.title,this.titleBar.appendChild(n),this.buttons.quit=new s({a11y:{active:this.params.a11y.buttonQuit,disabled:this.params.a11y.buttonQuitDisabled},classes:["h5p-ar-scavenger-button","h5p-ar-scavenger-button-quit"],disabled:!0,type:"pulse"},{onClick:this.callbacks.onClickButtonQuit}),this.buttons.quit.hide(),this.titleBar.appendChild(this.buttons.quit.getDOM()),this.params.canHasFullScreen&&(this.buttons.fullscreen=new s({a11y:{active:this.params.a11y.buttonFullScreenExit,inactive:this.params.a11y.buttonFullScreenEnter},classes:["h5p-ar-scavenger-button","h5p-ar-scavenger-button-fullscreen"],disabled:!1,type:"toggle"},{onClick:i.onClickButtonFullScreen}),this.titleBar.appendChild(this.buttons.fullscreen.getDOM()))}var i=t.prototype;return i.getDOM=function(){return this.titleBar},i.showButton=function(t){this.buttons[t]&&this.buttons[t].show()},i.hideButton=function(t){this.buttons[t]&&this.buttons[t].hide()},i.focusButton=function(t){this.buttons[t]&&this.buttons[t].focus()},i.toggleButtonActive=function(t,e){this.buttons[t]&&("boolean"!=typeof e&&(e=!this.buttons[t].isActive()),!0===e?this.buttons[t].activate():this.buttons[t].deactivate())},i.toggleButtonDisabled=function(t,e){this.buttons[t]&&("boolean"!=typeof e&&(e=!this.buttons[t].isDisabled()),!0===e?this.buttons[t].disable():this.buttons[t].enable())},i.isButtonActive=function(t){return this.buttons[t]?this.buttons[t].isActive():null},i.isButtonDisabled=function(t){return this.buttons[t]?this.buttons[t].isDisabled():null},t}(),r=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(this.params=t,this.callbacks=e,this.callbacks.onClose=e.onClose||(()=>{}),this.baseClassName="h5p-ar-scavenger-screen",this.screen=document.createElement("div"),this.screen.classList.add(`${this.baseClassName}`),this.params.id&&this.screen.classList.add(`${this.baseClassName}-${this.params.id}`),this.params.screenImage&&this.params.screenImage.params&&this.params.screenImage.params.file){const e=document.createElement("div");e.classList.add(`${this.baseClassName}-image-wrapper`),this.params.screenText&&e.classList.add("small-margin-bottom"),H5P.newRunnable(t.screenImage,i,H5P.jQuery(e),!1);const n=e.querySelector("img");n.classList.add(`${this.baseClassName}-image`),n.style.height="auto",n.style.width="auto";const s=document.createElement("div");s.classList.add(`${this.baseClassName}-image-bar`),e.appendChild(s),this.screen.appendChild(e)}if(this.params.screenText){const t=document.createElement("div");t.classList.add(`${this.baseClassName}-text`),t.innerHTML=this.params.screenText,this.screen.appendChild(t)}this.button=H5P.JoubelUI.createButton({class:`${this.baseClassName}-button-close`,text:this.params.l10n.buttonText,click:this.callbacks.onClose}).get(0),this.hide(),this.screen.appendChild(this.button)}var e=t.prototype;return e.getDOM=function(){return this.screen},e.show=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.screen.classList.remove("h5p-ar-scavenger-display-none"),t.focusStartButton&&this.button.focus()},e.hide=function(){this.screen.classList.add("h5p-ar-scavenger-display-none")},t}(),o=function(){function t(t,i){this.params=e.extend({},t||{}),this.callbacks=i||{},this.feedbackSection=document.createElement("div"),this.feedbackSection.classList.add("h5p-ar-scavenger-feedback-section"),this.scoreText=document.createElement("div"),this.scoreText.classList.add("h5p-ar-scavenger-score-text"),this.scoreText.innerText="",this.feedbackSection.appendChild(this.scoreText),this.scoreBar=H5P.JoubelUI.createScoreBar(0),this.scoreBar.setScore(-1),this.scoreBar.appendTo(H5P.jQuery(this.feedbackSection))}var i=t.prototype;return i.getDOM=function(){return this.feedbackSection},i.show=function(){this.feedbackSection.classList.remove("h5p-ar-scavenger-display-none")},i.hide=function(){this.feedbackSection.classList.add("h5p-ar-scavenger-display-none")},i.setScore=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.scoreBar.setScore(t)},i.setMaxScore=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.scoreBar.setMaxScore(t)},i.setScoreText=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.scoreText.innerText=e.htmlDecode(t)},t}();function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}let h=function(t){var e,i;function n(){var e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;return(e=t.call(this,i,n,s)||this).feedbackSection=new o({},{}),e.button.parentNode.insertBefore(e.feedbackSection.getDOM(),e.button),e}i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,c(e,i);var s=n.prototype;return s.setScoreText=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.feedbackSection.setScoreText(t)},s.setScore=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.feedbackSection.setScore(t)},s.setMaxScore=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.feedbackSection.setMaxScore(t)},n}(r);function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}let d=function(t){var e,i;function n(e,i,n){return t.call(this,e,i,n)||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,l(e,i),n}(r),u=function(){function t(){}var s=t.prototype;return s.buildTitleBar=function(){return new a({title:this.extras.metadata.title,a11y:{buttonFullScreenEnter:this.params.a11y.buttonFullScreenEnter,buttonFullScreenExit:this.params.a11y.buttonFullScreenExit,buttonSwitchViewAction:this.params.a11y.buttonSwitchViewAction,buttonSwitchViewCamera:this.params.a11y.buttonSwitchViewCamera,buttonSwitchViewDisabled:this.params.a11y.buttonSwitchViewDisabled,buttonQuit:this.params.a11y.buttonQuit,buttonQuitDisabled:this.params.a11y.buttonQuitDisabled},canHasFullScreen:this.params.canHasFullScreen},{onClickButtonFullScreen:t=>this.callbacks.onFullScreen(t),onClickButtonQuit:t=>this.handleQuit(t),onClickButtonSwitchView:()=>this.handleSwitchView()})},s.buildTitleScreen=function(){return new d({id:"title",screenImage:this.params.titleScreen.titleScreenImage,screenText:this.params.titleScreen.titleScreenIntroduction,l10n:{buttonText:this.params.l10n.start}},{onClose:()=>{this.handleTitleScreenClosed()}},this.contentId)},s.buildEndScreen=function(){return new h({id:"end",screenImage:this.params.endScreen.endScreenImage,screenText:this.params.endScreen.endScreenOutro,l10n:{buttonText:this.params.l10n.retry}},{onClose:()=>{this.handleRetry()}},this.contentId)},s.buildCamera=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=new n({contentId:t.contentId,fallbackHeight:t.fallbackHeight,markers:t.markers.map((t=>({actionType:t.actionType,markerPattern:t.markerPattern,model:t.model})))},e),a=s.getDOM();return i||a.classList.add("h5p-ar-scavenger-action-mode"),a.addEventListener("transitionend",(()=>{i||0===a.offsetWidth&&a.classList.add("h5p-ar-scavenger-display-none"),setTimeout((()=>{this.instances[this.currentInstanceId]&&this.instances[this.currentInstanceId].trigger("resize"),this.resize()}),100)})),s},s.buildAction=function(){const t=new i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return t.hide(),t.getDOM().addEventListener("transitionend",(()=>{this.isCameraMode&&t.hide(),setTimeout((()=>{this.instances[this.currentInstanceId]&&this.instances[this.currentInstanceId].trigger("resize"),this.resize()}),0)})),t},s.handleInitializationFailed=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.messages.innerHTML="",this.messages.classList.add("h5p-ar-scavenger-content-message-error"),t.forEach((t=>{const i=document.createElement("p");i.innerText=e.htmlDecode(t),this.messages.appendChild(i)}))},s.handleInitializationSucceeded=function(){this.params.showTitleScreen&&(this.hide(),this.screenTitle.show()),this.screenContent.removeChild(this.messages),this.titlebar=this.buildTitleBar(),this.screenContent.appendChild(this.titlebar.getDOM()),this.camera=this.buildCamera({contentId:this.contentId,markers:this.params.markers,fallbackHeight:this.params.behaviour.fallbackHeight},{onResize:()=>{this.resize({fromSubject:!0})},onMarkerFound:t=>{this.handleMarkerFound(t)},onMarkerLost:t=>{this.handleMarkerLost(t)}},this.isCameraMode),this.action=this.buildAction({l10n:{nothingToSee:this.params.l10n.nothingToSee}},{});const t=document.createElement("div");t.classList.add("h5p-ar-scavenger-panel"),t.appendChild(this.camera.getDOM()),t.appendChild(this.action.getDOM()),this.screenContent.appendChild(t),this.params.showEndScreen&&(this.screenEnd=this.buildEndScreen(),this.container.appendChild(this.screenEnd.getDOM())),this.instantiateMarkers(),this.instances.forEach(((t,e)=>{t&&this.instantiateContent(e)})),this.params.showEndScreen&&this.getMaxScore()>0?this.titlebar.showButton("quit"):this.titlebar.hideButton("quit"),0===this.instancesH5P&&this.titlebar.hideButton("switchView")},s.instantiateMarkers=function(){this.params.markers.forEach(((t,e)=>{if(this.markersFound[e]=this.markersFound[e]||{actionType:t.actionType,completed:!1},"h5p"!==t.actionType)return this.instances.push(null),void this.instanceDOMs.push(null);const i=t.interaction.interaction;let n;if(i.library&&(n=i.library.split(" ")[0]),void 0!==n&&this.contentId){const t=document.createElement("div");t.classList.add("h5p-ar-scavenger-content-action-library-wrapper");const s=null!==this.extras.previousState[e]?this.extras.previousState[e]:void 0,a={uninstantiated:{interaction:i,contentId:this.contentId,actionWrapper:t,previousState:s,index:e,machineName:n},on:()=>{},trigger:()=>{}};this.instancesH5P++,this.instances.push(a),this.instanceDOMs.push(t)}else this.instances.push(null),this.instanceDOMs.push(null)}))},t}(),m=function(){function t(){}var e=t.prototype;return e.handleMarkerFound=function(t){if(!this.isShown)return;if(!this.isCameraMode&&this.isNarrowScreen)return;const e=parseInt(t.target.id);"h5p"===this.params.markers[e].actionType&&(this.instantiateContent(e),this.instances[e].setActivityStarted(),this.currentInstanceId=e,this.action.attachInstance(this.instanceDOMs[e],e),this.action.showContent(),this.action.show(),this.isCameraMode&&(this.titlebar.toggleButtonActive("switchView",!1),this.toggleView()),setTimeout((()=>{this.instances[e].trigger("resize")}),0))},e.handleMarkerGotCompleted=function(t){this.markersFound[t].completed=!0;this.markersFound.reduce(((t,e)=>t+(e&&e.completed?1:0)),0)===this.tasksH5P&&this.handleCompleted()},e.handleMarkerLost=function(t){return t},e.handleTitleScreenClosed=function(){this.screenTitle&&this.screenTitle.hide(),this.show(),this.titlebar&&this.titlebar.focusButton("switchView"),setTimeout((()=>{this.callbacks.onResize()}),0)},e.handleCompleted=function(){this.params.showEndScreen&&(this.titlebar.showButton("quit"),this.titlebar.toggleButtonDisabled("quit",!1))},e.handleQuit=function(){if(this.params.showEndScreen){const t=this.getScore(),e=this.getMaxScore(),i=H5P.Question.determineOverallFeedback(this.params.endScreen.overallFeedback,t/e).replace("@score",t).replace("@total",e);this.screenEnd.setScoreText(i),this.screenEnd.setMaxScore(this.getMaxScore()),this.hide(),this.screenEnd.show(),setTimeout((()=>{this.screenEnd.setScore(this.getScore()),this.callbacks.onResize()}),0)}this.callbacks.onQuit()},e.handleRetry=function(){this.reset(),this.screenEnd.hide(),this.params.showTitleScreen?this.screenTitle.show({focusStartButton:!0}):this.show(),this.params.showEndScreen&&this.getMaxScore()>0?(this.titlebar.toggleButtonDisabled("quit",!0),this.titlebar.showButton("quit")):this.titlebar.hideButton("quit"),setTimeout((()=>{this.callbacks.onResize()}),0)},e.handleSwitchView=function(){const t=!this.titlebar.isButtonActive("switchView")?this.params.a11y.actionOpened:this.params.a11y.actionClosed;this.callbacks.onRead(t),this.toggleView()},t}(),p=function(){function t(i,n,s,a){e.addMixins(t,[u,m]),this.params=i,this.contentId=n,this.extras=s||{},this.extras.previousState=this.extras.previousState||[],this.callbacks=a||{},this.callbacks.onFullScreen=this.callbacks.onFullScreen||(()=>{}),this.callbacks.onQuit=this.callbacks.onQuit||(()=>null),this.callbacks.onRead=this.callbacks.onRead||(()=>{}),this.callbacks.onResize=this.callbacks.onResize||(()=>{}),this.isCameraMode=!0,this.instancesInitialized=0,this.instances=[],this.instanceDOMs=[],this.instancesH5P=0,this.tasksH5P=0,this.markersFound=new Array(this.params.markers.length),this.container=document.createElement("div"),this.container.classList.add("h5p-ar-scavenger-screen-content"),this.params.showTitleScreen&&(this.screenTitle=this.buildTitleScreen(),this.container.appendChild(this.screenTitle.getDOM())),this.screenContent=document.createElement("div"),this.screenContent.classList.add("h5p-ar-scavenger-content-container"),this.container.appendChild(this.screenContent),this.messages=document.createElement("div"),this.messages.classList.add("h5p-ar-scavenger-content-message"),this.messages.innerText=e.htmlDecode(this.params.l10n.initializingContent),this.screenContent.appendChild(this.messages);let r=[];0===i.markers.length&&r.push(this.params.l10n.errorNoMarkers),-1!==window.navigator.userAgent.indexOf("Trident/")&&r.push(this.params.l10n.errorBrowserNotSupported),window.Brave&&r.push(this.params.l10n.warningBrave),window.navigator.mediaDevices&&window.navigator.mediaDevices.getUserMedia||r.push(this.params.l10n.errorNoCameraSupport),0===r.length?(window.navigator.mediaDevices.getUserMedia({video:{width:4096,height:2160}}).then((t=>{t.getTracks().forEach((t=>{t.stop()})),this.handleInitializationSucceeded()})).catch((t=>{const e=`${this.params.l10n.errorNoCameraAccess} ${t.message}`;this.handleInitializationFailed([e])})),this.handleTitleScreenClosed()):this.handleInitializationFailed(r)}var i=t.prototype;return i.instantiateContent=function(t){if(!this.instances[t].uninstantiated)return;const i=this.instances[t].uninstantiated,n=i.index,s=i.machineName;i.interaction.params.behaviour&&("always"===this.params.behaviour.overrideShowSolutionButton?i.interaction.params.behaviour.enableSolutionsButton=!0:"never"===this.params.behaviour.overrideShowSolutionButton&&(i.interaction.params.behaviour.enableSolutionsButton=!1),"always"===this.params.behaviour.overrideRetryButton?i.interaction.params.behaviour.enableRetry=!0:"never"===this.params.behaviour.overrideRetryButton&&(i.interaction.params.behaviour.enableRetry=!1)),this.instances[t]=H5P.newRunnable(i.interaction,i.contentId,H5P.jQuery(i.actionWrapper),!0,{previousState:i.previousState}),this.instances[t].on("resize",(()=>{this.resize({fromAction:!0})})),e.isTask(this.instances[t],s)&&(this.tasksH5P++,this.instances[t].on("xAPI",(t=>{"answered"!==t.getVerb()&&"completed"!==t.getVerb()||setTimeout((()=>{this.handleMarkerGotCompleted(n)}),0)})))},i.getDOM=function(){return this.container},i.show=function(){this.screenContent.classList.remove("h5p-ar-scavenger-display-none"),this.isShown=!0},i.hide=function(){this.screenContent.classList.add("h5p-ar-scavenger-display-none"),this.isShown=!1},i.resize=function(t){this.camera?(this.container.offsetWidth<this.params.minWidthForDualView?this.isNarrowScreen||(this.isNarrowScreen=!0,this.camera.setNarrowView(!0)):(this.camera.show(),setTimeout((()=>{this.camera.setNarrowView(!1)}),0),this.isNarrowScreen&&(this.isNarrowScreen=!1)),t&&!0===t.fromSubject||this.camera.resize(),this.callbacks.onResize()):this.callbacks.onResize()},i.setFullScreen=function(){!0===(arguments.length>0&&void 0!==arguments[0]&&arguments[0])?setTimeout((()=>{const t=window.innerHeight-this.titlebar.getDOM().offsetHeight;this.camera.resizeIframeHeight(t),this.action.resizeIframeHeight(t)}),100):(setTimeout((()=>{this.camera.resizeIframeHeight(null),this.action.resizeIframeHeight(null)}),100),this.titlebar.toggleButtonActive("fullscreen",!1))},i.toggleView=function(){this.camera.show(),this.action.show(),setTimeout((()=>{this.camera.toggleView(),this.action.toggleView(),this.isCameraMode=!this.isCameraMode,this.resize()}),0)},i.getAnswerGiven=function(){return this.instances.some((t=>t&&"function"==typeof t.getAnswerGiven&&t.getAnswerGiven()))},i.getScore=function(){return this.instances.reduce(((t,e)=>t+(e&&"function"==typeof e.getScore?e.getScore():0)),0)},i.getMaxScore=function(){return this.instances.reduce(((t,e)=>t+(e&&"function"==typeof e.getMaxScore?e.getMaxScore():0)),0)},i.showSolutions=function(){this.instances.forEach((t=>{t&&"function"==typeof t.showSolutions&&t.showSolutions()}))},i.reset=function(){for(let t=0;t<this.markersFound.length;t++)this.markersFound[t]&&(this.markersFound[t].completed=!1);this.titlebar.toggleButtonActive("switchView",!1),this.titlebar.toggleButtonActive("quit",!1),this.titlebar.toggleButtonDisabled("quit",!0),this.isCameraMode||this.toggleView(),this.instances.forEach((t=>{t&&"function"==typeof t.resetTask&&t.resetTask()})),this.action.hideContent()},i.getXAPIDataFromChildren=function(){return this.instances.map((t=>{if(t&&"function"==typeof t.getXAPIData)return t.getXAPIData()})).filter((t=>!!t))},i.getCurrentState=function(){return this.instances.map((t=>t&&"function"==typeof t.getCurrentState?t.getCurrentState():{}))},t}();function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}let b=function(t){var i,n;function s(i,n){var a;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(a=t.call(this,"ar-scavenger")||this).contentId=n,a.params=e.extend({showTitleScreen:!1,canHasFullScreen:a.isRoot()&&!0===H5P.fullscreenSupported,markers:[],showEndScreen:!1,behaviour:{enableSolutionsButton:!1,enableRetry:!1,overrideShowSolutionButton:"useBehavioural",overrideRetryButton:"useBehavioural",fallbackHeight:400},l10n:{start:"Start",retry:"Retry",nothingToSee:"Find a marker to see an interaction.",errorBrowserNotSupported:"It seems that your browser cannot run this content type, unfortunately.",errorNoCameraAccess:"Could not access camera.",errorNoCameraSupport:"Your browser does not seem to support a camera.",errorNoMarkers:"Did someone forget to add markers?",warningBrave:"You seem to be using the Brave browser. Nice! But its strict privacy settings may prevent the camera from working.",initializingContent:"Initializing content. Please don't forget to allow camera access."},a11y:{buttonFullScreenEnter:"Enter fullscreen mode",buttonFullScreenExit:"Exit fullscreen mode",buttonSwitchViewAction:"Switch to an exercise",buttonSwitchViewCamera:"Switch to the camera",buttonSwitchViewDisabled:"You cannot switch the view right now",buttonQuit:"Quit exercise",buttonQuitDisabled:"You have not yet completed all exercises",actionOpened:"The view has switched to an exercise.",actionClosed:"The view has switched to the camera."},minWidthForDualView:s.MIN_WIDTH_FOR_DUALVIEW},i),a.params.markers=a.params.markers.filter((t=>t.markerImage&&t.markerPattern&&("h5p"===t.actionType&&t.interaction&&t.interaction.interaction||"model"===t.actionType&&t.model&&t.model.file))),a.extras=e.extend({metadata:{title:"ARScavenger"}},r);const o=r.metadata.defaultLanguage||"en";return a.languageTag=e.formatLanguageCode(o),a.params.canHasFullScreen&&(a.on("enterFullScreen",(()=>{setTimeout((()=>{a.content.setFullScreen(!0),a.isInFullScreen=!0}),250)})),a.on("exitFullScreen",(()=>{a.isInFullScreen=!1,a.content.setFullScreen(!1)}))),a.on("resize",(t=>{t.data&&!0===t.data.break||a.content.resize()})),a}n=t,(i=s).prototype=Object.create(n.prototype),i.prototype.constructor=i,g(i,n);var a=s.prototype;return a.registerDomElements=function(){this.params.behaviour.showActionOnStartup=this.params.behaviour.showActionOnStartup&&document.querySelector(".h5p-container").offsetWidth>=s.MIN_WIDTH_FOR_DUALVIEW,this.content=new p(this.params,this.contentId,this.extras,{onFullScreen:()=>{this.toggleFullScreen()},onQuit:()=>{this.handleCompleted()},onRead:t=>{this.read(t)},onResize:()=>{this.resize()}}),this.setContent(this.content.getDOM()),screen&&screen.orientation?screen.orientation.addEventListener("change",(()=>{this.handleScreenOrientationChanged()})):window.addEventListener("change",(()=>{this.handleScreenOrientationChanged()}))},a.toggleFullScreen=function(){this.params.canHasFullScreen&&(!0===H5P.isFullscreen?H5P.exitFullScreen():H5P.fullScreen(H5P.jQuery(document.querySelector(".h5p-container")),this))},a.handleCompleted=function(){setTimeout((()=>{const t=this.getXAPIData();t.statement.object.definition.interactionType="other";const e=new H5P.XAPIEvent;e.data.children=t.children,e.data.statement=t.statement,this.trigger(e)}),0)},a.handleScreenOrientationChanged=function(){this.isInFullScreen?this.content.setFullScreen(!0):this.resize()},a.getAnswerGiven=function(){return this.content.getAnswerGiven()},a.getScore=function(){return this.content.getScore()},a.getMaxScore=function(){return this.content.getMaxScore()},a.showSolutions=function(){this.content.showSolutions()},a.resetTask=function(){this.wasContentReset=!0,this.content.reset()},a.resize=function(){this.trigger("resize",{break:!0})},a.getXAPIData=function(){return{children:this.content.getXAPIDataFromChildren(),statement:this.getXAPIAnswerEvent().data.statement}},a.getXAPIAnswerEvent=function(){const t=this.createXAPIEvent("answered");return t.setScoredResult(this.getScore(),this.getMaxScore(),this,this.getAnswerGiven(),this.isPassed()),t},a.createXAPIEvent=function(t){const i=this.createXAPIEventTemplate(t);return e.extend(i.getVerifiedStatementValue(["object","definition"]),this.getxAPIDefinition()),i},a.getxAPIDefinition=function(){const t={name:{}};return t.name[this.languageTag]=this.getTitle(),t.name["en-US"]=t.name[this.languageTag],t.description={},t.description[this.languageTag]=this.getDescription(),t.description["en-US"]=t.description[this.languageTag],t.type="http://adlnet.gov/expapi/activities/cmi.interaction",t.interactionType="compound",t},a.isPassed=function(){return this.content.getScore()===this.content.getMaxScore()},a.getTitle=function(){let t;return this.extras.metadata&&(t=this.extras.metadata.title),t=t||s.DEFAULT_DESCRIPTION,H5P.createTitle(t)},a.getDescription=function(){return this.params.taskDescription||s.DEFAULT_DESCRIPTION},a.getCurrentState=function(){return this.getAnswerGiven()?this.content.getCurrentState():this.wasContentReset?{}:void 0},s}(H5P.Question);b.DEFAULT_DESCRIPTION="ARScavenger",b.MIN_WIDTH_FOR_DUALVIEW=1024,H5P.ARScavenger=b}();
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�