Add message details popup
This commit is contained in:
parent
4376169001
commit
1d7f0d5344
7 changed files with 66 additions and 116 deletions
27
reasoning.js
27
reasoning.js
|
@ -1,27 +0,0 @@
|
|||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const params = new URLSearchParams(location.search);
|
||||
const id = parseInt(params.get('mid'), 10);
|
||||
if (!id) return;
|
||||
try {
|
||||
const { subject, reasons } = await browser.runtime.sendMessage({ type: 'sortana:getReasons', id });
|
||||
document.getElementById('subject').textContent = subject;
|
||||
const container = document.getElementById('rules');
|
||||
for (const r of reasons) {
|
||||
const article = document.createElement('article');
|
||||
article.className = 'message mb-4';
|
||||
const header = document.createElement('div');
|
||||
header.className = 'message-header';
|
||||
header.innerHTML = `<p>${r.criterion}</p>`;
|
||||
const body = document.createElement('div');
|
||||
body.className = 'message-body';
|
||||
const pre = document.createElement('pre');
|
||||
pre.textContent = r.reason;
|
||||
body.appendChild(pre);
|
||||
article.appendChild(header);
|
||||
article.appendChild(body);
|
||||
container.appendChild(article);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('failed to load reasons', e);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue