Greasy Fork is available in English.

GA Core (ManagerZone)

Núcleo compartido del GA ManagerZone Assistant: inicializa el namespace window.GA, expone mzFetch (byte-idéntico al monolito) y GA.cargarEnCruce (inyección unificada al input de Cruzar Usuarios). Pensado para @require desde el userscript principal. Debe cargarse PRIMERO.

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyfork.org/scripts/588168/1882655/GA%20Core%20%28ManagerZone%29.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         GA Core (ManagerZone)
// @namespace    https://control.managerzone.com/ga
// @version      1.0.0
// @description  Núcleo compartido del GA ManagerZone Assistant: inicializa el namespace window.GA, expone mzFetch (byte-idéntico al monolito) y GA.cargarEnCruce (inyección unificada al input de Cruzar Usuarios). Pensado para @require desde el userscript principal. Debe cargarse PRIMERO.
// ==/UserScript==

(function () {
    'use strict';

    // Namespace compartido entre el principal y todas las libraries @require.
    // En el sandbox de Tampermonkey, window.GA persiste a través de los
    // @require y del script principal (no se filtra a la página).
    window.GA = window.GA || {};
    const GA = window.GA;

    // ------------------------------------------------------------------
    //  mzFetch  — wrapper de GM_xmlhttpRequest (GET) que devuelve Promise.
    //  Cuerpo BYTE-IDÉNTICO al del monolito (userscript 1.7.2, líneas
    //  148–167). Lo usan ip-amistosos, cruce (resolveUser) y racimo.
    //
    //  NOTA: requiere que el PRINCIPAL declare `// @grant GM_xmlhttpRequest`
    //  en su metadata; los @grant no pueden ir en un archivo @require-ado.
    // ------------------------------------------------------------------
    function mzFetch(url) {
        return new Promise((resolve, reject) => {
            GM_xmlhttpRequest({
                method: "GET",
                url: url,
                onload: function(res) {
                    if (res.status === 200) {
                        resolve(res.responseText);
                    } else {
                        reject("Error HTTP: " + res.status);
                    }
                },
                onerror: function(err) {
                    reject(err);
                }
            });
        });
    }
    GA.mzFetch = mzFetch;

    // ------------------------------------------------------------------
    //  cargarEnCruce  — CÓDIGO NUEVO. Unifica la "danza" de inyección que
    //  hoy está duplicada en 4 sitios (limpiador, botones [+] de bidhistory,
    //  y dos en analizarTransferencias). Agrega uno o más tokens al input
    //  de "Cruzar Usuarios" (#ga-simple-cross-input), deduplicando
    //  case-insensitive y preservando el orden.
    //
    //  Semántica idéntica a las copias existentes:
    //    · split(/[ ,\t\n]+/) → trim → filter(Boolean) sobre lo ya cargado
    //    · dedup case-insensitive vía Set de minúsculas
    //    · join(', ')
    //
    //  @param   {string|Array<string|number>} nombres  token o lista.
    //  @returns {number}  cantidad de tokens efectivamente agregados.
    //
    //  Si el widget de cruce no está en la página, no hace nada y devuelve 0.
    //  Un caller que necesite distinguir "widget ausente" de "0 nuevos"
    //  (p. ej. para alertar) debe chequear el elemento antes de llamar.
    // ------------------------------------------------------------------
    GA.cargarEnCruce = function (nombres) {
        const input = document.getElementById('ga-simple-cross-input');
        if (!input) return 0;

        const actuales = input.value.split(/[ ,\t\n]+/).map(s => s.trim()).filter(Boolean);
        const lower = new Set(actuales.map(s => s.toLowerCase()));
        let agregados = 0;

        (Array.isArray(nombres) ? nombres : [nombres]).forEach(n => {
            n = String(n == null ? '' : n).trim();
            if (n && !lower.has(n.toLowerCase())) {
                actuales.push(n);
                lower.add(n.toLowerCase());
                agregados++;
            }
        });

        input.value = actuales.join(', ');
        return agregados;
    };

})();