@liascript/exporter 3.2.7--1.0.7 → 3.2.10--1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/capacitor/icon.svg +81 -0
- package/dist/assets/capacitor/index.54530cdd.js +2 -0
- package/dist/assets/capacitor/{index.10023006.js → index.73bf47b5.js} +1 -1
- package/dist/assets/capacitor/index.html +1 -1
- package/dist/assets/capacitor/{jszip.min.a9d6051e.js → jszip.min.dfe97abc.js} +1 -1
- package/dist/assets/indexeddb/icon.svg +81 -0
- package/dist/assets/{scorm1.2/index.6509563e.js → indexeddb/index.176e8590.js} +1 -1
- package/dist/assets/indexeddb/index.9d083ccd.js +1 -0
- package/dist/assets/indexeddb/index.bf43b644.js +1 -0
- package/dist/assets/{scorm2004/index.b1a34062.js → indexeddb/index.d8ce2cba.js} +1 -1
- package/dist/assets/indexeddb/index.html +1 -1
- package/dist/assets/indexeddb/{jszip.min.63142cc8.js → jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/pdf/icon.svg +81 -0
- package/dist/assets/pdf/{index.114d2ca9.js → index.5c244bd1.js} +1 -1
- package/dist/assets/pdf/index.63c43469.js +1 -0
- package/dist/assets/pdf/{index.d8fec0e1.js → index.8ef1d6a7.js} +1 -1
- package/dist/assets/pdf/index.ed62c03b.js +1 -0
- package/dist/assets/pdf/index.html +1 -1
- package/dist/assets/{web/jszip.min.63142cc8.js → pdf/jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/scorm1.2/SCORM1.2.2a171f84.js +1 -0
- package/dist/assets/scorm1.2/SCORM1.2.adc5662b.js +1 -0
- package/dist/assets/scorm1.2/icon.svg +81 -0
- package/dist/assets/{indexeddb/index.6509563e.js → scorm1.2/index.176e8590.js} +1 -1
- package/dist/assets/scorm1.2/index.51246413.js +1 -0
- package/dist/assets/scorm1.2/index.c2d6b6b2.js +1 -0
- package/dist/assets/scorm1.2/{index.b1a34062.js → index.d8ce2cba.js} +1 -1
- package/dist/assets/scorm1.2/index.html +1 -1
- package/dist/assets/scorm2004/SCORM2004.d4eafaff.js +1 -0
- package/dist/assets/scorm2004/SCORM2004.e0ae8a9d.js +1 -0
- package/dist/assets/scorm2004/icon.svg +81 -0
- package/dist/assets/{web/index.6509563e.js → scorm2004/index.176e8590.js} +1 -1
- package/dist/assets/scorm2004/index.5737944b.js +1 -0
- package/dist/assets/scorm2004/index.7601cf50.js +1 -0
- package/dist/assets/{web/index.b1a34062.js → scorm2004/index.d8ce2cba.js} +1 -1
- package/dist/assets/scorm2004/index.html +1 -1
- package/dist/assets/web/icon.svg +81 -0
- package/dist/assets/web/index.113f8c63.js +1 -0
- package/dist/assets/{scorm2004/index.6509563e.js → web/index.176e8590.js} +1 -1
- package/dist/assets/web/index.8b784612.js +1 -0
- package/dist/assets/{indexeddb/index.b1a34062.js → web/index.d8ce2cba.js} +1 -1
- package/dist/assets/web/index.html +1 -1
- package/dist/assets/{xapi/jszip.min.63142cc8.js → web/jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/xapi/icon.svg +81 -0
- package/dist/assets/xapi/index.176e8590.js +1 -0
- package/dist/assets/xapi/index.1816a1f8.js +1 -0
- package/dist/assets/xapi/index.589f2670.js +1 -0
- package/dist/assets/xapi/index.d8ce2cba.js +1 -0
- package/dist/assets/xapi/index.html +1 -1
- package/dist/assets/{pdf/jszip.min.63142cc8.js → xapi/jszip.min.4fbcc13f.js} +1 -1
- package/dist/index.js +40 -50
- package/dist/presets.yaml +57 -2
- package/package.json +4 -4
- package/dist/assets/capacitor/index.a64b51e4.js +0 -2
- package/dist/assets/common/icon.ico +0 -0
- package/dist/assets/indexeddb/index.6223bae3.js +0 -1
- package/dist/assets/indexeddb/index.965a8fb4.js +0 -1
- package/dist/assets/pdf/icon.ico +0 -0
- package/dist/assets/pdf/index.33b2ab94.js +0 -1
- package/dist/assets/pdf/index.bcffeb87.js +0 -1
- package/dist/assets/scorm1.2/SCORM1.2.781cb28e.js +0 -1
- package/dist/assets/scorm1.2/SCORM1.2.a32b4125.js +0 -1
- package/dist/assets/scorm1.2/index.0db6a108.js +0 -1
- package/dist/assets/scorm1.2/index.d2ede8d2.js +0 -1
- package/dist/assets/scorm2004/SCORM2004.58941eb7.js +0 -1
- package/dist/assets/scorm2004/SCORM2004.84a9d66b.js +0 -1
- package/dist/assets/scorm2004/index.c29294fa.js +0 -1
- package/dist/assets/scorm2004/index.e448344f.js +0 -1
- package/dist/assets/web/index.f48686d5.js +0 -1
- package/dist/assets/web/index.fa52158a.js +0 -1
- package/dist/assets/xapi/index.077eaa95.js +0 -1
- package/dist/assets/xapi/index.520a955b.js +0 -1
- package/dist/assets/xapi/index.6509563e.js +0 -1
- package/dist/assets/xapi/index.b1a34062.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(){function t(t,e,i,n){Object.defineProperty(t,e,{get:i,set:n,enumerable:!0,configurable:!0})}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequire55a5;e.register("58dpJ",(function(i,n){t(i.exports,"Connector",(function(){return v}));var r=e("9Klpk"),o=e("3bWnf"),s=e("kb0qF"),a=e("5ENmm"),c=e("6Wo7Q"),u=e("bWNdT"),l=e("knzCS"),d=e("cRTHJ"),f=e("jxbaN"),h=e("jjBAR"),v=function(t){"use strict";(0,s.default)(i,t);var e=(0,u.default)(i);function i(){var t,n;if((0,r.default)(this,i),(t=e.call(this)).active=!1,t.db={quiz:[],survey:[],task:[]},t.id={quiz:[],survey:[],task:[]},console.warn("Hello, this is LiaScript from within a SCORM 1.2 package. You should definitely try out the SCORM 2004 exporter, since this one cannot be used to store states or any kind of progress. The only thing that is stores, is currently the user location...\n\nIF YOU ARE AN ELABORATE AND EXPERIENCED SCORM DEVELOPER?\n========================================================\n\nAnd you want to help us, to extend this service, please contact us via LiaScript@web.de\n\nHave fun ;-)"),window.API||window.top&&window.top.API?t.scorm=window.API||(null===(n=window.top)||void 0===n?void 0:n.API):t.scorm=(0,h.getAPI)(),t.scorm){g("successfully opened API"),g("LMSInitialize",t.scorm.LMSInitialize("")),g("loading quizzes ...");try{t.db.quiz=window.config_.quiz||[[]],g(" ... done")}catch(t){y("... failed",t)}g("loading surveys ...");try{t.db.survey=window.config_.survey||[[]],g(" ... done")}catch(t){y("... failed",t)}g("loading tasks ...");try{t.db.task=window.config_.task||[[]],g(" ... done")}catch(t){y("... failed",t)}t.init()}return t}return(0,o.default)(i,[{key:"init",value:function(){if(this.scorm){var t=this.scorm.LMSGetValue("cmi.core.lesson_mode")||"unknown";this.active="normal"===t||"unknown"===t,y('Running in "'+t+'" mode, results will'+(this.active?" ":" NOT ")+"be stored!"),g("open location ..."),this.location=f.jsonParse(this.scorm.LMSGetValue("cmi.core.lesson_location")),g("... ",this.location||0),null===this.location&&this.slide(0);var e=0;0===this.countObjectives()&&this.active?(g("seeding values ..."),e=this.initFirst("quiz",e),e=this.initFirst("survey",e),e=this.initFirst("task",e),g("... done")):(g("restoring values ..."),e=this.initSecond("quiz",e),e=this.initSecond("survey",e),e=this.initSecond("task",e),g("... done")),window.SCORE=0,this.score()}}},{key:"initFirst",value:function(t,e){for(var i=0;i<this.db[t].length;i++){this.id[t].push([]);for(var n=0;n<this.db[t][i].length;n++)this.setObjective(e,this.db[t][i][n]),this.id[t][i].push(e),e++}return e}},{key:"initSecond",value:function(t,e){for(var i=0;i<this.db[t].length;i++){this.id[t].push([]);for(var n=0;n<this.db[t][i].length;n++){var r=this.getObjective(e);r&&(this.db[t][i][n]=r),this.id[t][i].push(e),e++}}return e}},{key:"score",value:function(){var t;if(this.active&&this.score){for(var e=0,i=0,n=0,r=0,o=0;o<this.db.quiz.length;o++)for(var s=0;s<this.db.quiz[o].length;s++)switch(e+=r=this.db.quiz[o][s].score,this.db.quiz[o][s].solved){case 1:i+=r;case-1:n+=r}for(var c=0,u=0,l=0;l<this.db.survey.length;l++)for(var d=0;d<this.db.survey[l].length;d++)c+=1,this.db.survey[l][d].submitted&&(u+=1);var h,v,y,m,p=0===c||c===u,b=0===i?0:i/e;this.write("cmi.core.score.min","0"),this.write("cmi.core.score.max","100"),this.write("cmi.core.score.raw",(h=(100*b).toFixed(4),v=(0,a.default)(h.toString().split("."),2),y=v[0],m=v[1],"".concat(y,".").concat(m.padEnd(10,"0"))));var S=f.jsonParse((null===(t=this.scorm)||void 0===t?void 0:t.LMSGetValue("cmi.student_data.mastery_score"))||"null");null==S?0===e&&c>0&&p?this.write("cmi.core.lesson_status","completed"):this.write("cmi.core.lesson_status","not attempted"):(b>=S/100||0===e)&&p?this.write("cmi.core.lesson_status","passed"):n+i===e&&e>0&&p?this.write("cmi.core.lesson_status","failed"):this.write("cmi.core.lesson_status","incomplete"),g("SCORE updated =>",b,"surveys =>","".concat(u,"/").concat(c)),window.SCORE=b}}},{key:"open",value:function(t,e,i){if(null!==this.location){var n=this.location;setTimeout((function(){window.LIA.goto(n)}),500)}}},{key:"slide",value:function(t){this.location=t,this.scorm&&this.active&&(this.scorm.LMSSetValue("cmi.core.lesson_location",JSON.stringify(t)),this.scorm.LMSCommit(""))}},{key:"countObjectives",value:function(){return this.scorm?parseInt(this.scorm.LMSGetValue("cmi.objectives._count"))||0:null}},{key:"initSettings",value:function(t){return d.Settings.init(t,!1,this.setSettings)}},{key:"setSettings",value:function(t){this.write("cmi.suspend_data",JSON.stringify(t))}},{key:"getSettings",value:function(){var t="";try{var e;t=(null===(e=this.scorm)||void 0===e?void 0:e.LMSGetValue("cmi.suspend_data"))||null}catch(t){y("cannot read settings from cmi.suspend_data")}var i=null;if("string"==typeof t){try{(i=JSON.parse(t))&&(i.fromStorage=!0)}catch(t){y("getSettings =>",t)}i||(i=d.Settings.data),window.innerWidth<=768&&(i.table_of_contents=!1)}return i}},{key:"write",value:function(t,e){if(this.scorm){this.escape&&(e=e.replace(/"/g,'\\"'));try{this.scorm.LMSSetValue(t,e),this.scorm.LMSCommit("")}catch(i){if(y("Failed to write =>",t,e),y("Message:",i.message),void 0===this.escape){e=e.replace(/"/g,'\\"');try{this.scorm.LMSSetValue(t,e),this.scorm.LMSCommit(""),this.escape=!0}catch(t){this.escape=!1}}}}else y("could not write",t,e)}},{key:"getObjective",value:function(t){var e;try{if(this.scorm&&(e=this.scorm.LMSGetValue("cmi.objectives.".concat(t,".id"))))return f.decodeJSON(e)}catch(i){y("getObjective =>",i,"cmi.objectives.".concat(t,".id"),e)}return null}},{key:"setObjective",value:function(t,e){var i=f.encodeJSON(e);i.length>255&&y("cmi.objectives.".concat(t,".id"),"Content exceeds 256Bytes!"),this.write("cmi.objectives.".concat(t,".id"),i)}},{key:"load",value:function(t){switch(t.table){case"quiz":case"survey":case"task":return g("loading ",t.table,t.id,this.db[t.table][t.id]),this.db[t.table][t.id]}}},{key:"store",value:function(t){if(this.active)switch(y("store",t),t.table){case"quiz":case"survey":this.storeHelper(t),this.score();break;case"task":this.storeHelper(t)}}},{key:"storeHelper",value:function(t){for(var e=0;e<this.db[t.table][t.id].length;e++)f.neq(t.data[e],this.db[t.table][t.id][e])&&(this.setObjective(this.id[t.table][t.id][e],t.data[e]),this.db[t.table][t.id][e]=t.data[e],"quiz"==t.table?this.updateQuiz(this.id[t.table][t.id][e],t.data[e]):"survey"==t.table&&t.data[e].submitted&&this.updateSurvey(this.id[t.table][t.id][e],t.data[e]))}},{key:"updateQuiz",value:function(t,e){if(this.active)switch(e.solved){case 0:e.trial>0&&this.write("cmi.objectives.".concat(t,".status"),"failed");break;case 1:this.write("cmi.objectives.".concat(t,".status"),"completed");break;case-1:this.write("cmi.objectives.".concat(t,".status"),"incomplete")}}},{key:"updateSurvey",value:function(t,e){this.active&&e.submitted&&this.write("cmi.objectives.".concat(t,".status"),"completed")}}]),i}(l.Connector);function g(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n;(n=console).log.apply(n,["SCORM1.2: "].concat((0,c.default)(e)))}function y(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n;(n=console).log.apply(n,["SCORM1.2: "].concat((0,c.default)(e)))}})),e.register("knzCS",(function(i,n){t(i.exports,"Connector",(function(){return l}));var r=e("hnmIs"),o=e("9Klpk"),s=e("3bWnf"),a=e("32Euv"),c=e("87lFe"),u=e("cRTHJ"),l=function(){"use strict";function t(){(0,o.default)(this,t)}return(0,s.default)(t,[{key:"hasIndex",value:function(){return!1}},{key:"storage",value:function(){return new c.LiaStorage}},{key:"initSettings",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return u.Settings.init(t,e,this.setSettings)}},{key:"setSettings",value:function(t){u.Settings.update(t)}},{key:"getSettings",value:function(){var t="";try{t=localStorage.getItem(u.Settings.PORT)}catch(t){console.warn("cannot write to localStorage")}var e=null;if("string"==typeof t){try{e=JSON.parse(t)}catch(t){console.warn("getSettings =>",t)}e||(e=u.Settings.data),window.innerWidth<=768&&(e.table_of_contents=!1)}return e}},{key:"open",value:function(t,e,i){}},{key:"load",value:function(t){}},{key:"store",value:function(t){}},{key:"update",value:function(t,e){}},{key:"slide",value:function(t){}},{key:"getIndex",value:function(){}},{key:"deleteFromIndex",value:function(t){}},{key:"storeToIndex",value:function(t){return(0,r.default)((function(){return(0,a.__generator)(this,(function(t){return[2]}))}))()}},{key:"restoreFromIndex",value:function(t,e){}},{key:"reset",value:function(t,e){this.initSettings(null,!0)}},{key:"getFromIndex",value:function(t){return(0,r.default)((function(){return(0,a.__generator)(this,(function(t){return[2,null]}))}))()}},{key:"addMisc",value:function(t,e,i,n){return(0,r.default)((function(){return(0,a.__generator)(this,(function(t){return console.log("addMisc not implemented"),[2]}))}))()}},{key:"getMisc",value:function(t,e,i){return(0,r.default)((function(){return(0,a.__generator)(this,(function(t){return console.log("getMisc not implemented"),[2]}))}))()}}]),t}()})),e.register("87lFe",(function(i,n){t(i.exports,"LiaStorage",(function(){return a}));var r=e("9Klpk"),o=e("3bWnf"),s=e("5ENmm"),a=function(){"use strict";function t(){(0,r.default)(this,t)}return(0,o.default)(t,[{key:"getItems",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"==typeof t&&(t=[t]);for(var e={},i=0;i<t.length;i++){var n=localStorage.getItem(t[i]);e[t[i]]=n?JSON.parse(n):n}return e}},{key:"setItems",value:function(t){this._setLocal(t)}},{key:"_setLocal",value:function(t){var e=!0,i=!1,n=void 0;if("object"==typeof t)try{for(var r,o=Object.entries(t)[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var a=(0,s.default)(r.value,2),c=a[0],u=a[1];localStorage.setItem(c,JSON.stringify(u))}}catch(t){i=!0,n=t}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}}}]),t}()})),e.register("jxbaN",(function(i,n){t(i.exports,"encodeJSON",(function(){return c})),t(i.exports,"decodeJSON",(function(){return u})),t(i.exports,"jsonParse",(function(){return l})),t(i.exports,"neq",(function(){return d}));var r=e("5ENmm"),o={SingleChoice:"sc",MultipleChoice:"mc",Text:"tx",Select:"st",Matrix:"mx",Generic:"gn",error_msg:"err"},s=Object.entries(o).reduce((function(t,e){var i=(0,r.default)(e,2),n=i[0];return t[i[1]]=n,t}),{});function a(t,e){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map((function(t){return a(t,e)}));var i={},n=!0,o=!1,s=void 0;try{for(var c,u=Object.entries(t)[Symbol.iterator]();!(n=(c=u.next()).done);n=!0){var l=(0,r.default)(c.value,2),d=l[0],f=l[1];i[e[d]||d]=a(f,e)}}catch(t){o=!0,s=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw s}}return i}function c(t){return JSON.stringify(a(t,o))}function u(t){return a(JSON.parse(t),s)}function l(t){try{return JSON.parse(t)}catch(t){}return null}function d(t,e){return JSON.stringify(t)!=JSON.stringify(e)}})),e.register("jjBAR",(function(e,i){t(e.exports,"getAPI",(function(){return o}));var n=0;function r(t){for(;null==t.API&&null!=t.parent&&t.parent!=t;){if(++n>7)return alert("Error finding API -- too deeply nested."),null;t=t.parent}return t.API}function o(){var t=r(window);return null==t&&null!=window.opener&&void 0!==window.opener&&(t=r(window.opener)),null==t&&alert("Unable to find the SCORM1.2 API adapter"),t}}))}();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(t,e,i,s){Object.defineProperty(t,e,{get:i,set:s,enumerable:!0,configurable:!0})}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequire55a5;e.register("1FNwj",(function(i,s){t(i.exports,"Connector",(function(){return a}));var n=e("jXXgq"),o=e("ayIBF"),r=e("5aa3i"),c=e("fVQ47");class a extends n.Connector{init(){if(this.scorm){let t=this.scorm.LMSGetValue("cmi.core.lesson_mode")||"unknown";this.active="normal"===t||"unknown"===t,u('Running in "'+t+'" mode, results will'+(this.active?" ":" NOT ")+"be stored!"),l("open location ..."),this.location=r.jsonParse(this.scorm.LMSGetValue("cmi.core.lesson_location")),l("... ",this.location||0),null===this.location&&this.slide(0);let e=0;0===this.countObjectives()&&this.active?(l("seeding values ..."),e=this.initFirst("quiz",e),e=this.initFirst("survey",e),e=this.initFirst("task",e),l("... done")):(l("restoring values ..."),e=this.initSecond("quiz",e),e=this.initSecond("survey",e),e=this.initSecond("task",e),l("... done")),window.SCORE=0,this.score()}}initFirst(t,e){for(let i=0;i<this.db[t].length;i++){this.id[t].push([]);for(let s=0;s<this.db[t][i].length;s++)this.setObjective(e,this.db[t][i][s]),this.id[t][i].push(e),e++}return e}initSecond(t,e){for(let i=0;i<this.db[t].length;i++){this.id[t].push([]);for(let s=0;s<this.db[t][i].length;s++){let n=this.getObjective(e);n&&(this.db[t][i][s]=n),this.id[t][i].push(e),e++}}return e}score(){var t;if(!this.active||!this.score)return;let e=0,i=0,s=0,n=0;for(let t=0;t<this.db.quiz.length;t++)for(let o=0;o<this.db.quiz[t].length;o++)switch(n=this.db.quiz[t][o].score,e+=n,this.db.quiz[t][o].solved){case 1:i+=n;case-1:s+=n}let o=0,c=0;for(let t=0;t<this.db.survey.length;t++)for(let e=0;e<this.db.survey[t].length;e++)o+=1,this.db.survey[t][e].submitted&&(c+=1);const a=0===o||o===c,u=0===i?0:i/e;this.write("cmi.core.score.min","0"),this.write("cmi.core.score.max","100"),this.write("cmi.core.score.raw",function(t){const e=t.toFixed(4),[i,s]=e.toString().split(".");return`${i}.${s.padEnd(10,"0")}`}(100*u));let d=r.jsonParse((null===(t=this.scorm)||void 0===t?void 0:t.LMSGetValue("cmi.student_data.mastery_score"))||"null");null==d?0===e&&o>0&&a?this.write("cmi.core.lesson_status","completed"):this.write("cmi.core.lesson_status","not attempted"):(u>=d/100||0===e)&&a?this.write("cmi.core.lesson_status","passed"):s+i===e&&e>0&&a?this.write("cmi.core.lesson_status","failed"):this.write("cmi.core.lesson_status","incomplete"),l("SCORE updated =>",u,"surveys =>",`${c}/${o}`),window.SCORE=u}open(t,e,i){if(null!==this.location){const t=this.location;setTimeout((function(){window.LIA.goto(t)}),500)}}slide(t){this.location=t,this.scorm&&this.active&&(this.scorm.LMSSetValue("cmi.core.lesson_location",JSON.stringify(t)),this.scorm.LMSCommit(""))}countObjectives(){if(!this.scorm)return null;return parseInt(this.scorm.LMSGetValue("cmi.objectives._count"))||0}initSettings(t,e=!1){return o.Settings.init(t,!1,this.setSettings)}setSettings(t){this.write("cmi.suspend_data",JSON.stringify(t))}getSettings(){let t="";try{var e;t=(null===(e=this.scorm)||void 0===e?void 0:e.LMSGetValue("cmi.suspend_data"))||null}catch(t){u("cannot read settings from cmi.suspend_data")}let i=null;if("string"==typeof t){try{i=JSON.parse(t),i&&(i.fromStorage=!0)}catch(t){u("getSettings =>",t)}i||(i=o.Settings.data),window.innerWidth<=768&&(i.table_of_contents=!1)}return i}write(t,e){if(this.scorm){this.escape&&(e=e.replace(/"/g,'\\"'));try{this.scorm.LMSSetValue(t,e),this.scorm.LMSCommit("")}catch(i){if(u("Failed to write =>",t,e),u("Message:",i.message),void 0===this.escape){e=e.replace(/"/g,'\\"');try{this.scorm.LMSSetValue(t,e),this.scorm.LMSCommit(""),this.escape=!0}catch(t){this.escape=!1}}}}else u("could not write",t,e)}getObjective(t){let e;try{if(this.scorm&&(e=this.scorm.LMSGetValue(`cmi.objectives.${t}.id`),e))return r.decodeJSON(e)}catch(i){u("getObjective =>",i,`cmi.objectives.${t}.id`,e)}return null}setObjective(t,e){const i=r.encodeJSON(e);i.length>255&&u(`cmi.objectives.${t}.id`,"Content exceeds 256Bytes!"),this.write(`cmi.objectives.${t}.id`,i)}load(t){switch(t.table){case"quiz":case"survey":case"task":return l("loading ",t.table,t.id,this.db[t.table][t.id]),this.db[t.table][t.id]}}store(t){if(this.active)switch(u("store",t),t.table){case"quiz":case"survey":this.storeHelper(t),this.score();break;case"task":this.storeHelper(t)}}storeHelper(t){for(let e=0;e<this.db[t.table][t.id].length;e++)r.neq(t.data[e],this.db[t.table][t.id][e])&&(this.setObjective(this.id[t.table][t.id][e],t.data[e]),this.db[t.table][t.id][e]=t.data[e],"quiz"==t.table?this.updateQuiz(this.id[t.table][t.id][e],t.data[e]):"survey"==t.table&&t.data[e].submitted&&this.updateSurvey(this.id[t.table][t.id][e],t.data[e]))}updateQuiz(t,e){if(this.active)switch(e.solved){case 0:e.trial>0&&this.write(`cmi.objectives.${t}.status`,"failed");break;case 1:this.write(`cmi.objectives.${t}.status`,"completed");break;case-1:this.write(`cmi.objectives.${t}.status`,"incomplete")}}updateSurvey(t,e){this.active&&e.submitted&&this.write(`cmi.objectives.${t}.status`,"completed")}constructor(){var t;if(super(),this.active=!1,this.db={quiz:[],survey:[],task:[]},this.id={quiz:[],survey:[],task:[]},console.warn("Hello, this is LiaScript from within a SCORM 1.2 package. You should definitely try out the SCORM 2004 exporter, since this one cannot be used to store states or any kind of progress. The only thing that is stores, is currently the user location...\n\nIF YOU ARE AN ELABORATE AND EXPERIENCED SCORM DEVELOPER?\n========================================================\n\nAnd you want to help us, to extend this service, please contact us via LiaScript@web.de\n\nHave fun ;-)"),window.API||window.top&&window.top.API?this.scorm=window.API||(null===(t=window.top)||void 0===t?void 0:t.API):this.scorm=(0,c.getAPI)(),this.scorm){l("successfully opened API"),l("LMSInitialize",this.scorm.LMSInitialize("")),l("loading quizzes ...");try{this.db.quiz=window.config_.quiz||[[]],l(" ... done")}catch(t){u("... failed",t)}l("loading surveys ...");try{this.db.survey=window.config_.survey||[[]],l(" ... done")}catch(t){u("... failed",t)}l("loading tasks ...");try{this.db.task=window.config_.task||[[]],l(" ... done")}catch(t){u("... failed",t)}this.init()}}}function l(...t){console.log("SCORM1.2: ",...t)}function u(...t){console.log("SCORM1.2: ",...t)}})),e.register("jXXgq",(function(i,s){t(i.exports,"Connector",(function(){return r}));var n=e("3MPaZ"),o=e("ayIBF");class r{hasIndex(){return!1}storage(){return new n.LiaStorage}initSettings(t,e=!1){return o.Settings.init(t,e,this.setSettings)}setSettings(t){o.Settings.update(t)}getSettings(){let t="";try{t=localStorage.getItem(o.Settings.PORT)}catch(t){console.warn("cannot write to localStorage")}let e=null;if("string"==typeof t){try{e=JSON.parse(t)}catch(t){console.warn("getSettings =>",t)}e||(e=o.Settings.data),window.innerWidth<=768&&(e.table_of_contents=!1)}return e}open(t,e,i){}load(t){}store(t){}update(t,e){}slide(t){}getIndex(){}deleteFromIndex(t){}async storeToIndex(t){}restoreFromIndex(t,e){}reset(t,e){this.initSettings(null,!0)}async getFromIndex(t){return null}async addMisc(t,e,i,s){console.log("addMisc not implemented")}async getMisc(t,e,i){console.log("getMisc not implemented")}constructor(){}}})),e.register("3MPaZ",(function(e,i){t(e.exports,"LiaStorage",(function(){return s}));class s{getItems(t=[]){"string"==typeof t&&(t=[t]);let e={};for(let i=0;i<t.length;i++){let s=localStorage.getItem(t[i]);e[t[i]]=s?JSON.parse(s):s}return e}setItems(t){this._setLocal(t)}_setLocal(t){if("object"==typeof t)for(const[e,i]of Object.entries(t))localStorage.setItem(e,JSON.stringify(i))}constructor(){}}})),e.register("5aa3i",(function(e,i){t(e.exports,"encodeJSON",(function(){return r})),t(e.exports,"decodeJSON",(function(){return c})),t(e.exports,"jsonParse",(function(){return a})),t(e.exports,"neq",(function(){return l}));const s={SingleChoice:"sc",MultipleChoice:"mc",Text:"tx",Select:"st",Matrix:"mx",Generic:"gn",error_msg:"err"},n=Object.entries(s).reduce(((t,[e,i])=>(t[i]=e,t)),{});function o(t,e){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map((t=>o(t,e)));const i={};for(const[s,n]of Object.entries(t)){i[e[s]||s]=o(n,e)}return i}function r(t){return JSON.stringify(o(t,s))}function c(t){return o(JSON.parse(t),n)}function a(t){try{return JSON.parse(t)}catch(t){}return null}function l(t,e){return JSON.stringify(t)!=JSON.stringify(e)}})),e.register("fVQ47",(function(e,i){t(e.exports,"getAPI",(function(){return o}));var s=0;function n(t){for(;null==t.API&&null!=t.parent&&t.parent!=t;){if(++s>7)return alert("Error finding API -- too deeply nested."),null;t=t.parent}return t.API}function o(){var t=n(window);return null==t&&null!=window.opener&&void 0!==window.opener&&(t=n(window.opener)),null==t&&alert("Unable to find the SCORM1.2 API adapter"),t}}));
|