Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
/**
|
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
|
|
|
* https://www.drupal.org/node/2815083
|
|
|
|
* @preserve
|
|
|
|
**/
|
|
|
|
|
2021-12-18 06:12:16 +00:00
|
|
|
((Drupal, once) => {
|
2021-06-29 07:31:29 +00:00
|
|
|
function init(comments) {
|
2021-12-18 06:12:16 +00:00
|
|
|
comments.querySelectorAll('[data-drupal-selector="comment"]').forEach(comment => {
|
2021-06-29 07:31:29 +00:00
|
|
|
if (comment.nextElementSibling != null && comment.nextElementSibling.matches('.indented')) {
|
|
|
|
comment.classList.add('has-children');
|
|
|
|
}
|
|
|
|
});
|
2021-12-18 06:12:16 +00:00
|
|
|
comments.querySelectorAll('.indented').forEach(commentGroup => {
|
|
|
|
const showHideWrapper = document.createElement('div');
|
2021-06-29 07:31:29 +00:00
|
|
|
showHideWrapper.setAttribute('class', 'show-hide-wrapper');
|
2021-12-18 06:12:16 +00:00
|
|
|
const toggleCommentsBtn = document.createElement('button');
|
2021-06-29 07:31:29 +00:00
|
|
|
toggleCommentsBtn.setAttribute('type', 'button');
|
|
|
|
toggleCommentsBtn.setAttribute('aria-expanded', 'true');
|
|
|
|
toggleCommentsBtn.setAttribute('class', 'show-hide-btn');
|
|
|
|
toggleCommentsBtn.innerText = Drupal.t('Replies');
|
|
|
|
commentGroup.parentNode.insertBefore(showHideWrapper, commentGroup);
|
|
|
|
showHideWrapper.appendChild(toggleCommentsBtn);
|
2021-12-18 06:12:16 +00:00
|
|
|
toggleCommentsBtn.addEventListener('click', e => {
|
2021-06-29 07:31:29 +00:00
|
|
|
commentGroup.classList.toggle('hidden');
|
|
|
|
e.currentTarget.setAttribute('aria-expanded', commentGroup.classList.contains('hidden') ? 'false' : 'true');
|
|
|
|
});
|
Issue #3111409 by mherchel, proeung, larowlan, alexpott, lauriii, Gábor Hojtsy, andrewmacpherson, catch, xjm, andypost, rahulrasgon, rabbitlair, mrconnerton, poojakural, boulaffasae, jerseycheese, shimpy, Indrajith KB, DuneBL, kiran.kadam911, komalkolekar, keboca, hawkeye.twolf, andrewozone, Maithri Shetty, alexdmccabe, sd9121, Sreenivas Bttv, katannshaw, mgifford, nod_, webchick, mtift, rainbreaw, Berdir, brianperry, thejimbirch, Dom., q0rban, nitesh624, hansa11, himanshu_sindhwani, kostyashupenko, shaktik, bnjmnm, sharma.amitt16, sonam.chaturvedi, steinmb, shaal, ressa, Ramya Balasubramanian, Sebacic, pradeepjha, tanmaykadam, thedrupalkid, vinitk, volkswagenchick, viappidu, vebrovski, Ujval Shah, Webbeh, Yuri, trebormc, msuthars, mrinalini9, bash247, chetanbharambe, ellenoise, anevins, andriyun, CocoM, JayKandari, ambuj_gupta, hussainweb, jhodgdon, Pooja Ganjage, ju.vanderw, jwitkowski79, MaxPah, Lokender Singh2, jponch, KarenS, KarinG, Lal_: Add new Olivero frontend theme to Drupal 9.1 core as beta; later make it stable and the default
2020-10-16 09:43:55 +00:00
|
|
|
});
|
2021-06-29 07:31:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Drupal.behaviors.comments = {
|
2021-12-18 06:12:16 +00:00
|
|
|
attach(context) {
|
2021-06-29 07:31:29 +00:00
|
|
|
once('comments', '[data-drupal-selector="comments"]', context).forEach(init);
|
|
|
|
}
|
2021-12-18 06:12:16 +00:00
|
|
|
|
2021-06-29 07:31:29 +00:00
|
|
|
};
|
|
|
|
})(Drupal, once);
|