let data_indexs = 25; function ShowMoreWords(e) { let showmore = e.parentElement.children[0]; let script = document.getElementById("get-value"); let folderName = script.dataset.foldername; let fileName = script.dataset.filename; let lang = script.dataset.lang; let id = showmore.id; document.getElementById(id).innerHTML = `Loading...`; let content_area = document .getElementById("alpha_" + id) .getElementsByClassName("list-unstyled")[0]; const getSeodata = async () => { let URL = "/data" + "/" + folderName + "/" + lang + "/" + fileName + ".json"; const data = await fetch(URL); const seoData = await data.json(); return seoData; }; getSeodata().then((result) => { let full_words = []; for (let w = 0; w < result.words.length; w++) { for (let _i = 0; _i < result.words[w].length; _i++) { if (result.words[w][_i].i == id) { full_words.push(result.words[w][_i]); } } } if (data_indexs < full_words.length) { for (let d = data_indexs; d < data_indexs + 25; d++) { if (full_words[d] != undefined) { // $('[data-toggle="tooltip"]').tooltip(); let li = document.createElement("li"); li.classList.add("list_word") li.innerHTML = `${full_words[d].word}`; let div = document.createElement("div"); div.setAttribute("class", "tool-tip"); div.setAttribute("data-toggle", "tooltip"); div.setAttribute("data-placement", "top"); div.setAttribute("data-original-title", `Lookup ${full_words[d].word.replace(/<\/?[^>]+>/gi, '')} in Dictionary`); let span = document.createElement("span"); span.setAttribute("class", "points"); span.setAttribute("value", `${full_words[d].points}`); span.innerHTML = `${full_words[d].points}`; let a = document.createElement("a"); a.setAttribute("class", "anchor__style"); a.setAttribute("target", "_blank"); a.setAttribute( "href", "/word-meaning?search=" + full_words[d].word.replace(/<\/?[^>]+>/gi, '') ); li.appendChild(span) div.appendChild(li) a.appendChild(div); content_area.appendChild(a); } } document.getElementById(id).innerHTML = `See More Words`; data_indexs += 25; } else { document.getElementById(id).style.display = "none"; } }); }