var dict_pre_searching = false; var dict_pre_search_curr_word = ""; var dict_search_xml_http = null; var _autoSplit = true; function dict_search(word, autoSplit = true) { word = word.replace(/[\[\]]/g,""); _autoSplit = autoSplit; $("#pre_search_result").hide(); if (!localStorage.searchword) { localStorage.searchword = ""; } let oldHistory = localStorage.searchword; let arrOldHistory = oldHistory.split(","); let isExist = false; for (let i = 0; i < arrOldHistory.length; i++) { if (arrOldHistory[i] == word) { isExist = true; } } if (!isExist) { localStorage.searchword = word + "," + oldHistory; } word = standardize(word); //word = com_getPaliReal(word); $.get( "./dict_lookup.php", { word: word, }, function (data, status) { $("#dict_search_result").html(data); $("#dict_list").append($("#dictlist")); $("#right_bar").html(""); $("#right_bar").append($("#dict_user")); $("#search_result_shell").html(""); $("#search_result_shell").append($("#search_summary")); guide_init(); if (_autoSplit == true && word.length > 10) { get_comp_data(word); } let word_count = parseInt($("#word_count").val()); if (_autoSplit == true && word_count < 6) { //trubo_split(); } } ); } function standardize(word) { let word_end = word.slice(-1); if (word_end == "n" || word_end == "m") { word_end = "ṃ"; word = word.slice(0, -1) + word_end; } return word; } function dict_pre_search(word) { if (dict_pre_searching == true) { return; } dict_pre_searching = true; dict_pre_search_curr_word = word; $.get( "./dict_lookup_pre.php", { word: word, }, function (data, status) { dict_pre_searching = false; dict_pre_search_curr_word = ""; try { let result = JSON.parse(data); let html = "