Note2Link / VSCode Sync for Dropbox

// ==UserScript==
// @name         VSCode Sync for Dropbox
// @namespace    http://note2link.com/
// @version      5.0.1
// @description  Enhance VSCode with Dropbox sync capabilities - Multi-language support with iOS 16 glass effect design
// @description:zh-CN  为 VSCode 增强 Dropbox 同步功能 - 多语言支持,采用 iOS 16 玻璃效果设计
// @description:zh-TW  為 VSCode 增強 Dropbox 同步功能 - 多語言支持,採用 iOS 16 玻璃效果設計
// @description:ar  تحسين VSCode مع قدرات مزامنة Dropbox - دعم متعدد اللغات مع تصميم تأثير الزجاج iOS 16
// @description:ru  Улучшение VSCode с возможностями синхронизации Dropbox - Многоязычная поддержка с дизайном стеклянного эффекта iOS 16
// @description:fa  بهبود VSCode با قابلیت‌های همگام‌سازی Dropbox - پشتیبانی چندزبانه با طراحی افکت شیشه‌ای iOS 16
// @description:tr  VSCode'u Dropbox senkronizasyon yetenekleri ile geliştirin - iOS 16 cam efekti tasarımı ile çok dilli destek
// @description:vi  Nâng cao VSCode với khả năng đồng bộ Dropbox - Hỗ trợ đa ngôn ngữ với thiết kế hiệu ứng kính iOS 16
// @author       Note2Link
// @match        https://code.visualstudio.com/*
// @match        https://*.code.visualstudio.com/*
// @match        https://vscode.dev/*
// @match        https://*.vscode.dev/*
// @match        https://github.dev/*
// @match        https://*.github.dev/*
// @match        https://www.dropbox.com/*
// @match        https://dropbox.com/*
// @match        https://*.dropbox.com/*
// @match        https://paper.dropbox.com/*
// @grant        none
// @icon         https://vscode.dev/static/stable/favicon.ico
// @compatible   chrome
// @compatible   firefox
// @compatible   safari
// @compatible   edge
// @compatible   opera
// @supportURL   https://note2link.com/en-US/vscode-sync-for-dropbox
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Multi-language translations
    const translations = {
        'en': {
            title: 'VSCode Sync for Dropbox',
            description: 'Enhance your VSCode experience with seamless Dropbox synchronization',
            features: [
                '🔄 Real-time sync with Dropbox',
                '📱 Cross-device accessibility',
                '🔒 Secure cloud storage',
                '⚡ Lightning-fast performance'
            ],
            button: 'Get VSCode Dropbox Sync',
            close: '✕'
        },
        'zh-CN': {
            title: 'VSCode Dropbox 同步',
            description: '通过无缝的 Dropbox 同步增强您的 VSCode 体验',
            features: [
                '🔄 与 Dropbox 实时同步',
                '📱 跨设备访问',
                '🔒 安全的云存储',
                '⚡ 闪电般的性能'
            ],
            button: '获取 VSCode Dropbox 同步',
            close: '✕'
        },
        'zh-TW': {
            title: 'VSCode Dropbox 同步',
            description: '通過無縫的 Dropbox 同步增強您的 VSCode 體驗',
            features: [
                '🔄 與 Dropbox 即時同步',
                '📱 跨裝置存取',
                '🔒 安全的雲端儲存',
                '⚡ 閃電般的效能'
            ],
            button: '取得 VSCode Dropbox 同步',
            close: '✕'
        },
        'ar': {
            title: 'مزامنة VSCode مع Dropbox',
            description: 'عزز تجربة VSCode الخاصة بك مع مزامنة Dropbox السلسة',
            features: [
                '🔄 مزامنة فورية مع Dropbox',
                '📱 إمكانية الوصول عبر الأجهزة',
                '🔒 تخزين سحابي آمن',
                '⚡ أداء سريع البرق'
            ],
            button: 'احصل على مزامنة VSCode Dropbox',
            close: '✕'
        },
        'ru': {
            title: 'Синхронизация VSCode с Dropbox',
            description: 'Улучшите свой опыт работы с VSCode благодаря бесшовной синхронизации с Dropbox',
            features: [
                '🔄 Синхронизация в реальном времени с Dropbox',
                '📱 Доступ с разных устройств',
                '🔒 Безопасное облачное хранилище',
                '⚡ Молниеносная производительность'
            ],
            button: 'Получить синхронизацию VSCode Dropbox',
            close: '✕'
        },
        'fa': {
            title: 'همگام‌سازی VSCode با Dropbox',
            description: 'تجربه VSCode خود را با همگام‌سازی یکپارچه Dropbox بهبود دهید',
            features: [
                '🔄 همگام‌سازی بلادرنگ با Dropbox',
                '📱 دسترسی چندپلتفرمی',
                '🔒 ذخیره‌سازی ابری امن',
                '⚡ عملکرد فوق‌العاده سریع'
            ],
            button: 'دریافت همگام‌سازی VSCode Dropbox',
            close: '✕'
        },
        'tr': {
            title: 'VSCode Dropbox Senkronizasyonu',
            description: 'Sorunsuz Dropbox senkronizasyonu ile VSCode deneyiminizi geliştirin',
            features: [
                '🔄 Dropbox ile gerçek zamanlı senkronizasyon',
                '📱 Çapraz cihaz erişilebilirliği',
                '🔒 Güvenli bulut depolama',
                '⚡ Şimşek hızında performans'
            ],
            button: 'VSCode Dropbox Senkronizasyonu Al',
            close: '✕'
        },
        'vi': {
            title: 'Đồng bộ VSCode với Dropbox',
            description: 'Nâng cao trải nghiệm VSCode của bạn với đồng bộ hóa Dropbox liền mạch',
            features: [
                '🔄 Đồng bộ thời gian thực với Dropbox',
                '📱 Truy cập đa thiết bị',
                '🔒 Lưu trữ đám mây an toàn',
                '⚡ Hiệu suất nhanh như chớp'
            ],
            button: 'Nhận Đồng bộ VSCode Dropbox',
            close: '✕'
        }
    };

    // Detect user language
    function getUserLanguage() {
        const browserLang = navigator.language || navigator.userLanguage;
        const langCode = browserLang.toLowerCase();
        
        if (langCode.startsWith('zh-cn') || langCode === 'zh') return 'zh-CN';
        if (langCode.startsWith('zh-tw') || langCode.startsWith('zh-hk')) return 'zh-TW';
        if (langCode.startsWith('ar')) return 'ar';
        if (langCode.startsWith('ru')) return 'ru';
        if (langCode.startsWith('fa')) return 'fa';
        if (langCode.startsWith('tr')) return 'tr';
        if (langCode.startsWith('vi')) return 'vi';
        
        return 'en'; // Default fallback
    }

    // Generate product URL based on user language
    function getProductURL(lang) {
        const baseURL = 'https://openuserjs.org/scripts/YourUsername/VSCode_Sync_for_Dropbox';
        const langParam = lang !== 'en' ? `?lang=${lang}` : '';
        return baseURL + langParam;
    }

    // Create and show banner
    function createBanner() {
        const userLang = getUserLanguage();
        const t = translations[userLang];
        const productURL = getProductURL(userLang);

        // Remove existing banner if present
        const existingBanner = document.getElementById('vscode-dropbox-banner');
        if (existingBanner) {
            existingBanner.remove();
        }

        // Create banner element
        const banner = document.createElement('div');
        banner.id = 'vscode-dropbox-banner';
        banner.innerHTML = `
            <div style="
                position: fixed;
                top: 50px;
                right: 20px;
                width: 350px;
                background: rgba(255, 255, 255, 0.1);
                backdrop-filter: blur(20px);
                -webkit-backdrop-filter: blur(20px);
                border: 1px solid rgba(255, 255, 255, 0.2);
                border-radius: 16px;
                padding: 20px;
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
                z-index: 10000;
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
                color: #333;
                animation: slideIn 0.3s ease-out;
            ">
                <div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px;">
                    <h3 style="margin: 0; font-size: 16px; font-weight: 600; color: #2d3748;">${t.title}</h3>
                    <button onclick="this.closest('#vscode-dropbox-banner').remove()" style="
                        background: none;
                        border: none;
                        font-size: 18px;
                        cursor: pointer;
                        color: #666;
                        padding: 0;
                        width: 24px;
                        height: 24px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        border-radius: 50%;
                        transition: background-color 0.2s;
                    " onmouseover="this.style.backgroundColor='rgba(0,0,0,0.1)'" onmouseout="this.style.backgroundColor='transparent'">${t.close}</button>
                </div>
                <p style="margin: 0 0 12px 0; font-size: 13px; line-height: 1.4; color: #4a5568;">${t.description}</p>
                <ul style="margin: 0 0 16px 0; padding-left: 16px; font-size: 12px; color: #4a5568;">
                    ${t.features.map(feature => `<li style="margin-bottom: 4px;">${feature}</li>`).join('')}
                </ul>
                <a href="${productURL}" target="_blank" style="
                    display: inline-block;
                    background: linear-gradient(135deg, #007ACC 0%, #005A9E 100%);
                    color: white;
                    text-decoration: none;
                    padding: 10px 16px;
                    border-radius: 8px;
                    font-size: 13px;
                    font-weight: 500;
                    transition: transform 0.2s, box-shadow 0.2s;
                    box-shadow: 0 2px 8px rgba(0, 122, 204, 0.3);
                " onmouseover="this.style.transform='translateY(-1px)'; this.style.boxShadow='0 4px 12px rgba(0, 122, 204, 0.4)'" onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 2px 8px rgba(0, 122, 204, 0.3)'">${t.button}</a>
            </div>
            <style>
                @keyframes slideIn {
                    from { transform: translateX(100%); opacity: 0; }
                    to { transform: translateX(0); opacity: 1; }
                }
            </style>
        `;

        document.body.appendChild(banner);
    }

    // Show banner immediately and then every 5 minutes
    createBanner();
    setInterval(createBanner, 5 * 60 * 1000);

})();