|
|
|
@ -64,7 +64,6 @@ define('forum/topic', [
|
|
|
|
|
addBlockQuoteHandler();
|
|
|
|
|
addCodeBlockHandler();
|
|
|
|
|
addParentHandler();
|
|
|
|
|
addDropupHandler();
|
|
|
|
|
addRepliesHandler();
|
|
|
|
|
addPostsPreviewHandler();
|
|
|
|
|
setupQuickReply();
|
|
|
|
@ -278,37 +277,6 @@ define('forum/topic', [
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Topic.applyDropup = function () {
|
|
|
|
|
const containerRect = this.getBoundingClientRect();
|
|
|
|
|
const dropdownEl = this.querySelector('.dropdown-menu');
|
|
|
|
|
const dropdownStyle = window.getComputedStyle(dropdownEl);
|
|
|
|
|
const dropdownHeight = dropdownStyle.getPropertyValue('height').slice(0, -2);
|
|
|
|
|
const offset = document.documentElement.style.getPropertyValue('--panel-offset').slice(0, -2);
|
|
|
|
|
|
|
|
|
|
// Toggler position (including its height, since the menu spawns above it),
|
|
|
|
|
// minus the dropdown's height and navbar offset
|
|
|
|
|
const dropUp = (containerRect.top + containerRect.height - dropdownHeight - offset) > 0;
|
|
|
|
|
this.classList.toggle('dropup', dropUp);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function addDropupHandler() {
|
|
|
|
|
// Locate all dropdowns
|
|
|
|
|
const topicEl = components.get('topic');
|
|
|
|
|
const target = topicEl.find('.dropdown-menu').parent();
|
|
|
|
|
$(target).on('shown.bs.dropdown', function () {
|
|
|
|
|
const dropdownEl = this.querySelector('.dropdown-menu');
|
|
|
|
|
if (dropdownEl.innerHTML) {
|
|
|
|
|
Topic.applyDropup.call(this);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
hooks.onPage('action:topic.tools.load', ({ element }) => {
|
|
|
|
|
Topic.applyDropup.call(element.get(0).parentNode);
|
|
|
|
|
});
|
|
|
|
|
hooks.onPage('action:post.tools.load', ({ element }) => {
|
|
|
|
|
Topic.applyDropup.call(element.get(0).parentNode);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addRepliesHandler() {
|
|
|
|
|
$('[component="topic"]').on('click', '[component="post/reply-count"]', function () {
|
|
|
|
|
const btn = $(this);
|
|
|
|
|