From 5d5c0b937dc68a8e0e0a27c8077dcada024e6e35 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 3 May 2019 17:36:53 +0530 Subject: [PATCH] commit changes came from QA --- 400-SOURCECODE/AIAHTML5.Web/search-wp.js | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/search-wp.js b/400-SOURCECODE/AIAHTML5.Web/search-wp.js index f18b96c..d9ea76a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/search-wp.js +++ b/400-SOURCECODE/AIAHTML5.Web/search-wp.js @@ -1,92 +1,92 @@ - - -loadTermData = function (currentBodyViewId, languageName, languageID) { - - console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; - - var TermNumberData; - var AJAX_req = new XMLHttpRequest(); - AJAX_req.open("GET", termNoJsonPath, true); - AJAX_req.setRequestHeader("Content-type", "application/json"); - - AJAX_req.onreadystatechange = function () { - if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { - TermNumberData = JSON.parse(AJAX_req.responseText); - console.log("data returned: " + TermNumberData); - - loadTermTextData(TermNumberData, languageName, languageID); - - } - } - AJAX_req.send(); - - -} - - -loadTermTextData = function (TermNumberData, languageName, languageID) { - - var languageFileName; - if(languageName == "English (Undergraduate)") - { - languageFileName = "English_Undergraduate"; - } - else if (languageName == "Japanese (Kanji)") { - languageFileName = "Japanese_Kanji"; - } - else if (languageName == "Japanese (Yomi)") - { - languageFileName = "Japanese_yomi"; - } - else - { - languageFileName = languageName; - } - - var termTextJsonPath = '~/../content/data/json/da/vocab/' + languageFileName + '/cm_dat_vocabterm_' + languageID + '.json'; - - var VocabTermData = ''; - var AJAX_req = new XMLHttpRequest(); - AJAX_req.open("GET", termTextJsonPath, true); - AJAX_req.setRequestHeader("Content-type", "application/json"); - AJAX_req.onreadystatechange = function () { - if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { - console.log('AJAX_req.readyState= ' + AJAX_req.readyState + ' and AJAX_req.status =' + AJAX_req.status); - - VocabTermData = JSON.parse(AJAX_req.responseText); - var vocabTermTxt = []; - TermNumberData.TermData.Term.forEach(function (value1, key1) { - VocabTermData.VocabTerms.Term.forEach(function (value2, key2) { - if (value1._ActualTermNumber === value2._ActualTermNumber) { - vocabTermTxt.push( - { - "_ActualTermNumber": value2._ActualTermNumber, - "_TermText": value2._TermText, - "_cdId": value2._cdId - } - ); - } - }) - }) - self.postMessage({ - 'vocabTermTxt': vocabTermTxt, - 'TermNumberData': TermNumberData, - 'VocabTermData': VocabTermData, - 'language': languageName - - }); - } - } - AJAX_req.send(); -} - - -self.onmessage = function (e) { - console.log("search"); - //console.log('search-wp onmessage time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - loadTermData(e.data.currentBodyViewId, e.data.languageName, e.data.languageID); - - -} - + + +loadTermData = function (currentBodyViewId, languageName, languageID) { + + console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; + + var TermNumberData; + var AJAX_req = new XMLHttpRequest(); + AJAX_req.open("GET", termNoJsonPath, true); + AJAX_req.setRequestHeader("Content-type", "application/json"); + + AJAX_req.onreadystatechange = function () { + if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { + TermNumberData = JSON.parse(AJAX_req.responseText); + console.log("data returned: " + TermNumberData); + + loadTermTextData(TermNumberData, languageName, languageID); + + } + } + AJAX_req.send(); + + +} + + +loadTermTextData = function (TermNumberData, languageName, languageID) { + + var languageFileName; + if(languageName == "English (Undergraduate)") + { + languageFileName = "English_Undergraduate"; + } + else if (languageName == "Japanese (Kanji)") { + languageFileName = "Japanese_Kanji"; + } + else if (languageName == "Japanese (Yomi)") + { + languageFileName = "Japanese_yomi"; + } + else + { + languageFileName = languageName; + } + + var termTextJsonPath = '~/../content/data/json/da/vocab/' + languageFileName + '/cm_dat_vocabterm_' + languageID + '.json'; + + var VocabTermData = ''; + var AJAX_req = new XMLHttpRequest(); + AJAX_req.open("GET", termTextJsonPath, true); + AJAX_req.setRequestHeader("Content-type", "application/json"); + AJAX_req.onreadystatechange = function () { + if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { + console.log('AJAX_req.readyState= ' + AJAX_req.readyState + ' and AJAX_req.status =' + AJAX_req.status); + + VocabTermData = JSON.parse(AJAX_req.responseText); + var vocabTermTxt = []; + TermNumberData.TermData.Term.forEach(function (value1, key1) { + VocabTermData.VocabTerms.Term.forEach(function (value2, key2) { + if (value1._ActualTermNumber === value2._ActualTermNumber) { + vocabTermTxt.push( + { + "_ActualTermNumber": value2._ActualTermNumber, + "_TermText": value2._TermText, + "_cdId": value2._cdId + } + ); + } + }) + }) + self.postMessage({ + 'vocabTermTxt': vocabTermTxt, + 'TermNumberData': TermNumberData, + 'VocabTermData': VocabTermData, + 'language': languageName + + }); + } + } + AJAX_req.send(); +} + + +self.onmessage = function (e) { + console.log("search"); + //console.log('search-wp onmessage time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + loadTermData(e.data.currentBodyViewId, e.data.languageName, e.data.languageID); + + +} + -- libgit2 0.21.4