(() => { /** * Plugin Name: Фикс блоков в редакторе полей или в анкетах * Description: Фикс блоков в редакторе полей или в анкетах * Version: 1.0 * Author: Трофимов Никита Игоревич (Бородатый Геткурс) * Author URL: https://t.me/NiktarioN */ const changeFieldsSettingsEditorCSS = () => { ////////////////////////////////////////////////////////////////////////////////////// // ПАНЕЛЬ УПРАВЛЕНИЯ. НАЧАЛО // Определяем страницы, на которых будет работать скрипт const WORK_PAGES_LIST = [ // Страница создания дополнительных полей '/pl/logic/context/custom-fields', // Страница редактирования анкеты '/user/control/survey/update/id/', // Страница создания целей '/pl/teach/goal', ]; ////////////////////////////////////////////////////////////////////////////////////// // ПАНЕЛЬ УПРАЛЕНИЯ. КОНЕЦ // Определяем текущий адрес у пользователя const currentURLPage = decodeURIComponent(window.location.pathname); // Проверяем будет ли работать скрипт на текущей странице const checkWorkPages = WORK_PAGES_LIST.find((item) => { return currentURLPage.includes(item); }); // Если значение не определено, то скрипт не работает if (!checkWorkPages) { return; } // Редактируем кнопку с полями const buttonFields = document.querySelector('.control-buttons'); if (buttonFields) { buttonFields.style.cssText += 'position: sticky; top: 10px; z-index: 99'; } // Редактируем правый блок с настройками поля const FieldSettingsEditor = document.querySelector( '.field-settings-editor' ); if (FieldSettingsEditor) { FieldSettingsEditor.style.cssText += 'position: sticky; top: 10px;'; } }; window.addEventListener('DOMContentLoaded', changeFieldsSettingsEditorCSS); })();