Space Exploration Mode - Galaxy Theme

It transforms every site into outer space - stars, planets, nebulae, shooting meteors.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Space Exploration Mode - Galaxy Theme
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  It transforms every site into outer space - stars, planets, nebulae, shooting meteors.
// @author       Mustafa Hakan
// @match        *://*/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    let stars = [], meteors = [], planets = [], nebulaParticles = [];
    let canvas, ctx, W, H, mouseX = 0, mouseY = 0, animId;
    let speed = 0, lastScroll = 0, scrollDirection = 0;

    const PLANET_TYPES = [
        { name: 'Dünya', emoji: '🌍', size: 60, glow: '#4a90d9', orbit: true },
        { name: 'Satürn', emoji: '🪐', size: 70, glow: '#d9a64a', orbit: true },
        { name: 'Jüpiter', emoji: '🪐', size: 80, glow: '#d9b87a', orbit: true },
        { name: 'Mars', emoji: '🔴', size: 40, glow: '#d94a4a', orbit: false },
        { name: 'Ay', emoji: '🌙', size: 35, glow: '#e8e8e8', orbit: false },
        { name: 'Güneş', emoji: '☀️', size: 90, glow: '#ffd700', orbit: false, bright: true },
        { name: 'Neptün', emoji: '🔵', size: 50, glow: '#4a6ad9', orbit: true },
        { name: 'Ateş Gezegeni', emoji: '🟠', size: 45, glow: '#ff6b35', orbit: true }
    ];

    function rand(a, b) { return Math.random() * (b - a) + a; }

    class Star {
        constructor() {
            this.reset(true);
        }
        reset(init) {
            this.x = rand(0, W);
            this.y = init ? rand(0, H) : -5;
            this.size = rand(0.5, 3);
            this.brightness = rand(0.3, 1);
            this.twinkleSpeed = rand(0.005, 0.03);
            this.twinkleOffset = rand(0, Math.PI * 2);
            this.color = ['#fff', '#ffd', '#ddf', '#fdf', '#dff'][Math.floor(rand(0, 5))];
            this.driftX = rand(-0.02, 0.02);
            this.driftY = rand(0.1, 0.5);
        }
        update() {
            this.y += this.driftY + scrollDirection * 0.5;
            this.x += this.driftX;
            if (this.y > H + 5) this.reset(false);
            if (this.x < 0) this.x = W;
            if (this.x > W) this.x = 0;
        }
        draw() {
            const twinkle = Math.sin(Date.now() * this.twinkleSpeed + this.twinkleOffset) * 0.3 + 0.7;
            const alpha = this.brightness * twinkle;
            ctx.fillStyle = this.color;
            ctx.globalAlpha = alpha;
            ctx.beginPath();
            ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
            ctx.fill();
            if (this.size > 1.5) {
                ctx.shadowColor = this.color;
                ctx.shadowBlur = this.size * 3;
                ctx.fill();
                ctx.shadowBlur = 0;
            }
            ctx.globalAlpha = 1;
        }
    }

    class Meteor {
        constructor() {
            this.reset();
        }
        reset() {
            this.x = rand(0, W);
            this.y = rand(-100, -10);
            this.length = rand(40, 120);
            this.speed = rand(3, 8);
            this.angle = rand(-0.3, -0.1);
            this.opacity = rand(0.6, 1);
            this.trail = [];
        }
        update() {
            this.trail.push({ x: this.x, y: this.y, alpha: 1 });
            if (this.trail.length > 15) this.trail.shift();
            this.trail.forEach(t => t.alpha -= 0.06);

            this.x += Math.cos(this.angle) * this.speed;
            this.y += Math.sin(this.angle) * this.speed + this.speed * 0.7;

            if (this.y > H + 50 || this.x < -50 || this.x > W + 50) {
                this.reset();
                this.y = rand(-200, -20);
            }
        }
        draw() {
            if (this.trail.length < 2) return;
            ctx.strokeStyle = '#fff';
            ctx.lineWidth = 1.5;
            ctx.lineCap = 'round';
            ctx.beginPath();
            ctx.moveTo(this.trail[0].x, this.trail[0].y);
            for (let i = 1; i < this.trail.length; i++) {
                ctx.lineTo(this.trail[i].x, this.trail[i].y);
            }
            ctx.stroke();

            ctx.fillStyle = '#fff';
            ctx.shadowColor = '#fff';
            ctx.shadowBlur = 8;
            ctx.beginPath();
            ctx.arc(this.x, this.y, 1.5, 0, Math.PI * 2);
            ctx.fill();
            ctx.shadowBlur = 0;
        }
    }

    class Planet {
        constructor() {
            const type = PLANET_TYPES[Math.floor(rand(0, PLANET_TYPES.length))];
            Object.assign(this, type);
            this.x = rand(100, W - 100);
            this.y = rand(80, H - 200);
            this.baseX = this.x;
            this.baseY = this.y;
            this.orbitRadius = rand(30, 80);
            this.orbitSpeed = rand(0.0002, 0.001);
            this.orbitAngle = rand(0, Math.PI * 2);
            this.floatOffset = rand(0, Math.PI * 2);
        }
        update() {
            this.floatOffset += 0.003;
            const floatY = Math.sin(this.floatOffset) * 8;

            if (this.orbit) {
                this.orbitAngle += this.orbitSpeed;
                this.x = this.baseX + Math.cos(this.orbitAngle) * this.orbitRadius;
                this.y = this.baseY + Math.sin(this.orbitAngle) * this.orbitRadius * 0.4 + floatY;
            } else {
                this.y = this.baseY + floatY;
                this.x += (mouseX - W / 2) * 0.0001;
            }

            this.x += scrollDirection * 0.1;

            if (this.x < -50) this.x = W + 50;
            if (this.x > W + 50) this.x = -50;
        }
        draw() {
            ctx.save();
            ctx.translate(this.x, this.y);

            if (this.bright) {
                const gradient = ctx.createRadialGradient(0, 0, this.size * 0.5, 0, 0, this.size * 2);
                gradient.addColorStop(0, 'rgba(255,255,200,0.3)');
                gradient.addColorStop(0.5, 'rgba(255,200,100,0.1)');
                gradient.addColorStop(1, 'rgba(255,150,0,0)');
                ctx.fillStyle = gradient;
                ctx.beginPath();
                ctx.arc(0, 0, this.size * 2, 0, Math.PI * 2);
                ctx.fill();
            }

            ctx.shadowColor = this.glow;
            ctx.shadowBlur = this.bright ? 40 : 20;
            ctx.font = this.size + 'px serif';
            ctx.textAlign = 'center';
            ctx.textBaseline = 'middle';
            ctx.fillText(this.emoji, 0, 0);
            ctx.shadowBlur = 0;

            if (this.orbit) {
                ctx.strokeStyle = 'rgba(255,255,255,0.05)';
                ctx.lineWidth = 1;
                ctx.setLineDash([3, 8]);
                ctx.beginPath();
                ctx.ellipse(0, -Math.sin(this.floatOffset) * 8, this.orbitRadius, this.orbitRadius * 0.4, 0, 0, Math.PI * 2);
                ctx.stroke();
                ctx.setLineDash([]);
            }

            ctx.restore();
        }
    }

    class Nebula {
        constructor() {
            this.reset();
        }
        reset() {
            this.x = rand(0, W);
            this.y = rand(0, H);
            this.size = rand(100, 300);
            this.color = ['rgba(100,50,200,', 'rgba(50,100,200,', 'rgba(200,50,150,', 'rgba(50,200,150,', 'rgba(200,100,50,'][Math.floor(rand(0, 5))];
            this.opacity = rand(0.015, 0.04);
            this.driftX = rand(-0.1, 0.1);
            this.driftY = rand(-0.1, 0.1);
        }
        update() {
            this.x += this.driftX;
            this.y += this.driftY + scrollDirection * 0.2;
            if (this.x < -this.size) this.x = W + this.size;
            if (this.x > W + this.size) this.x = -this.size;
            if (this.y < -this.size) this.y = H + this.size;
            if (this.y > H + this.size) this.y = -this.size;
        }
        draw() {
            const gradient = ctx.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.size);
            gradient.addColorStop(0, this.color + this.opacity + ')');
            gradient.addColorStop(1, 'rgba(0,0,0,0)');
            ctx.fillStyle = gradient;
            ctx.beginPath();
            ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
            ctx.fill();
        }
    }

    function createSky() {
        stars = [];
        for (let i = 0; i < 250; i++) stars.push(new Star());
        meteors = [];
        for (let i = 0; i < 3; i++) meteors.push(new Meteor());
        planets = [];
        for (let i = 0; i < 5; i++) planets.push(new Planet());
        nebulaParticles = [];
        for (let i = 0; i < 6; i++) nebulaParticles.push(new Nebula());
    }

    function init() {
        if (document.getElementById('space-canvas')) return;

        canvas = document.createElement('canvas');
        canvas.id = 'space-canvas';
        canvas.style.cssText = `
            position:fixed;top:0;left:0;width:100%;height:100%;
            z-index:2147483640;pointer-events:none;
            background:linear-gradient(180deg,#000011,#0a0a2e 30%,#0d0d1a 60%,#000011);
        `;
        document.body.appendChild(canvas);

        W = canvas.width = window.innerWidth;
        H = canvas.height = window.innerHeight;
        ctx = canvas.getContext('2d');

        createSky();

        window.addEventListener('resize', () => {
            W = canvas.width = window.innerWidth;
            H = canvas.height = window.innerHeight;
            createSky();
        });

        document.addEventListener('mousemove', (e) => {
            mouseX = e.clientX;
            mouseY = e.clientY;
        });

        window.addEventListener('scroll', () => {
            const currentScroll = window.scrollY;
            scrollDirection = currentScroll - lastScroll;
            lastScroll = currentScroll;
            speed = Math.abs(scrollDirection);
            if (speed > 50) speed = 50;
            setTimeout(() => { scrollDirection *= 0.5; }, 200);
        });

        loop();
    }

    function loop() {
        ctx.clearRect(0, 0, W, H);

        const bgGrad = ctx.createLinearGradient(0, 0, 0, H);
        bgGrad.addColorStop(0, '#000011');
        bgGrad.addColorStop(0.3, '#0a0a2e');
        bgGrad.addColorStop(0.6, '#0d0d1a');
        bgGrad.addColorStop(1, '#000011');
        ctx.fillStyle = bgGrad;
        ctx.fillRect(0, 0, W, H);

        nebulaParticles.forEach(n => { n.update(); n.draw(); });
        stars.forEach(s => { s.update(); s.draw(); });
        planets.forEach(p => { p.update(); p.draw(); });
        meteors.forEach(m => { m.update(); m.draw(); });

        if (speed > 5) {
            for (let i = 0; i < Math.floor(speed / 3); i++) {
                const star = new Star();
                star.y = rand(0, H);
                star.driftY = speed * 0.3;
                star.draw();
            }
        }

        ctx.fillStyle = 'rgba(255,255,255,0.02)';
        ctx.font = '12px monospace';
        ctx.fillText('✦ UZAY KEŞİF MODU ✦', 20, H - 20);
        ctx.fillText('Mustafa Hakan', W - 130, H - 20);

        animId = requestAnimationFrame(loop);
    }

    function addInfoBadge() {
        const badge = document.createElement('div');
        badge.style.cssText = `
            position:fixed;top:15px;right:15px;background:rgba(0,0,0,0.6);
            color:#fff;padding:8px 14px;border-radius:20px;font-size:11px;
            z-index:2147483645;font-family:system-ui;pointer-events:none;
            border:1px solid rgba(255,255,255,0.1);letter-spacing:0.5px;
        `;
        badge.innerHTML = '🪐 Uzay Modu Aktif • Kaydır ===>';
        document.body.appendChild(badge);
        setTimeout(() => { badge.style.opacity = '0'; badge.style.transition = 'opacity 2s'; }, 8000);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', () => setTimeout(init, 500));
    } else {
        setTimeout(init, 500);
    }
    setTimeout(addInfoBadge, 1000);

    console.log('🪐 Uzay Keşif Modu Aktif | Sayfayı kaydır, yıldızlara bak |');
})();