diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/getrepo.js | 6 | ||||
| -rw-r--r-- | public/js/main.js | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/public/js/getrepo.js b/public/js/getrepo.js index b78eb30a..93a9c45a 100644 --- a/public/js/getrepo.js +++ b/public/js/getrepo.js @@ -91,15 +91,15 @@ var displayRepos = function displayRepos(repos) { var forksUrl = "".concat(userHome, "/").concat(repo.name, "/network/members"); var listItem = document.createElement('li'); listItem.classList.add('repo', 'animate', 'zoomIn'); - listItem.innerHTML = "\n\t\t\t<h2 class=\"repo-title\">".concat(repo.name, "</h2>\n\t\t\t<span class=\"rdescription\">").concat(repo.description ? "<span class=\"rdescriptiontext\">".concat(repo.description, "</span>") : '', "<br/><br/>"); + listItem.innerHTML = escapeTextReinterpreted("\n\t\t\t<h2 class=\"repo-title\">".concat(repo.name, "</h2>\n\t\t\t<span class=\"rdescription\">").concat(repo.description ? "<span class=\"rdescriptiontext\">".concat(repo.description, "</span>") : '', "<br/><br/>")); if (repo.stargazers_count > 0) { - listItem.innerHTML += "<a href=\"".concat(starsUrl, "\">\n\t\t\t<span>\u2B50 ").concat(repo.stargazers_count, "</span></a>"); + listItem.innerHTML += escapeTextReinterpreted("<a href=\"".concat(starsUrl, "\">\n\t\t\t<span>\u2B50 ").concat(repo.stargazers_count, "</span></a>")); } if (repo.language) { listItem.innerHTML += "<a href=\"".concat(langUrl, "\">\n\t\t\t<span>").concat(devicons[repo.language], "</span></a>"); } if (repo.forks_count > 0) { - listItem.innerHTML += "<a href=\"".concat(starsUrl, "\">\n\t\t\t<span>").concat(devicons["Git"], " ").concat(repo.forks_count, "</span></a>"); + listItem.innerHTML += escapeTextReinterpreted("<a href=\"".concat(starsUrl, "\">\n\t\t\t<span>").concat(devicons["Git"], " ").concat(repo.forks_count, "</span></a>")); } if (repo.homepage && repo.homepage !== "") { listItem.innerHTML += "<br /> <br />\n\t\t\t<a class=\"link-btn btn-code\" href=".concat(repo.html_url, ">Code ").concat(devicons["Github"], "</a>\n\t\t\t<a class=\"link-btn btn-live\" href=").concat(repo.homepage, ">Live ").concat(devicons["Chrome"], "</a> <br />"); diff --git a/public/js/main.js b/public/js/main.js index e7a44b6a..323dae9e 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -6,4 +6,7 @@ if ('serviceWorker' in navigator) { console.log('sw.js failed: ', err); }); }); +} +function escapeTextReinterpreted(htmlStr) { + return htmlStr.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); }
\ No newline at end of file |
