Roll20 Character Switcher

Switches the chatting character to the one who's sheet you clicked on

Verze ze dne 03. 02. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Roll20 Character Switcher
// @namespace    de.idrinth
// @homepage     https://github.com/Idrinth/Roll20-Character-Switcher
// @version      1.0.2
// @description  Switches the chatting character to the one who's sheet you clicked on
// @author       Idrinth
// @match        https://app.roll20.net/editor/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var a = function() {
        document.getElementsByTagName('body')[0].addEventListener('mousedown', function(event) {
            var e = window.event || event;
            if (e.target.tagName === 'BUTTON' && e.target.hasAttribute('type') && e.target.getAttribute('type') === 'roll') {
                var character = e.target;
                while (!character.hasAttribute('data-characterid')) {
                    if(!character.parentNode) {
                        return;
                    }
                    character = character.parentNode;
                }
                var id = 'character|' + character.getAttribute('data-characterid');
                var select = document.getElementById('speakingas');
                for (var i = 0; i < select.options.length; i++) {
                    if (select.options[i].value === id) {
                        select.selectedIndex = i;
                        return;
                    }
                }
            }
        });
    };
    eval('(' + a.toString() + '())');
})();