Replace innerHTML part 1 (Gitlab issue #45)

Change all plain text and empty content from innerHTML to textContent
This commit is contained in:
zzz
2020-05-11 08:20:03 -04:00
parent 2e36812740
commit a1c714b46e
14 changed files with 74 additions and 74 deletions

View File

@ -81,7 +81,7 @@ function refreshDirs() {
if (listOfDirs.length > 0)
dirsDiv.innerHTML = table.render()
else
dirsDiv.innerHTML = ""
dirsDiv.textContent = ""
}
}
var sortParam = "&key=" + sortKey + "&order=" + sortOrder
@ -131,7 +131,7 @@ function configure(path) {
function cancelConfig() {
var tableDiv = document.getElementById("dirConfig")
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
function sync(path) {

View File

@ -91,7 +91,7 @@ function showCertificates(hostB64, infoHash) {
hideLinkSpan.innerHTML = hideLink
var certSpan = document.getElementById("certificates-" + fetch.divId)
certSpan.innerHTML = _t("Fetching Certificates")
certSpan.textContent = _t("Fetching Certificates")
}
}
xmlhttp.open("POST", "/MuWire/Certificate", true)
@ -104,7 +104,7 @@ function hideCertificates(hostB64, infoHash) {
certificateFetches.delete(id)
var certSpan = document.getElementById("certificates-" + id)
certSpan.innerHTML = ""
certSpan.textContent = ""
var result = resultsByInfoHash.get(infoHash)
var showLinkText
@ -172,14 +172,14 @@ function refreshActive() {
if (activeBrowses.length > 0)
tableDiv.innerHTML = table.render()
else
tableDiv.innerHTML = ""
tableDiv.textContent = ""
if (currentBrowse != null) {
var newBrowse = browsesByHost.get(currentHost)
if (newBrowse == null || currentBrowse.revision < newBrowse.revision)
showResults(currentHost, currentBrowse.key, currentBrowse.descending)
} else {
document.getElementById("resultsTable").innerHTML = ""
document.getElementById("resultsTable").textContent = ""
}
}
}
@ -255,7 +255,7 @@ function showResults(host, key, descending) {
if (resultsByInfoHash.size > 0)
tableDiv.innerHTML = table.render()
else
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
}
var paramString = "/MuWire/Browse?section=results&host=" + browse.hostB64
@ -316,5 +316,5 @@ function hideComment(infoHash) {
linkSpan.innerHTML = getShowCommentLink(infoHash)
var commentSpan = document.getElementById("comment-"+infoHash)
commentSpan.innerHTML = ""
commentSpan.textContent = ""
}

View File

@ -195,7 +195,7 @@ function hideCertificateComment(divId, base64) {
linkDiv.innerHTML = link
var commentDiv = document.getElementById("certificate-comment-" + divId + "_" + base64)
commentDiv.innerHTML = ""
commentDiv.textContent = ""
}
function refreshCertificates() {

View File

@ -16,8 +16,8 @@ function refreshConnectionsCount() {
image = "NotStarted.png";
connectionIcon.innerHTML = "<img src=\"images/" + image + "\" alt=\"\">";
} else {
connectionCountSpan.innerHTML = _t("Down");
connectionIcon.innerHTML = "";
connectionCountSpan.textContent = _t("Down");
connectionIcon.textContent = "";
}
}
}

View File

@ -89,7 +89,7 @@ function cancelDownload(infoHash) {
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var downloadSpan = document.getElementById("download-"+infoHash);
downloadSpan.innerHTML = "";
downloadSpan.textContent = "";
refreshDownloader();
}
}
@ -179,11 +179,11 @@ function refreshDownloader() {
var clearLink = new Link(_t("Clear Finished"), "clear", ["ignored"])
clearDiv.innerHTML = clearLink.render()
} else {
downloadsDiv.innerHTML = ""
clearDiv.innerHTML = ""
downloadsDiv.textContent = ""
clearDiv.textContent = ""
downloader = null
var downloadDetailsDiv = document.getElementById("downloadDetails");
downloadDetailsDiv.innerHTML = ""
downloadDetailsDiv.textContent = ""
}
if (downloader != null)
updateDownloader(downloader);

View File

@ -164,18 +164,18 @@ function refreshFeeds() {
if (listOfFeeds.length > 0)
feedsDiv.innerHTML = table.render()
else
feedsDiv.innerHTML = ""
feedsDiv.textContent = ""
if (currentFeed != null) {
var updatedFeed = feeds.get(currentFeed)
if (updatedFeed == null) {
currentFeed = null
document.getElementById("itemsTable").innerHTML = ""
document.getElementById("itemsTable").textContent = ""
cancelConfig()
} else if (updatedFeed.revision > currentFeed.revision)
displayFeed(currentFeed)
} else
document.getElementById("itemsTable").innerHTML = ""
document.getElementById("itemsTable").textContent = ""
}
}
@ -215,7 +215,7 @@ function displayFeed(feed) {
if (items.length > 0)
itemsDiv.innerHTML = table.render()
else
itemsDiv.innerHTML = ""
itemsDiv.textContent = ""
}
}
var sortParam = "&key=" + itemsSortKey + "&order=" + itemsSortOrder
@ -307,7 +307,7 @@ function configure(publisher) {
function cancelConfig() {
var tableDiv = document.getElementById("feedConfig")
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
function showComment(infoHash) {
@ -328,7 +328,7 @@ function hideComment(infoHash) {
expandedComments.delete(infoHash)
var commentDiv = document.getElementById("comment-" + infoHash);
commentDiv.innerHTML = ""
commentDiv.textContent = ""
var showLink = new Link(_t("Show Comment"), "showComment", [infoHash])
var linkSpan = document.getElementById("comment-link-" + infoHash);
@ -347,7 +347,7 @@ function showCertificates(hostB64, infoHash) {
hideLinkSpan.innerHTML = hideLink.render()
var certSpan = document.getElementById("certificates-" + fetch.divId)
certSpan.innerHTML = _t("Fetching Certificates")
certSpan.textContent = _t("Fetching Certificates")
}
}
xmlhttp.open("POST", "/MuWire/Certificate", true)
@ -360,7 +360,7 @@ function hideCertificates(hostB64, infoHash) {
certificateFetches.delete(id)
var certSpan = document.getElementById("certificates-" + id)
certSpan.innerHTML = ""
certSpan.textContent = ""
var item = itemsByInfoHash.get(infoHash)
var showLinkText

View File

@ -104,7 +104,7 @@ function refreshSearchers() {
if (searchNodes.length > 0)
hitsDiv.innerHTML = table.render()
else
hitsDiv.innerHTML = ""
hitsDiv.textContent = ""
}
}
var sortParam = "&key=" + searchersSortKey + "&order=" + searchersSortOrder
@ -138,7 +138,7 @@ function refreshDownloaders() {
if (downloaders.length > 0)
downloadersDiv.innerHTML = table.render()
else
downloadersDiv.innerHTML = ""
downloadersDiv.textContent = ""
}
}
var sortParam = "&key=" + downloadersSortKey + "&order=" + downloadersSortOrder
@ -175,7 +175,7 @@ function refreshCertificates() {
if (certificates.length > 0)
certsDiv.innerHTML = table.render()
else
certsDiv.innerHTML = ""
certsDiv.textContent = ""
}
}
var sortParam = "&key=" + certificatesSortKey + "&order=" + certificatesSortOrder
@ -223,7 +223,7 @@ function hideComment(id) {
commentLinkDiv.innerHTML = showLink.render()
var commentDiv = document.getElementById("comment-" + id)
commentDiv.innerHTML = ""
commentDiv.textContent = ""
}
var path = null

View File

@ -113,14 +113,14 @@ function refreshStatus(noRefresh) {
var count = xmlDoc.getElementsByTagName("Count")[0].childNodes[0].nodeValue
var countSpan = document.getElementById("count")
countSpan.innerHTML = count
countSpan.textContent = count
var hashingSpan = document.getElementById("hashing")
var hashing = xmlDoc.getElementsByTagName("Hashing")
if (hashing != null && hashing.length == 1) {
hashingSpan.innerHTML = "Hashing "+hashing[0].childNodes[0].nodeValue
hashingSpan.textContent = "Hashing "+hashing[0].childNodes[0].nodeValue
} else
hashingSpan.innerHTML = "";
hashingSpan.textContent = "";
var newRevision = parseInt(xmlDoc.getElementsByTagName("Revision")[0].childNodes[0].nodeValue)
if (newRevision > treeRevision) {
@ -264,7 +264,7 @@ function unshare(nodeId) {
function showCommentForm(nodeId) {
var linkSpan = document.getElementById("comment-link-"+nodeId)
linkSpan.innerHTML=""
linkSpan.textContent=""
var commentDiv = document.getElementById("comment-"+nodeId)
var node = nodesById.get(nodeId)
@ -281,7 +281,7 @@ function showCommentForm(nodeId) {
function cancelComment(nodeId) {
var commentDiv = document.getElementById("comment-"+nodeId)
commentDiv.innerHTML = ""
commentDiv.textContent = ""
var node = nodesById.get(nodeId)
node.updateDiv()

View File

@ -60,14 +60,14 @@ function refreshStatus() {
var count = xmlDoc.getElementsByTagName("Count")[0].childNodes[0].nodeValue
var countSpan = document.getElementById("count")
countSpan.innerHTML = count
countSpan.textContent = count
var hashingSpan = document.getElementById("hashing")
var hashing = xmlDoc.getElementsByTagName("Hashing")
if (hashing != null && hashing.length == 1) {
hashingSpan.innerHTML = _t("Hashing") + " " +hashing[0].childNodes[0].nodeValue
hashingSpan.textContent = _t("Hashing") + " " +hashing[0].childNodes[0].nodeValue
} else
hashingSpan.innerHTML = "";
hashingSpan.textContent = "";
var newRevision = parseInt(xmlDoc.getElementsByTagName("Revision")[0].childNodes[0].nodeValue)
if (newRevision > tableRevision) {
@ -133,7 +133,7 @@ function refreshTable() {
if (filesList.length > 0 )
tableDiv.innerHTML = table.render()
else
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
}
var sortParam = "&key=" + sortKey + "&order=" + sortOrder
@ -164,7 +164,7 @@ function unshare(fileId) {
function showCommentForm(nodeId) {
var linkSpan = document.getElementById("comment-link-"+nodeId)
linkSpan.innerHTML=""
linkSpan.textContent=""
var commentDiv = document.getElementById("comment-"+nodeId)
var node = filesByPath.get(nodeId)
@ -181,7 +181,7 @@ function showCommentForm(nodeId) {
function cancelComment(nodeId) {
var commentDiv = document.getElementById("comment-"+nodeId)
commentDiv.innerHTML = ""
commentDiv.textContent = ""
var commentLink = new Link(_t("Comment"), "showCommentForm", [nodeId])

View File

@ -537,7 +537,7 @@ function hideComment(id) {
expandedComments.delete(id)
var commentDiv = document.getElementById("comment-" + id);
commentDiv.innerHTML = ""
commentDiv.textContent = ""
var showLink = "<a href='#' onclick='window.showCommentBy" + refreshType + "(\"" + id + "\"); return false;'>" + _t("Show Comment") + "</a>";
var linkSpan = document.getElementById("comment-link-"+id);
@ -559,7 +559,7 @@ function download(resultInfoHash) {
function markTrusted(host) {
var linkSpan = document.getElementById("trusted-link-"+host)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("trusted-"+host)
@ -578,7 +578,7 @@ function markNeutral(host) {
function markDistrusted(host) {
var linkSpan = document.getElementById("distrusted-link-"+host)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("distrusted-"+host)
@ -603,7 +603,7 @@ function submitDistrust(host) {
function cancelTrust(host) {
var textAreaSpan = document.getElementById("trusted-" + host)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("trusted-link-"+host)
var html = "<a href='#' onclick='markTrusted(\"" + host + "\"); return false;'>" + _t("Mark Trusted") + "</a>"
@ -612,7 +612,7 @@ function cancelTrust(host) {
function cancelDistrust(host) {
var textAreaSpan = document.getElementById("distrusted-" + host)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("distrusted-link-"+host)
var html = "<a href='#' onclick='markDistrusted(\"" + host + "\"); return false;'>" + _t("Mark Distrusted") + "</a>"
@ -672,7 +672,7 @@ function viewCertificatesByFile(fileSenderB64, count) {
linkSpan.innerHTML = hideLink
var fetchSpan = document.getElementById("certificates-" + fetch.divId)
fetchSpan.innerHTML = _t("Fetching Certificates")
fetchSpan.textContent = _t("Fetching Certificates")
}
}
xmlhttp.open("POST", "/MuWire/Certificate", true)
@ -685,7 +685,7 @@ function hideCertificatesByFile(fileSenderB64, count) {
certificateFetches.delete(id) // TODO: propagate cancel to core
var fetchSpan = document.getElementById("certificates-" + id)
fetchSpan.innerHTML = ""
fetchSpan.textContent = ""
var linkSpan = document.getElementById("certificates-link-" + id)
var linkText
@ -711,7 +711,7 @@ function viewCertificatesBySender(fileInfoHash, count) {
linkSpan.innerHTML = hideLink
var fetchSpan = document.getElementById("certificates-" + fetch.divId)
fetchSpan.innerHTML = _t("Fetching Certificates")
fetchSpan.textContent = _t("Fetching Certificates")
}
}
@ -726,7 +726,7 @@ function hideCertificatesBySender(fileInfoHash, count) {
certificateFetches.delete(id) // TODO: propagate cancel to core
var fetchSpan = document.getElementById("certificates-" + id)
fetchSpan.innerHTML = ""
fetchSpan.textContent = ""
var linkSpan = document.getElementById("certificates-link-" + id)
var linkText = _t("View {0} Certificates", count)
@ -848,7 +848,7 @@ function refreshStatus() {
if (statuses.length > 0)
activeDiv.innerHTML = table.render()
else
activeDiv.innerHTML = ""
activeDiv.textContent = ""
if (uuid != null) {
var newStatus = statusByUUID.get(uuid)
@ -875,9 +875,9 @@ function stopSearch(searchUUID) {
if (searchUUID == uuid) {
uuid = null
var element = document.getElementById("topTable" + refreshType)
element.innerHTML = ""
element.textContent = ""
element = document.getElementById("bottomTable" + refreshType)
element.innerHTML = ""
element.textContent = ""
}
refreshStatus()
}

View File

@ -9,12 +9,12 @@ function refreshStatus() {
var hopelessHosts = this.responseXML.getElementsByTagName("HopelessHosts")[0].childNodes[0].nodeValue
var timesBrowsed = this.responseXML.getElementsByTagName("TimesBrowsed")[0].childNodes[0].nodeValue
document.getElementById("incoming-connections").innerHTML = incomingConnections
document.getElementById("outgoing-connections").innerHTML = outgoingConnections
document.getElementById("known-hosts").innerHTML = knownHosts
document.getElementById("failing-hosts").innerHTML = failingHosts
document.getElementById("hopeless-hosts").innerHTML = hopelessHosts
document.getElementById("times-browsed").innerHTML = timesBrowsed
document.getElementById("incoming-connections").textContent = incomingConnections
document.getElementById("outgoing-connections").textContent = outgoingConnections
document.getElementById("known-hosts").textContent = knownHosts
document.getElementById("failing-hosts").textContent = failingHosts
document.getElementById("hopeless-hosts").textContent = hopelessHosts
document.getElementById("times-browsed").textContent = timesBrowsed
}
}
xmlhttp.open("GET", "/MuWire/Status", true);

View File

@ -110,7 +110,7 @@ var distrustedSortOrder = "descending"
function markTrusted(user) {
var linkSpan = document.getElementById("trusted-link-" + user)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("trusted-" + user)
@ -130,7 +130,7 @@ function submitTrust(user) {
function cancelTrust(user) {
var textAreaSpan = document.getElementById("trusted-" + user)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("trusted-link-" + user)
var html = "<a href='#' onclick='markTrusted(\"" + user + "\");return false;'>" + _t("Mark Trusted") + "</a>"
@ -143,7 +143,7 @@ function markNeutral(user) {
function markDistrusted(user) {
var linkSpan = document.getElementById("distrusted-link-" + user)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("distrusted-" + user)
@ -163,7 +163,7 @@ function submitDistrust(user) {
function cancelDistrust(user) {
var textAreaSpan = document.getElementById("distrusted-" + user)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("distrusted-link-" + user)
var html = "<a href='#' onclick='markDistrusted(\"" + user + "\");return false;'>" + _t("Mark Distrusted") + "</a>"
@ -254,7 +254,7 @@ function displayTrustedList(user) {
if (trusted.length > 0)
trustedDiv.innerHTML = table.render()
else
trustedDiv.innerHTML = ""
trustedDiv.textContent = ""
}
}
var sortParam = "&key=" + trustedSortKey + "&order=" + trustedSortOrder
@ -286,7 +286,7 @@ function displayDistrustedList(user) {
if (distrusted.length > 0)
distrustedDiv.innerHTML = table.render()
else
distrustedDiv.innerHTML = ""
distrustedDiv.textContent = ""
}
}
var sortParam = "&key=" + distrustedSortKey + "&order=" + distrustedSortOrder
@ -336,13 +336,13 @@ function refreshLists() {
if (listOfLists.length > 0)
trustListsDiv.innerHTML = table.render()
else
trustListsDiv.innerHTML = ""
trustListsDiv.textContent = ""
if (currentUser != null)
displayList(currentUser)
else {
document.getElementById("trusted").innerHTML = ""
document.getElementById("distrusted").innerHTML = ""
document.getElementById("trusted").textContent = ""
document.getElementById("distrusted").textContent = ""
}
}
}

View File

@ -87,7 +87,7 @@ function subscribe(host) {
function markTrusted(host) {
var linkSpan = document.getElementById("trusted-link-"+host)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("trusted-"+host)
@ -106,7 +106,7 @@ function markNeutral(host) {
function markDistrusted(host) {
var linkSpan = document.getElementById("distrusted-link-"+host)
linkSpan.innerHTML = ""
linkSpan.textContent = ""
var textAreaSpan = document.getElementById("distrusted-"+host)
@ -144,7 +144,7 @@ function publishTrust(host, reason, trust) {
function cancelTrust(host) {
var textAreaSpan = document.getElementById("trusted-" + host)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("trusted-link-"+host)
var html = "<a href='#' onclick='markTrusted(\"" + host + "\"); return false;'>" + _t("Mark Trusted") + "</a>"
@ -153,7 +153,7 @@ function cancelTrust(host) {
function cancelDistrust(host) {
var textAreaSpan = document.getElementById("distrusted-" + host)
textAreaSpan.innerHTML = ""
textAreaSpan.textContent = ""
var linkSpan = document.getElementById("distrusted-link-"+host)
var html = "<a href='#' onclick='markDistrusted(\"" + host + "\"); return false;'>" + _t("Mark Distrusted") + "</a>"
@ -202,7 +202,7 @@ function refreshDistrustedUsers() {
if (distrustedList.length > 0)
tableDiv.innerHTML = table.render()
else
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
}
var sortParam = "&key=" + distrustedUsersSortKey + "&order=" + distrustedUsersSortOrder
@ -240,7 +240,7 @@ function refreshTrustedUsers() {
if (trustedList.length > 0)
tableDiv.innerHTML = table.render()
else
tableDiv.innerHTML = ""
tableDiv.textContent = ""
}
}
var sortParam = "&key=" + trustedUsersSortKey + "&order=" + trustedUsersSortOrder

View File

@ -50,8 +50,8 @@ function refreshUploads() {
var clearLink = new Link(_t("Clear Finished"), "clear", ["ignored"])
clearDiv.innerHTML = clearLink.render()
} else {
uploadsDiv.innerHTML = ""
clearDiv.innerHTML = ""
uploadsDiv.textContent = ""
clearDiv.textContent = ""
}
}
}