Anima charsheet fixer

adds labels and sheeit

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Anima charsheet fixer
// @namespace   @ᕕ( ᐛ )ᕗ
// @description adds labels and sheeit
// @include     https://app.roll20.net/editor/
// @version     1
// @grant       none
// run-at       document-idle
// ==/UserScript==


window.initialooze = function () {
    console.log('USERSCRIPT LOADEDED ᕕ( ᐛ )ᕗ ᕕ( ᐛ )ᕗ ᕕ( ᐛ )ᕗ');
    var addLabels = function () {
        jQuery('.charsheet.tab-pane .sheet-tab').before(function (ind) {
            var title = jQuery(this).attr('title');
            return '<label style=\'width:auto;display:inline-block;padding-left:20px;\' for=\'' + title + '\'>' + title + '</label>';
        }).css('width', 'auto');
        jQuery('.sheet-tab-content.sheet-tab1 .sheet-wrapper input.sheet-small_tab').before(function (ind) {
            var title = jQuery(this).attr('title');
            return '<label style=\'width:auto;display:inline-block;padding-right:3px;font-size:1em;\' for=\'' + title + '\'>' + title + '</label>';
        }).css({
            'width': 'auto',
                'margin-left': '0px'
        });
    };
    Campaign.characters.models.forEach(function (element, ind, arr) {
        var old = element.view.showDialog;
        element.view.showDialog = function () {
            var ret = old.apply(this, arguments);
            window.d20mine = window.d20;
            var sentinel = new MutationObserver(function () {
                addLabels();
            });
            var mutie = document.getElementsByClassName('sheetform') [0];
            var config = {
                attributes: true,
                childList: true,
                characterData: true
            };
            sentinel.observe(mutie, config); //sheetform shows up empty before showDialog ends
            return ret;
        };
    });
};
function waitForElement() {
    if (typeof Campaign !== 'undefined' && Campaign.gameFullyLoaded) {
        window.initialooze();
    } 
    else {
        setTimeout(function () {
            waitForElement();
        }, 1000);
    }
}
waitForElement();