Fixed weird HTML on showing encrypted fields on click

This commit is contained in:
snipe
2026-05-30 09:13:11 +01:00
parent ce434b3d04
commit a5493f11bc
8 changed files with 43 additions and 14 deletions
+6
View File
@@ -340,6 +340,12 @@ body {
z-index: 0 !important;
}
// Clip the absolutely-positioned fixed-column overlays so they cannot
// bleed past the container's bottom edge into the pagination area.
.bootstrap-table .fixed-table-container {
overflow: hidden;
}
@media print {
@page {
+20 -9
View File
@@ -2526,23 +2526,34 @@
// Function to add original value to elements
function addValue($element) {
// Get original value of the element
var originalValue = $element.text().trim();
var originalHtml = $element.html().trim();
var originalText = $element.text().trim();
var hasHtmlContent = originalHtml !== '' && originalHtml !== originalText;
// Show asterisks only for not empty values
if (originalValue !== '') {
// This is necessary to avoid loop because value is generated dynamically
if (originalValue !== '' && originalValue !== asterisks) $element.attr('value', originalValue);
// Show asterisks only for non-empty values
if (originalText !== '') {
var asterisks = '*'.repeat(11);
// Avoid reprocessing already-asterisked elements
if (originalText !== asterisks) {
if (hasHtmlContent) {
$element.data('encrypted-html', originalHtml);
}
$element.attr('value', originalText);
}
// Hide the original value and show a fixed-length asterisk placeholder
var asterisks = '*'.repeat(11);
$element.text(asterisks);
// Add click event to show original text
// Add click event to show original value
$element.click(function() {
var $this = $(this);
if ($this.text().trim() === asterisks) {
$this.text($this.attr('value'));
var savedHtml = $this.data('encrypted-html');
if (savedHtml) {
$this.html(savedHtml);
} else {
$this.text($this.attr('value'));
}
} else {
$this.text(asterisks);
}