Gamer_Hardox / Ogame : Galactic Slider

// ==UserScript==
// @name         Ogame : Galactic Slider
// @namespace    http://tampermonkey.net/
// @version      1.11
// @description  Coordinate spinners and destination validation in fleetdispatch 2
// @author       =Hardox=
// @license      MIT
// @homepageURL  https://openuserjs.org/scripts/Gamer_Hardox/
// @updateURL    https://openuserjs.org/meta/Gamer_Hardox/Ogame_Galactic_Slider.meta.js
// @downloadURL  https://openuserjs.org/install/Gamer_Hardox/Ogame_Galactic_Slider.user.js
// @match        https://*.ogame.gameforge.com/game/index.php?page=ingame&component=fleetdispatch*
// @icon         data:image/gif;base64,R0lGODlhGwAbAKU/AAAAAAEBAQMEBAkGAgYHCQcICg0JBAoMDgsOEA8SFRkRBhATFhEVGBYaHR0aFhccIBwcGhkdIigbCxoeIhkfIxsfJCMeFhsgIx8fIRsgJBwgJRwhJR8lKjYjDT8qDzgsHS8vLUUuEEoyE1Q4FFs8Fk8/KmFAF19CHGNCGG5JGnFKG3xSHoJWH4laIJJhI5pmJJxnJaFqJqlwKLN2KrZ4K7l7LMF/LcaDL82IMNCMN9OTQtOTQ9SWR9abUNecUuYhISH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAD8ALAAAAAAbABsAAAb+wN+Psykaj8gkRzhUXo4pmc2WUjaRnEtFU0T5vj6eSOncolouHPjr4ia37ooHxuNNeWtfO17kTOIoPDQobjJ5exmJiX9FFSM+K4qJHjZfPC45MnwTf5M8K3ChFSUlIBgfOIiLGhkVNjJwISw1Ojo1LB8YGhofOiYVwJzAJj4inCQ0eT40JxHOLDYUnNMaMjMWGiEzPWDc3DMizhE8IRDOnBA4LBYQLN7v3iwUDw8zKBAPEQUNDj0kDhBo9BhIsCANZxJatHDQoACAhzs6PMSxo6LFizgCPFSh4qFHADtCTLxIckfGjR0/AniRMkbJizE0rhT50cCNHSMAoHhpEYWVgIkKVI6wOEABDJ4wggYYIUMlgKEmBwDocJQkDIkPb2BVGULFjZwAFKCIgQNHDBRBJah48cLpxw47UrpVYTGoW48ScrSQ6lRGz7sfJbzIsaKD4Q4jaFyUoNIhAacSVsiYLONFCAUjVJhwWuCA5wKgQ4seTbrzDwSoU6P2zLr1AdWpmTCYvaB27QQLEuDWnXt3gtlCggAAOw==
// @grant        GM_addStyle
// @run-at       document-body
// ==/UserScript==

// Changelog v.1.1 : update to OGAME 8.0.0-pl7

(function() {

    'use strict';
    window.onload = Main;

    function Main() {

        let tempo1 = 0;
        let tempo2 = 0;
        let sG = 1;
        let sS = 1;
        let sP = 1;
        let MENSAJE = "Show selected system";
        let Mision =[];
        const less = 'https://gf2.geo.gfsrv.net/cdn10/45494a6e18d52e5c60c8fb56dfbcc4.gif';
        const more = 'https://gf3.geo.gfsrv.net/cdnea/fa0c8ee62604e3af52e6ef297faf3c.gif';
        const ico_lupa = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAsQAAALEBxi1JjQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAXJSURBVFiFvdZ/TNT3GcDx9+f74+4oHAcyKDKokR+H2royOGvnNhyrRJzS1jRr1tXUP7Z1i//Mbl1sO9I2/MHcaonZ2rUJcUkXbKZJZ8ucVbFQmy6zDvHX5goelCmC3gmoHOPuvnf37I87DDPAcTH6JM+fn8/zyufno0SE2UIp5QDWAI8BlcBCIAeljWmm6Y+FQ8eAD4AjIhKcdaI5Qs0GUErVAruAQuC8br/nn7krH4kufHhtSXDs6oM3vGf00XP/CE1euWhTunFZopHNItJ+2wClVAbwGvAssBNofPTI1R8HR680Xes5pQcGvWQUlpLlrsC+IA9r4ga9rTvof+9t0QzbrpgVek5EAvMWiMjNJL7M/YmsLqr9XkHB17/T78zNF0DSnZnyQEWlpDszBZDMvIWyeMMzUrfPK6ua28TxpYKQ0s0LQOX0eefK6cUzEoXfAzKyyyq+n56TZy1b/hVpbW2V42f/JZ/5JqRjOCAfDY3LO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//xd9fB6SlBqGhyivsCKfoPD+/ySmphl8fB6Rkhh9fCmrrTTJySirrQZVVSu5uzDKyxelpimwsB2Nji7V2CGamyWlpRdeXym0tSasqyWioyKfnxh8fR2wspPn6CGambD29fr+/RuHid/s6/j+/WXi4S3AwAFVVkG7upjFxR+VliKeoDPa3jHLzxZkZCCamvr9/CisrjbZ2iarrDLPzyiur6HX2PL29Gqysyirqyy6uyWsrSG3ufP+//T//y9xbwtUVRSamfz+/yapqUujpSezsprX1v39/xuJiyCWl73g3977+yXKyyCZnCCbng5bXTG1t3vp6kfh4y/IyZvc3ef7/AFQUSmyszPd3i2/v6Pl5Sasrvr//u7+/ybl5iOeoPH9/vH9/y/Fxh+/wiewsBJlZRyOkAplZiOjofj9/RyLjBZ8fRqChiq5uim5uSatrSWmpiCZmhyJiiiurimztvX8/COXmfX9//f8/lDk5p3g3xd8e9719qvY2Gnt7XXU0yy1tHzZ2SCrref5+BNvcuf8/Vro6ieztITw7zB9exizt+/7/B5oaBh+fRaWlxp+fpC8uxKKiyarqSWzsx9+fSavryu7uxqDgzLS0h6gob3W1CGRkjXW2CGQlIDu7CWlpxp9f9z4+KP19iHOzyWxryKdniG9vyCanQpaWglbXiKkpA9eXwxoaySfoCu+vizKyyuOji7JyjDj5Znf3jCCgyakplOKiizCw2menyKdoBNxcTDf36f08y28vy69viWusfL8+6Xj5iasr/r+//v//u79/Sbi5SShpMHv8COjpSOfofD9/y6xtDHg4iyzsxl8fTLExfX+/iSgoSaxseXy8hZ2diewsR6ysy69wCy9wR6PkghiZC3CwSGbmyOjo/r//TnLzByPjhmJih2Ljhl+gRuChB+RkyOenvL8/Ci4uSiwsSasrB2anCaqrCSkpSGZmx+SlC/FxxyKi////wAAACH5BAEAAP8ALAAAAAARABEAAAj/AP/50GPBnpkEfhAgSMADAxESnf5Jk2UjnSp8CTrUe/MAgQJquEzsaaYvBIARufjxuqLLizA84QLI+yNJhQIx50bd6MKF0JhTG4ogqEZOAwgjoX4YizbJ37E0vX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Oia0mRAaANfFoVBYA6J6lC3VuXZEzueY1u/fh2iVHoJ6YseJkkT949rxNSFAnrU83Fv4OASFRI9yuEnPc5MvALEy8Pps+SaLHwNAwSBfgA0MCeDjgQAI+7BGDBMnU8o8RkwRABjgBVLiMMgo8wM4Rs/wTEAA7';
        Mision[10] = '';
        Mision[11] = '';
        Mision[12] = '';
        Mision[13] = 'data:image/gif;base64,R0lGODlhEQARAOfHAFUAZlYAZ1gAaVkBalEEZl0AcmAAbVoCa2EAbmAAdGYAdmcAd2ECdWgAeGkAeWoAem0AgW4AgnAAhGgDgHEBhXkAiHgAj3sAinMDhnwAi34Akn8Ak4EAlH8AmnkDkYIAlYMAloUAnIYAnYACm3oFkocAnogAn4kAoIsBoYYCpo0AqJAAo44AqY8AqpAAq5UAtGcUd5gArpkAr5gAt48CwJMDrY4EsokHqKAAupkA0qEAu5oA1KIAvZQGrpsA1aMAvp8Az5wB1msZe6ACw5wDx6cAxZcD2qgAxp8FtZEIwpsGubAAxaYEwJgG27AA030WkbIA1K4B2a4A56gFz7UA3LMA4rQA47UA5bQA8ZARybsC4ckA4bAI3McA6JETy8IC7cEF3qkPw4gdn7wH4tMA59QA6MwD5ZgU1tUA6aoRxNcA69oA5cgF6bMQ3skJ6p4buLUV4M8N57UjzrMn1bcn0JU3o7kq06E+tLc60KJLtLNFzcBD58JE6LdOzcFO37Bhu7ZeyMFc0sxZ6sVf489h6bBxuMxl6stp5bV4xcJ2yMty3cV03NVv5s9x5cR81NR26sN/z7yHxtOF5tSO7NST3NuU89uc7N+g796m9N+r8eSt7eKv5+Kz8eO86uS79+e78eS96+W+7eu7+t3C5u2+7+bD6urC8evD8uzE8+3J8ejM8uzN7e3N+vDN9PDU+vPU9OnZ9PHZ9+7e+u/f+/Hh/PDk+Pbj+fTl9Pfk+vXm9fLn+/Lq9/Ps+Pfw/Pzy+f/0+/n2+/v4/fv9+v/8+v78//z/+/7//P///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH+Dm1hZGUgYnkgZmwwMHJpACH5BAEKAP8ALAAAAAARABEAAAj+AP+B2cKmoBs3Bbt0+aJQy78xKESsQFGjhgyLFlWkKHGiShcRKloowVGkyJxBRYaEUaRHxJY4J1T0oeOkTaVehKIwoiULCYotZEq8yVWL1ClProwNs9TKz4wVZNaskCHHlDBDtfZwwnRJkxMdLdCgQTGjCJxGuIJJqTLJ2KYoTFygIXNDxhQqVTIR24NFiipRr8K0WOOkgJgTNogcisXpkaBPvxZ5WBBlBwxYpRylmsXqlTFbeFB1mHCgyQ4hkYAZCxSKzpJOkmwB8tBgwI4mAQzUoVQLFA4cP1YZg2TBgW0jBApAuOOLl4sXL3rcGvVkgYAdQAIMWADhzy5EIk4+dMhTaEKCADt2HICAwcOGRCVEyBfhwYIEBjuyGKBwIcMGEh9sEOAGG1xQgQNZ/JNEeukZYUQTDzJ4Bg3/BAQAOw==';
        Mision[14] = "";
        Mision[15] = 'data:image/gif;base64,R0lGODlhEQARAPf/ADlYl017yjNQiUVtt0RprUFkpT1foz1foD1dozhZmDdamTZWkzJOhSU8azRQiP///iY+cENnrjxenz1ipC5KgEFjpEJprT9jp0ZknkBnq0dZgkRpqydCeCtEdzZdqGiS1yc/cDNXmz5kpkJwwUt2xjhgo2yMxsfS5jlirUFnsDtiqkJnqV2CwVN2t+/0+TVTj+Pp8X2YzneNs058zDxdnpGnzEJprsrT4UluslJqmkForDJQijpgoi5IfTpfn6y83TNTlcbV7HKGsTNPijhalUBsvElwukNglz5XkYWdxjBHdpmszCM4aUZutEFmrEBmrj1kqUBhoVJ5wEFmqTFbq5alvk9/0DBMhTFOhkJjqDhcnkRnrSlFfEt4w0FpsEFbkThXlPT5+f/+/jdWkf3+/TZUjqK21TFNiFh3rklzvTpfp/7+/SQ8biY+b0Jor0NprlN/zjliqkt7z0tvsVBpmzRRiUBorUFprPr8/EdtsUJoq1WB0SxIfj5jpmGL0jtfnj9krDZhsF5+vTFXoTFUlp2x1EpwtS1PjkBotH+WxDBMgX+b0EFquEduuPb2+lp+xE1zvVJ0rTtcnqizx0x0woCay5Soyjpdmj5foVd9wuzv9j1cmDFZot/k8TZfo3GX2fn5+naY1kJmrE1rpT5jpHye20BlqEprqLzP7TNRjEJmqkNlrUZttLXG50Zut7zL5mWL0bbH6jBMhzNOhs3a78/a7M3X6WGBvClDeDdWlClEeC1FezhMeE95x0VdiCY/dkVelkx70EhutEl2yPL4+TZYnFN7w5mw2zVVkmmLxkJprDRQijVVjzdXj0VprkVqrDZaoTFPiFl2q09+zkhwvcvU6TtdpCtPkjxenf///ZSozI2lzSY9bFF3wEJork18yjphp0NorVF+zSg+cMvU4Tphqkl6z/39/Ep0wkl0wDNXnnWOuzRQiThYmjtfoOju9Iqav/z+/fn8/PLz+D9lqUdts0BoqzZfqFSB0EdlnUdwt4qk0kFnqjxipP///wAAACH5BAEAAP8ALAAAAAARABEAAAj/AP9lWVVOxZZwEdxY8KZDz50Mff5Z0wJtSRI1ESzYefJGlCkRExAYsEejRI1KiNKke5SMmhFWyugZ8OJMwpQ4rtAN++YnVIBelAbw66cvjw8ogmDQKhVAzrQ9cEgsasEDkrA/gFic85ctyKdgVvCJk1JvQrdG7mwwauXvwQM8qD6Ym9GlyQVjqoikKAKL2AMxYVzEi+VnxAAJhiqwoSONkxl/8sgci3GiUyEMv5wVYOIrB6E582pVW2OCSiR4kzQ4qcCNy5lLHgo5yvQK1K1BhxgoIVCgQY8dCTzh0LQv0I93pw4pavOMVINdWHKtA7fNFop72sgh4QNiQxReuiikTcon6cANNMWuyaiCC8IKTOOiMQPT7oC6RJZCYANy5EUHBM1AIMAYCwCQgAKbCKFAArkgUwYHo/wDzBVDLOOAA+zsIEsdDswyCwVf/BMQADs=';

        let Cadena_HTML = `
        <div id="galactic_slider">
            <a class="spin spin_LG" data-spin="galaxy" data-step="-1"><img src=` + less + `></a>
            <a class="spin spin_MG" data-spin="galaxy" data-step= "1"><img src=` + more + `></a>
            <a class="spin spin_LS" data-spin="system" data-step="-1"><img src=` + less + `></a>
            <a class="spin spin_MS" data-spin="system" data-step= "1"><img src=` + more + `></a>
            <a class="spin spin_LP" data-spin="position" data-step="-1"><img src=` + less + `></a>
            <a class="spin spin_MP" data-spin="position" data-step= "1"><img src=` + more + `></a>
            <div id="labels" class="offset_labels">
                <div id="offset_galaxy" class="offset_G" title="">¤</div>
                <div id="offset_system" class="offset_S" title="">¤</div>
                <div id="offset_position" class="offset_P" title="">¤</div>
            </div>
            <div id="galaxy_view"><img id="img_lupa" class="img_lupa" title="" src="` + ico_lupa + `"></div>
        </div>
        `;
        let Tabla = document.getElementById('position');
        Tabla.insertAdjacentHTML('afterend', Cadena_HTML);
        $("#galactic_slider a").click(giradores);
        document.getElementById("galaxy").addEventListener('change', sincroniza, false);
        document.getElementById("system").addEventListener('change', sincroniza, false);
        document.getElementById("position").addEventListener('change', sincroniza, false);
        document.getElementById("slbox").addEventListener('click', sincroniza, false);
        document.getElementById("pbutton").addEventListener('click', dispara_cambio_tipo, false);
        document.getElementById("mbutton").addEventListener('click', dispara_cambio_tipo, false);
        document.getElementById("dbutton").addEventListener('click', dispara_cambio_tipo, false);
        document.getElementById("img_lupa").addEventListener('click', muestra_galaxia_destino, false);
        document.getElementById("offset_galaxy").addEventListener('click', espejo, false);
        document.getElementById("offset_system").addEventListener('click', espejo, false);
        Lupa_Tooltip();
        sincroniza();

        function giradores(e){
            let boton = e.target.parentElement;
            let i = boton.dataset.spin;
            let s = parseInt(boton.dataset.step, 10);
            let min = 1;
            let max = eval("MAX_" + i.toUpperCase());
            let val = coge_valor(i);
            switch (true) {
                case (s > 0):
                    ( val + s ) > max ? val = min : val = (val + s);
                    break;
                case (s < 0):
                    ( val + s ) < min ? val = max : val = (val + s);
                    break;
               default:
            }
            document.getElementById(i).value = val;
            fleetDispatcher.targetPlanet[i] = val;
            let offset = minimo_relativo(val, i, max);
            document.getElementById(("offset_" + i)).title = offset;
            Spin_trySubmitFleet2();
        }

        function minimo_relativo(s, i, max) {
            let rn = s - currentPlanet[i];
            let rp = (i!=="position" ? max - currentPlanet[i] + s : 999);
            return (Math.abs(rn) < Math.abs(rp) ? rn : rp);
        }

        function coge_valor(i){
            let v = parseInt(fleetDispatcher.targetPlanet[i]);
            if (Number.isNaN(v) || !Number.isInteger(v)) { v = currentPlanet[i] }
            return v;
        }

        function sincroniza(){
            let elementos = ["galaxy", "system", "position"];
            elementos.forEach(sincroniza_sub);
            Spin_trySubmitFleet2();
        }

        function sincroniza_sub(i){
            let val = coge_valor(i);
            let max = eval("MAX_" + i.toUpperCase());
            let offset = minimo_relativo(val, i, max);
            document.getElementById(("offset_" + i)).title = offset;
        }

        function espejo(e){
            let i = e.target.id.split("_")[1];
            let offset = (-1)* parseInt(e.target.title, 10);
            let min = 1;
            let max = eval("MAX_" + i.toUpperCase());
            if (offset == 0) {return}
            let val = offset + currentPlanet[i];
            if (val > max) {val = val - max};
            if (val < min) {val = max + val};
            document.getElementById(i).value = val;
            fleetDispatcher.targetPlanet[i] = val;
            document.getElementById(("offset_" + i)).title = offset;
            Spin_trySubmitFleet2();
        }

        function muestra_galaxia_destino() {
            showGalaxy(document.getElementById("galaxy").value, document.getElementById("system").value, document.getElementById("position").value);
        }

        function Restablece_img_lupa() {
            document.getElementById("img_lupa").className = "img_lupa";
        }

        function dispara_cambio_tipo(e) {
            if ( event.target.id == "dbutton" && fleetDispatcher.hasRecycler) {
                let boton_mision = "missionButton" + missions.MISSION_RECYCLE
                document.getElementById(boton_mision).click()
            }
            tempo2 = setTimeout(Spin_trySubmitFleet2, 50)
        }

        function Spin_trySubmitFleet2() {
            fleetDispatcher.updateTargetDropDowns();
            clearTimeout(fleetDispatcher.fetchTargetPlayerDataTimeout)
            fleetDispatcher.fetchTargetPlayerDataTimeout = null
            let that = fleetDispatcher;
            if (that.validateFleet2() === false) {return};
            let params = {};
	        fleetDispatcher.appendShipParams(params);
	        fleetDispatcher.appendTargetParams(params);
	        fleetDispatcher.appendTokenParams(params);
            params.union = fleetDispatcher.union;
            if (fleetDispatcher.hasColonizationShip()) {params.cs = 1};
            if (fleetDispatcher.hasRecycler()) {params.recycler = 1};
            //fleetDispatcher.startLoading();
            $.post(fleetDispatcher.checkTargetUrl, params, function (response) {
                let data = JSON.parse(response);
                let status = data.status || 'failure';
                //that.stopLoading();
                if (status === 'success') {
                    that.refreshDataAfterAjax(data);
                    if (that.union !== 0 && that.hasMission() === false && that.isMissionAvailable(that.fleetHelper.MISSION_UNIONATTACK)) {
                        that.selectMission(that.fleetHelper.MISSION_UNIONATTACK);
                    }
                    else if (that.hasMission() === false && that.isOnlyMissionAvailable(that.fleetHelper.MISSION_EXPEDITION)) {
                        that.selectMission(that.fleetHelper.MISSION_EXPEDITION);
                    }
                    document.getElementById("img_lupa").classList.remove("mal_destino");
                    document.getElementById("img_lupa").classList.add("buen_destino");
                    MENSAJE = '<b><a style="color:#00FF00; font-weight: bold";>&check;</a> ' + eventboxLoca.missions + ":</b><hr>";
                    fleetDispatcher.getAvailableMissions().forEach(Nombra_misiones);
                }
                else {
                    that.setTargetPlayerName("-");
                    that.setTargetPlayerRankIcon("");
                    document.getElementById("img_lupa").classList.remove("buen_destino");
                    document.getElementById("img_lupa").classList.add("mal_destino");
                    MENSAJE = '<p style="color:red";>&cross;</p><hr>' + data.errors[0].message;
                }
                fleetDispatcher.refreshFleet2();
                fleetDispatcher.refreshStatusBarFleet();
                that.updateToken(data.newAjaxToken);
                Lupa_Tooltip();
                tempo1 = setTimeout(Restablece_img_lupa, 500);
            })
        }

        function Nombra_misiones (n, index, matriz) {
            MENSAJE = MENSAJE + '<img src=' + Mision[n] + '> '+ orderNames[n] + (matriz.length !== (index+1) ? "<br>" : "");
        }

        function Lupa_Tooltip() {
            Tipped.remove('#img_lupa');
            document.getElementById("img_lupa").title = MENSAJE;
            Tipped.create('#img_lupa', { position: 'right', skin: 'cloud', size: 'x-small', maxWidth: 170});
        }
    }

    GM_addStyle(`

        .spin
        {
	        position: relative;
	        height: 12px !important;
	        width: 14px !important;
            top: 2px;
        }

        .spin:hover
        {
	        position: relative;
	        background: #0af788 !important;
	        height: 12px !important;
	        width: 14px !important;
        }

        .spin_LG
        {
            left: 20px;
        }

        .spin_MG
        {
            left: 28px;
        }

        .spin_LS
        {
            left: 40px;
        }

        .spin_MS
        {
            left: 48px;
        }

        .spin_LP
        {
            left: 58px;
        }

        .spin_MP
        {
            left: 66px;
        }

        #galaxy_view
        {
            position: relative;
            left: 146px;
            top: -95px;
            width: 22px
            display: block;
        }

        .img_lupa
        {
            display:block;
            position:relative;
            width: 20px;
            height: 20px;
            top: -15px;
            right: -2px;
            border-radius: 5px;
            cursor: pointer;
            padding: 2px;
            background-color: #14161800;
        }

        .img_lupa:hover
        {
            width: 22px;
            height: 22px;
            border-radius: 5px;
            cursor: pointer;
            box-shadow: 0 0 2px 1px #FF9600 inset;
            background-color: #212a33;
        }

        .mal_destino
        {
            background: linear-gradient(0deg, red, #0b0b0b12 40%, #030303 70%, red);
        }

        .buen_destino
        {
            background: linear-gradient(0deg, green, #0b0b0b12 40%, #030303 70%, green);
        }

        .offset_labels
        {
            cursor: help;
            color: #6f9fc8;
        }

        .offset_G {
	        position: relative;
	        font-size: 16px;
	        width: 5px;
	        top: -15px;
	        left: 33px;
        }

        .offset_S {
	        position: relative;
	        font-size: 16px;
	        width: 5px;
	        top: -35px;
	        left: 81px;
        }

        .offset_P {
            position: relative;
            font-size: 16px;
            width: 5px;
            top: -55px;
            left: 127px;
        }
`);

})();