📄 debug.js.php
字号:
+ 'var _ElementIsWriteOnly = 404; \n' + 'var _IncorrectDataType = 405; \n' + ' \n' + '// local variable definitions \n' + 'var apiHandle = null; \n' + 'var API = null; \n' + 'var findAPITries = 0; \n' + ' \n' + ' \n' + 'function doLMSInitialize() { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSInitialize was not successful."); \n' + ' return "false"; \n' + ' } \n' + ' var result = api.<?php echo $LMS_prefix; ?>Initialize(""); \n' + ' if (result.toString() != "true") { \n' + ' var err = ErrorHandler(); \n' + ' } \n' + ' return result.toString(); \n' + '} \n' + ' \n' + 'function doLMSFinish() { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSFinish was not successful."); \n' + ' return "false"; \n' + ' } else { \n' + ' // call the LMSFinish function that should be implemented by the API \n' + ' var result = api.<?php echo $LMS_prefix; ?>Finish(""); \n' + ' if (result.toString() != "true") { \n' + ' var err = ErrorHandler(); \n' + ' } \n' + ' } \n' + ' return result.toString(); \n' + '} \n' + ' \n' + 'function doLMSTerminate() { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nTerminate was not successful."); \n' + ' return "false"; \n' + ' } else { \n' + ' // call the Terminate function that should be implemented by the API \n' + ' var result = api.Terminate(""); \n' + ' if (result.toString() != "true") { \n' + ' var err = ErrorHandler(); \n' + ' } \n' + ' } \n' + ' return result.toString(); \n' + '} \n' + ' \n' + 'function doLMSGetValue(name) { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetValue was not successful."); \n' + ' return ""; \n' + ' } else { \n' + ' var value = api.<?php echo $LMS_prefix; ?>GetValue(name); \n' + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n' + ' if (errCode != _NoError) { \n' + ' // an error was encountered so display the error description \n' + ' var errDescription = api.<?php echo $LMS_prefix; ?>GetErrorString(errCode); \n' + ' alert("<?php echo $LMS_prefix; ?>GetValue("+name+") failed. \\n"+ errDescription); \n' + ' return ""; \n' + ' } else { \n' + ' return value.toString(); \n' + ' } \n' + ' } \n' + '} \n' + ' \n' + 'function doLMSSetValue(name, value) { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSSetValue was not successful."); \n' + ' return; \n' + ' } else { \n' + ' var result = api.<?php echo $LMS_prefix; ?>SetValue(name, value); \n' + ' if (result.toString() != "true") { \n' + ' var err = ErrorHandler(); \n' + ' } \n' + ' } \n' + ' return; \n' + '} \n' + ' \n' + 'function doLMSCommit() { \n' + ' checkLMSVersion(); \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSCommit was not successful."); \n' + ' return "false"; \n' + ' } else { \n' + ' var result = api.<?php echo $LMS_prefix; ?>Commit(""); \n' + ' if (result != "true") { \n' + ' var err = ErrorHandler(); \n' + ' } \n' + ' } \n' + ' return result.toString(); \n' + '} \n' + ' \n' + 'function doLMSGetLastError() { \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetLastError was not successful."); \n' + ' //since we can\'t get the error code from the LMS, return a general error \n' + ' return _GeneralError; \n' + ' } \n' + ' return api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n' + '} \n' + ' \n' + 'function doLMSGetErrorString(errorCode) { \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetErrorString was not successful."); \n' + ' } \n' + ' return api.<?php echo $LMS_prefix; ?>GetErrorString(errorCode).toString(); \n' + '} \n' + ' \n' + 'function doLMSGetDiagnostic(errorCode) { \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetDiagnostic was not successful."); \n' + ' } \n' + ' return api.<?php echo $LMS_prefix; ?>GetDiagnostic(errorCode).toString(); \n' + '} \n' + ' \n' + 'function LMSIsInitialized() { \n' + ' // there is no direct method for determining if the LMS API is initialized \n' + ' // for example an LMSIsInitialized function defined on the API so we\'ll try \n' + ' // a simple LMSGetValue and trap for the LMS Not Initialized Error \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSIsInitialized() failed."); \n' + ' return false; \n' + ' } else { \n' + ' var value = api.<?php echo $LMS_prefix; ?>GetValue("cmi.core.student_name"); \n' + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n' + ' if (errCode == _NotInitialized) { \n' + ' return false; \n' + ' } else { \n' + ' return true; \n' + ' } \n' + ' } \n' + '} \n' + ' \n' + 'function ErrorHandler() { \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\nCannot determine LMS error code."); \n' + ' return; \n' + ' } \n' + ' // check for errors caused by or from the LMS \n' + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n' + ' if (errCode != _NoError) { \n' + ' // an error was encountered so display the error description \n' + ' var errDescription = api.<?php echo $LMS_prefix; ?>GetErrorString(errCode); \n' + ' if (_Debug == true) { \n' + ' errDescription += "\\n"; \n' + ' errDescription += api.<?php echo $LMS_prefix; ?>GetDiagnostic(null); \n' + ' // by passing null to LMSGetDiagnostic, we get any available diagnostics \n' + ' // on the previous error. \n' + ' } \n' + ' alert(errDescription); \n' + ' } \n' + ' return errCode; \n' + '} \n' + ' \n' + 'function getAPIHandle() { \n' + ' if (apiHandle == null) { \n' + ' apiHandle = getAPI(); \n' + ' } \n' + ' return apiHandle; \n' + '} \n' + ' \n' + 'function findAPI(win) { \n' + ' while ((win.<?php echo $LMS_api; ?> == null) && (win.parent != null) && (win.parent != win)) { \n' + ' findAPITries++; \n' + ' // Note: 7 is an arbitrary number, but should be more than sufficient \n' + ' if (findAPITries > 7) { \n' + ' alert("Error finding API -- too deeply nested."); \n' + ' return null; \n' + ' } \n' + ' win = win.parent; \n' + ' } \n' + ' return win.<?php echo $LMS_api; ?>; \n' + '} \n' + ' \n' + 'function getAPI() { \n' + ' var theAPI = findAPI(window); \n' + ' if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) { \n' + ' theAPI = findAPI(window.opener); \n' + ' } \n' + ' if (theAPI == null) { \n' + ' alert("Unable to find an API adapter"); \n' + ' } \n' + ' return theAPI \n' + '} \n' + ' \n' + ' function tryLMSInitialize() { \n' + ' var result = doLMSInitialize(); \n' + ' var msg; \n' + ' if(result == "true") { \n' + ' msg = "<?php echo $LMS_prefix; ?>Initialize Successful!"; \n' + ' } else { \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' msg = "<?php echo $LMS_prefix; ?>Initialize Failed! Error Code: "+err; \n' + ' msg += " Error Description: " + errString; \n' + ' } \n' + ' document.initForm.msgtxt.value= msg; \n' + ' } \n' + ' \n' + ' function tryLMSCommit() { \n' + ' var result = doLMSCommit(); \n' + ' var msg; \n' + ' if(result == "true") { \n' + ' msg = "<?php echo $LMS_prefix; ?>Commit was Successful!"; \n' + ' } else { \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' var msg = "<?php echo $LMS_prefix; ?>Commit Failed! Error Code: "+err; \n' + ' msg += " Error Description: " + errString; \n' + ' } \n' + ' document.otherForm.msgtxt.value = msg; \n' + ' document.elemForm.API_ELEMENT.value = saveElement; \n' + ' } \n' + ' \n' + ' function tryLMSFinish() { \n' + ' // set now, in case the SCO is unloaded on LMSFinish \n' + ' doLMSSetValue("cmi.core.lesson_status", "completed"); \n' + ' doLMSSetValue("cmi.core.exit", ""); \n' + ' doLMSSetValue("cmi.core.session_time", "00:00:30"); \n' + ' var result = doLMSFinish(); \n' + ' var msg; \n'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -