[XGrid] XFRM: Resource Image Preview Update

XGrid

Житель
Регистрация
08.10.26
Сообщения
11
Реакции
4
Веб-сайт
t.me
Совместимость с XenForo: 2.3
Видимый копирайт: Нет
Resource Manager: https://itnull.me/threads/10804

2026-09-2614-31-11online-video-cutter.com1-ezgif.com-video-to-gif-converter.webp

  1. Создаем новый шаблон и называем xgrid_xfrm_preview_update
    HTML:
    <xf:css>.xgrid-resource-icon-preview { object-fit: cover; }</xf:css>
    <xf:js>
    (() =>
    {
        'use strict';
        document.addEventListener('change', event =>
        {
            const input = event.target.closest('input[type="file"][name="upload"]');
            if (!input) return;
    
            const file = input.files?.[0];
            if (!file || !file.type.startsWith('image/')) return;
    
            const row = input.closest('[data-template-name="public:xfrm_resource_edit_macros::resource_icon"]');
            if (!row) return;
    
            const icon = row.querySelector('.contentRow-figureIcon .avatar');
            if (!icon) return;
    
            icon.replaceChildren();
    
            const image = document.createElement('img');
            image.className = 'xgrid-resource-icon-preview';
            image.alt = file.name;
            image.src = URL.createObjectURL(file);
    
            icon.appendChild(image);
        });
    })();
    </xf:js>

  2. Идем в модификации и создаем новую

    Первая модификация:
    Шаблон: xfrm_category_add_resource
    Ключ: xgrid_ajax_icon_add_resource
    Найти:
    Код:
    </xf:title>
    Заменить:
    Код:
    $0
    <xf:include template="xgrid_xfrm_preview_update" />

    Вторая модификация:
    Шаблон: xfrm_resource_edit
    Ключ: xgrid_ajax_icon_resource_edit
    Найти:
    Код:
    </xf:title>
    Заменить:
    Код:
    $0
    <xf:include template="xgrid_xfrm_preview_update" />
 

Создайте аккаунт или войдите в систему, чтобы комментировать

Вы должны быть зарегистрированным, чтобы оставить комментарий

Создать аккаунт

Создайте аккаунт в нашем сообществе.

Войти

У вас уже есть аккаунт? Войдите здесь.

Похожие темы

Назад
Сверху Снизу