Fix tooltip modal for story pages
This commit is contained in:
parent
252ecd3715
commit
c7d645ac28
4
js/application.min.js
vendored
4
js/application.min.js
vendored
File diff suppressed because one or more lines are too long
8
js/complete.min.js
vendored
8
js/complete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -71,7 +71,7 @@ get_header(
|
||||
do_action( 'fictioneer_story_after_header', $hook_args );
|
||||
?>
|
||||
|
||||
<section class="story__summary"><?php
|
||||
<section class="story__summary content-section"><?php
|
||||
if ( $password_required ) {
|
||||
if ( $password_note ) {
|
||||
echo '<div class="story__password-note infobox">' . $password_note . '</div>';
|
||||
|
@ -1623,25 +1623,27 @@ _$$('dialog').forEach(element => {
|
||||
});
|
||||
|
||||
// Open tooltip modal
|
||||
_$('.content-section')?.addEventListener('click', event => {
|
||||
if (event.target.closest('[data-click-action*="open-tooltip-modal"]') && !window.getSelection().toString()) {
|
||||
const modal = _$$$('fictioneer-tooltip-dialog');
|
||||
const header = event.target.dataset.dialogHeader;
|
||||
const content = event.target.dataset.dialogContent;
|
||||
_$$('.content-section').forEach(section => {
|
||||
section.addEventListener('click', event => {
|
||||
if (event.target.closest('[data-click-action*="open-tooltip-modal"]') && !window.getSelection().toString()) {
|
||||
const modal = _$$$('fictioneer-tooltip-dialog');
|
||||
const header = event.target.dataset.dialogHeader;
|
||||
const content = event.target.dataset.dialogContent;
|
||||
|
||||
if (content.length > 200) {
|
||||
modal.style.setProperty('--modal-width', '400px');
|
||||
} else {
|
||||
modal.style.removeProperty('--modal-width');
|
||||
if (content.length > 200) {
|
||||
modal.style.setProperty('--modal-width', '400px');
|
||||
} else {
|
||||
modal.style.removeProperty('--modal-width');
|
||||
}
|
||||
|
||||
if (header) {
|
||||
modal.querySelector('[data-finder="tooltip-dialog-header"]').innerHTML = header;
|
||||
}
|
||||
|
||||
modal.querySelector('[data-finder="tooltip-dialog-content"]').innerHTML = content;
|
||||
modal.showModal();
|
||||
}
|
||||
|
||||
if (header) {
|
||||
modal.querySelector('[data-finder="tooltip-dialog-header"]').innerHTML = header;
|
||||
}
|
||||
|
||||
modal.querySelector('[data-finder="tooltip-dialog-content"]').innerHTML = content;
|
||||
modal.showModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// =============================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user