diff options
author | Louie S <louie@example.com> | 2023-04-03 20:04:52 -0700 |
---|---|---|
committer | Louie S <louie@example.com> | 2023-04-03 20:04:52 -0700 |
commit | d8c68fe9cc59f667478bb763cf690d8f771afa59 (patch) | |
tree | daab2a55b7b5e77fd138e1913ff7db6dd553f5e9 /frontend/script.js | |
parent | e45d210517ae56abfec61ce1a8db1fc6ed7c4b4b (diff) |
Fix refresh issue
Diffstat (limited to 'frontend/script.js')
-rw-r--r-- | frontend/script.js | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/frontend/script.js b/frontend/script.js index f40d70b..90dcb9a 100644 --- a/frontend/script.js +++ b/frontend/script.js @@ -1,35 +1,26 @@ const endpoint = "http://127.0.0.1:8080/endpoints" +let i = 0; -console.log("hello"); function set_embed_page(url) { document.getElementById("docset-page").src = url; } function populateSearchBar(docset_json) { - console.log(docset_json); + //console.log(docset_json); + ++i; + console.log(i); // Add to search bar document.getElementById("searchbar").getElementsByTagName("tbody")[0].innerHTML += "<tr>" + "<td scope=\"row\">" + - "<button id=\"docset-\"" + docset_json["CFBundleIdentifier"] + "-parent\" class=\"docset-parent\">" + + "<button id=\"docset-" + docset_json["CFBundleIdentifier"] + "-parent\" class=\"docset-parent\" onclick=\"set_embed_page('" + docset_json["docset_root"] + "')\">" + docset_json["CFBundleName"] + "</button>" + "</td>" + "</tr>"; - - // Add onclick event - /* - document.getElementById("docset-" + docset_json["CFBundleIdentifier"] + "-parent").addEventListener("click", function(){ - set_embed_page(docset_json["docset_root"]); - }); - */ } -document.getElementById("docset-example-parent").addEventListener("click", function() { - set_embed_page("https://example.com"); -}); - let xhttp = new XMLHttpRequest(); xhttp.open("GET", endpoint + "/get_plist.py"); @@ -44,5 +35,6 @@ xhttp.onload = function(){ //populateSearchBar(json_response["docsets"][0]); json_response["docsets"].forEach(populateSearchBar); + delete json_response } xhttp.send(); |