- // Switch fold/expand - up = fold
- if (event.target.classList.contains('fa-chevron-up')) {
- event.target.title = 'Expand';
- if (description != null) {
- description.style.display = 'none';
- }
- if (thumbnail != null) {
- thumbnail.style.display = 'none';
- }
+ if (foldAllButtons != null) {
+ [].forEach.call(foldAllButtons, function (foldAllButton) {
+ foldAllButton.addEventListener('click', function (event) {
+ event.preventDefault();
+ [].forEach.call(foldButtons, function (foldButton) {
+ // Retrieve description
+ var description = null;
+ var thumbnail = null;
+ var linklistItem = getParentByClass(foldButton, 'linklist-item');
+ if (linklistItem != null) {
+ description = linklistItem.querySelector('.linklist-item-description');
+ thumbnail = linklistItem.querySelector('.linklist-item-thumbnail');
+ if (description != null || thumbnail != null) {
+ foldButton.style.display = 'inline';
+ }
+ }
+
+ toggleFold(foldButton.firstElementChild, description, thumbnail);
+ });
+ foldAllButton.firstElementChild.classList.toggle('fa-chevron-down');
+ foldAllButton.firstElementChild.classList.toggle('fa-chevron-up');
+ });
+ });
+ }
+})(this, this.document);
+
+function toggleFold(button, description, thumb)
+{
+ // Switch fold/expand - up = fold
+ if (button.classList.contains('fa-chevron-up')) {
+ button.title = 'Expand';
+ if (description != null) {
+ description.style.display = 'none';