css и js вынесены из файла comments_tree_sub.tpl
This commit is contained in:
@@ -298,3 +298,38 @@ html {
|
||||
opacity: 0.8;
|
||||
}
|
||||
.ico_delete_all:hover { opacity: 1; transform: scale(1.1); }
|
||||
|
||||
/* Стили для стандартной шапки поповера */
|
||||
.popover-header {
|
||||
background-color: #f0f0f0 !important; /* Тот самый серый цвет */
|
||||
border-bottom: 1px solid #dee2e6 !important;
|
||||
padding: 8px 12px !important;
|
||||
font-size: 0.9rem !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
/* Кнопка закрытия в шапке */
|
||||
.pop-close {
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
font-size: 22px !important;
|
||||
line-height: 1 !important;
|
||||
color: #999 !important;
|
||||
cursor: pointer !important;
|
||||
padding: 0 !important;
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.pop-close:hover {
|
||||
color: #f00 !important;
|
||||
}
|
||||
|
||||
.popover-body {
|
||||
padding: 12px !important;
|
||||
min-width: 230px !important;
|
||||
}
|
||||
.author-popover, .author-popover:focus, .author-popover:active {
|
||||
outline: none !important;
|
||||
box-shadow: none !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
@@ -371,6 +371,77 @@
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.closest('.pop-close')) {
|
||||
const pid = e.target.closest('.pop-close').getAttribute('data-id');
|
||||
const trigger = document.querySelector(`.author-popover[data-id="${pid}"]`);
|
||||
if (trigger) {
|
||||
const ins = bootstrap.Popover.getInstance(trigger);
|
||||
if (ins) ins.hide();
|
||||
trigger.blur();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const startInitialization = () => {
|
||||
if (typeof bootstrap === 'undefined') return false;
|
||||
|
||||
document.querySelectorAll('.author-popover').forEach(el => {
|
||||
if (el.getAttribute('data-popover-initialized')) return;
|
||||
|
||||
new bootstrap.Popover(el, {
|
||||
html: true,
|
||||
sanitize: false,
|
||||
trigger: 'focus',
|
||||
placement: 'top',
|
||||
// ВОТ ЗДЕСЬ ВОЗВРАЩАЕМ ШАПКУ
|
||||
title: function() {
|
||||
const cid = el.getAttribute('data-id');
|
||||
return `
|
||||
<span>${COMMENT_PUB_AUTOR_A}</span>
|
||||
<button type="button" class="pop-close" data-id="${cid}">×</button>
|
||||
`;
|
||||
},
|
||||
content: function() {
|
||||
const commentId = el.getAttribute('data-id');
|
||||
const popoverId = 'popover-content-' + commentId;
|
||||
|
||||
setTimeout(() => {
|
||||
const popContent = document.getElementById(popoverId);
|
||||
if (popContent && popContent.innerHTML === '...') {
|
||||
if (el.getAttribute('data-loading') === 'true') return;
|
||||
el.setAttribute('data-loading', 'true');
|
||||
|
||||
fetch('index.php?module=comment&action=postinfo&pop=1&Id=' + commentId)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
popContent.innerHTML = html;
|
||||
el.setAttribute('data-loading', 'false');
|
||||
})
|
||||
.catch(() => { popContent.innerHTML = 'Ошибка'; el.setAttribute('data-loading', 'false'); });
|
||||
}
|
||||
}, 30);
|
||||
return `<div id="${popoverId}">...</div>`;
|
||||
},
|
||||
template: `
|
||||
<div class="popover" role="tooltip">
|
||||
<div class="popover-arrow"></div>
|
||||
<h3 class="popover-header d-flex justify-content-between align-items-center"></h3>
|
||||
<div class="popover-body"></div>
|
||||
</div>`
|
||||
});
|
||||
el.setAttribute('data-popover-initialized', 'true');
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
let timer = setInterval(() => { if (startInitialization()) clearInterval(timer); }, 300);
|
||||
})();
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -1,41 +1,3 @@
|
||||
{literal}
|
||||
<style>
|
||||
/* Стили для стандартной шапки поповера */
|
||||
.popover-header {
|
||||
background-color: #f0f0f0 !important; /* Тот самый серый цвет */
|
||||
border-bottom: 1px solid #dee2e6 !important;
|
||||
padding: 8px 12px !important;
|
||||
font-size: 0.9rem !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
/* Кнопка закрытия в шапке */
|
||||
.pop-close {
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
font-size: 22px !important;
|
||||
line-height: 1 !important;
|
||||
color: #999 !important;
|
||||
cursor: pointer !important;
|
||||
padding: 0 !important;
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.pop-close:hover {
|
||||
color: #f00 !important;
|
||||
}
|
||||
|
||||
.popover-body {
|
||||
padding: 12px !important;
|
||||
min-width: 230px !important;
|
||||
}
|
||||
.author-popover, .author-popover:focus, .author-popover:active {
|
||||
outline: none !important;
|
||||
box-shadow: none !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
</style>
|
||||
{/literal}
|
||||
{foreach from=$subcomments item=c name=sub_loop}
|
||||
{* ОПРЕДЕЛЯЕМ СТАТУС УДАЛЕНИЯ *}
|
||||
{assign var="is_deleted" value=false}
|
||||
@@ -332,75 +294,3 @@
|
||||
|
||||
{/foreach}
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
// Глобальный обработчик для крестика
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.closest('.pop-close')) {
|
||||
const pid = e.target.closest('.pop-close').getAttribute('data-id');
|
||||
const trigger = document.querySelector(`.author-popover[data-id="${pid}"]`);
|
||||
if (trigger) {
|
||||
const ins = bootstrap.Popover.getInstance(trigger);
|
||||
if (ins) ins.hide();
|
||||
trigger.blur();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const startInitialization = () => {
|
||||
if (typeof bootstrap === 'undefined') return false;
|
||||
|
||||
document.querySelectorAll('.author-popover').forEach(el => {
|
||||
if (el.getAttribute('data-popover-initialized')) return;
|
||||
|
||||
new bootstrap.Popover(el, {
|
||||
html: true,
|
||||
sanitize: false,
|
||||
trigger: 'focus',
|
||||
placement: 'top',
|
||||
// ВОТ ЗДЕСЬ ВОЗВРАЩАЕМ ШАПКУ
|
||||
title: function() {
|
||||
const cid = el.getAttribute('data-id');
|
||||
return `
|
||||
<span>${COMMENT_PUB_AUTOR_A}</span>
|
||||
<button type="button" class="pop-close" data-id="${cid}">×</button>
|
||||
`;
|
||||
},
|
||||
content: function() {
|
||||
const commentId = el.getAttribute('data-id');
|
||||
const popoverId = 'popover-content-' + commentId;
|
||||
|
||||
setTimeout(() => {
|
||||
const popContent = document.getElementById(popoverId);
|
||||
if (popContent && popContent.innerHTML === '...') {
|
||||
if (el.getAttribute('data-loading') === 'true') return;
|
||||
el.setAttribute('data-loading', 'true');
|
||||
|
||||
fetch('index.php?module=comment&action=postinfo&pop=1&Id=' + commentId)
|
||||
.then(res => res.text())
|
||||
.then(html => {
|
||||
popContent.innerHTML = html;
|
||||
el.setAttribute('data-loading', 'false');
|
||||
})
|
||||
.catch(() => { popContent.innerHTML = 'Ошибка'; el.setAttribute('data-loading', 'false'); });
|
||||
}
|
||||
}, 30);
|
||||
return `<div id="${popoverId}">...</div>`;
|
||||
},
|
||||
template: `
|
||||
<div class="popover" role="tooltip">
|
||||
<div class="popover-arrow"></div>
|
||||
<h3 class="popover-header d-flex justify-content-between align-items-center"></h3>
|
||||
<div class="popover-body"></div>
|
||||
</div>`
|
||||
});
|
||||
el.setAttribute('data-popover-initialized', 'true');
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
let timer = setInterval(() => { if (startInitialization()) clearInterval(timer); }, 300);
|
||||
})();
|
||||
</script>
|
||||
{/literal}
|
||||
Reference in New Issue
Block a user