GeoPixels - Ghost Template Manager

[DEPRECATED] Now part of GeoPixelcons++

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         GeoPixels - Ghost Template Manager
// @version      3.9.0
// @description  [DEPRECATED] Now part of GeoPixelcons++
// @author       ariapokoteng
// @match        *://geopixels.net/*
// @match        *://*.geopixels.net/*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=geopixels.net
// @grant        none
// @run-at       document-idle
// @namespace http://tampermonkey.net/
// ==/UserScript==
(function () {
    'use strict';

    const SCRIPT_NAME = 'GeoPixels - Ghost Template Manager';
    const STORAGE_KEY_SHOWN  = 'gpc-deprecated-notice-shown';
    const STORAGE_KEY_DETECT = 'gpc-deprecated-scripts-detected';
    const GPC_URL = 'https://greasyfork.org/en/scripts/572698-geopixelcons';

    // Check if GeoPixelcons++ is already installed (by its group button)
    function isGpcInstalled() {
        return !!document.getElementById('geopixelconsGroupBtn');
    }

    // Register this script in the detected list
    function register() {
        try {
            const list = JSON.parse(localStorage.getItem(STORAGE_KEY_DETECT) || '[]');
            if (!list.includes(SCRIPT_NAME)) {
                list.push(SCRIPT_NAME);
                localStorage.setItem(STORAGE_KEY_DETECT, JSON.stringify(list));
            }
        } catch {}
    }

    function showModal() {
        const detected = JSON.parse(localStorage.getItem(STORAGE_KEY_DETECT) || '[]');

        const overlay = document.createElement('div');
        overlay.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:1000000;display:flex;align-items:center;justify-content:center;font-family:system-ui,-apple-system,sans-serif;';

        const modal = document.createElement('div');
        modal.style.cssText = 'background:#fff;border-radius:12px;padding:28px 32px;max-width:480px;width:90%;box-shadow:0 20px 60px rgba(0,0,0,0.3);color:#1f2937;';

        const title = document.createElement('h2');
        title.textContent = 'Scripts Deprecated';
        title.style.cssText = 'margin:0 0 12px 0;font-size:20px;font-weight:700;color:#1e293b;';
        modal.appendChild(title);

        const desc = document.createElement('p');
        desc.style.cssText = 'margin:0 0 16px 0;font-size:14px;line-height:1.6;color:#475569;';
        desc.textContent = 'The following standalone extensions have been merged into GeoPixelcons++ and are no longer maintained. Please uninstall them and install GeoPixelcons++ instead.';
        modal.appendChild(desc);

        if (detected.length > 0) {
            const list = document.createElement('ul');
            list.style.cssText = 'margin:0 0 20px 0;padding:0 0 0 20px;font-size:13px;color:#64748b;line-height:1.9;';
            detected.forEach(n => { const li = document.createElement('li'); li.textContent = n; list.appendChild(li); });
            modal.appendChild(list);
        }

        const gpcNote = document.createElement('p');
        gpcNote.style.cssText = 'margin:0 0 16px 0;font-size:13px;color:#475569;';
        gpcNote.innerHTML = isGpcInstalled()
            ? '<strong>GeoPixelcons++ is already installed.</strong> You can safely uninstall the scripts listed above.'
            : 'GeoPixelcons++ bundles all of these features and more in a single script.';
        modal.appendChild(gpcNote);

        const installBtn = document.createElement('a');
        installBtn.href = GPC_URL; installBtn.target = '_blank'; installBtn.rel = 'noopener';
        installBtn.textContent = 'Get GeoPixelcons++ on Greasyfork';
        installBtn.style.cssText = 'display:block;text-align:center;background:#3b82f6;color:#fff;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:600;text-decoration:none;margin-bottom:10px;';
        installBtn.addEventListener('mouseenter', () => installBtn.style.background = '#2563eb');
        installBtn.addEventListener('mouseleave', () => installBtn.style.background = '#3b82f6');
        modal.appendChild(installBtn);

        const dismissBtn = document.createElement('button');
        dismissBtn.textContent = 'Got it';
        dismissBtn.style.cssText = 'display:block;width:100%;background:none;border:1px solid #d1d5db;color:#6b7280;padding:8px;border-radius:8px;font-size:13px;cursor:pointer;';
        dismissBtn.addEventListener('mouseenter', () => dismissBtn.style.background = '#f9fafb');
        dismissBtn.addEventListener('mouseleave', () => dismissBtn.style.background = 'none');
        dismissBtn.addEventListener('click', () => overlay.remove());
        modal.appendChild(dismissBtn);

        overlay.appendChild(modal);
        overlay.addEventListener('click', e => { if (e.target === overlay) overlay.remove(); });
        document.body.appendChild(overlay);
    }

    function showNoticebar() {
        const bar = document.createElement('div');
        bar.style.cssText = 'position:fixed;bottom:0;left:0;right:0;z-index:999999;background:#f59e0b;color:#1c1917;padding:10px 20px;display:flex;align-items:center;justify-content:center;gap:12px;font-family:system-ui,-apple-system,sans-serif;font-size:13px;font-weight:600;cursor:pointer;box-shadow:0 -2px 12px rgba(0,0,0,0.2);';
        bar.innerHTML = '<span>&#9888;&#xFE0E;</span><span>Important: some of your GeoPixels scripts have been deprecated &mdash; click here for details.</span>';
        bar.addEventListener('click', () => {
            bar.remove();
            localStorage.setItem(STORAGE_KEY_SHOWN, 'true');
            showModal();
        });
        document.body.appendChild(bar);
    }

    // Main: register immediately, then wait 10s before showing bar
    register();

    setTimeout(() => {
        if (localStorage.getItem(STORAGE_KEY_SHOWN) === 'true') return;
        showNoticebar();
    }, 10000);

})();