15 lines
470 B
JavaScript
15 lines
470 B
JavaScript
|
|
// XSS prevention helper
|
||
|
|
function escapeHtml(text) {
|
||
|
|
const div = document.createElement('div');
|
||
|
|
div.textContent = text;
|
||
|
|
return div.innerHTML;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Get ticket ID from URL (handles both /ticket/123 and ?id=123 formats)
|
||
|
|
function getTicketIdFromUrl() {
|
||
|
|
const pathMatch = window.location.pathname.match(/\/ticket\/(\d+)/);
|
||
|
|
if (pathMatch) return pathMatch[1];
|
||
|
|
const params = new URLSearchParams(window.location.search);
|
||
|
|
return params.get('id');
|
||
|
|
}
|