ReleaseV17+CorrectifEmojiMembres
This commit is contained in:
parent
c5948928c6
commit
c1d3fb9875
@ -1129,7 +1129,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
<div class="d-flex flex-wrap gap-1">
|
<div class="d-flex flex-wrap gap-1">
|
||||||
${roles.map(r => `
|
${roles.map(r => `
|
||||||
<span class="badge rounded-pill d-flex align-items-center" style="background-color: rgba(0,0,0,0.3); border: 1px solid ${r.color}; font-size: 0.7em; color: ${r.color}; font-weight: 500; padding: 2px 8px;">
|
<span class="badge rounded-pill d-flex align-items-center" style="background-color: rgba(0,0,0,0.3); border: 1px solid ${r.color}; font-size: 0.7em; color: ${r.color}; font-weight: 500; padding: 2px 8px;">
|
||||||
${r.icon_url ? `<img src="${r.icon_url}" style="width: 14px; height: 14px; margin-right: 4px; object-fit: contain;">` : ''}
|
${renderRoleIconJS(r.icon_url, '14px', 'me-1')}
|
||||||
${escapeHTML(r.name)}
|
${escapeHTML(r.name)}
|
||||||
</span>
|
</span>
|
||||||
`).join('')}
|
`).join('')}
|
||||||
@ -1869,19 +1869,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
} catch (e) { console.error(e); }
|
} catch (e) { console.error(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderRoleIconJS(icon, size = '14px') {
|
function renderRoleIconJS(icon, size = '14px', extraClass = 'ms-1') {
|
||||||
if (!icon) return '';
|
if (!icon) return '';
|
||||||
const isUrl = icon.startsWith('http') || icon.startsWith('/');
|
const isUrl = icon.startsWith('http') || icon.startsWith('/');
|
||||||
if (isUrl) {
|
if (isUrl) {
|
||||||
return `<img src="${escapeHTML(icon)}" class="role-icon ms-1" style="width: ${size}; height: ${size}; vertical-align: middle; object-fit: contain;">`;
|
return `<img src="${escapeHTML(icon)}" class="role-icon ${extraClass}" style="width: ${size}; height: ${size}; vertical-align: middle; object-fit: contain;">`;
|
||||||
} else if (icon.startsWith(':') && icon.endsWith(':')) {
|
} else if (icon.startsWith(':') && icon.endsWith(':')) {
|
||||||
const ce = (window.CUSTOM_EMOTES_CACHE || []).find(e => e.code === icon);
|
const ce = (window.CUSTOM_EMOTES_CACHE || []).find(e => e.code === icon);
|
||||||
if (ce) {
|
if (ce) {
|
||||||
return `<img src="${ce.path}" class="role-icon ms-1" style="width: ${size}; height: ${size}; vertical-align: middle; object-fit: contain;">`;
|
return `<img src="${ce.path}" class="role-icon ${extraClass}" style="width: ${size}; height: ${size}; vertical-align: middle; object-fit: contain;">`;
|
||||||
}
|
}
|
||||||
return `<span class="ms-1" style="font-size: ${size}; vertical-align: middle;">${escapeHTML(icon)}</span>`;
|
return `<span class="${extraClass}" style="font-size: ${size}; vertical-align: middle;">${escapeHTML(icon)}</span>`;
|
||||||
} else {
|
} else {
|
||||||
return `<span class="ms-1" style="font-size: ${size}; vertical-align: middle;">${escapeHTML(icon)}</span>`;
|
return `<span class="${extraClass}" style="font-size: ${size}; vertical-align: middle;">${escapeHTML(icon)}</span>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2169,7 +2169,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
item.className = 'list-group-item bg-dark text-white border-secondary p-2 d-flex align-items-center';
|
item.className = 'list-group-item bg-dark text-white border-secondary p-2 d-flex align-items-center';
|
||||||
item.innerHTML = `
|
item.innerHTML = `
|
||||||
<input class="form-check-input me-3 user-role-checkbox" type="checkbox" value="${role.id}" id="user-role-${role.id}" ${isChecked ? 'checked' : ''}>
|
<input class="form-check-input me-3 user-role-checkbox" type="checkbox" value="${role.id}" id="user-role-${role.id}" ${isChecked ? 'checked' : ''}>
|
||||||
<label class="form-check-label flex-grow-1" for="user-role-${role.id}" style="color: ${role.color}; cursor: pointer;">
|
<label class="form-check-label flex-grow-1 d-flex align-items-center" for="user-role-${role.id}" style="color: ${role.color}; cursor: pointer;">
|
||||||
|
${renderRoleIconJS(role.icon_url, '14px', 'me-2')}
|
||||||
${role.name}
|
${role.name}
|
||||||
</label>
|
</label>
|
||||||
`;
|
`;
|
||||||
|
|||||||
BIN
assets/pasted-20260221-165938-c8695a55.png
Normal file
BIN
assets/pasted-20260221-165938-c8695a55.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
12
index.php
12
index.php
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'auth/session.php';
|
require_once 'auth/session.php';
|
||||||
|
|
||||||
function renderRoleIcon($icon, $size = '14px') {
|
function renderRoleIcon($icon, $size = '14px', $extraClass = 'ms-1') {
|
||||||
if (empty($icon)) return '';
|
if (empty($icon)) return '';
|
||||||
$isUrl = (strpos($icon, 'http') === 0 || strpos($icon, '/') === 0);
|
$isUrl = (strpos($icon, 'http') === 0 || strpos($icon, '/') === 0);
|
||||||
$isFa = (strpos($icon, 'fa-') === 0);
|
$isFa = (strpos($icon, 'fa-') === 0);
|
||||||
$isCustomEmote = (strpos($icon, ':') === 0 && substr($icon, -1) === ':');
|
$isCustomEmote = (strpos($icon, ':') === 0 && substr($icon, -1) === ':');
|
||||||
|
|
||||||
if ($isUrl) {
|
if ($isUrl) {
|
||||||
return '<img src="' . htmlspecialchars($icon) . '" class="role-icon ms-1" style="width: '.$size.'; height: '.$size.'; vertical-align: middle; object-fit: contain;">';
|
return '<img src="' . htmlspecialchars($icon) . '" class="role-icon ' . $extraClass . '" style="width: '.$size.'; height: '.$size.'; vertical-align: middle; object-fit: contain;">';
|
||||||
} elseif ($isFa) {
|
} elseif ($isFa) {
|
||||||
return '<i class="fa-solid ' . htmlspecialchars($icon) . ' ms-1" style="font-size: '.$size.'; vertical-align: middle;"></i>';
|
return '<i class="fa-solid ' . htmlspecialchars($icon) . ' ' . $extraClass . '" style="font-size: '.$size.'; vertical-align: middle;"></i>';
|
||||||
} elseif ($isCustomEmote) {
|
} elseif ($isCustomEmote) {
|
||||||
// Fetch emote path
|
// Fetch emote path
|
||||||
static $ce_icons_cache;
|
static $ce_icons_cache;
|
||||||
@ -18,11 +18,11 @@ function renderRoleIcon($icon, $size = '14px') {
|
|||||||
try { $ce_icons_cache = db()->query("SELECT code, path FROM custom_emotes")->fetchAll(PDO::FETCH_KEY_PAIR); } catch (Exception $e) { $ce_icons_cache = []; }
|
try { $ce_icons_cache = db()->query("SELECT code, path FROM custom_emotes")->fetchAll(PDO::FETCH_KEY_PAIR); } catch (Exception $e) { $ce_icons_cache = []; }
|
||||||
}
|
}
|
||||||
if (isset($ce_icons_cache[$icon])) {
|
if (isset($ce_icons_cache[$icon])) {
|
||||||
return '<img src="' . htmlspecialchars($ce_icons_cache[$icon]) . '" class="role-icon ms-1" style="width: '.$size.'; height: '.$size.'; vertical-align: middle; object-fit: contain;">';
|
return '<img src="' . htmlspecialchars($ce_icons_cache[$icon]) . '" class="role-icon ' . $extraClass . '" style="width: '.$size.'; height: '.$size.'; vertical-align: middle; object-fit: contain;">';
|
||||||
}
|
}
|
||||||
return '<span class="ms-1" style="font-size: '.$size.'; vertical-align: middle;">' . htmlspecialchars($icon) . '</span>';
|
return '<span class="' . $extraClass . '" style="font-size: '.$size.'; vertical-align: middle;">' . htmlspecialchars($icon) . '</span>';
|
||||||
} else {
|
} else {
|
||||||
return '<span class="ms-1" style="font-size: '.$size.'; vertical-align: middle;">' . htmlspecialchars($icon) . '</span>';
|
return '<span class="' . $extraClass . '" style="font-size: '.$size.'; vertical-align: middle;">' . htmlspecialchars($icon) . '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user