mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 04:38:28 +00:00
@@ -5,24 +5,11 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global utils:false */
|
||||
|
||||
// Define global variables
|
||||
var auditTimeout = null;
|
||||
|
||||
// Credit: http://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript/4835406#4835406
|
||||
function escapeHtml(text) {
|
||||
var map = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'"
|
||||
};
|
||||
|
||||
return text.replace(/[&<>"']/g, function (m) {
|
||||
return map[m];
|
||||
});
|
||||
}
|
||||
|
||||
function updateTopLists() {
|
||||
$.getJSON("api.php?topItems=audit", function (data) {
|
||||
if ("FTLnotrunning" in data) {
|
||||
@@ -38,7 +25,7 @@ function updateTopLists() {
|
||||
for (domain in data.top_queries) {
|
||||
if (Object.prototype.hasOwnProperty.call(data.top_queries, domain)) {
|
||||
// Sanitize domain
|
||||
domain = escapeHtml(domain);
|
||||
domain = utils.escapeHtml(domain);
|
||||
url = '<a href="queries.php?domain=' + domain + '">' + domain + "</a>";
|
||||
domaintable.append(
|
||||
"<tr><td>" +
|
||||
@@ -57,7 +44,7 @@ function updateTopLists() {
|
||||
if (Object.prototype.hasOwnProperty.call(data.top_ads, domain)) {
|
||||
var input = domain.split(" ");
|
||||
// Sanitize domain
|
||||
var printdomain = escapeHtml(input[0]);
|
||||
var printdomain = utils.escapeHtml(input[0]);
|
||||
if (input.length > 1) {
|
||||
url =
|
||||
'<a href="queries.php?domain=' +
|
||||
|
||||
Reference in New Issue
Block a user