Flowgame.io Custom Background!

Change the map background image

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Flowgame.io Custom Background!
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Change the map background image
// @author       Samira
// @match        *://*.flowgame.io/*
// @match        *://*.flowy.gg/*
// @grant        none
// @icon         https://www.google.com/s2/favicons?sz=64&domain=flowgame.io
// ==/UserScript==

window.addEventListener('load', function() {
    let url = localStorage.getItem('url');
    let backgroundImage = document.createElement('img');
    if (url) {
        backgroundImage.src = url;
    }

    let settings = [
        {
            name: 'url',
            title: 'Background Image URL',
            type: 'text',
            toolTip: 'Copy & paste the URL of an image that shall be used as map background',
            value: localStorage.getItem('url'),
            onChange: function(value) {
                url = value;
                localStorage.setItem('url', url);
                backgroundImage.src = url;
            }
        }
    ]

    let flow = window.flowExtensions.register('https://greasyfork.org/de/scripts/443067-flowgame-io-custom-background', settings);
    let originalDrawBackground = flow.drawBackground;
    flow.drawBackground = function(context, view) {
        if (url) {
            flow.drawImageBackground(context, view, backgroundImage, 0.5);
        } else {
            originalDrawBackground.call(flow, context, view);
        }
    };
});