Gartic background change

Choose the desired image or gif for the Gartic background

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

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 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.

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

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!)

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.

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

// ==UserScript==
// @name           Gartic background change
// @description    Choose the desired image or gif for the Gartic background
// @version        1.0
// @author         STRAGON
// @license        N/A
// @match          *://gartic.io/*
// @match          *://*/*?__cpo=aHR0cHM6Ly9nYXJ0aWMuaW8
// @icon           https://static.cdnlogo.com/logos/s/96/st.svg
// @grant          GM_addStyle
// @namespace      https://greatest.deepsurf.us/en/users/1353946-stragon-x
// ==/UserScript==

(function() {
    'use strict';

    var imageUrl = localStorage.getItem('imageUrl');

    if (window.location.href.indexOf('https://gartic.io') !== -1) {
        if (imageUrl) {
            GM_addStyle('body { background: url("' + imageUrl + '") no-repeat fixed center; background-size: cover; }');
        }

       var button = document.createElement('button');

        button.textContent = 'Change Background';
        button.style.zIndex = '99999';
        button.style.backgroundColor = 'red';
        button.style.position = 'fixed';
        button.style.bottom = '0px';
        button.style.right = '0px';
        button.style.padding = '10px 20px';
        button.style.fontSize = '16px';
        button.style.borderRadius = '5px';
        button.onclick = function() {
            var input = document.createElement('input');
            input.type = 'file';
            input.accept = 'image/*';
            input.onchange = function() {
                var file = input.files[0];
                var reader = new FileReader();
                reader.onload = function(event) {
                    var newImageUrl = event.target.result;
                    localStorage.setItem('imageUrl', newImageUrl);
                    GM_addStyle('body { background: url("' + newImageUrl + '") no-repeat fixed center; background-size: cover; }');
                };
                reader.readAsDataURL(file);
            };
            input.click();
        };
        document.body.appendChild(button);
        document.getElementById('background').remove();

    }
})();