UXInteract / task_039 /solution /code /index.html
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
5.57 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Content Safety Console</title>
<style>
*{box-sizing:border-box}body{margin:0;background:#f4f7fb;color:#1c2b42;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
header{background:#17243c;color:#fff;padding:22px max(24px,calc((100vw - 1100px)/2));display:flex;justify-content:space-between;align-items:center}
header strong{font-size:18px}header span{font-size:12px;color:#b2c1dc;background:#263754;border-radius:20px;padding:7px 12px}
main{max-width:1100px;margin:0 auto;padding:48px 24px 85px}.eyebrow{color:#5365bb;letter-spacing:.17em;font-size:11px;font-weight:800}
h1{font-size:clamp(32px,4vw,46px);letter-spacing:-.05em;margin:9px 0 11px}p.lead{color:#6b7b91;line-height:1.7;margin:0 0 34px}
.grid{display:grid;grid-template-columns:1.1fr .9fr;gap:22px}.card{background:#fff;border:1px solid #e1e8f1;border-radius:18px;padding:27px;box-shadow:0 14px 36px rgba(27,44,76,.05)}
h2{font-size:18px;margin:0 0 6px}.sub{font-size:13px;color:#7a879b;margin:0 0 22px;line-height:1.6}
label{display:block;font-size:13px;font-weight:700;margin:17px 0 8px}select,textarea{width:100%;border:1px solid #ccd7e6;border-radius:10px;padding:12px 14px;font:inherit;color:#273852;background:#fff;outline:none}textarea:focus,select:focus{border-color:#6678d1;box-shadow:0 0 0 4px #eff1ff}textarea{min-height:130px;resize:vertical;line-height:1.55}
button{border:0;border-radius:10px;background:#4d5fce;color:white;padding:12px 19px;font-weight:700;cursor:pointer;margin-top:17px}button:hover{background:#3b4ab5}.secondary{background:#e9edfb;color:#3a4e9f}.secondary:hover{background:#dce3fa}
.message{min-height:46px;border-radius:10px;padding:13px 15px;margin-top:20px;background:#f6f8fc;color:#68788d;font-size:14px}.message.blocked{background:#fff1ed;color:#a8442e}.message.ok{background:#eaf7ef;color:#24744b}
.audit{margin-top:23px}.audit h2{margin-bottom:14px}.audit-list{list-style:none;padding:0;margin:0;display:grid;gap:9px}.audit-list li{padding:14px 17px;border:1px solid #e2e8f1;border-radius:11px;background:#fff;font-size:13px;color:#52627c}.audit-list b{color:#b44735}.audit-list .empty{color:#96a2b3}
@media(max-width:720px){.grid{grid-template-columns:1fr}main{padding:35px 16px}.card{padding:22px}}
</style>
</head>
<body>
<header><strong>Answer / Content Safety</strong><span>Admin Demo</span></header>
<main>
<div class="eyebrow">CONTENT MODERATION</div>
<h1>Keep Every Submission Accountable</h1>
<p class="lead">Maintain a term list, simulate question, answer, and comment submissions, and review blocked attempts. This page runs offline.</p>
<div class="grid">
<section class="card" aria-label="Submit content">
<h2>Submit Content</h2><p class="sub">A submission that matches the term list is blocked, and both the original text and matched term are added to the audit log below.</p>
<label for="kind">Content Type</label><select id="kind"><option value="question">Question</option><option value="answer">Answer</option><option value="comment">Comment</option></select>
<label for="content">Content</label><textarea id="content" placeholder="Enter content to review…"></textarea>
<button id="submit">Check and Submit</button><div id="message" class="message" role="status">Waiting for a submission</div>
</section>
<section class="card" aria-label="Blocked-term settings">
<h2>Blocked-Term Settings</h2><p class="sub">Enter one term per line. Blank lines and comments beginning with # are ignored. Save changes to apply them immediately.</p>
<label for="words">Current Terms</label><textarea id="words"># Demo term list
spam-link
abuse-term
prohibited-ad</textarea>
<button id="save" class="secondary">Save Terms</button><div id="word-status" class="message" role="status">3 terms enabled</div>
</section>
</div>
<section class="audit"><h2>Blocked Attempt Audit</h2><ul id="audit-list" class="audit-list"><li class="empty">No blocked submissions</li></ul></section>
</main>
<script>
(()=>{
const wordsBox=document.getElementById('words'), content=document.getElementById('content');
const message=document.getElementById('message'),auditList=document.getElementById('audit-list');
let words=[];const audit=[];
function updateWords(){words=wordsBox.value.split(/\r?\n/).map(x=>x.trim()).filter(x=>x&&!x.startsWith('#'));document.getElementById('word-status').textContent=`${words.length} terms enabled`;}
document.getElementById('save').addEventListener('click',updateWords);
document.getElementById('submit').addEventListener('click',()=>{
const kind=document.getElementById('kind').value,text=content.value;
const match=words.find(w=>text.toLocaleLowerCase().includes(w.toLocaleLowerCase()));
message.className='message '+(match?'blocked':'ok');
message.textContent=match?`Submission blocked: contains "${match}"`:'Content passed the check and was accepted';
if(match){audit.push({kind,text,word:match});auditList.replaceChildren();for(const item of audit){const li=document.createElement('li'),strong=document.createElement('b');strong.textContent=`${item.kind} · ${item.word}`;li.append(strong,document.createTextNode(` — ${item.text}`));auditList.appendChild(li);}}
});
updateWords();
})();
</script>
</body>
</html>