arya2004/cmt-autofill

Improve User Feedback in the Popup

开放

#5 创建于 2025年10月2日

 (1 条评论) (0 个反应) (1 位负责人)JavaScript (11 个派生)auto 404
good first issuehacktoberfesthacktoberfest-acceptedhtmljavascript

仓库指标

星标
 (6 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

The extension uses alert() to notify the user when authors are saved or when errors occur. This can be disruptive. Improve the user experience by displaying these messages inside the popup interface itself, as dismissible messages or notification banners.

File to modify: popup.js

How to do it: Replace alert() calls with a function that creates and appends a temporary message element to the popup's body.

Example:

function showMessage(msg, isError = false) {
  const el = document.createElement('div');
  el.textContent = msg;
  el.className = isError ? 'popup-message error' : 'popup-message success';
  document.body.appendChild(el);
  setTimeout(() => el.remove(), 2500);
}
// Replace alert('Saved!') with:
showMessage('Authors saved!');
// ...and for errors:
showMessage('An error occurred', true);

Also, add basic styles to your popup CSS.

贡献者指南