gfsd
This commit is contained in:
@@ -706,8 +706,8 @@
|
||||
}
|
||||
|
||||
const existingRemoveBtn = document.getElementById('banner-remove-btn');
|
||||
if (!existingRemoveBtn && bannerUploadBtn) {
|
||||
const actionsDiv = bannerUploadBtn.closest('.avatar-upload-actions');
|
||||
if (!existingRemoveBtn) {
|
||||
const actionsDiv = bannerUploadBtn ? bannerUploadBtn.closest('.avatar-upload-actions') : null;
|
||||
if (actionsDiv) {
|
||||
const editBtn = document.createElement('button');
|
||||
editBtn.type = 'button'; editBtn.id = 'banner-edit-btn';
|
||||
@@ -720,6 +720,32 @@
|
||||
btn.className = 'button button-danger';
|
||||
btn.textContent = 'Remove Banner';
|
||||
actionsDiv.appendChild(btn);
|
||||
} else {
|
||||
const menu = document.getElementById('banner-edit-menu');
|
||||
if (menu) {
|
||||
const editBtn = document.createElement('button');
|
||||
editBtn.type = 'button'; editBtn.id = 'banner-edit-btn';
|
||||
editBtn.style.cssText = 'display: block; width: 100%; text-align: left; padding: 5px 8px; background: none; border: none; color: #fff; cursor: pointer; font-size: 0.8em;';
|
||||
editBtn.textContent = 'Edit Position';
|
||||
editBtn.onmouseover = () => editBtn.style.background='#333';
|
||||
editBtn.onmouseout = () => editBtn.style.background='none';
|
||||
editBtn.onclick = () => menu.style.display='none';
|
||||
menu.insertBefore(editBtn, menu.firstChild);
|
||||
|
||||
const remBtn = document.createElement('button');
|
||||
remBtn.type = 'button'; remBtn.id = 'banner-remove-btn';
|
||||
remBtn.style.cssText = 'display: block; width: 100%; text-align: left; padding: 5px 8px; background: none; border: none; color: #e74c3c; cursor: pointer; font-size: 0.8em;';
|
||||
remBtn.textContent = 'Remove Banner';
|
||||
remBtn.onmouseover = () => remBtn.style.background='#333';
|
||||
remBtn.onmouseout = () => remBtn.style.background='none';
|
||||
remBtn.onclick = () => menu.style.display='none';
|
||||
menu.insertBefore(remBtn, menu.children[1]);
|
||||
|
||||
const hr = document.createElement('hr');
|
||||
hr.style.cssText = 'border: none; border-top: 1px solid #444; margin: 5px 0;';
|
||||
hr.id = 'banner-menu-hr';
|
||||
menu.insertBefore(hr, menu.children[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,12 +816,12 @@
|
||||
window._f0ckBannerEditBound = true;
|
||||
document.addEventListener('click', async (e) => {
|
||||
if (e.target.id === 'banner-edit-btn') {
|
||||
const preview = document.getElementById('banner-preview');
|
||||
const preview = document.getElementById('banner-preview') || document.getElementById('live-profile-preview-box');
|
||||
if (!preview) return;
|
||||
|
||||
const bgImg = preview.style.backgroundImage;
|
||||
const bgPos = preview.style.backgroundPosition;
|
||||
const bgSize = preview.style.backgroundSize;
|
||||
let bgImg = preview.style.backgroundImage || preview.style.getPropertyValue('--author-banner');
|
||||
let bgPos = preview.style.backgroundPosition || preview.style.getPropertyValue('--author-banner-position');
|
||||
let bgSize = preview.style.backgroundSize || preview.style.getPropertyValue('--author-banner-size');
|
||||
|
||||
const urlMatch = bgImg.match(/url\(['"]?(.*?)['"]?\)/);
|
||||
if (!urlMatch) return;
|
||||
@@ -847,6 +873,8 @@
|
||||
e.target.remove();
|
||||
const editBtn = document.getElementById('banner-edit-btn');
|
||||
if (editBtn) editBtn.remove();
|
||||
const menuHr = document.getElementById('banner-menu-hr');
|
||||
if (menuHr) menuHr.remove();
|
||||
|
||||
const bannerPreview = document.getElementById('banner-preview');
|
||||
if (bannerPreview) {
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<div class="profile-page-wrapper" style="max-width: 800px; margin: 0 auto; width: 100%; padding: 20px 10px; box-sizing: border-box;">
|
||||
<div class="profile_head" id="live-profile-preview-box" data-banner-user="{{ user.user || '' }}" style="position: relative; @if(user.banner_file && user_banner_enabled) --author-banner: url('/a/{{ user.banner_file }}'); --author-banner-position: {{ user.banner_position === 'center' ? 'center top' : (user.banner_position || 'center top') }}; --author-banner-size: {{ user.banner_size || 'cover' }}; @endif">
|
||||
@if(session && session.id === user.user_id && user_banner_enabled)
|
||||
<button id="inline-banner-edit-btn" style="position:absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; padding: 4px 8px; color: #fff; cursor: pointer; z-index: 10; font-size: 0.8em;" title="{{ t('profile.edit_banner', 'Edit Banner') }}">
|
||||
<i class="fa-solid fa-pen"></i> Edit Banner
|
||||
</button>
|
||||
<div id="inline-banner-edit-wrapper" style="position:absolute; top: 10px; right: 10px; z-index: 10;">
|
||||
<button id="inline-banner-edit-btn" onclick="const menu = document.getElementById('banner-edit-menu'); menu.style.display = menu.style.display === 'none' ? 'block' : 'none';" style="background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; padding: 4px 8px; color: #fff; cursor: pointer; font-size: 0.8em;" title="{{ t('profile.edit_banner', 'Edit Banner') }}">
|
||||
<i class="fa-solid fa-pen"></i> Edit Banner
|
||||
</button>
|
||||
<div id="banner-edit-menu" style="display: none; position: absolute; right: 0; top: 100%; margin-top: 5px; background: #222; border: 1px solid #444; border-radius: 4px; padding: 5px; min-width: 120px; box-shadow: 0 2px 10px rgba(0,0,0,0.5);">
|
||||
@if(user.banner_file)
|
||||
<button id="banner-edit-btn" onclick="document.getElementById('banner-edit-menu').style.display='none';" style="display: block; width: 100%; text-align: left; padding: 5px 8px; background: none; border: none; color: #fff; cursor: pointer; font-size: 0.8em;" onmouseover="this.style.background='#333'" onmouseout="this.style.background='none'">Edit Position</button>
|
||||
<button id="banner-remove-btn" onclick="document.getElementById('banner-edit-menu').style.display='none';" style="display: block; width: 100%; text-align: left; padding: 5px 8px; background: none; border: none; color: #e74c3c; cursor: pointer; font-size: 0.8em;" onmouseover="this.style.background='#333'" onmouseout="this.style.background='none'">Remove Banner</button>
|
||||
<hr id="banner-menu-hr" style="border: none; border-top: 1px solid #444; margin: 5px 0;">
|
||||
@endif
|
||||
<button onclick="document.getElementById('banner-choose-btn').click(); document.getElementById('banner-edit-menu').style.display='none';" style="display: block; width: 100%; text-align: left; padding: 5px 8px; background: none; border: none; color: #fff; cursor: pointer; font-size: 0.8em;" onmouseover="this.style.background='#333'" onmouseout="this.style.background='none'">Upload New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:none;">
|
||||
<button id="banner-choose-btn"></button>
|
||||
<input type="file" id="banner-file-input" accept="image/gif,image/jpeg,image/png,image/webp">
|
||||
@@ -386,13 +396,7 @@
|
||||
<script src="/s/js/settings.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
const bannerEditBtn = document.getElementById('inline-banner-edit-btn');
|
||||
const bannerChooseBtn = document.getElementById('banner-choose-btn');
|
||||
if (bannerEditBtn && bannerChooseBtn) {
|
||||
bannerEditBtn.addEventListener('click', () => {
|
||||
bannerChooseBtn.click();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const avatarEditBtn = document.getElementById('inline-avatar-btn');
|
||||
const avatarFileInput = document.getElementById('inline-avatar-file');
|
||||
|
||||
Reference in New Issue
Block a user