Anima charsheet fixer

adds labels and sheeit

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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();