feat: implement UI privacy and aesthetic refinements (hidden usernames, random icons, compact layout)
This commit is contained in:
24
popup.js
24
popup.js
@@ -70,6 +70,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
return /[\u4E00-\u9FA5]/.test(str);
|
||||
}
|
||||
|
||||
const ICON_SET = [
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>', // User
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="2" width="16" height="20" rx="2" ry="2"/><line x1="9" y1="22" x2="9" y2="22"/><line x1="15" y1="22" x2="15" y2="22"/><line x1="12" y1="18" x2="12" y2="18"/><line x1="9" y1="14" x2="9" y2="14"/><line x1="15" y1="14" x2="15" y2="14"/><line x1="9" y1="10" x2="9" y2="10"/><line x1="15" y1="10" x2="15" y2="10"/><line x1="9" y1="6" x2="9" y2="6"/><line x1="15" y1="6" x2="15" y2="6"/></svg>', // Building
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>', // Shield
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3m-3-3l-2.5-2.5"/></svg>', // Key
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>', // Globe
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="7" width="20" height="14" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/></svg>', // Briefcase
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>', // Zap
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg>' // Database
|
||||
];
|
||||
|
||||
function getRandomIcon(seed) {
|
||||
// Use a simple hash of the seed (rule ID) to pick a stable icon
|
||||
let hash = 0;
|
||||
for (let i = 0; i < seed.length; i++) {
|
||||
hash = seed.charCodeAt(i) + ((hash << 5) - hash);
|
||||
}
|
||||
return ICON_SET[Math.abs(hash) % ICON_SET.length];
|
||||
}
|
||||
|
||||
// --- Auth View Controllers ---
|
||||
function showView(viewName) {
|
||||
if (loginView) loginView.classList.add('hidden');
|
||||
@@ -324,12 +344,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
<div class="drag-handle" title="拖拽排序">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 9h8M8 15h8" /></svg>
|
||||
</div>
|
||||
<div class="rule-icon-box">${getRandomIcon(rule.id)}</div>
|
||||
<div class="rule-info" data-id="${rule.id}" title="点击执行一键登录">
|
||||
<div class="rule-domain">
|
||||
${rule.clientName}
|
||||
<span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span>
|
||||
</div>
|
||||
<div class="rule-acc">帐号: ${rule.username}</div>
|
||||
</div>
|
||||
<div class="rule-actions">
|
||||
<button class="icon-btn btn-edit" data-id="${rule.id}" title="编辑此配置">
|
||||
@@ -365,9 +385,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'rule-item';
|
||||
li.innerHTML = `
|
||||
<div class="rule-icon-box">${getRandomIcon(rule.id)}</div>
|
||||
<div class="rule-info">
|
||||
<div class="rule-domain">${rule.clientName} <span class="rule-env env-${rule.env.toLowerCase().replace('_', '-')}">${rule.env.replace('_', ' ')}</span></div>
|
||||
<div class="rule-acc">帐号: ${rule.username}</div>
|
||||
</div>
|
||||
<div class="rule-actions">
|
||||
<button class="icon-btn btn-restore" data-id="${rule.id}" title="恢复到主列表">
|
||||
|
||||
Reference in New Issue
Block a user