-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
96 lines (85 loc) · 4 KB
/
Copy pathindex.html
File metadata and controls
96 lines (85 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Sanitizer Web Tool</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header class="app-header">
<div class="header-inner">
<div class="brand">
<img src="logo.jpg" alt="Input Sanitizer Logo" class="logo">
<div>
<h1>Input Sanitizer Web Tool</h1>
<p class="subtitle">Sanitize untrusted HTML for safe display (XSS-focused). Not a server-side
validator.</p>
</div>
</div>
<button id="themeToggle" class="button secondary" type="button" aria-pressed="false">Dark mode</button>
</div>
</header>
<main class="container" role="main">
<section class="card">
<div id="status" class="status" role="status" aria-live="polite"></div>
<div class="settings">
<div class="field">
<label for="mode">Mode</label>
<select id="mode">
<option value="html" selected>HTML (sanitize)</option>
<option value="text">Plain text / code (escape)</option>
</select>
</div>
<label class="check">
<input id="allowStyles" type="checkbox">
<span>Allow CSS (<code><style></code> + <code>style=""</code>)</span>
</label>
<label class="check">
<input id="autoSanitize" type="checkbox" checked>
<span>Auto-sanitize while typing</span>
</label>
</div>
<div class="grid">
<div class="panel">
<label for="input" class="panel-title">Input</label>
<textarea id="input" placeholder="Paste untrusted HTML or text here…" spellcheck="false"></textarea>
</div>
<div class="panel">
<label for="output" class="panel-title">Sanitized output</label>
<textarea id="output" readonly spellcheck="false"></textarea>
<div class="button-row">
<button id="sanitizeButton" class="button primary" type="button">Sanitize</button>
<button id="clearButton" class="button secondary" type="button">Clear</button>
<button id="copyButton" class="button secondary" type="button">Copy</button>
<button id="downloadButton" class="button secondary" type="button">Download</button>
</div>
<div class="stats">
<span>Input: <strong id="inputCharCount" aria-live="polite">0</strong> chars</span>
<span>Output: <strong id="outputCharCount" aria-live="polite">0</strong> chars</span>
</div>
</div>
</div>
</section>
<section class="card">
<h2>Preview (sandboxed)</h2>
<p class="hint">This preview uses an <code><iframe sandbox></code> to prevent script execution.</p>
<iframe id="preview" class="preview" sandbox="" title="Sanitized preview"></iframe>
</section>
<section class="card">
<h2>Suggestions</h2>
<ul id="suggestionsList" class="suggestions"></ul>
</section>
</main>
<footer class="footer">
<p>Tip: Sanitization depends on context. Prefer safe DOM APIs (like <code>textContent</code>) whenever possible.
<br>
<br>
</p>
</footer>
<script defer src="https://cdn.jsdelivr.net/npm/dompurify@3.0.9/dist/purify.min.js"
integrity="sha384-3HPB1XT51W3gGRxAmZ+qbZwRpRlFQL632y8x+adAqCr4Wp3TaWwCLSTAJJKbyWEK"
crossorigin="anonymous"></script>
<script defer src="script.js"></script>
</body>
</html>