MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / showRestoreNotification

Function showRestoreNotification

notes.js:2274–2327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2272
2273 // 显示恢复成功提示
2274 function showRestoreNotification() {
2275 // 移除已存在的提示框
2276 const existingNotification = document.querySelector('.nsn-restore-notification');
2277 if (existingNotification) {
2278 existingNotification.remove();
2279 }
2280
2281 // 创建提示框
2282 const notification = createElement('div', {
2283 className: 'nsn-restore-notification',
2284 style: {
2285 position: 'absolute',
2286 bottom: '60px',
2287 right: '20px',
2288 background: 'linear-gradient(135deg, #10b981, #059669)',
2289 color: 'white',
2290 padding: '8px 16px',
2291 borderRadius: '6px',
2292 fontSize: '12px',
2293 fontWeight: '500',
2294 boxShadow: '0 4px 20px rgba(16, 185, 129, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1)',
2295 zIndex: '1000000001',
2296 pointerEvents: 'none',
2297 opacity: '0',
2298 transform: 'translateY(20px)',
2299 transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
2300 backdropFilter: 'blur(10px)',
2301 border: '1px solid rgba(255, 255, 255, 0.2)'
2302 }
2303 }, ['✓ 已恢复到历史版本']);
2304
2305 // 确保提示框显示在弹窗内部
2306 dialog.appendChild(notification);
2307
2308 // 触发入场动画
2309 requestAnimationFrame(() => {
2310 notification.style.opacity = '1';
2311 notification.style.transform = 'translateY(0)';
2312 });
2313
2314 // 5秒后自动消失
2315 setTimeout(() => {
2316 if (notification && notification.parentNode) {
2317 notification.style.opacity = '0';
2318 notification.style.transform = 'translateY(20px)';
2319
2320 setTimeout(() => {
2321 if (notification && notification.parentNode) {
2322 notification.remove();
2323 }
2324 }, 300);
2325 }
2326 }, 5000);
2327 }
2328
2329
2330

Callers 1

restoreToVersionFunction · 0.85

Calls 1

createElementFunction · 0.85

Tested by

no test coverage detected