SLAMP CPT

Universal Heatmap for Egypt, KSA, and UAE. No red if New Orders = 0.

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greasyfork.org/scripts/574274/1801204/SLAMP%20CPT.js

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

v// ==UserScript==
// @name         SLAMP CPT
// @namespace    http://tampermonkey.net/
// @version      2.8
// @description  Universal Heatmap for Egypt, KSA, and UAE. No red if New Orders = 0.
// @author       Gemini
// @match        https://eu.central.df.amazon.dev/slam*
// @grant        none
// @downloadURL  https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/slam_heatmap.user.js
// @updateURL    https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/slam_heatmap.user.js
// ==/UserScript==

(function() {
    'use strict';

    function applyHeatmap() {
        const headers = Array.from(document.querySelectorAll('th, [role="columnheader"]'));
        const cptIndex = headers.findIndex(h => h.textContent.includes('1st Cpt Date'));
        const newIndex = headers.findIndex(h => h.textContent.trim() === 'New');

        if (cptIndex === -1) return;

        const rows = document.querySelectorAll('tbody tr, [role="row"]');
        const now = new Date();

        rows.forEach(row => {
            if (row.querySelector('th')) return;
            const cells = Array.from(row.querySelectorAll('td, [role="gridcell"]'));
            const cptCell = cells[cptIndex];
            const newCell = (newIndex !== -1) ? cells[newIndex] : null;

            if (!cptCell) return;

            const cptText = cptCell.textContent.trim();
            const newCount = newCell ? (parseInt(newCell.textContent.trim()) || 0) : 1;

            if (!cptText || cptText === 'N/A' || !cptText.includes('T')) return;

            const cptDate = new Date(cptText);
            const diffInHours = (cptDate - now) / (1000 * 60 * 60);

            let bgColor = "";
            let borderColor = "";

            if (newCount === 0) {
                bgColor = "#e8f5e9"; // Done
                borderColor = "#388e3c";
            } else {
                if (diffInHours < 0) {
                    bgColor = "#fce4ec"; 
                    borderColor = "#e91e63";
                } else if (diffInHours <= 1) {
                    bgColor = "#ffcccc"; // RED
                    borderColor = "#d32f2f";
                } else if (diffInHours <= 2.5) {
                    bgColor = "#fff3e0"; // ORANGE
                    borderColor = "#f57c00";
                } else {
                    bgColor = "#e8f5e9"; // GREEN
                    borderColor = "#388e3c";
                }
            }

            cells.forEach(cell => {
                cell.style.setProperty('background-color', bgColor, 'important');
                cell.style.setProperty('border-bottom', `1px solid ${borderColor}`, 'important');
                cell.style.setProperty('color', '#000000', 'important');
            });
        });
    }

    function addHighlightButton() {
        if (document.getElementById('cpt-highlight-btn')) return;
        const btn = document.createElement('button');
        btn.id = 'cpt-highlight-btn';
        btn.innerText = '📊 Apply MENA Heatmap';
        btn.style.cssText = `position:fixed; top:15px; right:15px; z-index:10000; padding:10px 20px; background:#232f3e; color:#ffffff; border:2px solid #ff9900; border-radius:4px; font-weight:bold; cursor:pointer;`;
        btn.onclick = (e) => { e.preventDefault(); applyHeatmap(); };
        document.body.appendChild(btn);
    }

    document.addEventListener('click', () => setTimeout(applyHeatmap, 500));
    setInterval(applyHeatmap, 15000); 
    setTimeout(addHighlightButton, 2000);
})();