diff --git a/Game/game.js b/Game/game.js index f9cf63f..e6122b7 100644 --- a/Game/game.js +++ b/Game/game.js @@ -6,9 +6,9 @@ var now_action_tag = '_2017_anti_entropy_now_action' var now_galgame = 1 var sceneList = [] var characterData = [] -var now_scene = -1 //存放当前场景,存档 +var now_scene = -1 // Stores the current scene for saves var now_action = -1 -var historyChoiceList = [] //用于记录当前场景的历史选择 +var historyChoiceList = [] // Records choices made in the current scene var uiImageList = new Array() var showInSceneList = new Array() var date_url = '' @@ -45,13 +45,13 @@ uiImageList.push( function tryAudio(pauseOrPlay, indexOrInner, countNumber) { var audio if (indexOrInner == 0) audio = $('#indexbgm')[0] - else audio = $('#bgm')[0] //选择控件 + else audio = $('#bgm')[0] // Selection control if (pauseOrPlay == 0) { audio.pause() if (!isNaN(audio.duration)) audio.currentTime = 0 if (indexOrInner == 0) indexAudioPlayingflag = false else innerAudioPlayingflag = false - return //暂停,立即执行 + return // Pause and return immediately } if (countNumber != 0) { if (indexOrInner == 0 && indexAudioPlayingflag == false) return @@ -91,22 +91,22 @@ $(function () { window.onresize = function () { check_size() - if (wrk_check_size()) window.scrollTo(0, 1) //隐藏浏览器工具栏 + if (wrk_check_size()) window.scrollTo(0, 1) // Hide the browser toolbar } window.addEventListener( 'orientationchange', function () { - window.scrollTo(0, 1) //隐藏浏览器工具栏 + window.scrollTo(0, 1) // Hide the browser toolbar }, false ) //------------------------------------------------------ -//主框体单击响应事件------------------------------------ -var listenScene //监听场景动向 -var listenAction //监听行动列动向 -var listenLoading //监听读档动向 -var str_index_in_Autotype //打字机动画用 +// Main frame click response------------------------------------ +var listenScene // Scene activity listener +var listenAction // Action list activity listener +var listenLoading // Save-load activity listener +var str_index_in_Autotype // Used by the typewriter animation function setListens(s, a, k) { listenScene = s @@ -116,30 +116,30 @@ function setListens(s, a, k) { $('.galgame-content').click(function () { if (listenScene != null && listenAction != null) { - if (listenLoading != 1) nextAction(listenScene, listenAction) //进行下一步 - else Action(listenScene, listenAction, listenLoading) //调回状态 + if (listenLoading != 1) nextAction(listenScene, listenAction) // Proceed to the next step + else Action(listenScene, listenAction, listenLoading) // Restore the state } else if (listenScene == null && listenAction == null && listenLoading != null) { if (listenLoading >= 0) { - if (autoSpeed == 'typing') dialogAutoplay('stop') //自动播放的打字,优先关闭自动播放 - else str_index_in_autotype = listenLoading //打字机状态调整 - } else if (listenLoading == -1) dialogAutoplay('stop') //处理自动播放变化 - else if (listenLoading == -2) $('.dialog-overflow').stop(true, true) //立即结束滚屏动画 + if (autoSpeed == 'typing') dialogAutoplay('stop') // Stop autoplay before stopping typing + else str_index_in_autotype = listenLoading // Adjust the typewriter state + } else if (listenLoading == -1) dialogAutoplay('stop') // Handle autoplay changes + else if (listenLoading == -2) $('.dialog-overflow').stop(true, true) // End scrolling immediately } }) var textSpeed = 75 -//全局变量相关:打字机效果 +// Global typewriter effect state $.fn.autotype_text = function (gotoScene, gotoAction) { var str var timer_key var $pThis = $(this) - $('.dialog-overflow').scrollTop(0) //开始打字前校正滚动条位置 + $('.dialog-overflow').scrollTop(0) // Reset scrolling before typing starts if (autoSpeed != 'skip') { str = $pThis.html() if (str.indexOf('<') >= 0) { return - } //注入了html文档的情形 + } // The content contains injected HTML if (isdialogAutoplay()) dialogAutoplayAutoStop('autotype') @@ -150,20 +150,20 @@ $.fn.autotype_text = function (gotoScene, gotoAction) { timer_key = setInterval(function () { str_index_in_autotype++ - $pThis.html(str.substring(0, str_index_in_autotype)) //当前显示的文本长度 + $pThis.html(str.substring(0, str_index_in_autotype)) // Display the current text length if ($('.dialog-overflow')[0].scrollHeight > $('.dialog-overflow').height()) { - //超出内容一次性显示完毕 + // Show all content when it exceeds the visible area $pThis.html(str) str_index_in_autotype = str.length } if (isdialogAutoplay()) { - //打字动画中自动播放开启 + // Autoplay was enabled during the typing animation $pThis.html(str) str_index_in_autotype = str.length } if (str_index_in_autotype >= str.length) { - clearInterval(timer_key) //结束setInterval的定时循环 + clearInterval(timer_key) // End the setInterval loop if (isdialogAutoplay()) { if (autoSpeed == 'auto') { dialogAutoplay('countinue') @@ -178,10 +178,10 @@ $.fn.autotype_text = function (gotoScene, gotoAction) { } } -//全局变量相关:自动播放 -var dialogAutoplayFlag = -1 //控制自动播放 -var timer_Autoplay //每次单击调用的是同一个timer -var autoSpeed = 'stop' //skip和autoplay的速度变量 +// Global autoplay state +var dialogAutoplayFlag = -1 // Controls autoplay +var timer_Autoplay // The same timer is used for every click +var autoSpeed = 'stop' // Speed mode for skip and autoplay $('.dialog-btn-autoplay').click(function (e) { e.stopPropagation() @@ -199,7 +199,7 @@ $('.dialog-btn-autoplay').click(function (e) { $('.dialog-btn-skip').click(function (e) { e.stopPropagation() if (listenScene == null && listenAction == null && listenLoading != null) { - if (listenLoading >= 0) str_index_in_autotype = listenLoading //打字机状态调整 + if (listenLoading >= 0) str_index_in_autotype = listenLoading // Adjust the typewriter state } dialogAutoplay('skip') }) @@ -207,17 +207,17 @@ $('.dialog-btn-skip').click(function (e) { function dialogAutoplay(keySpeed) { var tempTimeout if (keySpeed == null || keySpeed == 'auto' || keySpeed == 'countinue') { - //按下auto + // Auto was pressed if (autoSpeed == 'skip' && isdialogAutoplay()) { - //在skip时按下auto + // Auto was pressed while skipping dialogAutoplayAutoStop() } autoSpeed = 'auto' $('.dialog-btn-autoplay').addClass('dialog-btn-autoplay-on') } else if (keySpeed == 'skip') { - //按下skip + // Skip was pressed if (autoSpeed == 'auto' && isdialogAutoplay()) { - //在auto时按下skip + // Skip was pressed while autoplaying dialogAutoplayAutoStop() } autoSpeed = 'skip' @@ -228,7 +228,7 @@ function dialogAutoplay(keySpeed) { } changedialogAutoplayFlag() if (isdialogAutoplay()) { - setListens(null, null, -1) //主操作响应事件改变 + setListens(null, null, -1) // Change the main input response if (keySpeed == 'countinue') { tempTimeout = baseTime() } else { @@ -310,7 +310,7 @@ function dialogAutoplayAutoStop(keyFlag) { } //------------------------------------------------------ -//CG展示 +// CG display var cgPageIndex = 0 var cgPageLength = 0 var cgListTemp = null @@ -357,10 +357,9 @@ function cgPage(page, flag) { j++ } preLoadUiImages('cg', cgImageList) - //检测预加载图片是否加载完毕 + // Check whether preloaded images have finished loading if (preLoadImagesCheck() > 0) { - //如果已经预载过 - //加载 + // Already preloaded; load the images j = 0 for (i in cgListSort) { if (j >= page * 4 && j < (page + 1) * 4) { @@ -387,9 +386,9 @@ function cgPage(page, flag) { var i var j if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) { - //图片预载完毕,或者超时 + // Images are preloaded or the timeout was reached clearTimeout(preLoadImagesTimer) - //加载 + // Load the images j = 0 for (i in cgListSort) { if (j >= page * 4 && j < (page + 1) * 4) { @@ -455,7 +454,7 @@ function generate_all_characterData(name) { }) if (!xmlDoc) return if (characterData.length) { - //此时xml已经载入过 + // The XML has already been loaded var imageList = xmlDoc.getElementsByTagName('image') preLoadImagesBegin(imageList) return @@ -464,7 +463,7 @@ function generate_all_characterData(name) { generate_all_characterData(name) }) if (!xmlDoc) return - //此时characterData还是空的,从下面开始读入 + // characterData is still empty; populate it below var characterList = xmlDoc.getElementsByTagName('character') for (j = 0; j < characterList.length; j++) { var newCharacter = {} @@ -509,7 +508,7 @@ function generate_all_characterData(name) { ) } } - //此时xml已经载入过 + // The XML has already been loaded xmlDoc = loadExistXmlFile(name) var imageList = xmlDoc.getElementsByTagName('image') preLoadImagesBegin(imageList) @@ -533,7 +532,7 @@ function galgame(name) { galgame(name) }) if (!xmlDoc) return - //--让scene的id在sceneList中有意义 + //-- Make scene IDs meaningful in sceneList var sceneList0 = [] sceneList0 = xmlDoc.getElementsByTagName('scene') sceneList = new Array() @@ -547,7 +546,7 @@ function galgame(name) { } for (j = 0; uselessTexts[j] != null; j++) { thisSceneTemp.removeChild(uselessTexts[j]) - } //在此处清除所有#text + } // Remove all #text nodes here j = thisSceneTemp.getAttribute('id') sceneList[Number(j)] = thisSceneTemp sceneList0[i] = null @@ -588,9 +587,9 @@ function checkTextScroll() { textLenth: (baseTime() / 5) * ((scrollTop1 - scrollTop0) / lineHeight) } } else if (scrollTop0 + showHeight < scrollHeight0 - lineHeight / 5) { - return { scrollTop: scrollTop1, textLenth: baseTime() / 20 } //误差累积的情形 + return { scrollTop: scrollTop1, textLenth: baseTime() / 20 } // Handle accumulated error } else { - return null //到底了 + return null // Already at the bottom } } @@ -600,10 +599,10 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) { //console.log("action: " + gotoScene + ', ' + gotoAction + ', ' +skipKey + ', ' + loadKey2 + '; autoSpeed:' + autoSpeed) ; var thisScene var thisEvent - //首先判断文本滚动的情况,优先显示完毕当前文本 + // Handle text scrolling first so the current text is shown completely checkTextScrollLastMove = 0 if (!skipKey && autoSpeed != 'skip' && gotoScene == now_scene) { - //如果不是读档的情形 + // Not loading a saved game var checkTextScroll_answer = checkTextScroll() if (checkTextScroll_answer != null) { checkTextScrollLastMove = checkTextScroll_answer.textLenth * 5 * 2.5 @@ -616,7 +615,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) { }, step: function () { if (autoSpeed == 'stop') { - setListens(null, null, -2) //单击事件变成快速完成动画 + setListens(null, null, -2) // Make a click complete the animation immediately } else if (autoSpeed == 'skip') { $('.dialog-overflow').stop(true, true) } @@ -640,7 +639,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) { return } } - if (autoSpeed == 'stop') setListens(gotoScene, gotoAction) //普通状态 + if (autoSpeed == 'stop') setListens(gotoScene, gotoAction) // Normal state //-- remark_btn_hide() $('.choice_list').hide() @@ -649,7 +648,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) { thisScene = sceneList[gotoScene] if (gotoAction < 2) { - historyChoiceList = new Array() //清空选择标记 + historyChoiceList = new Array() // Clear choice markers } thisEvent = thisScene.childNodes[gotoAction] @@ -669,7 +668,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) { .css( 'background', "url('" + base_url + '/resources/background/' + thisScene.getAttribute('background') + "') no-repeat" - ) //附加属性 white去除 否则会一瞬间跳白 + ) // Remove the white attribute to prevent a brief white flash .css('background-size', size + ' ' + size) .css('background-position', 'center') } @@ -698,9 +697,9 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { switch (act.nodeName) { case 'cg': if (skipKey) { - if (loadKey2) return //读档时跳过CG + if (loadKey2) return // Skip CG while loading a save } - dialogAutoplay('stop') //强制终止自动播放 + dialogAutoplay('stop') // Force autoplay to stop lastEventNode = gotoAction $('#all').hide() var fadeInTimeCG = 300 @@ -741,7 +740,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { lastEventNode = gotoAction $('#all').hide() if (skipKey || autoSpeed == 'skip') { - //快速播放或读档时跳过 + // Skip during fast playback or while loading a save return } var time = 0.5 @@ -775,7 +774,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'shake': lastEventNode = gotoAction if (skipKey || autoSpeed == 'skip') { - //快速播放或读档时跳过 + // Skip during fast playback or while loading a save return } var time = Number(act.getAttribute('time')) @@ -792,7 +791,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'text': lastEventNode = gotoAction - ClearDialog() //清除临时加载的格式 + ClearDialog() // Clear temporarily loaded formatting $('.dialog-chara').hide() post_achievement_in_event(act) var tempAttribute = act.getAttribute('article') @@ -832,7 +831,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'speak': lastEventNode = gotoAction - ClearDialog() //清除临时加载的格式 + ClearDialog() // Clear temporarily loaded formatting post_achievement_in_event(act) $('.dialog').removeClass('dialog_article') $('.dialog-overflow').removeClass('dialog-overflow_article').removeClass('dialog-overflow_article_center') @@ -858,9 +857,9 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'choices': lastEventNode = gotoAction if (skipKey) { - if (loadKey2) return //读档过程中,跳过 + if (loadKey2) return // Skip while loading a save } - dialogAutoplay('stop') //强制终止自动播放 + dialogAutoplay('stop') // Force autoplay to stop var choiceList = act.childNodes var choices = [] for (var i = 0; i < choiceList.length; i++) { @@ -871,7 +870,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { text: getText(choiceList[i]), continueScene: gotoScene, continueAction: gotoAction - }) //选择肢无影响 + }) // This choice has no effect } else { choices.push({ text: getText(choiceList[i]), @@ -958,7 +957,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'end': lastEventNode = gotoAction - dialogAutoplay('stop') //强制终止自动播放 + dialogAutoplay('stop') // Force autoplay to stop post_achievement_in_event(act) if (act.getAttribute('last')) { endGame(-1) @@ -973,7 +972,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) { case 'sound': lastEventNode = gotoAction if (skipKey || autoSpeed == 'skip') { - //读档或快进跳过历史音效 + // Skip historical sound effects while loading or fast-forwarding return } var sound = $('#sound')[0] @@ -1059,11 +1058,11 @@ function gotoA(sceneKey, change, skipKey) { changeColour = null } } - if (changeColour) dialogAutoplay('stop') //强制终止自动播放 - $('.white').removeClass().addClass('white').hide() //容错 + if (changeColour) dialogAutoplay('stop') // Force autoplay to stop + $('.white').removeClass().addClass('white').hide() // Error recovery $('.background').css('transition-duration', '0ms').css('transform', 'scale(1,1)').css('transform-origin', 'center') if (changeColour) { - setListens() //单击暂时无响应 + setListens() // Temporarily ignore clicks $('.white') .css('background', changeColour) .fadeIn(changeTime, function () { @@ -1079,9 +1078,9 @@ function gotoA(sceneKey, change, skipKey) { var actionTimer function nextAction(nowScene, nowAction, nowKey) { - systemAutoSave() //自动保存 + systemAutoSave() // Auto-save if (!isdialogAutoplay()) { - setListens() //单击暂时无响应 + setListens() // Temporarily ignore clicks } if (actionTimer) { clearTimeout(actionTimer) @@ -1098,9 +1097,9 @@ function RefreshDialog(dialog_text, gotoScene, gotoAction, typeLoad, textColour) return "url('" + base_url + '/resources/background/' + $('div.article-pic')[n].getAttribute('picsrc') + "')" }) if (checkTextScroll() == null) { - $('.dialog-overflow_article').addClass('dialog-overflow_article_center') //居中 + $('.dialog-overflow_article').addClass('dialog-overflow_article_center') // Center the text } else { - $('.dialog-overflow_article').removeClass('dialog-overflow_article_center') //取消居中 + $('.dialog-overflow_article').removeClass('dialog-overflow_article_center') // Disable centering } if (textColour != null) $('.dialog-text').css('color', textColour) else $('.dialog-text').css('color', '#ffffff') @@ -1130,7 +1129,7 @@ function ShowDialog(mode, content) { c3: i }, function (e) { - historyChoiceList[e.data.c2] = e.data.c3 // 记录非转场选择 + historyChoiceList[e.data.c2] = e.data.c3 // Record a choice without a scene transition nextAction(e.data.c1, e.data.c2) $('.choice_list').hide() $('.choice_list').html('') @@ -1205,7 +1204,7 @@ function ToggleWindow(mode) { } ///////////////////////////////// -//自动存档---------------------------------------------------------- +// Automatic saves---------------------------------------------------------- function systemAutoSave() { setCookie(now_galgame_tag, now_galgame) setCookie(now_scene_tag, now_scene) @@ -1265,7 +1264,7 @@ function startGame(galgameKey, loadKey) { return } startLoad() - //catalogListTemp 和 catalogListLength都是全局变量,注意 + // catalogListTemp and catalogListLength are global variables var xmlDoc = loadExistXmlFile('catalog_list', function () { catalogListTemp = xml_files_all_in_this['catalog_list'].getElementsByTagName('log') catalogListLength = catalogListTemp.length @@ -1275,26 +1274,26 @@ function startGame(galgameKey, loadKey) { if (!xmlDoc) return for (var i = 0; i < catalogListLength; i++) { if (getText(catalogListTemp[i]) == galgameKey) { - playKey = galgameKey //传入的是文件名 + playKey = galgameKey // The input is a filename break } if (catalogListTemp[i].getAttribute('id') == galgameKey) { - playKey = getText(catalogListTemp[i]) //传入的是ID + playKey = getText(catalogListTemp[i]) // The input is an ID break } } if (playKey != galgameKey && Number(galgameKey) < 1) { i-- - playKey = getText(catalogListTemp[i]) //无效参数,读取最新章节 + playKey = getText(catalogListTemp[i]) // Invalid parameter; load the latest chapter } else if (i >= catalogListLength) { - //传入的可能是章节列表中的数组序号,所以之前的循环中没有检测到任何结果 + // The input may be an index in the chapter list, so the previous loop found no match if (catalogListTemp[Number(galgameKey) - 1] != null) { playKey = getText(catalogListTemp[Number(galgameKey) - 1]) i = Number(galgameKey) - 1 } else { LoadFinish() thanksWords() - return //章节到头 + return // No more chapters } } @@ -1318,21 +1317,21 @@ function startGame(galgameKey, loadKey) { // } else if (GetQueryString("from") == "cd") { // pv("gameStart_" + now_galgame + "_CD"); // } - //检测预加载图片是否加载完毕 + // Check whether preloaded images have finished loading var countIndexTimer = 0 var preLoadImagesTimer = setInterval(function () { if (!loadExistXmlFile(playKey, function () {})) { - //xml声明加载不受超时限制 + // XML declaration loading is not subject to the timeout countIndexTimer++ return } if (!characterData.length) { - //xml声明加载不受超时限制 + // XML declaration loading is not subject to the timeout countIndexTimer++ return } if (preLoadImagesCheck() > 0 || countIndexTimer > 100) { - //图片加载完毕,或者超时 + // Images have loaded or the timeout was reached clearTimeout(preLoadImagesTimer) $('.cg').css('display', 'none') $('.transition').fadeIn(300, function () { @@ -1374,7 +1373,7 @@ function preLoadUiImages(resStr, resList, flag_continue) { .bind('error', function () { var count = $(this).data('retryCount') if (count < 5) { - //尝试次数 + // Retry count $(this).data('retryCount', count + 1) this.src = this.src } @@ -1384,12 +1383,12 @@ function preLoadUiImages(resStr, resList, flag_continue) { } function preLoadImagesBegin(imageList) { - showInSceneList = new Array() //清空立绘缓存名单 + showInSceneList = new Array() // Clear the character image cache list bgInSceneList = new Array() cgInSceneList = new Array() var charaDefErrorList = new Array() for (i in sceneList) { - var thisScene = sceneList[i] //场景列表在流程上已被读取 + var thisScene = sceneList[i] // The scene list has already been loaded var thisBgFileName = thisScene.getAttribute('background') if (thisBgFileName.length) { if ($.inArray(thisBgFileName, bgInSceneList) < 0 && $.inArray('.', thisBgFileName) > 0) { @@ -1403,7 +1402,7 @@ function preLoadImagesBegin(imageList) { if (chara) { if (characterData[chara]) { if ($.inArray(characterData[chara]['src'], showInSceneList) < 0) { - showInSceneList.push(characterData[chara]['src']) //只存储确实使用过且被声明的立绘 + showInSceneList.push(characterData[chara]['src']) // Store only declared character images that are used } } else if (!charaDefErrorList[chara]) { console.log('Defination Error: ' + chara) @@ -1457,7 +1456,7 @@ function preLoadImagesBegin(imageList) { .bind('error', function () { var count = $(this).data('retryCount') if (count < 5) { - //尝试次数 + // Retry count $(this).data('retryCount', count + 1) this.src = this.src } @@ -1473,7 +1472,7 @@ function preLoadImagesBegin(imageList) { .bind('error', function () { var count = $(this).data('retryCount') if (count < 5) { - //尝试次数 + // Retry count $(this).data('retryCount', count + 1) this.src = this.src } @@ -1563,7 +1562,7 @@ function ShowUi(dialog, chara) { } function ToggleCloseButton(close_obj) { - //功能是否已经变化? + // Has the state changed? var close_btn_data = $('.close_btn').attr('data') if (close_btn_data) { $('.close_btn').toggle() @@ -1575,7 +1574,7 @@ function ToggleCloseButton(close_obj) { } } -//读档存档 +// Save and load function add_record() { dialogAutoplay('stop') $('#confirm_1').html( @@ -1668,11 +1667,11 @@ function browserRedirect() { function check_size() { var winWidth var winHeight - //获取窗口宽度 + // Get the window width if (window.innerWidth) { winWidth = window.innerWidth } else if (document.body && document.body.clientWidth) { - winWidth = document.body.clientWidth //获取窗口高度 + winWidth = document.body.clientWidth // Get the window height } winWidth = parseInt(winWidth) if (window.innerHeight) { @@ -1681,7 +1680,7 @@ function check_size() { winHeight = document.body.clientHeight } winHeight = parseInt(winHeight) - //通过深入Document内部对body进行检测,获取窗口大小 + // Inspect the document to determine the window size if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { winHeight = document.documentElement.clientHeight winWidth = document.documentElement.clientWidth @@ -1708,7 +1707,7 @@ function check_size() { .css('left', ($('.black').width() - $('.frame').width()) / 2 + 'px') .css('top', ($('.black').height() - $('.frame').height()) / 2 + 'px') - window.scrollTo(0, 1) //隐藏浏览器工具栏 + window.scrollTo(0, 1) // Hide the browser toolbar } // CUSTOM: requests XML from user-configurable xmlPath, if it fails, it'll fall back to main VN repo @@ -1743,7 +1742,7 @@ function loadExistXmlFile(xmlName, callBack, fileType) { if (xml_files_all_in_this.hasOwnProperty(xmlName)) { return xml_files_all_in_this[xmlName] } else if (loading_xml_files.hasOwnProperty(xmlName)) { - return null //排除意外并发 + return null // Prevent unexpected concurrent loads } else { loading_xml_files[xmlName] = true //console.log(xmlName + ' start load'); @@ -1762,14 +1761,14 @@ function loadExistXmlFile(xmlName, callBack, fileType) { function getText(e) { var t = '' if (!e) return null - e = e.childNodes || e //如果传入的是元素,则继续遍历其子元素;否则假定它是一个数组 + e = e.childNodes || e // Traverse child nodes for elements; otherwise assume an array for (var i = 0; i < e.length; i++) { - //如果不是元素,追回其文本值; - //否则,递归遍历所有元素的子节点; + // Append the text value when this is not an element; + // Otherwise, recursively traverse all child nodes; if (e[i].nodeType) { t += e[i].nodeType != 1 ? e[i].nodeValue : getText(e[i].childNodes) } else { - t += e[i] //字符串的情形 + t += e[i] // String input } } return t @@ -1791,7 +1790,7 @@ function base64Decode(input) { } //------------------------------------------------------- -//Catalog 目录界面 +// Catalog interface var catalogPageIndex = 0 var catalogListLength = 0 var catalogListTemp = null @@ -2088,7 +2087,7 @@ $('.pagenum#pagenum-7').click(function () { $('.pagenum#pagenum-7').addClass('pagenum-gray') } } -}) //向前 +}) // Previous page $('.pagenum#pagenum-8').click(function () { if ((catalogPageIndex + 1) * 2 < catalogListLength) { @@ -2101,7 +2100,7 @@ $('.pagenum#pagenum-8').click(function () { $('.pagenum#pagenum-8').addClass('pagenum-gray') } } -}) //向后 +}) // Next page function showCatalogFrame(page) { //new @@ -2117,7 +2116,7 @@ function setCookie(name, value) { localStorage.setItem(name, value) } -///删除cookie +/// Delete cookie function delCookie(name) { // var exp = new Date(); // exp.setTime(exp.getTime() - 1); @@ -2126,7 +2125,7 @@ function delCookie(name) { localStorage.removeItem(name) } -//读取cookie +// Read cookie function getCookie(name) { // var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); // if (arr != null) return unescape(arr[2]); @@ -2141,7 +2140,7 @@ function GetQueryString(_name) { return null } -//历史纪录相关------------------------------------------------------ +// History ------------------------------------------------------ $('.dialog-btn-history').click(function (e) { e.stopPropagation() showHistory() @@ -2256,7 +2255,7 @@ function hideHistory() { } //---------------------------------------------------------------- -//文本注释系统相关------------------------------------------------ +// Text annotation system ------------------------------------------------ $('.remark').hide() remark_btn_hide() @@ -2333,10 +2332,10 @@ function wrk_get_size() { if (window.innerWidth) winWidth = window.innerWidth else if (document.body && document.body.clientWidth) winWidth = document.body.clientWidth - //获取窗口高度 + // Get the window height if (window.innerHeight) winHeight = window.innerHeight else if (document.body && document.body.clientHeight) winHeight = document.body.clientHeight - //通过深入Document内部对body进行检测,获取窗口大小 + // Inspect the document to determine the window size if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { winHeight = document.documentElement.clientHeight winWidth = document.documentElement.clientWidth @@ -2490,11 +2489,11 @@ function portraitPage(typeReturn) { } } preLoadUiImages('achievement', achievementImageList) - //检测预加载图片是否加载完毕 + // Check whether preloaded images have finished loading var countIndexTimer = 0 var preLoadImagesTimer = setInterval(function () { if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) { - //图片预载完毕,或者超时 + // Images are preloaded or the timeout was reached clearTimeout(preLoadImagesTimer) $('#family-portrait').addClass('family-portrait') $('#achievement-exhibition').addClass('achievement-exhibition')