From cfb03854bf3373109dacadff5044ac4498654756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Raddaoui=20Mar=C3=ADn?= Date: Sun, 31 Jan 2016 13:12:49 +0100 Subject: [PATCH] Change fields affected by expander, refs #9266 Apply expander to all fields except those with only one child, if that child is a list --- js/qubit.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/js/qubit.js b/js/qubit.js index f51ee33613..9644e62c36 100644 --- a/js/qubit.js +++ b/js/qubit.js @@ -17,14 +17,19 @@ window.log = function() Drupal.behaviors.expander = { attach: function (context) { - jQuery('div.field:not(:has(div.field)) > div:not(:has(ul, li))') - .expander({ - slicePoint: 255, - expandText: '»', - expandPrefix: '... ', - userCollapseText: '«', - widow: 4, - expandEffect: 'show' - }); + jQuery('div.field:not(:has(div.field)) > div').each(function (index, element) { + var $element = jQuery(element); + // Don't apply expander to fields with only one child, if that child is a list + if ($element.children().length !== 1 || !$element.children().first().is('ul')) { + $element.expander({ + slicePoint: 255, + expandText: '»', + expandPrefix: '... ', + userCollapseText: '«', + widow: 4, + expandEffect: 'show' + }); + } + }); } };