mirror of
https://github.com/pi-hole/web.git
synced 2026-04-28 12:44:07 +01:00
@@ -7,6 +7,21 @@
|
||||
|
||||
/* global moment:false */
|
||||
|
||||
// Credit: https://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript/4835406#4835406
|
||||
function escapeHtml(text) {
|
||||
var map = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'"
|
||||
};
|
||||
|
||||
return text.replace(/[&<>"']/g, function (m) {
|
||||
return map[m];
|
||||
});
|
||||
}
|
||||
|
||||
var info = null;
|
||||
function showAlert(type, icon, title, message) {
|
||||
var opts = {};
|
||||
@@ -172,6 +187,7 @@ function stateLoadCallback(itemName) {
|
||||
|
||||
window.utils = (function () {
|
||||
return {
|
||||
escapeHtml: escapeHtml,
|
||||
showAlert: showAlert,
|
||||
datetime: datetime,
|
||||
disableAll: disableAll,
|
||||
|
||||
Reference in New Issue
Block a user