Greasy Fork

'Delta - 999999 in 1

Delta - extension for agario, agar.io mod collection

目前为 2021-03-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         'Delta - 999999 in 1
// @name:ru      'Delta - 999999 в 1
// @description       Delta - extension for agario, agar.io mod collection
// @description:ru       Delta - расширение для агарио, сборник модов для agar.io
// @version      5.98
// @namespace    delta.agar
// @author       neo
// @icon         https://deltav4.gitlab.io/ext/assets/favicon.ico
// @match        *://agar.io/*
// @run-at       document-start
// @connect      ogario.ovh
// @connect      glitch.me
// @connect      ex-script.com
// @connect      gitlab.io
// @connect      127.0.0.1
// @connect      sigr.io
// @grant        GM.xmlHttpRequest
// @grant        GM.registerMenuCommand
// @grant        window.close
// ==/UserScript==

/*
  Copying and subsequent publication of this source code is prohibited. The publication of this user script is allowed, use the following links:
    - https://greasyfork.org/ru/scripts/399197-delta-999999-in-1
    - https://deltav4.gitlab.io/delta.gs.user.js
  If this user script does not start, write me a discord
  Если данное расширение не запускается, напишите мне в дискорд
  https://discord.gg/HHmyKW6
*/



try{
    GM.registerMenuCommand('\uD83D\uDF02\u2075 Delta 5', function() {
        window.location.href="https://agar.io/v5"
    });
    GM.registerMenuCommand('\uD83D\uDF02\u2074 Delta 4', function() {
        window.location.href="https://agar.io/v4"
    });
    GM.registerMenuCommand('\u2104 Legendmod (n/a)', function() {
        alert('Sorry, this mod is not available in this user-script')
    });
    GM.registerMenuCommand('\u24B6 Agar Tool (n/a)', function() {
        alert('Sorry, this mod is not available in this user-script')
    });
    GM.registerMenuCommand('\u2164 VANILLA (n/a)', function() {
        alert('Sorry, this mod is not available in this user-script')
    });
    GM.registerMenuCommand('\u1EFA HSLO', function() {
        window.location.href="https://agar.io/hslo"
    });
    GM.registerMenuCommand('\u2168 Agarix', function() {
        window.location.href="https://agar.io/ix"
    });
    GM.registerMenuCommand('\u00D8 Ogario', function() {
        window.location.href="https://agar.io/ogario"
    });
    GM.registerMenuCommand('\uD83D\uDDAD Delta Discord', function() {
        window.location.href="https://discord.gg/HHmyKW6"
    });
}catch(e){}

if(window.document && window.document.title === 'Attention Required! | Cloudflare'){
    return
}

if (window.location.host == 'agar.io' && window.location.pathname === '/' ) {
    window.stop()
    window.location.href = 'https://agar.io/delta';
    return;
}

if (window.location.pathname.indexOf('delta')>-1) {
    window.history && window.history.replaceState && window.history.replaceState({}, window.document.title, '/');
}



var webBase = 'https://deltav4.gitlab.io'
var devBase = 'http://127.0.0.1:5636/deltav4.gitlab.io/'
var defaultMode = 'v5'
var location = ''
var isDevMode = window.location.pathname.indexOf('dev') > -1
var modes = {
    "url":function(){
        // For developers
        // example http://agar.io/url?https://your.host.com/
        // add
        // @connect      your.host.com
        location = window.location.search.slice(1)
    },
    "ogario":function(){
        location = 'https://cdn.ogario.ovh/v4/beta/'
    },
    "v4":function(){
        location = (isDevMode?devBase:webBase)+'/v4/index.html'
    },
    "v5":function(){
        location = (isDevMode?devBase:webBase)+'/ext/index.html'
    },
    "ix":function(){
        location = 'https://sentinelix-source-agarix.glitch.me/'
    },
    "hslo540":function(){
        location = (isDevMode?devBase:webBase)+'/hslo540/index.html'
    },
    "hslo536":function(){
        location = (isDevMode?devBase:webBase)+'/hslo536/index.html'
    },
    "hslo532":function(){
        location = (isDevMode?devBase:webBase)+'/hslo532/index.html'
    },
    "hslo":function(){
        location = 'https://hslo.sigr.io/'
    }
}

for(var mode in modes){
    var isMatched = window.location.pathname.indexOf(mode) > -1
    if(isMatched) {
        modes[mode]()
        break;
    }
}
if(!isMatched) modes[defaultMode]()


document&&document.documentElement&&(document.documentElement.innerHTML = 'Extension is loading');

if(location==='none'){

}else{
    console.log('Extension location',location)
    loader()
}
function loader(){
        GM.xmlHttpRequest({
        method: "GET",
        url: location+'?'+Math.random(),
        onload: async function(e) {
            var blob = new Blob(['\ufeff'+e.responseText], {type:"text/html;charset=windows-1252"});
            var reader = new FileReader();
            reader.onload = function() {
                document.open();
                var str = reader.result
                if(isDevMode) str = str.replace(webBase,devBase)
                if(mode==='hslo') str = str.replace('<head>','<head><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>')
                document.write(str);
                document.close();
            }
            reader.readAsText(blob);

        }
    })
}