2019-04-01 15:04:11 +02:00
|
|
|
import { delegate } from '@utils';
|
|
|
|
|
|
|
|
function updateReadMoreVisibility() {
|
|
|
|
const descBody = document.querySelector('.procedure-description-body');
|
|
|
|
if (descBody) {
|
|
|
|
// If the description text overflows, display a "Read more" button.
|
|
|
|
const isOverflowing = descBody.scrollHeight > descBody.clientHeight;
|
|
|
|
descBody.classList.toggle('read-more-enabled', isOverflowing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function expandProcedureDescription() {
|
|
|
|
const descBody = document.querySelector('.procedure-description-body');
|
|
|
|
descBody.classList.remove('read-more-collapsed');
|
|
|
|
}
|
|
|
|
|
2019-08-01 15:22:37 +02:00
|
|
|
addEventListener('ds:page:update', updateReadMoreVisibility);
|
2019-04-01 15:04:11 +02:00
|
|
|
addEventListener('resize', updateReadMoreVisibility);
|
|
|
|
|
|
|
|
delegate('click', '.read-more-button', expandProcedureDescription);
|