Toffu

Autofills Woffu schedule

Устаревшая версия за 11.02.2021. Перейдите к последней версии.

// ==UserScript==
// @name         Toffu
// @namespace    http://yelidmod.com/trendier
// @version      0.2
// @description  Autofills Woffu schedule
// @author       DonNadie
// @match        https://gotrendier.woffu.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', () => {
        const observer = new MutationObserver(() => {
            document.querySelectorAll('#signs input').forEach((input, i) => {
                if (input.value.length < 1) {
                    input.value = input.placeholder.substr(0, 5); // from 19:00:00 to 19:00
                    input.focus();
                    input.dispatchEvent(new Event("change"));
                }
            });
        });
        const $modal = document.getElementById('diary-edit');

        if ($modal != null) {
            observer.observe($modal, {
                attributes: true,
                attributeFilter: ["style"]
            });
        }
    }, false);
})();