- Автор темы
- #1
Совместимость с XenForo:
Видимый копирайт:
Resource Manager: https://itnull.me/threads/10804

2.3Видимый копирайт:
НетResource Manager: https://itnull.me/threads/10804

- Создаем новый шаблон и называем 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>
- Идем в модификации и создаем новую
Первая модификация:
Шаблон: 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" />
